public abstract class LifecycleManagerStore extends Object
Holds associations of LifecycleManager with arbitrary objects.
In order to store binding, one can need to use object and its class/interface as key.
Once the binding is stored, one can use that object together with key to restore associated LifecycleManager.
This way, LifecycleManager can be propagated to arbitrary contexts without need of shared store (particularly this
principle avoids use of ThreadLocal store.
Storing current references:
| Constructor and Description |
|---|
LifecycleManagerStore() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract <T> void |
bind(LifecycleManager manager,
Class<T> clazz,
T object)
Provides implementation of binding a current
LifecycleManager with given object of given class. |
protected abstract <T> void |
checkUnbound(LifecycleManager manager)
Checks that given manager does not have any associations in context of current store.
|
static <T> LifecycleManager |
get(Class<T> type,
T boundObject)
Retrieves instance of
LifecycleManager for given instance of given class. |
protected abstract <T> LifecycleManager |
obtain(Class<T> clazz,
T object)
Provides implementation of obtaining
LifecycleManager for given instance of given class. |
protected abstract <T> void |
unbind(LifecycleManager manager,
Class<T> clazz,
T object)
Provides implementation of binding a
LifecycleManager for given class and given object. |
public static <T> LifecycleManager get(Class<T> type, T boundObject) throws ObjectNotAssociatedException
LifecycleManager for given instance of given class.clazz - the class used as denominator during retrievalboundObject - the object used as key for retriving LifecycleManagerLifecycleManagerObjectNotAssociatedException - when instance of no such class and class' instance was associated with any
LifecycleManagerprotected abstract <T> void bind(LifecycleManager manager, Class<T> clazz, T object) throws ObjectAlreadyAssociatedException
LifecycleManager with given object of given class.clazz - the class to be boundobject - the object to be boundObjectAlreadyAssociatedException - when there is already object bound with LifecycleManager for given
class.protected abstract <T> void unbind(LifecycleManager manager, Class<T> clazz, T object) throws ObjectNotAssociatedException
LifecycleManager for given class and given object.clazz - the bound classobject - the bound classObjectNotAssociatedException - when no object bound with LifecycleManager.protected abstract <T> void checkUnbound(LifecycleManager manager) throws StoreHasAssociatedObjectsException
Checks that given manager does not have any associations in context of current store.
It ensures that all managers associated with bind(LifecycleManager, Class, Object) was properly unbound with
unbind(LifecycleManager, Class, Object).
manager - ObjectNotAssociatedExceptionStoreHasAssociatedObjectsExceptionprotected abstract <T> LifecycleManager obtain(Class<T> clazz, T object) throws ObjectNotAssociatedException
LifecycleManager for given instance of given class.clazz - the class used as denominator during retrievalboundObject - the object used as key for retriving LifecycleManagerLifecycleManagerObjectNotAssociatedException - when instance of no such class and class' instance was associated with any
LifecycleManagerCopyright © 2014 JBoss by Red Hat. All rights reserved.