org.apache.gora.persistency
Class StatefulHashMap<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by org.apache.gora.persistency.StatefulHashMap<K,V>
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>, StatefulMap<K,V>

public class StatefulHashMap<K,V>
extends HashMap<K,V>
implements StatefulMap<K,V>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Constructor Summary
StatefulHashMap()
          Create an empty instance.
StatefulHashMap(Map<K,V> m)
          Create an instance with initial entries.
 
Method Summary
 void clear()
           
 void clearStates()
           
 State getState(K key)
           
 V put(K key, V value)
           
 void putAll(Map<? extends K,? extends V> m)
           
 void putState(K key, State state)
           
 V remove(Object key)
           
 void reuse()
          Reuse will clear the map completely with states.
 Map<K,State> states()
           
 
Methods inherited from class java.util.HashMap
clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, 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
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, values
 

Constructor Detail

StatefulHashMap

public StatefulHashMap()
Create an empty instance.


StatefulHashMap

public StatefulHashMap(Map<K,V> m)
Create an instance with initial entries. These entries are added stateless; in other words the statemap will be clear after the construction.

Parameters:
m - The map with initial entries.
Method Detail

put

public V put(K key,
             V value)
Specified by:
put in interface Map<K,V>
Overrides:
put in class HashMap<K,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<K,V>
Overrides:
remove in class HashMap<K,V>

putAll

public void putAll(Map<? extends K,? extends V> m)
Specified by:
putAll in interface Map<K,V>
Overrides:
putAll in class HashMap<K,V>

clear

public void clear()
Specified by:
clear in interface Map<K,V>
Overrides:
clear in class HashMap<K,V>

getState

public State getState(K key)
Specified by:
getState in interface StatefulMap<K,V>

clearStates

public void clearStates()
Specified by:
clearStates in interface StatefulMap<K,V>

putState

public void putState(K key,
                     State state)
Specified by:
putState in interface StatefulMap<K,V>

states

public Map<K,State> states()
Specified by:
states in interface StatefulMap<K,V>

reuse

public void reuse()
Description copied from interface: StatefulMap
Reuse will clear the map completely with states. This is different from Map.clear() in that the latter only sets entries to deleted.

Specified by:
reuse in interface StatefulMap<K,V>


Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.