Esri Geoportal Server
1.0

com.esri.gpt.framework.collection
Class CaseInsensitiveMap<T>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<String,T>
              extended by com.esri.gpt.framework.collection.CaseInsensitiveMap<T>
All Implemented Interfaces:
Serializable, Cloneable, Map<String,T>
Direct Known Subclasses:
AliasedDiscoverables, PropertyMeanings, SecurityPrincipals, StringAttributeMap, SupportedParameters, UserAttributeMap

public class CaseInsensitiveMap<T>
extends LinkedHashMap<String,T>

Maintains an ordered map where are all map keys are stored as lower case strings.

The primary intent is to provide a map having case insensitive keys.


Map keys are trimmed and converted to lower case.
Null map keys are converted to empty strings.
Empty map keys are only set if specified as allowed on the constructor.

Null values are not stored.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
CaseInsensitiveMap(boolean allowEmptyKey)
          Construct with a flag indicating if an empty map key is allowed.
 
Method Summary
 boolean containsKey(Object key)
          Determines if a key is contained within the map.
 T get(Object key)
          Gets the value associated with a key.
protected  boolean getAllowEmptyKey()
          Gets the status indicating whether an empty key is allowed.
 T put(String key, T member)
          Sets a value within the map.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, removeEldestEntry
 
Methods inherited from class java.util.HashMap
clone, entrySet, isEmpty, keySet, putAll, remove, 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
entrySet, equals, hashCode, isEmpty, keySet, putAll, remove, size, values
 

Constructor Detail

CaseInsensitiveMap

public CaseInsensitiveMap(boolean allowEmptyKey)
Construct with a flag indicating if an empty map key is allowed.

Parameters:
allowEmptyKey - true if an empty key is allowed
Method Detail

getAllowEmptyKey

protected boolean getAllowEmptyKey()
Gets the status indicating whether an empty key is allowed.

Returns:
true if an empty key is allowed

containsKey

public boolean containsKey(Object key)
Determines if a key is contained within the map.

Specified by:
containsKey in interface Map<String,T>
Overrides:
containsKey in class HashMap<String,T>
Parameters:
key - the key to check
Returns:
true if the key is contained

get

public T get(Object key)
Gets the value associated with a key.

Specified by:
get in interface Map<String,T>
Overrides:
get in class LinkedHashMap<String,T>
Parameters:
key - the key associated with the value to find
Returns:
the corresponding value (null if none was found)

put

public T put(String key,
             T member)
Sets a value within the map.


Keys are trimmed and converted to lower case.
Null keys are converted to empty strings.
Empty map keys are only set if specified as allowed on the constructor.

Null values are not stored. If a null value is supplied, the value associated with the supplied key is removed (if it exists);

Specified by:
put in interface Map<String,T>
Overrides:
put in class HashMap<String,T>
Parameters:
key - the key to set
member - the value to set
Returns:
the previously mapped value associated with the key, or null if there was no existing mapping for the key

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class AbstractMap<String,T>
Returns:
the string

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.