javax.script
Interface Bindings

All Superinterfaces:
Map
All Known Implementing Classes:
SimpleBindings

public interface Bindings
extends Map

A mapping of key/value pairs, all of whose keys are non-empty Strings. See Javadoc of Java Scripting API


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Method Summary
 boolean containsKey(Object key)
          Returns true if this map contains a mapping for the specified key.
 Object get(Object key)
          Returns the value to which this map maps the specified key.
 Object put(String key, Object value)
          Associates the specified value with the specified key in a java.util.Map.
 void putAll(Map toMerge)
          Copies all of the mappings from the specified map to this map.
 Object remove(Object key)
          Removes the mapping for this key from this map if it is present (optional operation).
 
Methods inherited from interface java.util.Map
clear, containsValue, entrySet, equals, hashCode, isEmpty, keySet, put, size, values
 

Method Detail

put

Object put(String key,
           Object value)
Associates the specified value with the specified key in a java.util.Map. If the map previously contained a mapping for this key, the old value is replaced.

Parameters:
key - the String value which uniquely identifies the object
value - the object to be stored.
Returns:
the previous value for the mapping, or null if there was none.
Throws:
NullPointerException - if key is null
ClassCastException - if the key is not a String
IllegalArgumentException - if the key is an empty string

putAll

void putAll(Map toMerge)
Copies all of the mappings from the specified map to this map. These mappings will replace any mappings that this map had for any of the keys currently in the specified map.

Specified by:
putAll in interface Map
Parameters:
toMerge - mappings to be stored in the map.
Throws:
NullPointerException - if toMerge map is null or if some key in the map is null.
IllegalArgumentException - if some key in the map is an empty String
ClassCastException - if some key in the map is not a String

containsKey

boolean containsKey(Object key)
Returns true if this map contains a mapping for the specified key.

Specified by:
containsKey in interface Map
Parameters:
key - key whose presence in this map is to be tested.
Returns:
true if this map contains a mapping for the specified key.
Throws:
NullPointerException - if key is null
ClassCastException - if key is not a String
IllegalArgumentException - if key is empty String

get

Object get(Object key)
Returns the value to which this map maps the specified key. Returns null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Specified by:
get in interface Map
Parameters:
key - key whose presence in this map is to be tested.
Returns:
the value to which this map maps the specified key, or null if the map contains no mapping for this key.
Throws:
NullPointerException - if key is null
ClassCastException - if key is not a String
IllegalArgumentException - if key is empty String

remove

Object remove(Object key)
Removes the mapping for this key from this map if it is present (optional operation). 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.

Specified by:
remove in interface Map
Parameters:
key - key of entry to be removed.
Returns:
the previous value associated with the key, or null if the map contained no mapping for this key.
Throws:
NullPointerException - if key is null
ClassCastException - if key is not a String
IllegalArgumentException - if key is empty String


Copyright © 1999-2012 The Apache Software Foundation. All Rights Reserved.