|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.script.SimpleScriptContext
public class SimpleScriptContext
A simple implementation of ScriptContext.
This class is not synchronized.
See Javadoc of Java Scripting API
| Field Summary | |
|---|---|
protected Bindings |
engineScope
This is the scope bindings for ENGINE_SCOPE . |
protected java.io.Writer |
errorWriter
The writer to be used for displaying error output from scripts |
protected Bindings |
globalScope
This is the scope bindings for GLOBAL_SCOPE. |
protected java.io.Reader |
reader
The reader to be used for input from scripts. |
protected java.io.Writer |
writer
The writer to be used for displaying output from scripts |
| Fields inherited from interface javax.script.ScriptContext |
|---|
ENGINE_SCOPE, GLOBAL_SCOPE |
| Constructor Summary | |
|---|---|
SimpleScriptContext()
Create a new instance, setting the Reader and Writers from the corresponding System streams. |
|
| 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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Bindings globalScope
protected Bindings engineScope
protected java.io.Reader reader
protected java.io.Writer writer
protected java.io.Writer errorWriter
| Constructor Detail |
|---|
public SimpleScriptContext()
| Method Detail |
|---|
public java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface ScriptContextname - the name of the attribute
public java.lang.Object getAttribute(java.lang.String name,
int scope)
getAttribute in interface ScriptContextname - the name of the attributescope - the value of the scope
public int getAttributesScope(java.lang.String name)
getAttributesScope in interface ScriptContextname - the name of attribute
public Bindings getBindings(int scope)
getBindings in interface ScriptContextscope - the scope
public java.lang.Object removeAttribute(java.lang.String name,
int scope)
removeAttribute in interface ScriptContextname - the name of the attributescope - the scope from which to remove the attribute
public void setAttribute(java.lang.String name,
java.lang.Object value,
int scope)
setAttribute in interface ScriptContextname - the name of the attributevalue - the value of the attributescope - the scope
public void setBindings(Bindings bindings,
int scope)
setBindings in interface ScriptContextbindings - the Bindings to be associated with the
specified scopescope - the scopepublic java.util.List getScopes()
getScopes in interface ScriptContextpublic java.io.Reader getReader()
getReader in interface ScriptContextpublic void setReader(java.io.Reader reader)
setReader in interface ScriptContextreader - the new readerpublic java.io.Writer getWriter()
getWriter in interface ScriptContextpublic void setWriter(java.io.Writer writer)
setWriter in interface ScriptContextwriter - the new writer.public java.io.Writer getErrorWriter()
getErrorWriter in interface ScriptContextpublic void setErrorWriter(java.io.Writer writer)
setErrorWriter in interface ScriptContextwriter - the new writer.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||