Interface WeldManager
-
- All Superinterfaces:
jakarta.enterprise.inject.spi.BeanContainer
,jakarta.enterprise.inject.spi.BeanManager
,Serializable
public interface WeldManager extends jakarta.enterprise.inject.spi.BeanManager, Serializable
Functionality provided by the Weld Manager over and above theBeanManager
.- Author:
- Pete Muir
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> jakarta.enterprise.inject.spi.AnnotatedType<T>
createAnnotatedType(Class<T> type, String id)
Obtain anAnnotatedType
that may be used to read the annotations of the given class or interface.<T> WeldCreationalContext<T>
createCreationalContext(jakarta.enterprise.context.spi.Contextual<T> contextual)
<T> jakarta.enterprise.inject.spi.InjectionTarget<T>
createInjectionTarget(EjbDescriptor<T> descriptor)
The injection target for the given EJB, or null if Weld was not given this descriptor in the deployment.<T> WeldInjectionTargetBuilder<T>
createInjectionTargetBuilder(jakarta.enterprise.inject.spi.AnnotatedType<T> type)
Returns a new instance ofWeldInjectionTargetBuilder
which can be used to create a newWeldInjectionTarget
for the specified type.<T> void
disposeAnnotatedType(Class<T> type, String id)
Dispose theAnnotatedType
created for the identified type.<X> jakarta.enterprise.inject.spi.InjectionTarget<X>
fireProcessInjectionTarget(jakarta.enterprise.inject.spi.AnnotatedType<X> type)
Fire a ProcessInjectionTarget event for the given type.<X> jakarta.enterprise.inject.spi.InjectionTarget<X>
fireProcessInjectionTarget(jakarta.enterprise.inject.spi.AnnotatedType<X> annotatedType, jakarta.enterprise.inject.spi.InjectionTarget<X> injectionTarget)
Fire a ProcessInjectionTarget event for the given type.default Collection<jakarta.enterprise.context.spi.Context>
getActiveContexts()
Returns an unmodifiable collection of all currently activeContext
s.default Collection<WeldAlterableContext>
getActiveWeldAlterableContexts()
Returns an unmodifiable collection of all currently activeContext
s that implementWeldAlterableContext
.<T> jakarta.enterprise.inject.spi.Bean<T>
getBean(EjbDescriptor<T> descriptor)
Get the Bean object for the given EJB, or null if Weld was not given this descriptor in the deployment.<T> EjbDescriptor<T>
getEjbDescriptor(String ejbName)
Get the EjbDescriptor for the given EJB nameString
getId()
The ID of the manager, identical to the ID provided by the BDA<T> WeldInjectionTargetFactory<T>
getInjectionTargetFactory(jakarta.enterprise.inject.spi.AnnotatedType<T> type)
jakarta.enterprise.inject.spi.Bean<?>
getPassivationCapableBean(BeanIdentifier identifier)
Collection<Class<? extends Annotation>>
getScopes()
Returns an unmodifiable collection of all registered scopes, both built-in and custom.ServiceRegistry
getServices()
Get the services registered for this managerjakarta.enterprise.inject.Instance<Object>
instance()
boolean
isContextActive(Class<? extends Annotation> scopeType)
Indicates whether there is an active context for a given scope.WeldManager
unwrap()
-
Methods inherited from interface jakarta.enterprise.inject.spi.BeanContainer
createInstance, getBeans, getBeans, getContext, getEvent, getReference, isInterceptorBinding, isNormalScope, isQualifier, isScope, isStereotype, resolve, resolveInterceptors
-
Methods inherited from interface jakarta.enterprise.inject.spi.BeanManager
areInterceptorBindingsEquivalent, areQualifiersEquivalent, createAnnotatedType, createBean, createBean, createBeanAttributes, createBeanAttributes, createInjectionPoint, createInjectionPoint, createInterceptionFactory, getELResolver, getExtension, getInjectableReference, getInterceptorBindingDefinition, getInterceptorBindingHashCode, getPassivationCapableBean, getProducerFactory, getProducerFactory, getQualifierHashCode, getStereotypeDefinition, isPassivatingScope, resolveDecorators, resolveObserverMethods, validate, wrapExpressionFactory
-
-
-
-
Method Detail
-
createInjectionTarget
<T> jakarta.enterprise.inject.spi.InjectionTarget<T> createInjectionTarget(EjbDescriptor<T> descriptor)
The injection target for the given EJB, or null if Weld was not given this descriptor in the deployment. This should be used to create and inject contextual EJBs by the EJB container. Can also be used for message driven beans, even though they are non-contextual.fireProcessInjectionTarget(AnnotatedType)
andfireProcessInjectionTarget(AnnotatedType, InjectionTarget)
must be used to obtain anInjectionTarget
for non-contextual EJB injection.- Type Parameters:
T
- the type of the EJB- Parameters:
descriptor
- the given EJB descriptor- Returns:
- the injection target for the given EJB
-
getBean
<T> jakarta.enterprise.inject.spi.Bean<T> getBean(EjbDescriptor<T> descriptor)
Get the Bean object for the given EJB, or null if Weld was not given this descriptor in the deployment.- Type Parameters:
T
- the type of the bean- Parameters:
descriptor
- the given EJB descriptor- Returns:
- the Bean object for the given EJB
-
getEjbDescriptor
<T> EjbDescriptor<T> getEjbDescriptor(String ejbName)
Get the EjbDescriptor for the given EJB name- Type Parameters:
T
- the type of the EJB- Parameters:
ejbName
- the given EJB name- Returns:
- the EjbDescriptor for the given EJB name
-
getServices
ServiceRegistry getServices()
Get the services registered for this manager- Returns:
- the services registered for this manager
-
fireProcessInjectionTarget
<X> jakarta.enterprise.inject.spi.InjectionTarget<X> fireProcessInjectionTarget(jakarta.enterprise.inject.spi.AnnotatedType<X> type)
Fire a ProcessInjectionTarget event for the given type. A helper method to allow integration code to easily fire the ProcessInjectionTarget for Java EE component classes supporting injection The container must use the returned InjectionTarget to inject the Java EE component.- Type Parameters:
X
- the type- Parameters:
type
- the type- Returns:
- final version of InjectionTarget after all observers have been invoked
-
fireProcessInjectionTarget
<X> jakarta.enterprise.inject.spi.InjectionTarget<X> fireProcessInjectionTarget(jakarta.enterprise.inject.spi.AnnotatedType<X> annotatedType, jakarta.enterprise.inject.spi.InjectionTarget<X> injectionTarget)
Fire a ProcessInjectionTarget event for the given type. A helper method to allow integration code to easily fire the ProcessInjectionTarget for Java EE component classes supporting injection The container must use the returned InjectionTarget to inject the Java EE component.- Type Parameters:
X
- the type- Parameters:
annotatedType
- the typeinjectionTarget
- the injection target- Returns:
- final version of InjectionTarget after all observers have been invoked
-
getId
String getId()
The ID of the manager, identical to the ID provided by the BDA- Returns:
- the ID of the manager
-
instance
jakarta.enterprise.inject.Instance<Object> instance()
-
getInjectionTargetFactory
<T> WeldInjectionTargetFactory<T> getInjectionTargetFactory(jakarta.enterprise.inject.spi.AnnotatedType<T> type)
- Specified by:
getInjectionTargetFactory
in interfacejakarta.enterprise.inject.spi.BeanManager
-
createCreationalContext
<T> WeldCreationalContext<T> createCreationalContext(jakarta.enterprise.context.spi.Contextual<T> contextual)
- Specified by:
createCreationalContext
in interfacejakarta.enterprise.inject.spi.BeanContainer
-
getPassivationCapableBean
jakarta.enterprise.inject.spi.Bean<?> getPassivationCapableBean(BeanIdentifier identifier)
-
createInjectionTargetBuilder
<T> WeldInjectionTargetBuilder<T> createInjectionTargetBuilder(jakarta.enterprise.inject.spi.AnnotatedType<T> type)
Returns a new instance ofWeldInjectionTargetBuilder
which can be used to create a newWeldInjectionTarget
for the specified type.- Type Parameters:
T
- the type- Parameters:
type
- the specified type- Returns:
- a new
WeldInjectionTargetBuilder
instance for the specified type
-
unwrap
WeldManager unwrap()
- Returns:
- an unwrapped instance (e.g. the delegate in the case of forwarding implementation)
-
createAnnotatedType
<T> jakarta.enterprise.inject.spi.AnnotatedType<T> createAnnotatedType(Class<T> type, String id)
Obtain anAnnotatedType
that may be used to read the annotations of the given class or interface.Allows multiple annotated types, based on the same underlying type, to be created.
AnnotatedType
s discovered by the container use the fully qualified class name to identify the type.This method must only be used when creating non-contextual instances, such as Java EE components. It's not designed to work with contextual instances.
If called after the container bootstrap finished, the client code is required to explicitly call
disposeAnnotatedType(Class, String)
as soon as the specified type should be garbage-collected (to avoid memory leaks).- Type Parameters:
T
- holds information about the class type- Parameters:
type
- underlying class for theAnnotatedType
id
- unique ID of this newly createdAnnotatedType
- Returns:
- the
AnnotatedType
-
disposeAnnotatedType
<T> void disposeAnnotatedType(Class<T> type, String id)
Dispose theAnnotatedType
created for the identified type.This method should be explicitly called for each result of
createAnnotatedType(Class, String)
created after the container bootstrap finished.It's not necessary to call this method unless the identified type should be a subject of garbage collection.
- Type Parameters:
T
- holds information about the class type- Parameters:
type
- underlying class for theAnnotatedType
id
- unique ID of theAnnotatedType
that is to be destroyed- See Also:
createAnnotatedType(Class, String)
-
isContextActive
boolean isContextActive(Class<? extends Annotation> scopeType)
Indicates whether there is an active context for a given scope.- Parameters:
scopeType
- an annotation representing the scope- Returns:
- true if there is an active context for a given scope, false otherwise
- Throws:
IllegalStateException
- if there are multiple active contexts for a given scope
-
getScopes
Collection<Class<? extends Annotation>> getScopes()
Returns an unmodifiable collection of all registered scopes, both built-in and custom. You can then useBeanManager#getContext()
to retrieve theContext
. The method returns scopes regardless of whether their respective contexts are active or otherwise.- Returns:
- All scopes present in the application
-
getActiveContexts
default Collection<jakarta.enterprise.context.spi.Context> getActiveContexts()
Returns an unmodifiable collection of all currently activeContext
s. This is just a convenient method. Note that for each scope, there might be more than oneContext
, but there can be at most one active at a time.- Returns:
- Collection of all currently active
Context
s
-
getActiveWeldAlterableContexts
default Collection<WeldAlterableContext> getActiveWeldAlterableContexts()
Returns an unmodifiable collection of all currently activeContext
s that implementWeldAlterableContext
. This is just a convenient method. Note that for each scope, there might be more than oneContext
, but there can be at most one active at a time. This method can therefore return an incomplete view of all active contexts as not every context implementsWeldAlterableContext
.- Returns:
- Collection of all active contexts implementing
WeldAlterableContext
-
-