Class AbstractScriptExecutor

java.lang.Object
org.springframework.integration.scripting.jsr223.AbstractScriptExecutor
All Implemented Interfaces:
ScriptExecutor
Direct Known Subclasses:
DefaultScriptExecutor, KotlinScriptExecutor, PythonScriptExecutor

public abstract class AbstractScriptExecutor
extends java.lang.Object
implements ScriptExecutor
Base Class for ScriptExecutor.
Since:
2.1
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected org.apache.commons.logging.Log logger  
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected AbstractScriptExecutor​(java.lang.String language)  
    protected AbstractScriptExecutor​(javax.script.ScriptEngine scriptEngine)  
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object executeScript​(org.springframework.scripting.ScriptSource scriptSource, java.util.Map<java.lang.String,​java.lang.Object> variables)
    Execute a script from the provided ScriptSource with an optional binding variables.
    javax.script.ScriptEngine getScriptEngine()  
    protected abstract java.lang.Object postProcess​(java.lang.Object result, javax.script.ScriptEngine scriptEngine, java.lang.String script, javax.script.Bindings bindings)
    Subclasses may implement this to provide any special handling required

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.integration.scripting.ScriptExecutor

    executeScript
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
  • Constructor Details

  • Method Details

    • getScriptEngine

      public javax.script.ScriptEngine getScriptEngine()
    • executeScript

      @Nullable public java.lang.Object executeScript​(org.springframework.scripting.ScriptSource scriptSource, java.util.Map<java.lang.String,​java.lang.Object> variables)
      Description copied from interface: ScriptExecutor
      Execute a script from the provided ScriptSource with an optional binding variables.
      Specified by:
      executeScript in interface ScriptExecutor
      Parameters:
      scriptSource - The script source.
      variables - The variables.
      Returns:
      The result of the execution.
    • postProcess

      protected abstract java.lang.Object postProcess​(java.lang.Object result, javax.script.ScriptEngine scriptEngine, java.lang.String script, javax.script.Bindings bindings)
      Subclasses may implement this to provide any special handling required
      Parameters:
      result - the result.
      scriptEngine - the engine.
      script - the script.
      bindings - the bindings.
      Returns:
      modified result