javax.script
Class SimpleBindings

java.lang.Object
  extended by javax.script.SimpleBindings
All Implemented Interfaces:
java.util.Map, Bindings

public class SimpleBindings
extends java.lang.Object
implements Bindings

SimpleNamespace is an implementation of Namespace using an instance of java.util.HashMap or another Map passed in a constructor to store and expose key-pair values.

Author:
Nandika Jayawardana , Sanka Samaranayake

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry
 
Constructor Summary
SimpleBindings()
          Constructs a SimpleNamespace.
SimpleBindings(java.util.Map map)
          Constructs a SimpleNamespace and initializes it using a specified map.
 
Method Summary
 void clear()
          
 boolean containsKey(java.lang.Object key)
          
 boolean containsValue(java.lang.Object value)
          
 java.util.Set entrySet()
          
 java.lang.Object get(java.lang.Object key)
          
 boolean isEmpty()
          
 java.util.Set keySet()
          
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Associates the specified value with the specified key in a java.util.Map.
 void putAll(java.util.Map toMerge)
          Copies all of the mappings from the specified map to this map.
 java.lang.Object remove(java.lang.Object key)
          
 int size()
          
 java.util.Collection values()
          
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

SimpleBindings

public SimpleBindings()
Constructs a SimpleNamespace.


SimpleBindings

public SimpleBindings(java.util.Map map)
Constructs a SimpleNamespace and initializes it using a specified map.

Parameters:
map - a map which is used to initialize the SimpleNamespace
Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
                     throws java.lang.IllegalArgumentException
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.

Specified by:
put in interface java.util.Map
Specified by:
put in interface Bindings
Parameters:
key - the String value which uniquely identifies the object
value - the object to be stored.
Returns:
The old object
Throws:
java.lang.IllegalArgumentException - if the key is null or is not java.lang.String type

putAll

public void putAll(java.util.Map toMerge)
            throws java.lang.IllegalArgumentException
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 java.util.Map
Specified by:
putAll in interface Bindings
Parameters:
toMerge - mappings to be stored in the map.
Throws:
java.lang.IllegalArgumentException - if a key is null or is not java.lang.String type in the specified map

size

public int size()

Specified by:
size in interface java.util.Map

clear

public void clear()

Specified by:
clear in interface java.util.Map

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface java.util.Map

containsKey

public boolean containsKey(java.lang.Object key)

Specified by:
containsKey in interface java.util.Map

containsValue

public boolean containsValue(java.lang.Object value)

Specified by:
containsValue in interface java.util.Map

values

public java.util.Collection values()

Specified by:
values in interface java.util.Map

entrySet

public java.util.Set entrySet()

Specified by:
entrySet in interface java.util.Map

get

public java.lang.Object get(java.lang.Object key)

Specified by:
get in interface java.util.Map

keySet

public java.util.Set keySet()

Specified by:
keySet in interface java.util.Map

remove

public java.lang.Object remove(java.lang.Object key)

Specified by:
remove in interface java.util.Map