Class ExprEvaluator

java.lang.Object
org.faktorips.fl.ExprEvaluator

public class ExprEvaluator extends Object
Evaluates a given expression and returns it's result.

Technically this is done by first compiling the expression to Java source code using the JavaExprCompiler. After that a java bean-shell} interpreter interprets the expression and the result is returned by the evaluate method of this class.

Author:
Jan Ortmann
  • Constructor Details

    • ExprEvaluator

      public ExprEvaluator(JavaExprCompiler compiler)
      Constructs a new processor for the given compiler.
    • ExprEvaluator

      public ExprEvaluator(JavaExprCompiler compiler, ClassLoader classLoader)
      Constructs a new processor for the given compiler and class loader.
  • Method Details

    • evaluate

      public Object evaluate(String expression) throws Exception
      Evaluates and returns the result of the given expression.
      Throws:
      Exception
    • evaluate

      public Object evaluate(String expression, String[] variables, Object[] variableValues) throws Exception
      Evaluates and returns the result of the given expression. If the expression contains any variables the variables can be specified with the variables parameter and the values of the variables can be specified by means of the variableValues parameter.
      Throws:
      Exception
    • evaluate

      public Object evaluate(org.faktorips.codegen.JavaCodeFragment javaCodeFragment) throws Exception
      Evaluates and returns the result of the given java code fragment.
      Throws:
      Exception