public interface Scope
Modifier and Type | Method and Description |
---|---|
Bindings |
createBindings()
Returns an uninitialized
Bindings . |
void |
flush() |
Object |
get(String key)
Retrieves a value set in the state of this engine.
|
Bindings |
getBindings()
Returns a scope of named values.
|
void |
put(String key,
Object value)
Sets a key/value pair in the state of the ScriptEngine that may either
create a Java Language Binding to be used in the execution of scripts or
be used in some other way, depending on whether the key is reserved.
|
void |
setBindings(Bindings bindings)
Sets a scope of named values to be used by scripts.
|
void put(String key, Object value)
getBindings(ScriptContext.ENGINE_SCOPE).put
.key
- The name of named value to addvalue
- The value of named value to add.NullPointerException
- if key is null.IllegalArgumentException
- if key is empty.Object get(String key)
setValue
or some other value in the
state of the ScriptEngine
, depending on the implementation.
Must have the same effect as
getBindings(ScriptContext.ENGINE_SCOPE).get
key
- The key whose value is to be returnedNullPointerException
- if key is null.IllegalArgumentException
- if key is empty.Bindings getBindings()
ScriptContext.GLOBAL_SCOPE
- The set of named values
representing global scope. If this ScriptEngine
is created
by a ScriptEngineManager
, then the manager sets global scope
bindings. This may be null
if no global scope is associated
with this ScriptEngine
ScriptContext.ENGINE_SCOPE
- The set of named values
representing the state of this ScriptEngine
. The values are
generally visible in scripts using the associated keys as variable names.
ScriptContext
of the ScriptEngine
.Bindings
instances that are returned must be identical
to those returned by the getBindings
method of
ScriptContext
called with corresponding arguments on the
default ScriptContext
of the ScriptEngine
.Bindings
with the specified scope.IllegalArgumentException
- if specified scope is invalidvoid setBindings(Bindings bindings)
ScriptContext.ENGINE_SCOPE
- The specified
Bindings
replaces the engine scope of the
ScriptEngine
.ScriptContext.GLOBAL_SCOPE
- The specified
Bindings
must be visible as the GLOBAL_SCOPE
.ScriptContext
of the ScriptEngine
.setBindings
method of ScriptContext
with the
corresponding value of scope
on the default
ScriptContext
of the ScriptEngine
.bindings
- The Bindings
for the specified scope.IllegalArgumentException
- if the scope is invalidNullPointerException
- if the bindings is null and the scope is
ScriptContext.ENGINE_SCOPE
void flush()
Bindings createBindings()
Bindings
.Bindings
that can be used to replace the state of
this ScriptEngine
.Copyright © 2025 Open Identity Platform Community. All rights reserved.