public class PythonScriptExecutor extends AbstractScriptExecutor
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.
Modifier and Type | Class and Description |
---|---|
static class |
PythonScriptExecutor.PythonVariableParser |
logger
Constructor and Description |
---|
PythonScriptExecutor() |
Modifier and Type | Method and Description |
---|---|
protected Object |
postProcess(Object result,
ScriptEngine scriptEngine,
String script,
Bindings bindings)
Subclasses may implement this to provide any special handling required
|
executeScript, getScriptEngine
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executeScript
protected Object postProcess(Object result, ScriptEngine scriptEngine, String script, Bindings bindings)
AbstractScriptExecutor
postProcess
in class AbstractScriptExecutor
result
- the result.scriptEngine
- the engine.script
- the script.bindings
- the bindings.