Package org.kie.dmn.feel
Interface FEEL
-
- All Known Implementing Classes:
FEELImpl
public interface FEELFEEL expression language engine interfaceThis class is the entry point for the engine use
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddListener(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)Registers a new event listener into this FEEL instance.org.kie.dmn.feel.lang.CompiledExpressioncompile(String expression, org.kie.dmn.feel.lang.CompilerContext ctx)Compiles the string expression using the given compiler context.org.kie.dmn.feel.lang.CompiledExpressioncompileUnaryTests(String expression, org.kie.dmn.feel.lang.CompilerContext ctx)Compiles the string expression using the given compiler context.Objectevaluate(String expression)Evaluates the given FEEL expression and returns the resultObjectevaluate(String expression, Map<String,Object> inputVariables)Evaluates the given FEEL expression using the given input variables, and returns the resultObjectevaluate(String expression, org.kie.dmn.feel.lang.EvaluationContext ctx)Evaluates the given FEEL expression using the given EvaluationContext, and returns the resultObjectevaluate(org.kie.dmn.feel.lang.CompiledExpression expression, Map<String,Object> inputVariables)Evaluates the given compiled FEEL expression using the given input variables, and returns the resultObjectevaluate(org.kie.dmn.feel.lang.CompiledExpression expr, org.kie.dmn.feel.lang.EvaluationContext ctx)Evaluates the given compiled FEEL expression using the given EvaluationContext, and returns the resultList<org.kie.dmn.feel.runtime.UnaryTest>evaluateUnaryTests(String expression)Evaluates the given expression as a list of of unary tests.List<org.kie.dmn.feel.runtime.UnaryTest>evaluateUnaryTests(String expression, Map<String,org.kie.dmn.feel.lang.Type> variableTypes)Evaluates the given expression as a list of of unary tests.Set<org.kie.dmn.api.feel.runtime.events.FEELEventListener>getListeners()Retrieves the set of registered event listenersorg.kie.dmn.feel.lang.CompilerContextnewCompilerContext()Factory method to create a new compiler contextstatic FEELnewInstance()Factory method to create a new FEEL engine instancestatic FEELnewInstance(List<org.kie.dmn.feel.lang.FEELProfile> profiles)Factory method to create a new FEEL engine instance using custom FEELProfile(s)StringparseTest(String value)voidremoveListener(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(List<org.kie.dmn.feel.lang.FEELProfile> profiles)
Factory method to create a new FEEL engine instance using custom FEELProfile(s)- Returns:
- a newly instantiated FEEL engine instance
-
newCompilerContext
org.kie.dmn.feel.lang.CompilerContext newCompilerContext()
Factory method to create a new compiler context- Returns:
- compiler context with default options set
-
compile
org.kie.dmn.feel.lang.CompiledExpression compile(String expression, org.kie.dmn.feel.lang.CompilerContext ctx)
Compiles the string expression using the given compiler context.- Parameters:
expression- a FEEL expressionctx- a compiler context- Returns:
- the compiled expression
-
compileUnaryTests
org.kie.dmn.feel.lang.CompiledExpression compileUnaryTests(String expression, org.kie.dmn.feel.lang.CompilerContext ctx)
Compiles the string expression using the given compiler context.- Parameters:
expression- a FEEL expression for unary testsctx- a compiler context- Returns:
- the compiled unary tests
-
evaluate
Object evaluate(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
Object evaluate(String expression, org.kie.dmn.feel.lang.EvaluationContext ctx)
Evaluates the given FEEL expression using the given EvaluationContext, and returns the result- Parameters:
expression- a FEEL expressionctx- 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
Object evaluate(String expression, Map<String,Object> inputVariables)
Evaluates the given FEEL expression using the given input variables, and returns the result- Parameters:
expression- a FEEL expressioninputVariables- 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
Object evaluate(org.kie.dmn.feel.lang.CompiledExpression expression, Map<String,Object> inputVariables)
Evaluates the given compiled FEEL expression using the given input variables, and returns the result- Parameters:
expression- a FEEL expressioninputVariables- 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
Object evaluate(org.kie.dmn.feel.lang.CompiledExpression expr, org.kie.dmn.feel.lang.EvaluationContext ctx)
Evaluates the given compiled FEEL expression using the given EvaluationContext, and returns the result- Parameters:
expr- a FEEL expressionctx- 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
List<org.kie.dmn.feel.runtime.UnaryTest> evaluateUnaryTests(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
List<org.kie.dmn.feel.runtime.UnaryTest> evaluateUnaryTests(String expression, Map<String,org.kie.dmn.feel.lang.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 expressionvariableTypes- 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
Set<org.kie.dmn.api.feel.runtime.events.FEELEventListener> getListeners()
Retrieves the set of registered event listeners- Returns:
- the set of listeners
-
-