Package org.kie.dmn.feel.lang.impl
Class FEELImpl
- java.lang.Object
-
- org.kie.dmn.feel.lang.impl.FEELImpl
-
-
Constructor Summary
Constructors Constructor Description FEELImpl()FEELImpl(java.lang.ClassLoader cl)FEELImpl(java.lang.ClassLoader cl, java.util.List<FEELProfile> profiles)FEELImpl(java.util.List<FEELProfile> profiles)
-
Method Summary
All Methods Instance Methods Concrete 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.ProcessedExpressioncompileExpression(java.lang.String expression, CompilerContext ctx)ProcessedUnaryTestcompileUnaryTests(java.lang.String expressions, 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 expr, 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.Collection<FEELFunction>getCustomFunctions()FEELEventListenersManagergetEventsManager(java.util.Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> contextListeners)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 contextCompilerContextnewCompilerContext(java.util.Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> contextListeners)EvaluationContextImplnewEvaluationContext(java.lang.ClassLoader cl, java.util.Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> listeners, java.util.Map<java.lang.String,java.lang.Object> inputVariables)Creates a new EvaluationContext with the supplied classloader, and the supplied parameters listeners and inputVariablesEvaluationContextImplnewEvaluationContext(java.util.Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> listeners, java.util.Map<java.lang.String,java.lang.Object> inputVariables)Creates a new EvaluationContext using this FEEL instance classloader, and the supplied parameters listeners and inputVariablesvoidremoveListener(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)Removes a listener from the list of event listeners.
-
-
-
Constructor Detail
-
FEELImpl
public FEELImpl()
-
FEELImpl
public FEELImpl(java.lang.ClassLoader cl)
-
FEELImpl
public FEELImpl(java.util.List<FEELProfile> profiles)
-
FEELImpl
public FEELImpl(java.lang.ClassLoader cl, java.util.List<FEELProfile> profiles)
-
-
Method Detail
-
newCompilerContext
public CompilerContext newCompilerContext()
Description copied from interface:FEELFactory method to create a new compiler context- Specified by:
newCompilerContextin interfaceFEEL- Returns:
- compiler context with default options set
-
newCompilerContext
public CompilerContext newCompilerContext(java.util.Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> contextListeners)
-
getCustomFunctions
public java.util.Collection<FEELFunction> getCustomFunctions()
-
compile
public CompiledExpression compile(java.lang.String expression, CompilerContext ctx)
Description copied from interface:FEELCompiles the string expression using the given compiler context.
-
compileExpression
public ProcessedExpression compileExpression(java.lang.String expression, CompilerContext ctx)
-
compileUnaryTests
public ProcessedUnaryTest compileUnaryTests(java.lang.String expressions, CompilerContext ctx)
Description copied from interface:FEELCompiles the string expression using the given compiler context.- Specified by:
compileUnaryTestsin interfaceFEEL- Parameters:
expressions- a FEEL expression for unary testsctx- a compiler context- Returns:
- the compiled unary tests
-
evaluate
public java.lang.Object evaluate(java.lang.String expression)
Description copied from interface:FEELEvaluates the given FEEL expression and returns the result
-
evaluate
public java.lang.Object evaluate(java.lang.String expression, EvaluationContext ctx)Description copied from interface:FEELEvaluates the given FEEL expression using the given EvaluationContext, and returns the result
-
evaluate
public java.lang.Object evaluate(java.lang.String expression, java.util.Map<java.lang.String,java.lang.Object> inputVariables)Description copied from interface:FEELEvaluates the given FEEL expression using the given input variables, and returns the result- Specified by:
evaluatein interfaceFEEL- 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
public java.lang.Object evaluate(CompiledExpression expr, java.util.Map<java.lang.String,java.lang.Object> inputVariables)
Description copied from interface:FEELEvaluates the given compiled FEEL expression using the given input variables, and returns the result- Specified by:
evaluatein interfaceFEEL- Parameters:
expr- 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
public java.lang.Object evaluate(CompiledExpression expr, EvaluationContext ctx)
Description copied from interface:FEELEvaluates the given compiled FEEL expression using the given EvaluationContext, and returns the result
-
newEvaluationContext
public EvaluationContextImpl newEvaluationContext(java.util.Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> listeners, java.util.Map<java.lang.String,java.lang.Object> inputVariables)
Creates a new EvaluationContext using this FEEL instance classloader, and the supplied parameters listeners and inputVariables
-
newEvaluationContext
public EvaluationContextImpl newEvaluationContext(java.lang.ClassLoader cl, java.util.Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> listeners, java.util.Map<java.lang.String,java.lang.Object> inputVariables)
Creates a new EvaluationContext with the supplied classloader, and the supplied parameters listeners and inputVariables
-
evaluateUnaryTests
public java.util.List<UnaryTest> evaluateUnaryTests(java.lang.String expression)
Description copied from interface:FEELEvaluates 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:
evaluateUnaryTestsin interfaceFEEL- Parameters:
expression- a unary test list expression- Returns:
- a List of compiled UnaryTests
-
evaluateUnaryTests
public java.util.List<UnaryTest> evaluateUnaryTests(java.lang.String expression, java.util.Map<java.lang.String,Type> variableTypes)
Description copied from interface:FEELEvaluates 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:
evaluateUnaryTestsin interfaceFEEL- 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
public void addListener(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)
Description copied from interface:FEELRegisters a new event listener into this FEEL instance. The event listeners are notified about signitificative events during compilation or evaluation of expressions.- Specified by:
addListenerin interfaceFEEL- Parameters:
listener- the listener to register
-
removeListener
public void removeListener(org.kie.dmn.api.feel.runtime.events.FEELEventListener listener)
Description copied from interface:FEELRemoves a listener from the list of event listeners.- Specified by:
removeListenerin interfaceFEEL- Parameters:
listener- the listener to remove
-
getListeners
public java.util.Set<org.kie.dmn.api.feel.runtime.events.FEELEventListener> getListeners()
Description copied from interface:FEELRetrieves the set of registered event listeners- Specified by:
getListenersin interfaceFEEL- Returns:
- the set of listeners
-
getEventsManager
public FEELEventListenersManager getEventsManager(java.util.Collection<org.kie.dmn.api.feel.runtime.events.FEELEventListener> contextListeners)
-
-