Class EvalScriptWithJsonDataModel

java.lang.Object
org.fugerit.java.script.helper.EvalScriptWithJsonDataModel
All Implemented Interfaces:
EvalScript

public class EvalScriptWithJsonDataModel extends Object implements EvalScript
EvalScript decorator. The Map dataModel will be transformed into a json styled LinkedHashMap.
  • Constructor Details

    • EvalScriptWithJsonDataModel

      public EvalScriptWithJsonDataModel(EvalScript evalScript)
      Add decoration to a give EvalScript
      Parameters:
      evalScript - the EvalScript instance to decorate
  • Method Details

    • handleEx

      public Object handleEx(Reader reader, Map<String,Object> dataModel) throws ScriptException
      Description copied from interface: EvalScript
      It will handle a script and bind a data model. Any class implementing EvalScript will need to provide at least this method.
      Specified by:
      handleEx in interface EvalScript
      Parameters:
      reader - the reader over script
      dataModel - the data model to bind
      Returns:
      the result of script processing
      Throws:
      ScriptException - in case of script handling issues
    • newEvalScriptWithJsonDataModel

      public static EvalScript newEvalScriptWithJsonDataModel(String scriptExtension, String dataModelBindingName)
      It will decorate a EvalScriptWithDataModel instance.
      Parameters:
      scriptExtension - the extension to be used for the ScriptEngine
      dataModelBindingName - the data model binding name
      Returns:
      the new EvalScript
    • newEvalScriptWithJsonDataModel

      public static EvalScript newEvalScriptWithJsonDataModel(String scriptExtension)
      It will decorate a EvalScriptWithDataModel instance with default data model binding name.
      Parameters:
      scriptExtension - the extension to be used for the ScriptEngine
      Returns:
      the new EvalScript