Package ch.obermuhlner.scriptengine.java
Class JavaCompiledScript
java.lang.Object
javax.script.CompiledScript
ch.obermuhlner.scriptengine.java.JavaCompiledScript
The compiled Java script created by a
JavaScriptEngine
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Class
<?> private final Object
private final JavaScriptEngine
private ExecutionStrategy
-
Constructor Summary
ConstructorsConstructorDescriptionJavaCompiledScript
(JavaScriptEngine engine, Class<?> compiledClass, Object compiledInstance, ExecutionStrategy executionStrategy) Construct aJavaCompiledScript
. -
Method Summary
Modifier and TypeMethodDescriptioneval
(ScriptContext context) Class
<?> Returns the compiledClass
.Returns the instance of the compiledClass
.Deprecated.Class
<?> Deprecated.in release 1.1.0 this method was deprecated, usegetCompiledClass()
instead.mergeBindings
(Bindings... bindingsToMerge) private void
pullVariables
(Bindings globalBindings, Bindings engineBindings) private void
pushVariables
(Bindings globalBindings, Bindings engineBindings) private void
setBindingsValue
(Bindings globalBindings, Bindings engineBindings, String name, Object value) void
setExecutionStrategy
(ExecutionStrategy executionStrategy) Sets theExecutionStrategy
to be used when evaluating the compiled class instance.Methods inherited from class javax.script.CompiledScript
eval, eval
-
Field Details
-
engine
-
compiledClass
-
compiledInstance
-
executionStrategy
-
-
Constructor Details
-
JavaCompiledScript
JavaCompiledScript(JavaScriptEngine engine, Class<?> compiledClass, Object compiledInstance, ExecutionStrategy executionStrategy) Construct aJavaCompiledScript
.- Parameters:
engine
- theJavaScriptEngine
that compiled this scriptcompiledClass
- the compiledClass
compiledInstance
- the instance of the compiledClass
ornull
if no instance was created and only static methods will be called by the theExecutionStrategy
.executionStrategy
- theExecutionStrategy
-
-
Method Details
-
getCompiledClass
Returns the compiledClass
.- Returns:
- the compiled
Class
.
-
getCompiledInstance
Returns the instance of the compiledClass
.- Returns:
- the instance of the compiled
Class
ornull
if no instance was created and only static methods will be called by the theExecutionStrategy
.
-
getInstanceClass
Deprecated.in release 1.1.0 this method was deprecated, usegetCompiledClass()
instead.Returns the compiledClass
.- Returns:
- the compiled
Class
.
-
getInstance
Deprecated.in release 1.1.0 this method was deprecated, usegetCompiledInstance()
instead.Returns the instance of the compiledClass
.- Returns:
- the instance of the compiled
Class
ornull
if no instance was created and only static methods will be called by the theExecutionStrategy
.
-
setExecutionStrategy
Sets theExecutionStrategy
to be used when evaluating the compiled class instance.- Parameters:
executionStrategy
- theExecutionStrategy
-
getEngine
- Specified by:
getEngine
in classCompiledScript
-
eval
- Specified by:
eval
in classCompiledScript
- Throws:
ScriptException
-
pushVariables
- Throws:
ScriptException
-
pullVariables
- Throws:
ScriptException
-
setBindingsValue
-
mergeBindings
-
getCompiledInstance()
instead.