org.ektorp.util
Class ClassHierarchyMap<V>

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

public class ClassHierarchyMap<V>
extends java.lang.Object
implements java.util.Map<java.lang.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
java.util.Map.Entry<K,V>
 
Constructor Summary
ClassHierarchyMap()
           
ClassHierarchyMap(int capacity)
           
 
Method Summary
 void clear()
           
 boolean containsKey(java.lang.Object key)
           
 boolean containsValue(java.lang.Object value)
           
 java.util.Set<java.util.Map.Entry<java.lang.Class<?>,V>> entrySet()
           
 V get(java.lang.Object key)
           
 boolean isEmpty()
           
 java.util.Set<java.lang.Class<?>> keySet()
           
 V put(java.lang.Class<?> key, V value)
           
 void putAll(java.util.Map<? extends java.lang.Class<?>,? extends V> t)
           
 V remove(java.lang.Object 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
 
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 java.util.Map<java.lang.Class<?>,V>

containsKey

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

containsValue

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

entrySet

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

get

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

isEmpty

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

keySet

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

put

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

putAll

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

remove

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

size

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

values

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


Copyright © 2010. All Rights Reserved.