Fields Summary |
---|
public static final String | ARGVReserved key for a named value that passes
an array of positional arguments to a script. |
public static final String | FILENAMEReserved key for a named value that is
the name of the file being executed. |
public static final String | ENGINEReserved key for a named value that is
the name of the ScriptEngine implementation. |
public static final String | ENGINE_VERSIONReserved key for a named value that identifies
the version of the ScriptEngine implementation. |
public static final String | NAMEReserved key for a named value that identifies
the short name of the scripting language. The name is used by the
ScriptEngineManager to locate a ScriptEngine
with a given name in the getEngineByName method. |
public static final String | LANGUAGEReserved key for a named value that is
the full name of Scripting Language supported by the implementation. |
public static final String | LANGUAGE_VERSIONReserved key for the named value that identifies
the version of the scripting language supported by the implementation. |
Methods Summary |
---|
public javax.script.Bindings | createBindings()Returns an uninitialized Bindings .
|
public java.lang.Object | eval(java.lang.String script, javax.script.ScriptContext context)Causes the immediate execution of the script whose source is the String
passed as the first argument. The script may be reparsed or recompiled before
execution. State left in the engine from previous executions, including
variable values and compiled procedures may be visible during this execution.
|
public java.lang.Object | eval(java.io.Reader reader, javax.script.ScriptContext context)Same as eval(String, ScriptContext) where the source of the script
is read from a Reader .
|
public java.lang.Object | eval(java.lang.String script)Executes the specified script. The default ScriptContext for the ScriptEngine
is used.
|
public java.lang.Object | eval(java.io.Reader reader)Same as eval(String) except that the source of the script is
provided as a Reader
|
public java.lang.Object | eval(java.lang.String script, javax.script.Bindings n)Executes the script using the Bindings argument as the ENGINE_SCOPE
Bindings of the ScriptEngine during the script execution. The
Reader , Writer and non-ENGINE_SCOPE Bindings of the
default ScriptContext are used. The ENGINE_SCOPE
Bindings of the ScriptEngine is not changed, and its
mappings are unaltered by the script execution.
|
public java.lang.Object | eval(java.io.Reader reader, javax.script.Bindings n)Same as eval(String, Bindings) except that the source of the script
is provided as a Reader .
|
public java.lang.Object | get(java.lang.String key)Retrieves a value set in the state of this engine. The value might be one
which was set using setValue or some other value in the state
of the ScriptEngine , depending on the implementation. Must have the same effect
as getBindings(ScriptContext.ENGINE_SCOPE).get
|
public javax.script.Bindings | getBindings(int scope)Returns a scope of named values. The possible scopes are:
ScriptContext.GLOBAL_SCOPE - The set of named values representing global
scope. If this ScriptEngine is created by a ScriptEngineManager ,
then the manager sets global scope bindings. This may be null if no global
scope is associated with this ScriptEngine
ScriptContext.ENGINE_SCOPE - The set of named values representing the state of
this ScriptEngine . The values are generally visible in scripts using
the associated keys as variable names.
- Any other value of scope defined in the default
ScriptContext of the ScriptEngine .
The Bindings instances that are returned must be identical to those returned by the
getBindings method of ScriptContext called with corresponding arguments on
the default ScriptContext of the ScriptEngine .
|
public javax.script.ScriptContext | getContext()Returns the default ScriptContext of the ScriptEngine whose Bindings, Reader
and Writers are used for script executions when no ScriptContext is specified.
|
public javax.script.ScriptEngineFactory | getFactory()Returns a ScriptEngineFactory for the class to which this ScriptEngine belongs.
|
public void | put(java.lang.String key, java.lang.Object value)Sets a key/value pair in the state of the ScriptEngine that may either create
a Java Language Binding to be used in the execution of scripts or be used in some
other way, depending on whether the key is reserved. Must have the same effect as
getBindings(ScriptContext.ENGINE_SCOPE).put .
|
public void | setBindings(javax.script.Bindings bindings, int scope)Sets a scope of named values to be used by scripts. The possible scopes are:
ScriptContext.ENGINE_SCOPE - The specified Bindings replaces the
engine scope of the ScriptEngine .
ScriptContext.GLOBAL_SCOPE - The specified Bindings must be visible
as the GLOBAL_SCOPE .
- Any other value of scope defined in the default
ScriptContext of the ScriptEngine .
The method must have the same effect as calling the setBindings method of
ScriptContext with the corresponding value of scope on the default
ScriptContext of the ScriptEngine .
|
public void | setContext(javax.script.ScriptContext context)Sets the default ScriptContext of the ScriptEngine whose Bindings, Reader
and Writers are used for script executions when no ScriptContext is specified.
|