atg.search.query.formhandlers
Class HashMapMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by atg.search.query.formhandlers.HashMapMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class HashMapMap
extends java.util.HashMap

An implementation of a HashMap which by default returns another HashMapMap for any key that has not already been set to some value. This makes it very easy to create nested maps from JSP.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
           
 
Constructor Summary
HashMapMap()
          Create a instance of this class
 
Method Summary
 void accept(HashMapMapVisitor pVisitor)
          Accept a visitor to this root node.
protected  void accept(java.lang.Object pKey, HashMapMapVisitor pVisitor)
          Accept visitors, recursively.
 void acceptChildren(HashMapMapVisitor pVisitor)
          Invoke accept( Object, HashMapMapVisitor ) on all value elements which are HashMapMap instances.
 java.lang.Object get(java.lang.Object pKey)
          Get the value associated with the specified key.
 HashMapMap getParent()
          Get the parent HashMapMap or null if there is no parent
 java.lang.Object put(java.lang.Object pKey, java.lang.Object pValue)
          Associate an object with specified key, return previously associated object.
 java.lang.Object remove(java.lang.Object pKey)
          Remove value associated with specified key, return that value or null if no current value exists.
 void setParent(HashMapMap pParentMap)
          Set the parent map
 java.lang.String toString()
          Don't display as "{}" when empty so empty input fields on the page are actually empty.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

HashMapMap

public HashMapMap()
Create a instance of this class

Method Detail

getParent

public HashMapMap getParent()
Get the parent HashMapMap or null if there is no parent

Returns:
parent HashMapMap or null

setParent

public void setParent(HashMapMap pParentMap)
Set the parent map

Parameters:
pParentMap - the parent HashMapMap or null

get

public java.lang.Object get(java.lang.Object pKey)
Get the value associated with the specified key. If there is no current value, create and save a new HashMapMap associated with this key.

Specified by:
get in interface java.util.Map
Overrides:
get in class java.util.HashMap
Parameters:
pKey - the key
Returns:
value associated with key, possibly creating new HashMapMap for the value

put

public java.lang.Object put(java.lang.Object pKey,
                            java.lang.Object pValue)
Associate an object with specified key, return previously associated object.

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.HashMap
Parameters:
pKey - the key
pValue - the value
Returns:
the previously associateed value or null

remove

public java.lang.Object remove(java.lang.Object pKey)
Remove value associated with specified key, return that value or null if no current value exists. If previous value was a HashMapMap, set it's parent to null before returning.

Specified by:
remove in interface java.util.Map
Overrides:
remove in class java.util.HashMap
Parameters:
pKey - the key
Returns:
the value previously associated with specified key

toString

public java.lang.String toString()
Don't display as "{}" when empty so empty input fields on the page are actually empty.

Overrides:
toString in class java.util.AbstractMap
Returns:
a string representation

accept

public void accept(HashMapMapVisitor pVisitor)
Accept a visitor to this root node. This method simply calls accept( Object, HashMapMapVisitor ).

Parameters:
pVisitor - the visitor

acceptChildren

public void acceptChildren(HashMapMapVisitor pVisitor)
Invoke accept( Object, HashMapMapVisitor ) on all value elements which are HashMapMap instances.

Parameters:
pVisitor - the visitor

accept

protected void accept(java.lang.Object pKey,
                      HashMapMapVisitor pVisitor)
Accept visitors, recursively.

Parameters:
pKey - the element key
pVisitor - the visitor