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:
- Serializable, Cloneable, Map<ClassDescriptor,T>
public class ClassMap<T>
- extends 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
|
Field Summary |
protected static org.apache.commons.logging.Log |
log
Logger |
|
Method Summary |
T |
get(Object key)
Returns the value associated with the key Class. |
T |
put(ClassDescriptor key,
T value)
Associates a value with a class and all of its descendents. |
| Methods inherited from class java.util.HashMap |
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, remove, size, values |
log
protected static final org.apache.commons.logging.Log log
- Logger
ClassMap
public ClassMap()
get
public T get(Object key)
- Returns the value associated with the key
Class. 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, null is returned.
- Specified by:
get in interface Map<ClassDescriptor,T>- Overrides:
get in class HashMap<ClassDescriptor,T>
- Parameters:
key - the class to check
- Returns:
- the mapping for the class
put
public T put(ClassDescriptor key,
T value)
- Associates a value with a class and all of its descendents.
- Specified by:
put in interface Map<ClassDescriptor,T>- Overrides:
put in class HashMap<ClassDescriptor,T>
- Parameters:
key - the class to mapvalue - the value to map to the class
- Returns:
- the old value associated with the class
Copyright © 2008-2011 CodeLutin. All Rights Reserved.