Class PythonScriptExecutor
java.lang.Object
org.springframework.integration.scripting.jsr223.AbstractScriptExecutor
org.springframework.integration.scripting.jsr223.PythonScriptExecutor
- All Implemented Interfaces:
ScriptExecutor
A
ScriptExecutor
that implements special handling required for Python to
emulate behavior similar to other JSR223 scripting languages.
Script evaluation using the Jython implementation results in a null
return
value for normal variable expressions such as x=2
. As a work around, it is
necessary to get the value of 'x' explicitly following the script evaluation. This
class performs simple parsing on the last line of the script to obtain the variable
name, if any, and return its value.
- Since:
- 2.1
- Author:
- David Turanski, Gary Russell
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.springframework.integration.scripting.jsr223.AbstractScriptExecutor
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
postProcess
(Object result, ScriptEngine scriptEngine, String script, Bindings bindings) Subclasses may implement this to provide any special handling requiredMethods inherited from class org.springframework.integration.scripting.jsr223.AbstractScriptExecutor
executeScript, getScriptEngine
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
-
Constructor Details
-
PythonScriptExecutor
public PythonScriptExecutor()
-
-
Method Details
-
postProcess
protected Object postProcess(Object result, ScriptEngine scriptEngine, String script, Bindings bindings) Description copied from class:AbstractScriptExecutor
Subclasses may implement this to provide any special handling required- Specified by:
postProcess
in classAbstractScriptExecutor
- Parameters:
result
- the result.scriptEngine
- the engine.script
- the script.bindings
- the bindings.- Returns:
- modified result
-