org.pentaho.reporting.engine.classic.core.modules.misc.beanshell

Class BSHExpression

    • Field Detail

      • BSHHEADERFILE

        public static final String BSHHEADERFILE
        The headerfile with the default initialisations.
        See Also:
        Constant Field Values
    • Constructor Detail

      • BSHExpression

        public BSHExpression()
        default constructor, create a new BeanShellExpression.
    • Method Detail

      • getValue

        public Object getValue()
        Evaluates the defined expression. If an exception or an evaluation error occures, the evaluation returns null and the error is logged. The current datarow and a copy of the expressions properties are set to script-internal variables. Changes to the properties will not alter the expressions original properties and will be lost when the evaluation is finished.

        Expressions do not maintain a state and no assumptions about the order of evaluation can be made.

        Returns:
        the evaluated value or null.
      • getInstance

        public Expression getInstance()
        Return a new instance of this expression. The copy is initialized and uses the same parameters as the original, but does not share any objects.
        Specified by:
        getInstance in interface Expression
        Overrides:
        getInstance in class AbstractExpression
        Returns:
        a copy of this function.
      • getExpression

        public String getExpression()
        Sets the beanshell script as string.
        Returns:
        the script.
      • setExpression

        public void setExpression(String expression)
        Sets the beanshell script that should be executed. The script should define a getValue() method which returns a single object.
        Parameters:
        expression - the script.