|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.ClassLocal<E>
public class ClassLocal<E>
This class is a similar to the JDK ThreadLocal
class,
but stores one object per class instead of one object per thread.
The main usage for this class is to allow a superclass to hold one object for each subclass that is extending it.
Field Summary | |
---|---|
private Map<Class,E> |
objects
|
Constructor Summary | |
---|---|
ClassLocal()
Create a new ClassLocal object. |
Method Summary | |
---|---|
E |
get(Object instance)
Get the object associated with the class of the specified instance. |
protected E |
initialValue(Object instance)
Subclasses may override this to initialize the object stored for that class. |
void |
set(Object instance,
E object)
Store an object and associate it with the class of the specified instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Map<Class,E> objects
Constructor Detail |
---|
public ClassLocal()
ClassLocal
object.
Method Detail |
---|
public E get(Object instance)
instance
- An object instance of the classThreadLocal.get()
public void set(Object instance, E object)
instance
- An object instance of the classobject
- The object to storeThreadLocal.set(Object)
protected E initialValue(Object instance)
instance
- An object instance of the class
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |