Package org.faktorips.fl
Class ExprEvaluator
java.lang.Object
org.faktorips.fl.ExprEvaluator
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 Summary
ConstructorsConstructorDescriptionExprEvaluator(JavaExprCompiler compiler) Constructs a new processor for the given compiler.ExprEvaluator(JavaExprCompiler compiler, ClassLoader classLoader) Constructs a new processor for the given compiler and class loader. -
Method Summary
Modifier and TypeMethodDescriptionEvaluates and returns the result of the given expression.Evaluates and returns the result of the given expression.evaluate(org.faktorips.codegen.JavaCodeFragment javaCodeFragment) Evaluates and returns the result of the givenjava code fragment.
-
Constructor Details
-
ExprEvaluator
Constructs a new processor for the given compiler. -
ExprEvaluator
Constructs a new processor for the given compiler and class loader.
-
-
Method Details
-
evaluate
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 thevariablesparameter and the values of the variables can be specified by means of thevariableValuesparameter.- Throws:
Exception
-
evaluate
Evaluates and returns the result of the givenjava code fragment.- Throws:
Exception
-