ScriptContext methods. ScriptContexts also expose Readers and Writers
that can be used by the ScriptEngines for input and output.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ENGINE_SCOPE
EngineScope attributes are visible during the lifetime of a single
|
| public static final int | GLOBAL_SCOPE
GlobalScope attributes are visible to all engines created by same ScriptEngineFactory. |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: The value of the attribute. Returnsnull is the name
does not exist in the given scope.The name of the attribute to retrieve. name, int The scope in which to retrieve the attribute. scope)Gets the value of an attribute in a given scope. |
| public Object | Returns: 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.The name of the attribute to retrieve. name)Retrieves the value of the attribute with the given name in the scope occurring earliest in the search order. |
| public int | Returns: The lowest scope. Returns -1 if no attribute with the given name is defined in any scope.Name of the attribute
. name)Get the lowest scope in which an attribute is defined. |
| public Bindings | Returns: The associatedBindings. Returns null if it has not
been set.The scope scope)Gets the |
| public Writer | |
| public Reader | |
| public List | Returns: list of scope valuesReturns immutable |
| public Writer | |
| public Object | Returns: The removed value.The name of the attribute to remove name, int The scope in which to remove the attribute scope)Remove an attribute in a given scope. |
| public void | setAttribute(String
The name of the attribute to set name, Object The value of the attribute value, int The scope in which to set the attribute scope)Sets the value of an attribute in a given scope. |
| public void | setBindings(Bindings
The bindings, int Bindings to associate with the given scopeThe scope scope)Associates a |
| public void | |
| public void | |
| public void |
| ENGINE_SCOPE | back to summary |
|---|---|
| public static final int ENGINE_SCOPE EngineScope attributes are visible during the lifetime of a single
| |
| GLOBAL_SCOPE | back to summary |
|---|---|
| public static final int GLOBAL_SCOPE GlobalScope attributes are visible to all engines created by same ScriptEngineFactory. | |
| getAttribute | back to summary |
|---|---|
| public Object getAttribute(String name, int scope) Gets the value of an attribute in a given scope.
| |
| getAttribute | back to summary |
|---|---|
| public Object getAttribute(String name) 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.)
| |
| getAttributesScope | back to summary |
|---|---|
| public int getAttributesScope(String name) Get the lowest scope in which an attribute is defined.
| |
| getBindings | back to summary |
|---|---|
| public Bindings getBindings(int scope) Gets the
| |
| getErrorWriter | back to summary |
|---|---|
| public Writer getErrorWriter() Returns the
| |
| getReader | back to summary |
|---|---|
| public Reader getReader() Returns a
| |
| getScopes | back to summary |
|---|---|
| public List Returns immutable | |
| getWriter | back to summary |
|---|---|
| public Writer getWriter() Returns the
| |
| removeAttribute | back to summary |
|---|---|
| public Object removeAttribute(String name, int scope) Remove an attribute in a given scope.
| |
| setAttribute | back to summary |
|---|---|
| public void setAttribute(String name, Object value, int scope) Sets the value of an attribute in a given scope. If the scope is
| |
| setBindings | back to summary |
|---|---|
| public void setBindings(Bindings bindings, int scope) Associates a
| |
| setErrorWriter | back to summary |
|---|---|
| public void setErrorWriter(Writer writer) Sets the
| |
| setReader | back to summary |
|---|---|
| public void setReader(Reader reader) Sets the
| |
| setWriter | back to summary |
|---|---|
| public void setWriter(Writer writer) Sets the
| |