Interface CompiledAction
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A compiled action, shared by every run of its rule list.
Several runs can execute one compiled action at the same time, each with its own Session, which only one run
uses at a time. Keep what changes while the action runs in the session.
Implemented by expression languages. A method added to this interface is a default method, so an
existing language keeps compiling and working.
-
Method Summary
Modifier and TypeMethodDescriptionexecute(ActionContext context, Session session) Executes the action.
-
Method Details
-
execute
Executes the action. The action either changesActionContext.output()in place and returnsActionResult.done(), or returnsActionResult.set(java.util.Map)with the properties the engine sets on the output, as a language without side effects does. Variables it declares stay local to this execution, or, for a language that documents it, to the run; they never reach another run. An exception it throws fails the rule with aRuleExecutionException, except a fatalError, whichrun()rethrows unchanged.- Parameters:
context- The facts of the run and the output objectsession- The run's session for this action's language, created by the compiler that compiled it- Returns:
- What the action did, never
null. Returningnullfails the rule with aRuleExecutionException. - Throws:
Exception- if the action fails
-