Package org.jboss.weld.contexts
Class AbstractBoundContext<S>
- java.lang.Object
-
- org.jboss.weld.contexts.AbstractContext
-
- org.jboss.weld.contexts.AbstractManagedContext
-
- org.jboss.weld.contexts.AbstractBoundContext<S>
-
- All Implemented Interfaces:
AlterableContext
,Context
,BoundContext<S>
,ManagedContext
,WeldAlterableContext
- Direct Known Subclasses:
AbstractConversationContext
,BoundRequestContextImpl
,BoundSessionContextImpl
public abstract class AbstractBoundContext<S> extends AbstractManagedContext implements BoundContext<S>
Base class for contexts using a thread local to store a bound bean context- Author:
- Pete Muir
-
-
Constructor Summary
Constructors Constructor Description AbstractBoundContext(String contextId, boolean multithreaded)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
Activate the Context.void
cleanup()
void
clearAndSet(Collection<ContextualInstance<?>> setOfInstances)
Clears the backing bean store and feeds it with the set ofContextualInstance
provided as parameter.void
deactivate()
Deactivate the Context, destroying any instances if the context is invalid.boolean
dissociate(S storage)
Dissociate the context from the storage (for this thread).Collection<ContextualInstance<?>>
getAllContextualInstances()
Retrieves set ofContextualInstance
within the context.protected BoundBeanStore
getBeanStore()
Gets the bean storeprotected void
setBeanStore(BoundBeanStore beanStore)
Sets the bean store-
Methods inherited from class org.jboss.weld.contexts.AbstractManagedContext
invalidate, isActive, isValid, removeState, setActive
-
Methods inherited from class org.jboss.weld.contexts.AbstractContext
checkContextInitialized, destroy, destroy, get, get, getContextual, getId, getServiceRegistry, isMultithreaded
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.enterprise.context.spi.AlterableContext
destroy
-
Methods inherited from interface org.jboss.weld.context.BoundContext
associate
-
-
-
-
Constructor Detail
-
AbstractBoundContext
public AbstractBoundContext(String contextId, boolean multithreaded)
-
-
Method Detail
-
getBeanStore
protected BoundBeanStore getBeanStore()
Gets the bean store- Specified by:
getBeanStore
in classAbstractContext
- Returns:
- The bean store
-
setBeanStore
protected void setBeanStore(BoundBeanStore beanStore)
Sets the bean store- Parameters:
beanStore
- The bean store
-
cleanup
public void cleanup()
- Overrides:
cleanup
in classAbstractContext
-
activate
public void activate()
Description copied from interface:ManagedContext
Activate the Context.- Specified by:
activate
in interfaceManagedContext
- Overrides:
activate
in classAbstractManagedContext
-
deactivate
public void deactivate()
Description copied from interface:ManagedContext
Deactivate the Context, destroying any instances if the context is invalid.- Specified by:
deactivate
in interfaceManagedContext
- Overrides:
deactivate
in classAbstractManagedContext
-
dissociate
public boolean dissociate(S storage)
Description copied from interface:BoundContext
Dissociate the context from the storage (for this thread). The context will only dissociate from the same storage it associated with.- Specified by:
dissociate
in interfaceBoundContext<S>
- Parameters:
storage
- the external storage- Returns:
- true if the storage was dissociated
-
getAllContextualInstances
public Collection<ContextualInstance<?>> getAllContextualInstances()
Description copied from interface:WeldAlterableContext
Retrieves set ofContextualInstance
within the context. This entails all instances that were created up to this point - Weld creates them lazily so unless some beans were already used, they have not been stored.- Specified by:
getAllContextualInstances
in interfaceWeldAlterableContext
- Returns:
- Set of all
ContextualInstance
existing in this context
-
clearAndSet
public void clearAndSet(Collection<ContextualInstance<?>> setOfInstances)
Description copied from interface:WeldAlterableContext
Clears the backing bean store and feeds it with the set ofContextualInstance
provided as parameter. AllContextualInstance
have to belong to the same scope as does thisWeldAlterableContext
otherwiseIllegalArgumentException
is thrown.- Specified by:
clearAndSet
in interfaceWeldAlterableContext
- Parameters:
setOfInstances
- set ofContextualInstance
which are to become the new bean store for this context
-
-