Class GroovyFormulaEvaluator

  • All Implemented Interfaces:
    org.faktorips.runtime.formula.IFormulaEvaluator

    public class GroovyFormulaEvaluator
    extends org.faktorips.runtime.formula.AbstractFormulaEvaluator
    This formula evaluator evaluates the formulas using groovy. The implementation expects the formula compiled as java code. Each compiled expression should be a complete java method including the method signature. It expects the product component or product component generation in which context the method should run. These are referenced as 'this' within the method. That means the method is expected to run within the context of the product component or product component generation.
    Author:
    dirmeier
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String THIS_CLASS_VAR  
      • Fields inherited from class org.faktorips.runtime.formula.AbstractFormulaEvaluator

        COMPILED_EXPRESSION_XML_TAG
    • Constructor Summary

      Constructors 
      Constructor Description
      GroovyFormulaEvaluator​(java.lang.Object object, java.util.Map<java.lang.String,​java.lang.String> nameToExpressionMap)
      The constructor expects the product component or product component generation and a list of java method, one for every formula that should be evaluated by this formula evaluator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Object evaluateInternal​(java.lang.String formularName, java.lang.Object... parameters)  
      • Methods inherited from class org.faktorips.runtime.formula.AbstractFormulaEvaluator

        evaluate, getNameToExpressionMap, getObject
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GroovyFormulaEvaluator

        public GroovyFormulaEvaluator​(java.lang.Object object,
                                      java.util.Map<java.lang.String,​java.lang.String> nameToExpressionMap)
        The constructor expects the product component or product component generation and a list of java method, one for every formula that should be evaluated by this formula evaluator. The methods should be designed to run in the context of the product component generation. The product component generation should be referenced as 'this' within the methods body.
        Parameters:
        object - the product component or product component generation in which context the compiled expression methods would run
        nameToExpressionMap - a list of compiled expression methods, one for each formula
    • Method Detail

      • evaluateInternal

        protected java.lang.Object evaluateInternal​(java.lang.String formularName,
                                                    java.lang.Object... parameters)
        Specified by:
        evaluateInternal in class org.faktorips.runtime.formula.AbstractFormulaEvaluator