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 Objectprivate final JavaScriptEngineprivate 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 voidpullVariables(Bindings globalBindings, Bindings engineBindings) private voidpushVariables(Bindings globalBindings, Bindings engineBindings) private voidsetBindingsValue(Bindings globalBindings, Bindings engineBindings, String name, Object value) voidsetExecutionStrategy(ExecutionStrategy executionStrategy) Sets theExecutionStrategyto 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- theJavaScriptEnginethat compiled this scriptcompiledClass- the compiledClasscompiledInstance- the instance of the compiledClassornullif 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
Classornullif 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
Classornullif no instance was created and only static methods will be called by the theExecutionStrategy.
-
setExecutionStrategy
Sets theExecutionStrategyto be used when evaluating the compiled class instance.- Parameters:
executionStrategy- theExecutionStrategy
-
getEngine
- Specified by:
getEnginein classCompiledScript
-
eval
- Specified by:
evalin classCompiledScript- Throws:
ScriptException
-
pushVariables
- Throws:
ScriptException
-
pullVariables
- Throws:
ScriptException
-
setBindingsValue
-
mergeBindings
-
getCompiledInstance()instead.