Class BSFExpression

    • Constructor Detail

      • BSFExpression

        public BSFExpression()
        Default constructor, create a new BeanShellExpression.
    • Method Detail

      • createInterpreter

        protected org.apache.bsf.BSFManager createInterpreter()
        Creates a new interpreter instance.
        Returns:
        the interpreter or null, if there was an error.
      • initializeInterpreter

        protected void initializeInterpreter​(org.apache.bsf.BSFManager interpreter)
                                      throws org.apache.bsf.BSFException
        Initializes the Bean-Scripting Framework manager.
        Parameters:
        interpreter - the BSF-Manager that should be initialized.
        Throws:
        org.apache.bsf.BSFException - if an error occured.
      • 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.
      • getExpression

        public String getExpression()
        Returns the script that gets evaluated every time the getValue() method is called.
        Returns:
        the script.
      • invalidate

        protected void invalidate()
        Invalidates the interpreter-cache and forces a reinterpretation of the script.
      • setExpression

        public void setExpression​(String expression)
        Sets the script that should be executed. Whats in the script depends on what langage is selected.
        Parameters:
        expression - the script.
      • getLanguage

        public String getLanguage()
        Returns the programming language, in which the interpreter work.
        Returns:
        the programming language, which must be one of the supported BSF-Languages.
      • setLanguage

        public void setLanguage​(String language)
        Defines the programming language of the script and expression.
        Parameters:
        language - the programming language of the script.
      • getScript

        public String getScript()
        Returns the script. The script is a predefined piece of code that gets executed once. It can (and should) be used to perform global initializations and to define functions.
        Returns:
        the script (can be null).
      • setScript

        public void setScript​(String script)
        Defines the script. The script is a predefined piece of code that gets executed once. It can (and should) be used to perform global initializations and to define functions.
        Parameters:
        script - an initialization script.