Package org.kie.dmn.feel
Interface FEEL
-
- All Known Implementing Classes:
FEELImpl
public interface FEELFEEL 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 voidaddListener(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)Registers a new event listener into this FEEL instance.CompiledExpressioncompile(java.lang.String expression, CompilerContext ctx)Compiles the string expression using the given compiler context.CompiledExpressioncompileUnaryTests(java.lang.String expression, CompilerContext ctx)Compiles the string expression using the given compiler context.java.lang.Objectevaluate(java.lang.String expression)Evaluates the given FEEL expression and returns the resultjava.lang.Objectevaluate(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 resultjava.lang.Objectevaluate(java.lang.String expression, EvaluationContext ctx)Evaluates the given FEEL expression using the given EvaluationContext, and returns the resultjava.lang.Objectevaluate(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 resultjava.lang.Objectevaluate(CompiledExpression expr, EvaluationContext ctx)Evaluates the given compiled FEEL expression using the given EvaluationContext, and returns the resultjava.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 listenersCompilerContextnewCompilerContext()Factory method to create a new compiler contextstatic FEELnewInstance()Factory method to create a new FEEL engine instancestatic FEELnewInstance(java.lang.ClassLoader cl)Factory method to create a new FEEL engine instance, using the specified classloader.static FEELnewInstance(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 FEELnewInstance(java.util.List<FEELProfile> profiles)Factory method to create a new FEEL engine instance using custom FEELProfile(s)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(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 expressionctx- 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 testsctx- 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 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
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 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
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 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
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 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
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 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
java.util.Set<org.kie.dmn.api.feel.runtime.events.FEELEventListener> getListeners()
Retrieves the set of registered event listeners- Returns:
- the set of listeners
-
-