|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ScriptContext
See Javadoc of Java Scripting API
Field Summary | |
---|---|
static int |
ENGINE_SCOPE
defines an integer for the scope, ENGINE_SCOPE |
static int |
GLOBAL_SCOPE
defines an integer for the scope, GLOBAL_SCOPE |
Method Summary | |
---|---|
java.lang.Object |
getAttribute(java.lang.String name)
Retrieves the value of the getAttribute(String, int) for the lowest scope in which it returns a non-null value. |
java.lang.Object |
getAttribute(java.lang.String name,
int scope)
Retrieves the value of an attribute in the specified scope. |
int |
getAttributesScope(java.lang.String name)
Retrieves the lowest value of the scope for which the attribute is defined. |
Bindings |
getBindings(int scope)
Retrieves the Bindings instance associated with the given scope. |
java.io.Writer |
getErrorWriter()
Returns the Writer to be used to display error output. |
java.io.Reader |
getReader()
Returns a Reader to be used by the script to read input. |
java.util.List |
getScopes()
Returns an immutable List of all the valid values for scope in the ScriptContext. |
java.io.Writer |
getWriter()
Retrieves an instance of java.io.Writer which can be used by scripts to display their output. |
java.lang.Object |
removeAttribute(java.lang.String name,
int scope)
Removes the given attribute from the specified scope. |
void |
setAttribute(java.lang.String name,
java.lang.Object value,
int scope)
Associates a specified value with the specifed name in the specified scope. |
void |
setBindings(Bindings bindings,
int scope)
Associates the specified Bindings with the specified scope. |
void |
setErrorWriter(java.io.Writer writer)
Sets the Writer for scripts to use when displaying error output. |
void |
setReader(java.io.Reader reader)
Sets the Reader to be used by the script to read input. |
void |
setWriter(java.io.Writer writer)
Sets the Writer for scripts to use when displaying output. |
Field Detail |
---|
static final int ENGINE_SCOPE
static final int GLOBAL_SCOPE
Method Detail |
---|
java.lang.Object getAttribute(java.lang.String name)
name
- the name of the attribute
java.lang.IllegalArgumentException
- if the name is empty
java.lang.NullPointerException
- if the name is nulljava.lang.Object getAttribute(java.lang.String name, int scope)
name
- the name of the attributescope
- the value of the scope
java.lang.IllegalArgumentException
- if the name is empty or the
scope is invalid
java.lang.NullPointerException
- if the name is nullint getAttributesScope(java.lang.String name)
name
- the name of attribute
java.lang.NullPointerException
- if name is null.
java.lang.IllegalArgumentException
- if name is empty.Bindings getBindings(int scope)
scope
- the scope
java.lang.IllegalArgumentException
- If no Bindings is defined for the specified scope value in ScriptContext of this type.java.io.Writer getWriter()
java.io.Writer getErrorWriter()
void setWriter(java.io.Writer writer)
writer
- the new writer.void setErrorWriter(java.io.Writer writer)
writer
- the new writer.java.io.Reader getReader()
void setReader(java.io.Reader reader)
reader
- the new readerjava.lang.Object removeAttribute(java.lang.String name, int scope)
name
- the name of the attributescope
- the scope from which to remove the attribute
java.lang.NullPointerException
- if the name is null
java.lang.IllegalArgumentException
- if the name is empty or if the
scope is invalidvoid setAttribute(java.lang.String name, java.lang.Object value, int scope)
name
- the name of the attributevalue
- the value of the attributescope
- the scope
java.lang.IllegalArgumentException
- if the name is null or the
scope is invalid
java.lang.NullPointerException
- if the name is null.void setBindings(Bindings bindings, int scope)
bindings
- the Bindings to be associated with the
specified scopescope
- the scope
java.lang.IllegalArgumentException
- if the scope is invalid
java.lang.NullPointerException
- if the bindings is null and the
scope is ScriptEngine.ENGINE_SCOPEjava.util.List getScopes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |