|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.script.AbstractScriptEngine
public abstract class AbstractScriptEngine
See Javadoc of Java Scripting API
| Field Summary | |
|---|---|
protected ScriptContext |
context
|
| Fields inherited from interface javax.script.ScriptEngine |
|---|
ARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME |
| Constructor Summary | |
|---|---|
AbstractScriptEngine()
Constructs a ScriptEngine using an uninitialized SimpleNamespace. |
|
AbstractScriptEngine(Bindings bindings)
Constructs a ScriptEngine using the specified namespace as its ENGINE_SCOPE. |
|
| Method Summary | |
|---|---|
java.lang.Object |
eval(java.io.Reader reader)
Evaluates a piece of script obtained using the specified reader as the script source. |
java.lang.Object |
eval(java.io.Reader reader,
Bindings bindings)
Evaluates a piece of scripts obtained using a reader as the script source and using the specified namespace as the SCRIPT_SCOPE. |
java.lang.Object |
eval(java.lang.String script)
Evaluates a piece of script and returns the resultant object. |
java.lang.Object |
eval(java.lang.String script,
Bindings nameSpace)
Evaluates a piece of script using the specified namespace as its SCRIPT_SCOPE. |
java.lang.Object |
get(java.lang.String key)
Retrieves the associated value with the specified key ScriptEngine namespace. |
Bindings |
getBindings(int scope)
Retrieves a reference to the associated namespace for the specified level of 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. |
protected ScriptContext |
getScriptContext(Bindings bindings)
Retrieves an instance of ScriptContext with namespaces associated with all the level of scopes and the specified namespace associated with SCRIPT_SCOPE. |
void |
put(java.lang.String key,
java.lang.Object value)
Associates a key and a value in the ScriptEngine namespace. |
void |
setBindings(Bindings bindings,
int scope)
Associates a namespace with a specified level of 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.script.ScriptEngine |
|---|
createBindings, eval, eval, getFactory |
| Field Detail |
|---|
protected ScriptContext context
| Constructor Detail |
|---|
public AbstractScriptEngine()
public AbstractScriptEngine(Bindings bindings)
bindings - the namespace to be used as the ENGINE_SCOPE| Method Detail |
|---|
public java.lang.Object eval(java.io.Reader reader)
throws ScriptException
eval in interface ScriptEnginereader - the reader form which the script is obtained
ScriptException - if an error occurs
public java.lang.Object eval(java.io.Reader reader,
Bindings bindings)
throws ScriptException
eval in interface ScriptEnginereader - the reader from which the script is obtainednamespace - the namespace to be used as SCRIPT_SCOPE
ScriptException - if an error occurs
public java.lang.Object eval(java.lang.String script)
throws ScriptException
eval in interface ScriptEnginescript - the String representation of the script
ScriptException - if an error occurs
public java.lang.Object eval(java.lang.String script,
Bindings nameSpace)
throws ScriptException
eval in interface ScriptEnginescript - the String representation of the scriptnamespace - the namespace to be used as the SCRIPT_SCOPE
ScriptException - if an error occurspublic java.lang.Object get(java.lang.String key)
get in interface ScriptEnginekey - the associated key of the value
public Bindings getBindings(int scope)
getBindings in interface ScriptEnginescope - the specified level of scope
java.lang.IllegalArgumentException - if the scope is invalidprotected ScriptContext getScriptContext(Bindings bindings)
bindings - the namespace to be associated with
SCRIPT_SCOPE
public void put(java.lang.String key,
java.lang.Object value)
put in interface ScriptEnginekey - String value which uniquely identifies the valuevalue - value which is to be associated with the
specified key
java.lang.IllegalArgumentException - if the key is null
public void setBindings(Bindings bindings,
int scope)
throws java.lang.UnsupportedOperationException
setBindings in interface ScriptEnginebindings - the namespace to be associated with specified scopescope - the level of scope of the specified namespace
java.lang.IllegalArgumentException - if scope is invalid
java.lang.IllegalArgumentException - if the bindings is null and the scope
is ScriptContext.ENGINE_SCOPE
java.lang.UnsupportedOperationExceptionpublic ScriptContext getContext()
getContext in interface ScriptEnginepublic void setContext(ScriptContext context)
setContext in interface ScriptEnginescriptcontext - scriptContext that will replace the default ScriptContext in the ScriptEngine.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||