de.lmu.ifi.dbs.elki.utilities.datastructures
Class AnyMap<K>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,Object>
          extended by de.lmu.ifi.dbs.elki.utilities.datastructures.AnyMap<K>
Type Parameters:
K - Key class type
All Implemented Interfaces:
Serializable, Cloneable, Map<K,Object>
Direct Known Subclasses:
VisualizationTask, VisualizerContext

public class AnyMap<K>
extends HashMap<K,Object>

Associative storage based on a HashMap for multiple object types that offers a type checked get(Object, Class) method.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
private static long serialVersionUID
          Serial version.
 
Constructor Summary
AnyMap()
          Constructor
 
Method Summary
<T> T
get(K key, Class<T> restriction)
          Type checked get method
 Object get(Object key)
          Deprecated. use get(Object, Class) or getGenerics(Object, Class) instead, for type safety!
<T> T
getGenerics(K key, Class<?> restriction)
          (Largely) type checked get method for use with generic types
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version.

See Also:
Constant Field Values
Constructor Detail

AnyMap

public AnyMap()
Constructor

Method Detail

get

public <T> T get(K key,
                 Class<T> restriction)
Type checked get method

Type Parameters:
T - Return type
Parameters:
key - Key
restriction - restriction class
Returns:
Object that is guaranteed to be of class restriction or null

getGenerics

public <T> T getGenerics(K key,
                         Class<?> restriction)
(Largely) type checked get method for use with generic types

Type Parameters:
T - Return type
Parameters:
key - Key
restriction - restriction class
Returns:
Object that is guaranteed to be of class restriction or null

get

@Deprecated
public Object get(Object key)
Deprecated. use get(Object, Class) or getGenerics(Object, Class) instead, for type safety!

Depreciate the use of the untyped get method.

Specified by:
get in interface Map<K,Object>
Overrides:
get in class HashMap<K,Object>

Release 0.4.0 (2011-09-20_1324)