Package org.jboss.weld.contexts
Class AbstractContext
java.lang.Object
org.jboss.weld.contexts.AbstractContext
- All Implemented Interfaces:
jakarta.enterprise.context.spi.AlterableContext,jakarta.enterprise.context.spi.Context
- Direct Known Subclasses:
AbstractManagedContext,AbstractSharedContext
public abstract class AbstractContext
extends Object
implements jakarta.enterprise.context.spi.AlterableContext
Base for the Context implementations. Delegates calls to the abstract
getBeanStore and getActive to allow for different implementations (storage
types and ThreadLocal vs. shared)
- Author:
- Nicklas Karlsson, Pete Muir
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAllows contexts that are initialized lazily to plug in additional logic.voidcleanup()protected voiddestroy()Destroys the contextvoiddestroy(jakarta.enterprise.context.spi.Contextual<?> contextual) <T> Tget(jakarta.enterprise.context.spi.Contextual<T> contextual) <T> Tget(jakarta.enterprise.context.spi.Contextual<T> contextual, jakarta.enterprise.context.spi.CreationalContext<T> creationalContext) Get the bean if it exists in the contexts.protected abstract BeanStoreA method that returns the actual bean store implementationprotected static <T> jakarta.enterprise.context.spi.Contextual<T>getContextual(String contextId, String id) protected org.jboss.weld.serialization.spi.BeanIdentifiergetId(jakarta.enterprise.context.spi.Contextual<?> contextual) protected org.jboss.weld.bootstrap.api.ServiceRegistryprotected booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.enterprise.context.spi.Context
getScope, isActive
-
Constructor Details
-
AbstractContext
Constructor
-
-
Method Details
-
get
public <T> T get(jakarta.enterprise.context.spi.Contextual<T> contextual, jakarta.enterprise.context.spi.CreationalContext<T> creationalContext) Get the bean if it exists in the contexts.- Specified by:
getin interfacejakarta.enterprise.context.spi.Context- Returns:
- An instance of the bean
- Throws:
jakarta.enterprise.context.ContextNotActiveException- if the context is not active
-
get
public <T> T get(jakarta.enterprise.context.spi.Contextual<T> contextual) - Specified by:
getin interfacejakarta.enterprise.context.spi.Context
-
destroy
public void destroy(jakarta.enterprise.context.spi.Contextual<?> contextual) - Specified by:
destroyin interfacejakarta.enterprise.context.spi.AlterableContext
-
destroy
protected void destroy()Destroys the context -
getBeanStore
A method that returns the actual bean store implementation- Returns:
- The bean store
-
cleanup
public void cleanup() -
getContextual
-
getId
protected org.jboss.weld.serialization.spi.BeanIdentifier getId(jakarta.enterprise.context.spi.Contextual<?> contextual) -
getServiceRegistry
protected org.jboss.weld.bootstrap.api.ServiceRegistry getServiceRegistry() -
checkContextInitialized
protected void checkContextInitialized()Allows contexts that are initialized lazily to plug in additional logic. -
isMultithreaded
protected boolean isMultithreaded()
-