| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
SimpleScriptContext tempctxt = new SimpleScriptContext();
Based on 9 examples
public class SimpleScriptContext extends Object implements ScriptContext
Simple implementation of ScriptContext.
Field Summary | |
---|---|
protected Bindings |
engineScope
This is the engine scope bindings. |
protected Writer |
errorWriter
This is the writer to be used to output errors from scripts. |
protected Bindings |
globalScope
This is the global scope bindings. |
protected Reader |
reader
This is the reader to be used for input from scripts. |
protected Writer |
writer
This is the writer to be used to output from scripts. |
Constructor Summary | |
---|---|
|
Method Summary | |
---|---|
Object |
getAttribute(String name) Retrieves the value of the attribute with the given name in the scope occurring earliest in the search order. |
Object |
getAttribute(String name, int scope) Gets the value of an attribute in a given scope. |
int |
getAttributesScope(String name) Get the lowest scope in which an attribute is defined. |
Bindings |
getBindings(int scope) Returns the value of the engineScope field if specified scope is
ENGINE_SCOPE .
|
Writer |
|
Reader |
|
List |
|
Writer |
|
Object |
removeAttribute(String name, int scope) Remove an attribute in a given scope. |
void |
setAttribute(String name, Object value, int scope) Sets the value of an attribute in a given scope. |
void |
setBindings(Bindings bindings, int scope) Sets a Bindings of attributes for the given scope.
|
void |
setErrorWriter(Writer writer) |
void |
|
void |
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Bindings engineScope
SimpleBindings
is used. Accessor
methods setBindings, getBindings are used to manage this field.
protected Writer errorWriter
PrintWriter
based on System.err
is
used. Accessor methods getErrorWriter, setErrorWriter are used to manage
this field.
protected Bindings globalScope
protected Reader reader
InputStreamReader
based on System.in
is used and default charset is used by this reader. Accessor methods
getReader, setReader are used to manage this field.
protected Writer writer
PrintWriter
based on System.out
is used. Accessor methods getWriter, setWriter are used to manage
this field.
Constructor Detail |
---|
public SimpleScriptContext()
Method Detail |
---|
public Object getAttribute(String name)
name
- The name of the the attribute to retrieve.public Object getAttribute(String name, int scope)
name
- The name of the attribute to retrieve.scope
- The scope in which to retrieve the attribute.null
is the name
does not exist in the given scope.public int getAttributesScope(String name)
name
- Name of the attribute
.public Bindings getBindings(int scope)
engineScope
field if specified scope is
ENGINE_SCOPE
. Returns the value of the globalScope
field if the specified scope is
GLOBAL_SCOPE
.
scope
- The specified scopeengineScope
or globalScope
field.public Writer getErrorWriter()
public Reader getReader()
public List getScopes()
public Writer getWriter()
public Object removeAttribute(String name, int scope)
name
- The name of the attribute to removescope
- The scope in which to remove the attributepublic void setAttribute(String name, Object value, int scope)
name
- The name of the attribute to setvalue
- The value of the attributescope
- The scope in which to set the attributepublic void setBindings(Bindings bindings, int scope)
Bindings
of attributes for the given scope. If the value
of scope is ENGINE_SCOPE
the given Bindings
replaces the
engineScope
field. If the value
of scope is GLOBAL_SCOPE
the given Bindings
replaces the
globalScope
field.
bindings
- The Bindings
of attributes to set.scope
- The value of the scope in which the attributes are set.public void setErrorWriter(Writer writer)
writer
public void setReader(Reader reader)
reader
public void setWriter(Writer writer)
writer
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |