|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbsh.ScriptContextEngineView
public class ScriptContextEngineView
This class implements an ENGINE_SCOPE centric Map view of the ScriptContext for engine implementations. This class can be used to simplify engine implementations which have the capability to bind their namespaces to Maps or other external interfaces.
Get operations on this view delegate to the ScriptContext inheriting get() method that automatically traverses the binding scopes in order or precedence. Put operations on this view always store values in the ENGINE_SCOPE bindings. Other operations such as size() and contains() are implemented appropriately, but perhaps not as efficiently as possible.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
ScriptContextEngineView(javax.script.ScriptContext context)
|
Method Summary | |
---|---|
void |
clear()
Removes all mappings from this map (optional operation). |
boolean |
containsKey(java.lang.Object key)
Returns true if the key name is bound in any scope in the context. |
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more keys to the specified value. |
java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
entrySet()
Returns a set view of the mappings contained in this map. |
java.lang.Object |
get(java.lang.Object key)
Returns the value bound in the most specific (lowest numbered) bindings space for this key. |
boolean |
isEmpty()
Returns true if no bindings are present in any scope of the context. |
java.util.Set<java.lang.String> |
keySet()
Returns the total key set of all scopes. |
java.lang.Object |
put(java.lang.String key,
java.lang.Object value)
Set the key, value binding in the ENGINE_SCOPE of the context. |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> t)
Put the bindings into the ENGINE_SCOPE of the context. |
java.lang.Object |
remove(java.lang.Object okey)
Removes the mapping from the engine scope. |
int |
size()
Returns the number of unique object bindings in all scopes. |
java.util.Collection<java.lang.Object> |
values()
Returns the total values set of all scopes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public ScriptContextEngineView(javax.script.ScriptContext context)
Method Detail |
---|
public int size()
size
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.lang.Object>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.lang.Object>
key
- key whose presence in this map is to be tested.
java.lang.ClassCastException
- if the key is of an inappropriate type for this
map (optional).
java.lang.NullPointerException
- if the key is null and this map does
not permit null keys (optional).public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,java.lang.Object>
value
- value whose presence in this map is to be tested.
java.lang.ClassCastException
- if the value is of an inappropriate type for this
map (optional).
java.lang.NullPointerException
- if the value is null and this map does
not permit null values (optional).public java.lang.Object get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.lang.Object>
key
- key whose associated value is to be returned.
java.lang.ClassCastException
- if the key is of an inappropriate type for this
map (optional).
java.lang.NullPointerException
- if the key is null and this map does
not permit null keys (optional).containsKey(Object)
public java.lang.Object put(java.lang.String key, java.lang.Object value)
put
in interface java.util.Map<java.lang.String,java.lang.Object>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
java.lang.UnsupportedOperationException
- if the put operation is not
supported by this map.
java.lang.ClassCastException
- if the class of the specified key or value
prevents it from being stored in this map.
java.lang.IllegalArgumentException
- if some aspect of this key or value
prevents it from being stored in this map.
java.lang.NullPointerException
- if this map does not permit null keys
or values, and the specified key or value is null.public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> t)
putAll
in interface java.util.Map<java.lang.String,java.lang.Object>
t
- Mappings to be stored in this map.
java.lang.UnsupportedOperationException
- if the putAll method is not
supported by this map.
java.lang.ClassCastException
- if the class of a key or value in the specified
map prevents it from being stored in this map.
java.lang.IllegalArgumentException
- some aspect of a key or value in the
specified map prevents it from being stored in this map.
java.lang.NullPointerException
- if the specified map is null, or if
this map does not permit null keys or values, and the specified map
contains null keys or values.public java.lang.Object remove(java.lang.Object okey)
Returns the value to which the map previously associated the key, or null if the map contained no mapping for this key. (A null return can also indicate that the map previously associated null with the specified key if the implementation supports null values.) The map will not contain a mapping for the specified key once the call returns.
remove
in interface java.util.Map<java.lang.String,java.lang.Object>
okey
- key whose mapping is to be removed from the map.
java.lang.ClassCastException
- if the key is of an inappropriate type for this
map (optional).
java.lang.NullPointerException
- if the key is null and this map does
not permit null keys (optional).
java.lang.UnsupportedOperationException
- if the remove method is not
supported by this map.public void clear()
clear
in interface java.util.Map<java.lang.String,java.lang.Object>
java.lang.UnsupportedOperationException
- clear is not supported by this map.public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Collection<java.lang.Object> values()
values
in interface java.util.Map<java.lang.String,java.lang.Object>
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> entrySet()
Map.Entry
. The set is backed by the
map, so changes to the map are reflected in the set, and vice-versa. If the
map is modified while an iteration over the set is in progress (except
through the iterator's own remove operation, or through the
setValue operation on a map entry returned by the iterator) the
results of the iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove, Set.remove, removeAll,
retainAll and clear operations. It does not support the
add or addAll operations.
entrySet
in interface java.util.Map<java.lang.String,java.lang.Object>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |