Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CompiledAction
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 Details

    • execute

      ActionResult execute(ActionContext context, Session session) throws Exception
      Executes the action. The action either changes ActionContext.output() in place and returns ActionResult.done(), or returns ActionResult.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 a RuleExecutionException, except a fatal Error, which run() rethrows unchanged.
      Parameters:
      context - The facts of the run and the output object
      session - The run's session for this action's language, created by the compiler that compiled it
      Returns:
      What the action did, never null. Returning null fails the rule with a RuleExecutionException.
      Throws:
      Exception - if the action fails