org.enhydra.barracuda.core.util.data
Class DefaultStateMap

java.lang.Object
  |
  +--org.enhydra.barracuda.core.util.data.DefaultStateMap
All Implemented Interfaces:
StateMap
Direct Known Subclasses:
ObjectRepository

public class DefaultStateMap
extends java.lang.Object
implements StateMap

A StateMap is an object that is capable of carrying state information along with it--you can put properties into the state and then get them back out.

This class provides the default implementation of a StateMap. The underlying storage structure is a HashMap, so it a) isn't threadsafe and b) accepts nulls. If you need more than the minimal functionality exposed in the StateMap interface, you should work with the underlying Map structure.

Key entities that implement StateMap:


Field Summary
protected static org.apache.log4j.Logger logger
           
protected  java.util.Map props
           
 
Constructor Summary
DefaultStateMap()
           
 
Method Summary
 java.lang.Object getState(java.lang.Object key)
          get a property in this StateMap
 java.util.List getStateKeys()
          get a List of the keys for this StateMap (implementation is an ArrayList)
 java.util.Map getStateValues()
          get a copy of the underlying Map that holds the state values
 void putState(java.lang.Object key, java.lang.Object val)
          set a property in this StateMap
 java.lang.Object removeState(java.lang.Object key)
          remove a property in this StateMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.apache.log4j.Logger logger

props

protected java.util.Map props
Constructor Detail

DefaultStateMap

public DefaultStateMap()
Method Detail

putState

public void putState(java.lang.Object key,
                     java.lang.Object val)
set a property in this StateMap

Specified by:
putState in interface StateMap
Parameters:
key - the key object
val - the value object

getState

public java.lang.Object getState(java.lang.Object key)
get a property in this StateMap

Specified by:
getState in interface StateMap
Parameters:
key - the key object
Returns:
the value for the given key

removeState

public java.lang.Object removeState(java.lang.Object key)
remove a property in this StateMap

Specified by:
removeState in interface StateMap
Parameters:
key - the key object
Returns:
the object which was removed

getStateKeys

public java.util.List getStateKeys()
get a List of the keys for this StateMap (implementation is an ArrayList)

Specified by:
getStateKeys in interface StateMap
Returns:
a List the keys for this StateMap

getStateValues

public java.util.Map getStateValues()
get a copy of the underlying Map that holds the state values

Specified by:
getStateValues in interface StateMap
Returns:
a copy of the underlying state Map


Copyright © 2001 Enhydra.org