Class FormulaFunction

  • All Implemented Interfaces:
    Serializable, Cloneable, EventListener, ReportListener, Expression, Function

    public final class FormulaFunction
    extends AbstractFunction
    The formula function is a stateful version of the FormulaExpression and is used to evaluate a LibFormula/OpenFormula expression. This function can be used if a stateful evaluation is needed or if the formula value should be initialized to a certain value before the real evaluation starts.
    Author:
    Thomas Morgner
    See Also:
    Serialized Form
    • Constructor Detail

      • FormulaFunction

        public FormulaFunction()
        Default Constructor.
    • Method Detail

      • getFailOnError

        public Boolean getFailOnError()
      • setFailOnError

        public void setFailOnError​(Boolean failOnError)
      • getInitial

        public String getInitial()
        Returns the initial formula (incuding the optional namespace) as defined by the OpenFormula standard.
        Returns:
        the formula as text.
      • getInitialExpression

        public String getInitialExpression()
        Returns the initial formula expression. The initial formula is used at the first call only.
        Returns:
        the initial formula expression.
      • getInitialNamespace

        public String getInitialNamespace()
        Returns the formula namespace if the initial formula. If the formula specified by the user starts with "=", then the namespace "report" is assumed.
        Returns:
        the namespace of the formula.
      • setInitial

        public void setInitial​(String initial)
        Defines the initial formula (incuding the optional namespace) as defined by the OpenFormula standard. The initial formula is used at the first call only.
        Parameters:
        initial - the initial formula as text.
      • getFormula

        public String getFormula()
        Returns the formula (incuding the optional namespace) as defined by the OpenFormula standard.
        Returns:
        the formula as text.
      • getFormulaNamespace

        public String getFormulaNamespace()
        Returns the formula namespace. If the formula specified by the user starts with "=", then the namespace "report" is assumed.
        Returns:
        the namespace of the formula.
      • getFormulaExpression

        public String getFormulaExpression()
        Returns the formula expression.
        Returns:
        the formula expression.
      • setFormula

        public void setFormula​(String formula)
        Defines the formula (incuding the optional namespace) as defined by the OpenFormula standard.
        Parameters:
        formula - the formula as text.
      • getValue

        public Object getValue()
        Return the computed value of the formula. The first call will return the initial-value instead.
        Returns:
        the value of the function.
      • clone

        public Object clone()
                     throws CloneNotSupportedException
        Clones the expression, expression should be reinitialized after the cloning.

        Expression maintain no state, cloning is done at the beginning of the report processing to disconnect the used expression from any other object space.

        Specified by:
        clone in interface Expression
        Overrides:
        clone in class AbstractExpression
        Returns:
        A clone of this expression.
        Throws:
        CloneNotSupportedException - this should never happen.
      • getInstance

        public Expression getInstance()
        Return a completly separated copy of this function. The copy does no longer share any changeable objects with the original function.
        Specified by:
        getInstance in interface Expression
        Overrides:
        getInstance in class AbstractExpression
        Returns:
        a copy of this function.