ScriptEngine is the fundamental interface whose methods must be
fully functional in every implementation of this specification.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | ARGV
Reserved key for a named value that passes an array of positional arguments to a script. |
| public static final String | ENGINE
Reserved key for a named value that is
the name of the |
| public static final String | ENGINE_VERSION
Reserved key for a named value that identifies
the version of the |
| public static final String | FILENAME
Reserved key for a named value that is the name of the file being executed. |
| public static final String | LANGUAGE
Reserved key for a named value that is the full name of Scripting Language supported by the implementation. |
| public static final String | LANGUAGE_VERSION
Reserved key for the named value that identifies the version of the scripting language supported by the implementation. |
| public static final String | NAME
Reserved key for a named value that identifies the short name of the scripting language. |
| Modifier and Type | Method and Description |
|---|---|
| public Bindings | Returns: ABindings that can be used to replace the state of this ScriptEngine.Returns an uninitialized |
| public Object | Returns: The value returned from the execution of the script.The script to be executed by the script engine. script, ScriptContext A context)ScriptContext exposing sets of attributes in
different scopes. The meanings of the scopes ScriptContext.GLOBAL_SCOPE,
and ScriptContext.ENGINE_SCOPE are defined in the specification.
The ENGINE_SCOPE Bindings of the ScriptContext contains the
bindings of scripting variables to application objects to be used during this
script execution.Causes the immediate execution of the script whose source is the String passed as the first argument. |
| public Object | Returns: The value returned from the execution of the script.The source of the script to be executed by the script engine. reader, ScriptContext The context)ScriptContext passed to the script engine.Same as |
| public Object | |
| public Object | |
| public Object | |
| public Object | |
| public Object | |
| public Bindings | Returns: TheBindings with the specified scope.Either scope)ScriptContext.ENGINE_SCOPE or ScriptContext.GLOBAL_SCOPE
which specifies the Bindings to return. Implementations of ScriptContext
may define additional scopes. If the default ScriptContext of the ScriptEngine
defines additional scopes, any of them can be passed to get the corresponding Bindings.Returns a scope of named values. |
| public ScriptContext | Returns: The defaultScriptContext of the ScriptEngine.Returns the default |
| public ScriptEngineFactory | Returns: TheScriptEngineFactoryReturns a |
| public void | put(String
The name of named value to add key, Object The value of named value to add. 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. |
| public void | setBindings(Bindings
The bindings, int Bindings for the specified scope.The specified scope. Either scope)ScriptContext.ENGINE_SCOPE,
ScriptContext.GLOBAL_SCOPE, or any other valid value of scope.Sets a scope of named values to be used by scripts. |
| public void | setContext(ScriptContext
A context)ScriptContext that will replace the default ScriptContext in
the ScriptEngine.Sets the default |
| ARGV | back to summary |
|---|---|
| public static final String ARGV Reserved key for a named value that passes an array of positional arguments to a script. | |
| ENGINE | back to summary |
|---|---|
| public static final String ENGINE Reserved key for a named value that is
the name of the | |
| ENGINE_VERSION | back to summary |
|---|---|
| public static final String ENGINE_VERSION Reserved key for a named value that identifies
the version of the | |
| FILENAME | back to summary |
|---|---|
| public static final String FILENAME Reserved key for a named value that is the name of the file being executed. | |
| LANGUAGE | back to summary |
|---|---|
| public static final String LANGUAGE Reserved key for a named value that is the full name of Scripting Language supported by the implementation. | |
| LANGUAGE_VERSION | back to summary |
|---|---|
| public static final String LANGUAGE_VERSION Reserved key for the named value that identifies the version of the scripting language supported by the implementation. | |
| NAME | back to summary |
|---|---|
| public static final String NAME Reserved key for a named value that identifies
the short name of the scripting language. The name is used by the
| |
| createBindings | back to summary |
|---|---|
| public Bindings createBindings() Returns an uninitialized
| |
| eval | back to summary |
|---|---|
| public Object eval(String script, ScriptContext context) throws ScriptException 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.
| |
| eval | back to summary |
|---|---|
| public Object eval(Reader reader, ScriptContext context) throws ScriptException Same as
| |
| eval | back to summary |
|---|---|
| public Object eval(String script) throws ScriptException Executes the specified script. The default
| |
| eval | back to summary |
|---|---|
| public Object eval(Reader reader) throws ScriptException Same as
| |
| eval | back to summary |
|---|---|
| public Object eval(String script, Bindings n) throws ScriptException Executes the script using the
| |
| eval | back to summary |
|---|---|
| public Object eval(Reader reader, Bindings n) throws ScriptException Same as
| |
| get | back to summary |
|---|---|
| public Object get(String key) Retrieves a value set in the state of this engine. The value might be one
which was set using
| |
| getBindings | back to summary |
|---|---|
| public Bindings getBindings(int scope) Returns a scope of named values. The possible scopes are:
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.
| |
| getContext | back to summary |
|---|---|
| public ScriptContext getContext() Returns the default
| |
| getFactory | back to summary |
|---|---|
| public ScriptEngineFactory getFactory() Returns a
| |
| put | back to summary |
|---|---|
| public void put(String key, 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
| |
| setBindings | back to summary |
|---|---|
| public void setBindings(Bindings bindings, int scope) Sets a scope of named values to be used by scripts. The possible scopes are:
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.
| |
| setContext | back to summary |
|---|---|
| public void setContext(ScriptContext context) Sets the default
| |