|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ScriptEngine
See Javadoc of Java Scripting API
| Field Summary | |
|---|---|
static java.lang.String |
ARGV
Reserved key associated with an object array which is used to pass set of positional parameters to the ScriptEngines. |
static java.lang.String |
ENGINE
Reserved key associated with the name of the Java ScriptEngine |
static java.lang.String |
ENGINE_VERSION
Reserved key associated with the version of the Java ScriptEngine |
static java.lang.String |
FILENAME
Reserved key associated with name of the file which contains the source of the script. |
static java.lang.String |
LANGUAGE
Reserved key associated with the name of the supported scripting language |
static java.lang.String |
LANGUAGE_VERSION
Reserved key associated with the version of the supported scripting language |
static java.lang.String |
NAME
Reserved key associated with the named value which identifies the short name of the supported language |
| Method Summary | |
|---|---|
Bindings |
createBindings()
Retrieves an uninitialized Bindings which can be used as the scope of the ScriptEngine. |
java.lang.Object |
eval(java.io.Reader reader)
Evaluates a script obtained using the specified reader as the script source. |
java.lang.Object |
eval(java.io.Reader reader,
Bindings bindings)
Evaluates a script obtained using a reader as the script source and using the specified namespace as the ENGINE_SCOPE. |
java.lang.Object |
eval(java.io.Reader reader,
ScriptContext context)
Evaluates a script obtained using the specified reader as the script source and using the bindings in the specifed ScriptContext. |
java.lang.Object |
eval(java.lang.String script)
Evaluates a script contained in a String and returns the resultant object. |
java.lang.Object |
eval(java.lang.String script,
Bindings bindings)
Evaluates a piece of script using the specified namespace as the ENGINE_SCOPE. |
java.lang.Object |
eval(java.lang.String script,
ScriptContext context)
Evaluates a script using the bindings in the specifed ScriptContext. |
java.lang.Object |
get(java.lang.String key)
Retrieves the value which is associated with the specified key in the state of the ScriptEngine. |
Bindings |
getBindings(int scope)
Retrieves a reference to the associated bindings for the specified scope. |
ScriptContext |
getContext()
Returns the default ScriptContext of the ScriptEngine whose Bindings, Readers and Writers are used for script executions when no ScriptContext is specified. |
ScriptEngineFactory |
getFactory()
Returns a ScriptEngineFactory for the class to which this ScriptEngine belongs. |
void |
put(java.lang.String key,
java.lang.Object value)
Associates a key and a value in the ScriptEngine ENGINE_SCOPE bindings. |
void |
setBindings(Bindings bindings,
int scope)
Associates the specified bindings with the specified scope. |
void |
setContext(ScriptContext context)
Sets the default ScriptContext of the ScriptEngine whose Bindings, Readers and Writers are used for script executions when no ScriptContext is specified. |
| Field Detail |
|---|
static final java.lang.String ARGV
static final java.lang.String FILENAME
static final java.lang.String ENGINE
static final java.lang.String ENGINE_VERSION
static final java.lang.String LANGUAGE
static final java.lang.String LANGUAGE_VERSION
static final java.lang.String NAME
| Method Detail |
|---|
Bindings createBindings()
java.lang.Object eval(java.io.Reader reader)
throws ScriptException
reader - the source of the script
ScriptException - if an error occurs
java.lang.NullPointerException - if argument is null
java.lang.Object eval(java.io.Reader reader,
Bindings bindings)
throws ScriptException
reader - the script source used to obtained the scriptbindings - the bindings to be used as ENGINE_SCOPE
ScriptException - if an error occurs
java.lang.NullPointerException - if either argument is null
java.lang.Object eval(java.io.Reader reader,
ScriptContext context)
throws ScriptException
reader - the script sourcecontext - the context contianing different bindings for
script evaluation
ScriptException - if an error occurs
java.lang.NullPointerException - if either argument is null
java.lang.Object eval(java.lang.String script)
throws ScriptException
script - the String representation of the script
ScriptException - if an error occurs
java.lang.NullPointerException - if argument is null
java.lang.Object eval(java.lang.String script,
Bindings bindings)
throws ScriptException
script - the String representation of the scriptbindings - the bindings to be used as the ENGINE_SCOPE
ScriptException - if an error occurs
java.lang.NullPointerException - if either argument is null
java.lang.Object eval(java.lang.String script,
ScriptContext context)
throws ScriptException
script - the String representation of the scriptcontext - tbe ScriptContext containing bindings for the
script evaluation
ScriptException - if an error occurs
java.lang.NullPointerException - if either argument is nulljava.lang.Object get(java.lang.String key)
key - the key associated with value.
java.lang.IllegalArgumentException - if argument is empty
java.lang.NullPointerException - if argument is nullScriptEngineFactory getFactory()
Bindings getBindings(int scope)
scope - the specified scope
java.lang.IllegalArgumentException - if the scope is invalid
void put(java.lang.String key,
java.lang.Object value)
key - the specified key associated with the valuevalue - value which is to be associated with the
specified key
java.lang.IllegalArgumentException - if the key is empty
java.lang.NullPointerException - if key is null
void setBindings(Bindings bindings,
int scope)
bindings - bindings to be associated with the specified scopescope - scope which the bindings should be associated with
java.lang.IllegalArgumentException - if the scope is invalid
java.lang.NullPointerException - if the bindings is null and the scope is ScriptContext.ENGINE_SCOPEScriptContext getContext()
void setContext(ScriptContext context)
context - scriptContext that will replace the default ScriptContext in the ScriptEngine.
java.lang.NullPointerException - if the context is null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||