com.generationjava.collections
Class FQMap

java.lang.Object
  extended bycom.generationjava.collections.FQMap
All Implemented Interfaces:
Map

public class FQMap
extends Object
implements Map

A map which nests maps depending on a separator in the key. The default case is to use the '.' character.


Nested Class Summary
 
Nested classes inherited from class java.util.Map
Map.Entry
 
Constructor Summary
FQMap()
           
FQMap(char c)
           
FQMap(Map m)
           
FQMap(Map m, char separator)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Map createEmptyMap()
           
 Set entrySet()
           
 boolean equals(Object o)
           
 Object get(Object key)
           
 Collection[] getSeparatedValues()
          returns an array of size 2.
 char getSeperationChar()
           
 int hashCode()
           
 boolean isEmpty()
           
 Set keySet()
          Returns a set view of the keys contained in this map.
 Object put(Object key, Object value)
           
 void putAll(Map t)
           
 Object remove(Object key)
          Unimplemented.
 int size()
           
 String toString()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FQMap

public FQMap(Map m,
             char separator)

FQMap

public FQMap()

FQMap

public FQMap(Map m)

FQMap

public FQMap(char c)
Method Detail

toString

public String toString()

createEmptyMap

public Map createEmptyMap()

getSeperationChar

public char getSeperationChar()

getSeparatedValues

public Collection[] getSeparatedValues()
returns an array of size 2. First element is a Collection of the values that are FQMaps, second element is the values that aren`t FQMaps.


clear

public void clear()
Specified by:
clear in interface Map

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

equals

public boolean equals(Object o)
Specified by:
equals in interface Map

get

public Object get(Object key)
Specified by:
get in interface Map

hashCode

public int hashCode()
Specified by:
hashCode in interface Map

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map

keySet

public Set keySet()
Returns a set view of the keys contained in this map. BUG: If a FQMap is intentionally added to an FQMap, rather than created through a fully qualified key, such that put(someObj,FQMap) is effectively done, and then this top level FQMap is added to another, either intentionally or under the fully qualified scheme, then the keySet will contain the stringied version of someObj, which means that a request with this key will _not_ work, unless someObj's hashCode() and equals() are such that someObj equals the stringified version of someObj. To this end, a fix is to wrap all keys coming back out in a 'FQKey' object which contains an ArrayList of all subkeys. Code would need changing so a value may be obtained using this FQKey. Also to note, the stringified form of an object is fully qualified, using '.' as the package/class seperator. ie) the default behaviour of this class.

Specified by:
keySet in interface Map

put

public Object put(Object key,
                  Object value)
Specified by:
put in interface Map

putAll

public void putAll(Map t)
Specified by:
putAll in interface Map

remove

public Object remove(Object key)
Unimplemented.

Specified by:
remove in interface Map

size

public int size()
Specified by:
size in interface Map

values

public Collection values()
Specified by:
values in interface Map


Copyright © 2000-2005 OSJava. All Rights Reserved.