Package jaxx.compiler
Class ClassMap<T>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<ClassDescriptor,T>
jaxx.compiler.ClassMap<T>
- Type Parameters:
T- type of the class
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.util.Map<ClassDescriptor,T>
public class ClassMap<T> extends java.util.HashMap<ClassDescriptor,T>
A Map implementation which uses Classes as keys.
ClassMap differs from typical maps
in that it takes subclasses into account; mapping a class to a value also maps all subclasses of
that class to the value.
A get operation will return the value associated with the class itself, or failing
that, with its nearest ancestor for which there exists a mapping.- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K extends java.lang.Object,V extends java.lang.Object> -
Field Summary
Fields Modifier and Type Field Description protected static org.apache.commons.logging.LoglogLogger -
Constructor Summary
Constructors Constructor Description ClassMap() -
Method Summary
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
equals, hashCode
-
Field Details
-
log
protected static final org.apache.commons.logging.Log logLogger
-
-
Constructor Details
-
ClassMap
public ClassMap()
-
-
Method Details
-
get
Returns the value associated with the keyClass. If the class itself does not have a mapping, its superclass will be checked, and so on until an ancestor class with a mapping is located. If none of the class' ancestors have a mapping,nullis returned.- Specified by:
getin interfacejava.util.Map<ClassDescriptor,T>- Overrides:
getin classjava.util.HashMap<ClassDescriptor,T>- Parameters:
key- the class to check- Returns:
- the mapping for the class
-
put
Associates a value with a class and all of its descendents.- Specified by:
putin interfacejava.util.Map<ClassDescriptor,T>- Overrides:
putin classjava.util.HashMap<ClassDescriptor,T>- Parameters:
key- the class to mapvalue- the value to map to the class- Returns:
- the old value associated with the class
-