|
||||||||||
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 | |
---|---|
Object |
getAttribute(String name)
Retrieves the value of the getAttribute(String, int) for the lowest scope in which it returns a non-null value. |
Object |
getAttribute(String name,
int scope)
Retrieves the value of an attribute in the specified scope. |
int |
getAttributesScope(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. |
Writer |
getErrorWriter()
Returns the Writer to be used to display error output. |
Reader |
getReader()
Returns a Reader to be used by the script to read input. |
List |
getScopes()
Returns an immutable List of all the valid values for scope in the ScriptContext. |
Writer |
getWriter()
Retrieves an instance of java.io.Writer which can be used by scripts to display their output. |
Object |
removeAttribute(String name,
int scope)
Removes the given attribute from the specified scope. |
void |
setAttribute(String name,
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(Writer writer)
Sets the Writer for scripts to use when displaying error output. |
void |
setReader(Reader reader)
Sets the Reader to be used by the script to read input. |
void |
setWriter(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 |
---|
Object getAttribute(String name)
name
- the name of the attribute
IllegalArgumentException
- if the name is empty
NullPointerException
- if the name is nullObject getAttribute(String name, int scope)
name
- the name of the attributescope
- the value of the scope
IllegalArgumentException
- if the name is empty or the
scope is invalid
NullPointerException
- if the name is nullint getAttributesScope(String name)
name
- the name of attribute
NullPointerException
- if name is null.
IllegalArgumentException
- if name is empty.Bindings getBindings(int scope)
scope
- the scope
IllegalArgumentException
- If no Bindings is defined for the specified scope value in ScriptContext of this type.Writer getWriter()
Writer getErrorWriter()
void setWriter(Writer writer)
writer
- the new writer.void setErrorWriter(Writer writer)
writer
- the new writer.Reader getReader()
void setReader(Reader reader)
reader
- the new readerObject removeAttribute(String name, int scope)
name
- the name of the attributescope
- the scope from which to remove the attribute
NullPointerException
- if the name is null
IllegalArgumentException
- if the name is empty or if the
scope is invalidvoid setAttribute(String name, Object value, int scope)
name
- the name of the attributevalue
- the value of the attributescope
- the scope
IllegalArgumentException
- if the name is null or the
scope is invalid
NullPointerException
- if the name is null.void setBindings(Bindings bindings, int scope)
bindings
- the Bindings to be associated with the
specified scopescope
- the scope
IllegalArgumentException
- if the scope is invalid
NullPointerException
- if the bindings is null and the
scope is ScriptEngine.ENGINE_SCOPEList getScopes()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |