Interface WeldManager
-
- All Superinterfaces:
javax.enterprise.inject.spi.BeanManager,Serializable
public interface WeldManager extends javax.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> javax.enterprise.inject.spi.AnnotatedType<T>createAnnotatedType(Class<T> type, String id)Obtain anAnnotatedTypethat may be used to read the annotations of the given class or interface.<T> WeldCreationalContext<T>createCreationalContext(javax.enterprise.context.spi.Contextual<T> contextual)<T> javax.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(javax.enterprise.inject.spi.AnnotatedType<T> type)Returns a new instance ofWeldInjectionTargetBuilderwhich can be used to create a newWeldInjectionTargetfor the specified type.<T> voiddisposeAnnotatedType(Class<T> type, String id)Dispose theAnnotatedTypecreated for the identified type.<X> javax.enterprise.inject.spi.InjectionTarget<X>fireProcessInjectionTarget(javax.enterprise.inject.spi.AnnotatedType<X> type)Fire a ProcessInjectionTarget event for the given type.<X> javax.enterprise.inject.spi.InjectionTarget<X>fireProcessInjectionTarget(javax.enterprise.inject.spi.AnnotatedType<X> annotatedType, javax.enterprise.inject.spi.InjectionTarget<X> injectionTarget)Fire a ProcessInjectionTarget event for the given type.default Collection<javax.enterprise.context.spi.Context>getActiveContexts()Returns an unmodifiable collection of all currently activeContexts.default Collection<WeldAlterableContext>getActiveWeldAlterableContexts()Returns an unmodifiable collection of all currently activeContexts that implementWeldAlterableContext.<T> javax.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 nameStringgetId()The ID of the manager, identical to the ID provided by the BDA<T> WeldInjectionTargetFactory<T>getInjectionTargetFactory(javax.enterprise.inject.spi.AnnotatedType<T> type)javax.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.ServiceRegistrygetServices()Get the services registered for this managerjavax.enterprise.inject.Instance<Object>instance()booleanisContextActive(Class<? extends Annotation> scopeType)Indicates whether there is an active context for a given scope.WeldManagerunwrap()-
Methods inherited from interface javax.enterprise.inject.spi.BeanManager
areInterceptorBindingsEquivalent, areQualifiersEquivalent, createAnnotatedType, createBean, createBean, createBeanAttributes, createBeanAttributes, createInjectionPoint, createInjectionPoint, createInjectionTarget, createInstance, createInterceptionFactory, fireEvent, getBeans, getBeans, getContext, getELResolver, getEvent, getExtension, getInjectableReference, getInterceptorBindingDefinition, getInterceptorBindingHashCode, getPassivationCapableBean, getProducerFactory, getProducerFactory, getQualifierHashCode, getReference, getStereotypeDefinition, isInterceptorBinding, isNormalScope, isPassivatingScope, isQualifier, isScope, isStereotype, resolve, resolveDecorators, resolveInterceptors, resolveObserverMethods, validate, wrapExpressionFactory
-
-
-
-
Method Detail
-
createInjectionTarget
<T> javax.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 anInjectionTargetfor 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> javax.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> javax.enterprise.inject.spi.InjectionTarget<X> fireProcessInjectionTarget(javax.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> javax.enterprise.inject.spi.InjectionTarget<X> fireProcessInjectionTarget(javax.enterprise.inject.spi.AnnotatedType<X> annotatedType, javax.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
javax.enterprise.inject.Instance<Object> instance()
-
getInjectionTargetFactory
<T> WeldInjectionTargetFactory<T> getInjectionTargetFactory(javax.enterprise.inject.spi.AnnotatedType<T> type)
- Specified by:
getInjectionTargetFactoryin interfacejavax.enterprise.inject.spi.BeanManager
-
createCreationalContext
<T> WeldCreationalContext<T> createCreationalContext(javax.enterprise.context.spi.Contextual<T> contextual)
- Specified by:
createCreationalContextin interfacejavax.enterprise.inject.spi.BeanManager
-
getPassivationCapableBean
javax.enterprise.inject.spi.Bean<?> getPassivationCapableBean(BeanIdentifier identifier)
-
createInjectionTargetBuilder
<T> WeldInjectionTargetBuilder<T> createInjectionTargetBuilder(javax.enterprise.inject.spi.AnnotatedType<T> type)
Returns a new instance ofWeldInjectionTargetBuilderwhich can be used to create a newWeldInjectionTargetfor the specified type.- Type Parameters:
T- the type- Parameters:
type- the specified type- Returns:
- a new
WeldInjectionTargetBuilderinstance for the specified type
-
unwrap
WeldManager unwrap()
- Returns:
- an unwrapped instance (e.g. the delegate in the case of forwarding implementation)
-
createAnnotatedType
<T> javax.enterprise.inject.spi.AnnotatedType<T> createAnnotatedType(Class<T> type, String id)
Obtain anAnnotatedTypethat 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.
AnnotatedTypes 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 theAnnotatedTypeid- unique ID of this newly createdAnnotatedType- Returns:
- the
AnnotatedType
-
disposeAnnotatedType
<T> void disposeAnnotatedType(Class<T> type, String id)
Dispose theAnnotatedTypecreated 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 theAnnotatedTypeid- unique ID of theAnnotatedTypethat 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<javax.enterprise.context.spi.Context> getActiveContexts()
Returns an unmodifiable collection of all currently activeContexts. 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
Contexts
-
getActiveWeldAlterableContexts
default Collection<WeldAlterableContext> getActiveWeldAlterableContexts()
Returns an unmodifiable collection of all currently activeContexts 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
-
-