| javax.script.ScriptContext | 
|  Known Indirect Subclasses | 
The interface whose implementing classes are used to connect Script Engines
 with objects, such as scoped Bindings, in hosting applications.  Each scope is a set
 of named attributes whose values can be set and retrieved using the
 ScriptContext methods. ScriptContexts also expose Readers and Writers
 that can be used by the ScriptEngines for input and output.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | ENGINE_SCOPE | EngineScope attributes are visible during the lifetime of a single ScriptEngineand a set of attributes is maintained for each
 engine. | |||||||||
| int | GLOBAL_SCOPE | GlobalScope attributes are visible to all engines created by same ScriptEngineFactory. | |||||||||
| 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. | |||||||||||
| Gets the  Bindingsassociated with the given scope in thisScriptContext. | |||||||||||
| Returns the  Writerused to display error output. | |||||||||||
| Returns a  Readerto be used by the script to read
 input. | |||||||||||
| Returns immutable  Listof all the valid values for
 scope in the ScriptContext. | |||||||||||
| Returns the  Writerfor scripts to use when displaying output. | |||||||||||
| Remove an attribute in a given scope. | |||||||||||
| Sets the value of an attribute in a given scope. | |||||||||||
| Associates a  Bindingsinstance with a particular scope in thisScriptContext. | |||||||||||
| Sets the  Writerused to display error output. | |||||||||||
| Sets the  Readerfor scripts to read input
 . | |||||||||||
| Sets the  Writerfor scripts to use when displaying output. | |||||||||||
EngineScope attributes are visible during the lifetime of a single
 ScriptEngine and a set of attributes is maintained for each
 engine.
GlobalScope attributes are visible to all engines created by same ScriptEngineFactory.
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. | 
Gets the Bindings  associated with the given scope in this
 ScriptContext.
Bindings.  Returns null if it has not
 been set.| IllegalArgumentException | If no Bindingsis defined for the
 specified scope value inScriptContextof this type. | 
|---|
Returns the Writer used to display error output.
Writer
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. | 
Associates a Bindings instance with a particular scope in this
 ScriptContext.  Calls to the getAttribute and
 setAttribute methods must map to the get and
 put methods of the Bindings for the specified scope.
| bindings | The Bindingsto associate with the given scope | 
|---|---|
| scope | The scope | 
| IllegalArgumentException | If no Bindingsis defined for the
 specified scope value in ScriptContexts of this type. | 
|---|---|
| NullPointerException | if value of scope is ENGINE_SCOPEand
 the specifiedBindingsis 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. | 
|---|