Class FEELImpl

  • All Implemented Interfaces:
    FEEL

    @GwtIncompatible
    public class FEELImpl
    extends Object
    implements FEEL
    Language runtime entry point
    • Method Detail

      • newCompilerContext

        public CompilerContext newCompilerContext()
        Description copied from interface: FEEL
        Factory method to create a new compiler context
        Specified by:
        newCompilerContext in interface FEEL
        Returns:
        compiler context with default options set
      • newCompilerContext

        public CompilerContext newCompilerContext​(Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> contextListeners)
      • compile

        public CompiledExpression compile​(String expression,
                                          CompilerContext ctx)
        Description copied from interface: FEEL
        Compiles the string expression using the given compiler context.
        Specified by:
        compile in interface FEEL
        Parameters:
        expression - a FEEL expression
        ctx - a compiler context
        Returns:
        the compiled expression
      • compileUnaryTests

        public ProcessedUnaryTest compileUnaryTests​(String expressions,
                                                    CompilerContext ctx)
        Description copied from interface: FEEL
        Compiles the string expression using the given compiler context.
        Specified by:
        compileUnaryTests in interface FEEL
        Parameters:
        expressions - a FEEL expression for unary tests
        ctx - a compiler context
        Returns:
        the compiled unary tests
      • evaluate

        public Object evaluate​(String expression)
        Description copied from interface: FEEL
        Evaluates the given FEEL expression and returns the result
        Specified by:
        evaluate in interface FEEL
        Parameters:
        expression - a FEEL expression
        Returns:
        the result of the evaluation of the expression
      • evaluate

        public Object evaluate​(String expression,
                               EvaluationContext ctx)
        Description copied from interface: FEEL
        Evaluates the given FEEL expression using the given EvaluationContext, and returns the result
        Specified by:
        evaluate in interface FEEL
        Parameters:
        expression - a FEEL expression
        ctx - the EvaluationContext to be used for defining input variables and additional feel event listeners contextual to this method call
        Returns:
        the result of the evaluation of the expression.
      • evaluate

        public Object evaluate​(String expression,
                               Map<String,​Object> inputVariables)
        Description copied from interface: FEEL
        Evaluates the given FEEL expression using the given input variables, and returns the result
        Specified by:
        evaluate in interface FEEL
        Parameters:
        expression - a FEEL expression
        inputVariables - a map of input Variables. The keys on the map are the variable names, that need to follow the naming rules for the FEEL language. The values on the map are the corresponding values for the variables. It is completely fine to use a previously returned FEEL context as inputVariables.
        Returns:
        the result of the evaluation of the expression.
      • evaluate

        public Object evaluate​(CompiledExpression expr,
                               Map<String,​Object> inputVariables)
        Description copied from interface: FEEL
        Evaluates the given compiled FEEL expression using the given input variables, and returns the result
        Specified by:
        evaluate in interface FEEL
        Parameters:
        expr - a FEEL expression
        inputVariables - a map of input Variables. The keys on the map are the variable names, that need to follow the naming rules for the FEEL language. The values on the map are the corresponding values for the variables. It is completely fine to use a previously returned FEEL context as inputVariables.
        Returns:
        the result of the evaluation of the expression.
      • evaluate

        public Object evaluate​(CompiledExpression expr,
                               EvaluationContext ctx)
        Description copied from interface: FEEL
        Evaluates the given compiled FEEL expression using the given EvaluationContext, and returns the result
        Specified by:
        evaluate in interface FEEL
        ctx - the EvaluationContext to be used for defining input variables and additional feel event listeners contextual to this method call
        Returns:
        the result of the evaluation of the expression.
      • newEvaluationContext

        public EvaluationContextImpl newEvaluationContext​(Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> listeners,
                                                          Map<String,​Object> inputVariables)
        Creates a new EvaluationContext using this FEEL instance classloader, and the supplied parameters listeners and inputVariables
      • newEvaluationContext

        public EvaluationContextImpl newEvaluationContext​(ClassLoader cl,
                                                          Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> listeners,
                                                          Map<String,​Object> inputVariables)
        Creates a new EvaluationContext with the supplied classloader, and the supplied parameters listeners and inputVariables
      • evaluateUnaryTests

        public List<UnaryTest> evaluateUnaryTests​(String expression)
        Description copied from interface: FEEL
        Evaluates the given expression as a list of of unary tests. The syntax for this is defined in the FEEL grammar rule #17, i.e., a list of unary tests separated by commas.
        Specified by:
        evaluateUnaryTests in interface FEEL
        Parameters:
        expression - a unary test list expression
        Returns:
        a List of compiled UnaryTests
      • evaluateUnaryTests

        public List<UnaryTest> evaluateUnaryTests​(String expression,
                                                  Map<String,​Type> variableTypes)
        Description copied from interface: FEEL
        Evaluates the given expression as a list of of unary tests. The syntax for this is defined in the FEEL grammar rule #17, i.e., a list of unary tests separated by commas.
        Specified by:
        evaluateUnaryTests in interface FEEL
        Parameters:
        expression - a unary test list expression
        variableTypes - map of variable names and corresponding types, necessary to compile the unary tests
        Returns:
        a List of compiled UnaryTests
      • addListener

        public void addListener​(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)
        Description copied from interface: FEEL
        Registers a new event listener into this FEEL instance. The event listeners are notified about signitificative events during compilation or evaluation of expressions.
        Specified by:
        addListener in interface FEEL
        Parameters:
        listener - the listener to register
      • removeListener

        public void removeListener​(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)
        Description copied from interface: FEEL
        Removes a listener from the list of event listeners.
        Specified by:
        removeListener in interface FEEL
        Parameters:
        listener - the listener to remove
      • getListeners

        public Set<org.kie.dmn.api.feel.runtime.events.FEELEventListener> getListeners()
        Description copied from interface: FEEL
        Retrieves the set of registered event listeners
        Specified by:
        getListeners in interface FEEL
        Returns:
        the set of listeners