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:
jakarta.enterprise.context.spi.AlterableContext,jakarta.enterprise.context.spi.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 -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate()Activate the Context.voidcleanup()voidclearAndSet(Collection<ContextualInstance<?>> setOfInstances) Clears the backing bean store and feeds it with the set ofContextualInstanceprovided as parameter.voidDeactivate the Context, destroying any instances if the context is invalid.booleandissociate(S storage) Dissociate the context from the storage (for this thread).Retrieves set ofContextualInstancewithin the context.protected BoundBeanStoreGets the bean storeprotected voidsetBeanStore(BoundBeanStore beanStore) Sets the bean storeMethods inherited from class org.jboss.weld.contexts.AbstractManagedContext
invalidate, isActive, isValid, removeState, setActiveMethods inherited from class org.jboss.weld.contexts.AbstractContext
checkContextInitialized, destroy, destroy, get, get, getContextual, getId, getServiceRegistry, isMultithreadedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.enterprise.context.spi.AlterableContext
destroyMethods inherited from interface org.jboss.weld.context.BoundContext
associateMethods inherited from interface jakarta.enterprise.context.spi.Context
get, get, getScope, isActive
-
Constructor Details
-
AbstractBoundContext
-
-
Method Details
-
getBeanStore
Gets the bean store- Specified by:
getBeanStorein classAbstractContext- Returns:
- The bean store
-
setBeanStore
Sets the bean store- Parameters:
beanStore- The bean store
-
cleanup
public void cleanup()- Overrides:
cleanupin classAbstractContext
-
activate
public void activate()Description copied from interface:ManagedContextActivate the Context.- Specified by:
activatein interfaceManagedContext- Overrides:
activatein classAbstractManagedContext
-
deactivate
public void deactivate()Description copied from interface:ManagedContextDeactivate the Context, destroying any instances if the context is invalid.- Specified by:
deactivatein interfaceManagedContext- Overrides:
deactivatein classAbstractManagedContext
-
dissociate
Description copied from interface:BoundContextDissociate the context from the storage (for this thread). The context will only dissociate from the same storage it associated with.- Specified by:
dissociatein interfaceBoundContext<S>- Parameters:
storage- the external storage- Returns:
- true if the storage was dissociated
-
getAllContextualInstances
Description copied from interface:WeldAlterableContextRetrieves set ofContextualInstancewithin 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:
getAllContextualInstancesin interfaceWeldAlterableContext- Returns:
- Set of all
ContextualInstanceexisting in this context
-
clearAndSet
Description copied from interface:WeldAlterableContextClears the backing bean store and feeds it with the set ofContextualInstanceprovided as parameter. AllContextualInstancehave to belong to the same scope as does thisWeldAlterableContextotherwiseIllegalArgumentExceptionis thrown.- Specified by:
clearAndSetin interfaceWeldAlterableContext- Parameters:
setOfInstances- set ofContextualInstancewhich are to become the new bean store for this context
-