Package org.apache.commons.dbutils
Class BasicRowProcessor.CaseInsensitiveHashMap
java.lang.Object
java.util.AbstractMap<String,Object>
java.util.HashMap<String,Object>
java.util.LinkedHashMap<String,Object>
org.apache.commons.dbutils.BasicRowProcessor.CaseInsensitiveHashMap
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
,Object> SequencedMap<String,
Object>
- Enclosing class:
BasicRowProcessor
private static final class BasicRowProcessor.CaseInsensitiveHashMap
extends LinkedHashMap<String,Object>
A Map that converts all keys to lowercase Strings for case insensitive
lookups. This is needed for the toMap() implementation because
databases don't consistently handle the casing of column names.
The keys are stored as they are given [BUG #DBUTILS-34], so we maintain an internal mapping from lowercase keys to the real keys in order to achieve the case insensitive lookup.
Note: This implementation does not allow null
for key, whereas LinkedHashMap
does, because of the code:
key.toString().toLowerCase()
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionThe internal mapping from lowercase keys to the real keys.private static final long
Required for serialization support. -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, removeEldestEntry, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, isEmpty, merge, newHashMap, putIfAbsent, remove, replace, replace, size
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, hashCode, isEmpty, merge, putIfAbsent, remove, replace, replace, size
Methods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Field Details
-
lowerCaseMap
The internal mapping from lowercase keys to the real keys.Any query operation using the key (
get(Object)
,containsKey(Object)
) is done in three steps:- convert the parameter key to lower case
- get the actual key that corresponds to the lower case key
- query the map with the actual key
-
serialVersionUID
private static final long serialVersionUIDRequired for serialization support.- See Also:
-
-
Constructor Details
-
CaseInsensitiveHashMap
private CaseInsensitiveHashMap(int initialCapacity)
-
-
Method Details
-
containsKey
- Specified by:
containsKey
in interfaceMap<String,
Object> - Overrides:
containsKey
in classHashMap<String,
Object>
-
get
-
put
-
putAll
-
remove
-