T
- This type parameter allows to specify a lower bound of the classes
used as keys. If this is unnecessary, use Object
.public class ClassHierarchyMap<T,V> extends java.lang.Object
Constructor and Description |
---|
ClassHierarchyMap() |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
V |
get(java.lang.Class<?> key)
Get value stored for a class.
|
V |
get(T element)
Get value stored for the declaring class of the provided element.
|
java.util.List<V> |
getAll(java.lang.Class<?> key)
Retrieve a list of values stored for the provided class and its super
classes.
|
java.util.List<V> |
getAll(T element)
Get value list for the declaring class of the provided element.
|
V |
getDeclared(java.lang.Class<?> key)
Get value stored for this class.
|
V |
getDeclared(T element)
Get value stored for the declaring class of the provided element.
|
boolean |
isEmpty() |
java.util.Set<java.lang.Class<? extends T>> |
keySet() |
V |
put(java.lang.Class<? extends T> key,
V value)
Store a key-value-pair.
|
V |
remove(java.lang.Class<?> key) |
int |
size() |
java.util.Collection<V> |
values() |
public ClassHierarchyMap()
public void clear()
Map.clear()
public V get(java.lang.Class<?> key)
If a key is stored for the provided class the performance of this method
equals the performance of HashMap.get(Object)
. Otherwise its
worst case performance is O(DIT(key)).
key
- the keynull
if no value was found.public V get(T element)
get(Class)
public java.util.List<V> getAll(java.lang.Class<?> key)
public java.util.List<V> getAll(T element)
getAll(Class)
public V getDeclared(java.lang.Class<?> key)
get(Class)
this does not
retrieve values stored for super classes.public V getDeclared(T element)
get(Object)
this does not retrieve values stored for super
classes.public boolean isEmpty()
Map.isEmpty()
public V put(java.lang.Class<? extends T> key, V value)
Map.put(Object, Object)
public int size()
Map.size()