public class ClassMap<T> extends Object implements Map<Class,T>
class A {}
class B extends A {}
...
cm = new ClassMap<Integer>
cm.put( A.class, 1 )
cm.fetch( A.class ) // вернет 1
cm.fetch( B.class ) // вернет 1,
// т.к. B является подклассом A
| Modifier and Type | Field and Description |
|---|---|
protected Lock |
lock |
protected Map<Class,T> |
map |
protected ClassSet |
types |
| Constructor and Description |
|---|
ClassMap() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<Class,T>> |
entrySet() |
T |
fetch(Class cls) |
T |
get(Class key) |
T |
get(Object key) |
boolean |
isEmpty() |
Set<Class> |
keySet() |
T |
put(Class key,
T value) |
void |
putAll(Map<? extends Class,? extends T> m) |
T |
remove(Class key) |
T |
remove(Object key) |
int |
size() |
Collection<T> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllCopyright © 2017. All rights reserved.