This is the writer to be used to output from scripts.
By default, a PrintWriter based on System.out
is used. Accessor methods getWriter, setWriter are used to manage
this field.
This is the writer to be used to output errors from scripts.
By default, a PrintWriter based on System.err is
used. Accessor methods getErrorWriter, setErrorWriter are used to manage
this field.
This is the reader to be used for input from scripts.
By default, a 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.
This is the global scope bindings.
By default, a null value (which means no global scope) is used. Accessor
methods setBindings, getBindings are used to manage this field.
Constructor Detail
SimpleScriptContext
public SimpleScriptContext()
Create a SimpleScriptContext.
Method Detail
setBindings
public void setBindings(Bindings bindings,
int scope)
Sets a 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.
Retrieves the value of the attribute with the given name in
the scope occurring earliest in the search order. The order
is determined by the numeric value of the scope parameter (lowest
scope values first.)
The value of the attribute in the lowest scope for
which an attribute with the given name is defined. Returns
null if no attribute with the name exists in any scope.
public void setAttribute(String name,
Object value,
int scope)
Sets the value of an attribute in a given scope. If the scope is GLOBAL_SCOPE
and no Bindings is set for GLOBAL_SCOPE, then setAttribute call is a no-op.
Returns the value of the engineScope field if specified scope is
ENGINE_SCOPE. Returns the value of the globalScope field if the specified scope is
GLOBAL_SCOPE.