public class SourceExecutableScript extends ExecutableScript
Modifier and Type | Field and Description |
---|---|
protected CompiledScript |
compiledScript
The cached compiled script.
|
protected String |
scriptSource
The source of the script.
|
protected boolean |
shouldBeCompiled
Flag to signal if the script should be compiled
|
language
Constructor and Description |
---|
SourceExecutableScript(String language,
String source) |
Modifier and Type | Method and Description |
---|---|
protected void |
compileScript(ScriptEngine engine) |
protected Object |
evaluateScript(ScriptEngine engine,
Bindings bindings) |
Object |
execute(ScriptEngine engine,
VariableScope variableScope,
Bindings bindings)
Evaluates the script using the provided engine and bindings
|
CompiledScript |
getCompiledScript() |
String |
getScriptSource() |
boolean |
isShouldBeCompiled() |
void |
setScriptSource(String scriptSource)
Sets the script source code.
|
getLanguage
protected String scriptSource
protected boolean shouldBeCompiled
protected CompiledScript compiledScript
public Object execute(ScriptEngine engine, VariableScope variableScope, Bindings bindings)
ExecutableScript
Evaluates the script using the provided engine and bindings
execute
in class ExecutableScript
engine
- the script engine to use for evaluating the script.variableScope
- the variable scope of the executionbindings
- the bindings to use for evaluating the script.protected void compileScript(ScriptEngine engine)
protected Object evaluateScript(ScriptEngine engine, Bindings bindings)
public String getScriptSource()
public void setScriptSource(String scriptSource)
scriptSource
- the new script source codepublic CompiledScript getCompiledScript()
public boolean isShouldBeCompiled()
Copyright © 2018. All rights reserved.