java.lang.Object | |
↳ | javax.script.SimpleScriptContext |
Simple implementation of ScriptContext.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
engineScope | This is the engine scope bindings. | ||||||||||
errorWriter | This is the writer to be used to output errors from scripts. | ||||||||||
globalScope | This is the global scope bindings. | ||||||||||
reader | This is the reader to be used for input from scripts. | ||||||||||
writer | This is the writer to be used to output from scripts. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Retrieves the value of the attribute with the given name in
the scope occurring earliest in the search order.
| |||||||||||
Gets the value of an attribute in a given scope.
| |||||||||||
Get the lowest scope in which an attribute is defined.
| |||||||||||
Returns the value of the
engineScope field if specified scope is
ENGINE_SCOPE . | |||||||||||
Returns the
Writer used to display error output. | |||||||||||
Returns a
Reader to be used by the script to read
input. | |||||||||||
Returns immutable
List of all the valid values for
scope in the ScriptContext. | |||||||||||
Returns the
Writer for scripts to use when displaying output. | |||||||||||
Remove an attribute in a given scope.
| |||||||||||
Sets the value of an attribute in a given scope.
| |||||||||||
Sets a
Bindings of attributes for the given scope. | |||||||||||
Sets the
Writer used to display error output. | |||||||||||
Sets the
Reader for scripts to read input
. | |||||||||||
Sets the
Writer for scripts to use when displaying output. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
This is the engine scope bindings.
By default, a SimpleBindings
is used. Accessor
methods setBindings, getBindings 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 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.
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 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.
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.)
name | The name of the the attribute to retrieve. |
---|
NullPointerException | if the name is null. |
---|---|
IllegalArgumentException | if the name is empty. |
Gets the value of an attribute in a given 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.IllegalArgumentException | if the name is empty or if the value of scope is invalid. |
---|---|
NullPointerException | if the name is null. |
Get the lowest scope in which an attribute is defined.
name | Name of the attribute . |
---|
NullPointerException | if name is null. |
---|---|
IllegalArgumentException | if name is empty. |
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
.
scope | The specified scope |
---|
engineScope
or globalScope
field.IllegalArgumentException | if the value of scope is invalid. |
---|
Returns a Reader
to be used by the script to read
input.
Reader
.
Returns immutable List
of all the valid values for
scope in the ScriptContext.
Returns the Writer
for scripts to use when displaying output.
Writer
.
Remove an attribute in a given scope.
name | The name of the attribute to remove |
---|---|
scope | The scope in which to remove the attribute |
IllegalArgumentException | if the name is empty or if the scope is invalid. |
---|---|
NullPointerException | if the name is null. |
Sets the value of an attribute in a given scope.
name | The name of the attribute to set |
---|---|
value | The value of the attribute |
scope | The scope in which to set the attribute |
IllegalArgumentException | if the name is empty or if the scope is invalid. |
---|---|
NullPointerException | if the name is null. |
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.
bindings | The Bindings of attributes to set. |
---|---|
scope | The value of the scope in which the attributes are set. |
IllegalArgumentException | if scope is invalid. |
---|---|
NullPointerException | if the value of scope is ENGINE_SCOPE and
the specified Bindings is null.
|
Sets the Writer
used to display error output.
writer | The Writer .
|
---|
Sets the Reader
for scripts to read input
.
reader | The new Reader .
|
---|
Sets the Writer
for scripts to use when displaying output.
writer | The new Writer .
|
---|