|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.tum.cs.commons.collections.ClassHierarchyMap<T,V>
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>
This class provides a mapping from classes to values. The speciality of this class lies in its awareness of the class hierarchy: If no value was found this class tries to retrieve values stored for the super classes of the provided class. If values are stored for multiple super classes of the class the one value that maps to the super class closest to the provided class will be returned.
Constructor Summary | |
---|---|
ClassHierarchyMap()
|
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassHierarchyMap()
Method Detail |
---|
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 key
null
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 java.util.Set<java.lang.Class<? extends T>> keySet()
Map.keySet()
public V put(java.lang.Class<? extends T> key, V value)
Map.put(Object, Object)
public V remove(java.lang.Class<?> key)
Map.remove(Object)
public int size()
Map.size()
public java.util.Collection<V> values()
Map.values()
|
TUM CCSM Commons | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |