Interface ScriptHelper

All Known Implementing Classes:
AbstractScriptHelper, CompositeScriptHelper, ELScriptHelper, GroovyScriptHelper, JavaScriptScriptHelper

public interface ScriptHelper
The DataScriptHelper interface to implement dynamic script evaluation support.
  • Method Details

    • getBindings

      Bindings getBindings()
      Get current script bindings.
      Returns:
      bindings
    • setBindings

      void setBindings(Bindings bindings)
      Set script bindings.
      Parameters:
      bindings - new script bindings.
    • eval

      Object eval(String expr)
      Evaluate the given expression.
      Parameters:
      expr - the expression to evaluate
      Returns:
      expression result
    • eval

      Object eval(String expr, Bindings bindings) throws Exception
      Evaluate the given expression with the given bindings.
      Parameters:
      expr - the expression to evaluate
      bindings - the context bindings
      Returns:
      expression result
      Throws:
      Exception
    • test

      boolean test(String expr)
      Evaluate a boolean expression.
      Parameters:
      expr - a boolean expression
      Returns:
      true or false
    • call

      Object call(Object obj, String methodCall)
      Call a method on the given object.

      The methodCall is a string expression containing arguments to be passed. For example:

       scriptHelper.call(bean, "test(var1, var2, var3)");
       
      This is a convenient method to call:
       scriptHelper.call(bean, "test", new Object[] { var1, var2, var3 });
       
      Parameters:
      obj - the object on which method should be called
      methodCall - method call expression
      Returns:
      return value of the method