Package org.faktorips.runtime.formula
Class AbstractFormulaEvaluator
java.lang.Object
org.faktorips.runtime.formula.AbstractFormulaEvaluator
- All Implemented Interfaces:
IFormulaEvaluator
An abstract implementation of
IFormulaEvaluator holding the product component generation
or product component and handles the exceptions thrown by the
evaluateInternal(String, Object...) method.
There is no method to set the compiled formula expression because the expressions have to be set
by the IFormulaEvaluatorFactory while creating the evaluator.
- Author:
- dirmeier
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFormulaEvaluator(Object object, Map<String, String> nameToExpressionMap) -
Method Summary
Modifier and TypeMethodDescriptionEvaluates a formula that was added through the builderprotected abstract ObjectevaluateInternal(String formularName, Object... parameters) This method evaluates the formula with the given name and the specified parameters.Returns a defensive copy of the map of expressions/formulas held by this evaluator.Returns the product component generation or product component this is an evaluator for.
-
Field Details
-
COMPILED_EXPRESSION_XML_TAG
- See Also:
-
-
Constructor Details
-
AbstractFormulaEvaluator
-
-
Method Details
-
getObject
Description copied from interface:IFormulaEvaluatorReturns the product component generation or product component this is an evaluator for.- Specified by:
getObjectin interfaceIFormulaEvaluator
-
evaluate
Evaluates a formula that was added through the builder- Specified by:
evaluatein interfaceIFormulaEvaluator- Parameters:
formularName- The name of the formula to evaluateparameters- the parameters the formula requires when being evaluated- Returns:
- the result of the evaluated formula
- Throws:
IllegalArgumentException- if the formula signature is unknown
-
evaluateInternal
protected abstract Object evaluateInternal(String formularName, Object... parameters) throws Exception This method evaluates the formula with the given name and the specified parameters. With the name and parameters you have the complete formula method signature. The order of the parameters is given by the formula signature.- Parameters:
formularName- name of the formula to evaluateparameters- the parameters to evaluate the formula- Returns:
- the return value of the evaluated formula
- Throws:
Exception
-
getNameToExpressionMap
Returns a defensive copy of the map of expressions/formulas held by this evaluator.- Specified by:
getNameToExpressionMapin interfaceIFormulaEvaluator- Returns:
- a map containing the expressions (with their names as keys) held by this formula evaluator
-