org.dhmp.util
Interface HierarchicalMap2

All Superinterfaces:
java.lang.Cloneable, HierarchicalMap, java.io.Serializable
All Known Implementing Classes:
BasicHierarchicalMap

public interface HierarchicalMap2
extends HierarchicalMap

This interface extends HierarchicalMap Interface. The main difference is that this version accepts key composed by Object array. Each element in the array represents a level, or depth, in the hierarchy. The single Object in key behaves as an array with one element. There is a special treatment for String key. It splits the key using String.split() to generate Object array.

See Also:
HierarchicalMap

Nested Class Summary
 
Nested classes inherited from class org.dhmp.util.HierarchicalMap
HierarchicalMap.EntrySet
 
Field Summary
 
Fields inherited from interface org.dhmp.util.HierarchicalMap
DEFAULT_PATH_SEPARATOR
 
Method Summary
 HierarchicalMap add(java.lang.Object[] key)
          Associates a new HierarchicalMap with the specified key in this map.
 java.lang.Object add(java.lang.Object[] key, java.lang.Object value)
          Associates the specified value with the specified key in this map.
 java.lang.Object addAll(java.lang.Object[] key, java.util.Collection values)
          Associates all the values contained in the specified collection with the specified key in this map.
 java.util.Collection addAll(java.lang.Object[] key, HierarchicalMap hmap)
          Associates all the values contained in the specified hierarchicalmap with the specified key in this map.
 java.lang.Object get(java.lang.Object[] key)
          Returns the value in this map associated to the specified key.
 java.util.Collection getAll(java.lang.Object[] key)
          Returns collection containing all the value in this map associated to the specified key.
 java.lang.Object put(java.lang.Object[] key, java.lang.Object value)
          Associates the specified value with the specified key in this map.
 java.lang.Object remove(java.lang.Object[] key)
          Removes the mapping for this key from this map if it is present.
 java.util.Collection removeAll(java.lang.Object[] key)
          Removes the mapping for this key from this map if it is present.
 
Methods inherited from interface org.dhmp.util.HierarchicalMap
add, add, addAll, addAll, addAll, clone, entrySet, get, get, getAll, getPathSeparator, keySet, newInstance, put, remove, removeAll, setPathSeparator, size, values
 

Method Detail

get

public java.lang.Object get(java.lang.Object[] key)
Returns the value in this map associated to the specified key. Returns null if the map contains no mapping for this key. This method is similar to get(Object key) except that the key is an Object array.

Parameters:
key - key array whose associated value is to be returned.
Returns:
the value to which this map maps the specified key array, or null if the map contains no mapping for this key.
See Also:
HierarchicalMap.get(Object key)

getAll

public java.util.Collection getAll(java.lang.Object[] key)
Returns collection containing all the value in this map associated to the specified key. Returns null if the map contains no mapping for this key. This method is similar to getAll(Object key) except that the key is an Object array.

Parameters:
key - key array whose associated value is to be returned.
Returns:
a collection of values associated to the specified key array, or an empty collection if the map contains no mapping for this key.
See Also:
HierarchicalMap.getAll(Object key)

put

public java.lang.Object put(java.lang.Object[] key,
                            java.lang.Object value)
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced by the specified value. This method is similar to put(Object key, Object value) except that the key is an Object array.

Parameters:
key - key array which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
previous value associated with specified key, or null if there was no mapping for key. A null return can also indicate that the map previously associated null with the specified key, if the implementation supports null values.
See Also:
HierarchicalMap.put(Object key, Object value)

add

public java.lang.Object add(java.lang.Object[] key,
                            java.lang.Object value)
Associates the specified value with the specified key in this map. This method is similar to add(Object key, Object value) except that the key is an Object array.

Parameters:
key - key array which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
current value which has been added
See Also:
HierarchicalMap.add(Object key, Object value)

add

public HierarchicalMap add(java.lang.Object[] key)
Associates a new HierarchicalMap with the specified key in this map. This method is similar to add(Object key) except that the key is an Object array.

Parameters:
key - key array which a new HierarchicalMap is to be associated.
Returns:
new HierarchicalMap which has been added
See Also:
HierarchicalMap.add(Object key)

addAll

public java.lang.Object addAll(java.lang.Object[] key,
                               java.util.Collection values)
Associates all the values contained in the specified collection with the specified key in this map. This method is similar to addAll(Object key, Collection values) except that the key is an Object array.

Parameters:
key - key array which the specified values is to be associated.
values - a collection containing the values to be associated with the specified key.
Returns:
current collection which has been added
See Also:
HierarchicalMap.addAll(Object key, Collection values)

addAll

public java.util.Collection addAll(java.lang.Object[] key,
                                   HierarchicalMap hmap)
Associates all the values contained in the specified hierarchicalmap with the specified key in this map. This method is similar to addAll(Object key, HierarchicalMap hmap) except that the key is an Object array.

Parameters:
key - key array which the specified values is to be associated.
hmap - a HierarchicalMap containing the values to be associated with the specified key.
Returns:
collection containing all objects in hmap referenced by key
See Also:
HierarchicalMap.addAll(Object key, HierarchicalMap hmap)

remove

public java.lang.Object remove(java.lang.Object[] key)
Removes the mapping for this key from this map if it is present. This method is similar to remove(Object key) except that the key is an Object array.

Parameters:
key - key array which mapping is to be removed from the map.
Returns:
previous value associated with specified key, or null if there was no mapping for key.
See Also:
HierarchicalMap.remove(Object key)

removeAll

public java.util.Collection removeAll(java.lang.Object[] key)
Removes the mapping for this key from this map if it is present. This method is similar to removeAll(Object key) except that the key is an Object array.

Parameters:
key - key array which mapping is to be removed from the map.
Returns:
a collection of values removed.
See Also:
HierarchicalMap.removeAll(Object key)