Package org.jboss.weld.context
Interface WeldAlterableContext
- All Superinterfaces:
jakarta.enterprise.context.spi.AlterableContext,jakarta.enterprise.context.spi.Context
- All Known Subinterfaces:
BoundContext<S>,BoundConversationContext,BoundRequestContext,BoundSessionContext,ConversationContext,EjbRequestContext,HttpConversationContext,HttpRequestContext,HttpSessionContext,ManagedContext,RequestContext,SessionContext
public interface WeldAlterableContext
extends jakarta.enterprise.context.spi.AlterableContext
Enriched version of
AlterableContext which allows to capture all instances from given context or to set them to
previously obtained values.
Most built-in contexts implement this in order to support context propagation. Exception are ApplicationContext which
works out of the box and then SingletonContext and DependentContext which are not to be propagated.- Author:
- Matej Novotny
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclearAndSet(Collection<ContextualInstance<?>> setOfInstances) Clears the backing bean store and feeds it with the set ofContextualInstanceprovided as parameter.default Collection<ContextualInstance<?>>Retrieves set ofContextualInstancewithin the context.Methods inherited from interface jakarta.enterprise.context.spi.AlterableContext
destroyMethods inherited from interface jakarta.enterprise.context.spi.Context
get, get, getScope, isActive
-
Method Details
-
getAllContextualInstances
Retrieves 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.- Returns:
- Set of all
ContextualInstanceexisting in this context
-
clearAndSet
Clears the backing bean store and feeds it with the set ofContextualInstanceprovided as parameter. AllContextualInstancehave to belong to the same scope as does thisWeldAlterableContextotherwiseIllegalArgumentExceptionis thrown.- Parameters:
setOfInstances- set ofContextualInstancewhich are to become the new bean store for this context- Throws:
IllegalArgumentException- ifContextualInstances belong to different scope than this context
-