org.ektorp.util
Class ClassHierarchyMap<V>

java.lang.Object
  extended by org.ektorp.util.ClassHierarchyMap<V>
Type Parameters:
V -
All Implemented Interfaces:
Map<Class<?>,V>

public class ClassHierarchyMap<V>
extends Object
implements Map<Class<?>,V>

If a class is not directly mapped, this implementation will try to find a value with the key's interfaces instead. if a value is found, the key's class is mapped directly for quicker access in the future.

Author:
henrik lundgren

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
ClassHierarchyMap()
           
ClassHierarchyMap(int capacity)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set<Map.Entry<Class<?>,V>> entrySet()
           
 V get(Object key)
           
 boolean isEmpty()
           
 Set<Class<?>> keySet()
           
 V put(Class<?> key, V value)
           
 void putAll(Map<? extends Class<?>,? extends V> t)
           
 V remove(Object key)
           
 int size()
           
 Collection<V> values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

ClassHierarchyMap

public ClassHierarchyMap()

ClassHierarchyMap

public ClassHierarchyMap(int capacity)
Method Detail

clear

public void clear()
Specified by:
clear in interface Map<Class<?>,V>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<Class<?>,V>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<Class<?>,V>

entrySet

public Set<Map.Entry<Class<?>,V>> entrySet()
Specified by:
entrySet in interface Map<Class<?>,V>

get

public V get(Object key)
Specified by:
get in interface Map<Class<?>,V>
Returns:
V

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<Class<?>,V>

keySet

public Set<Class<?>> keySet()
Specified by:
keySet in interface Map<Class<?>,V>

put

public V put(Class<?> key,
             V value)
Specified by:
put in interface Map<Class<?>,V>

putAll

public void putAll(Map<? extends Class<?>,? extends V> t)
Specified by:
putAll in interface Map<Class<?>,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<Class<?>,V>

size

public int size()
Specified by:
size in interface Map<Class<?>,V>

values

public Collection<V> values()
Specified by:
values in interface Map<Class<?>,V>


Copyright © 2011. All Rights Reserved.