Interface FEEL

  • All Known Implementing Classes:
    FEELImpl

    public interface FEEL
    FEEL expression language engine interface This class is the entry point for the engine use
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addListener​(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)
      Registers a new event listener into this FEEL instance.
      CompiledExpression compile​(java.lang.String expression, CompilerContext ctx)
      Compiles the string expression using the given compiler context.
      CompiledExpression compileUnaryTests​(java.lang.String expression, CompilerContext ctx)
      Compiles the string expression using the given compiler context.
      java.lang.Object evaluate​(java.lang.String expression)
      Evaluates the given FEEL expression and returns the result
      java.lang.Object evaluate​(java.lang.String expression, java.util.Map<java.lang.String,​java.lang.Object> inputVariables)
      Evaluates the given FEEL expression using the given input variables, and returns the result
      java.lang.Object evaluate​(java.lang.String expression, EvaluationContext ctx)
      Evaluates the given FEEL expression using the given EvaluationContext, and returns the result
      java.lang.Object evaluate​(CompiledExpression expression, java.util.Map<java.lang.String,​java.lang.Object> inputVariables)
      Evaluates the given compiled FEEL expression using the given input variables, and returns the result
      java.lang.Object evaluate​(CompiledExpression expr, EvaluationContext ctx)
      Evaluates the given compiled FEEL expression using the given EvaluationContext, and returns the result
      java.util.List<UnaryTest> evaluateUnaryTests​(java.lang.String expression)
      Evaluates the given expression as a list of of unary tests.
      java.util.List<UnaryTest> evaluateUnaryTests​(java.lang.String expression, java.util.Map<java.lang.String,​Type> variableTypes)
      Evaluates the given expression as a list of of unary tests.
      java.util.Set<org.kie.dmn.api.feel.runtime.events.FEELEventListener> getListeners()
      Retrieves the set of registered event listeners
      CompilerContext newCompilerContext()
      Factory method to create a new compiler context
      static FEEL newInstance()
      Factory method to create a new FEEL engine instance
      static FEEL newInstance​(java.lang.ClassLoader cl)
      Factory method to create a new FEEL engine instance, using the specified classloader.
      static FEEL newInstance​(java.lang.ClassLoader cl, java.util.List<FEELProfile> profiles)
      Factory method to create a new FEEL engine instance using custom FEELProfile(s), using the specified classloader.
      static FEEL newInstance​(java.util.List<FEELProfile> profiles)
      Factory method to create a new FEEL engine instance using custom FEELProfile(s)
      void removeListener​(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)
      Removes a listener from the list of event listeners.
    • Method Detail

      • newInstance

        static FEEL newInstance()
        Factory method to create a new FEEL engine instance
        Returns:
        a newly instantiated FEEL engine instance
      • newInstance

        static FEEL newInstance​(java.lang.ClassLoader cl)
        Factory method to create a new FEEL engine instance, using the specified classloader.
        Returns:
        a newly instantiated FEEL engine instance
      • newInstance

        static FEEL newInstance​(java.util.List<FEELProfile> profiles)
        Factory method to create a new FEEL engine instance using custom FEELProfile(s)
        Returns:
        a newly instantiated FEEL engine instance
      • newInstance

        static FEEL newInstance​(java.lang.ClassLoader cl,
                                java.util.List<FEELProfile> profiles)
        Factory method to create a new FEEL engine instance using custom FEELProfile(s), using the specified classloader.
        Returns:
        a newly instantiated FEEL engine instance
      • newCompilerContext

        CompilerContext newCompilerContext()
        Factory method to create a new compiler context
        Returns:
        compiler context with default options set
      • compile

        CompiledExpression compile​(java.lang.String expression,
                                   CompilerContext ctx)
        Compiles the string expression using the given compiler context.
        Parameters:
        expression - a FEEL expression
        ctx - a compiler context
        Returns:
        the compiled expression
      • compileUnaryTests

        CompiledExpression compileUnaryTests​(java.lang.String expression,
                                             CompilerContext ctx)
        Compiles the string expression using the given compiler context.
        Parameters:
        expression - a FEEL expression for unary tests
        ctx - a compiler context
        Returns:
        the compiled unary tests
      • evaluate

        java.lang.Object evaluate​(java.lang.String expression)
        Evaluates the given FEEL expression and returns the result
        Parameters:
        expression - a FEEL expression
        Returns:
        the result of the evaluation of the expression
      • evaluate

        java.lang.Object evaluate​(java.lang.String expression,
                                  EvaluationContext ctx)
        Evaluates the given FEEL expression using the given EvaluationContext, and returns the result
        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

        java.lang.Object evaluate​(java.lang.String expression,
                                  java.util.Map<java.lang.String,​java.lang.Object> inputVariables)
        Evaluates the given FEEL expression using the given input variables, and returns the result
        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

        java.lang.Object evaluate​(CompiledExpression expression,
                                  java.util.Map<java.lang.String,​java.lang.Object> inputVariables)
        Evaluates the given compiled FEEL expression using the given input variables, and returns the result
        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

        java.lang.Object evaluate​(CompiledExpression expr,
                                  EvaluationContext ctx)
        Evaluates the given compiled FEEL expression using the given EvaluationContext, and returns the result
        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.
      • evaluateUnaryTests

        java.util.List<UnaryTest> evaluateUnaryTests​(java.lang.String expression)
        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.
        Parameters:
        expression - a unary test list expression
        Returns:
        a List of compiled UnaryTests
      • evaluateUnaryTests

        java.util.List<UnaryTest> evaluateUnaryTests​(java.lang.String expression,
                                                     java.util.Map<java.lang.String,​Type> variableTypes)
        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.
        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

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

        void removeListener​(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)
        Removes a listener from the list of event listeners.
        Parameters:
        listener - the listener to remove
      • getListeners

        java.util.Set<org.kie.dmn.api.feel.runtime.events.FEELEventListener> getListeners()
        Retrieves the set of registered event listeners
        Returns:
        the set of listeners