Class Script

  • All Implemented Interfaces:
    ScriptInterface, Serializable

    public class Script
    extends FunctorScript
    A wrapper for a couple of type of scripting objects. This is to determine which is which and execute the script. Either this has a JSONObject (like a LogicBlock or it has a JSONArray of strings that are to be executed sequentially.
    Note that the factory and parser contain the environment of the execution. If an older set of logic blocks, these are available in the FunctorScript.getLogicBlocks() call. If this is from a newer script, the complete set of returned handlers from the parser is available in the FunctorScript.getHandlers() call.
    The two formats for the JSON object are either
          {"script":[
             "line 1",
             "line 2",
             ...
          ],
          "version":"1.0"}
      
    where each line is a separate command (version is optional) or as described in the comment to JFunctorFactory.createLogicBlock(JSONObject)
    Note this this has several convenience methods, such as FunctorScript.getFunctorMap().
    Also, you may either create this and execute is against arguments OR initialize it with JSON and execute it later when needed in your control flow. This allows you to configure everything the way you need it up front.

    Created by Jeff Gaynor
    on 9/24/18 at 1:49 PM

    See Also:
    Serialized Form