Project Wonder 2.0

er.extensions
Class ERXThreadStorage

java.lang.Object
  extended byer.extensions.ERXThreadStorage

public class ERXThreadStorage
extends Object

ERXThreadStorage provides a way to store objects for a particular thread. This can be especially handy for storing objects like the current actor or the current form name within the scope of a thread handling a particular request.


Constructor Summary
ERXThreadStorage()
           
 
Method Summary
static Map map()
          Gets the storage map from the current thread.
static Object removeValueForKey(String key)
          Removes the value in the map for a given key.
static void reset()
          Removes all of the keys from the current Map.
static void takeValueForKey(Object object, String key)
          Sets a value for a particular key for a particular thread.
static Object valueForKey(String key)
          Gets the object associated with the key in the storage map off of the current thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXThreadStorage

public ERXThreadStorage()
Method Detail

takeValueForKey

public static void takeValueForKey(Object object,
                                   String key)
Sets a value for a particular key for a particular thread.

Parameters:
object - value
key - key

removeValueForKey

public static Object removeValueForKey(String key)
Removes the value in the map for a given key.

Parameters:
key - key to be removed from the map.
Returns:
the object corresponding to the key that was removed, null if nothing is found.

valueForKey

public static Object valueForKey(String key)
Gets the object associated with the key in the storage map off of the current thread.

Parameters:
key - key to be used to retrieve value from map.
Returns:
the value stored in the map for the given key.

map

public static Map map()
Gets the storage map from the current thread. At the moment this Map is syncronized for thread safety. This might not be necessary in which case users of this method would need to make sure that they take the appropriate precautions.

Returns:
Map object associated with this particular thread.

reset

public static void reset()
Removes all of the keys from the current Map.


Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.