Package javax.enterprise.inject.spi
Interface AfterBeanDiscovery
-
public interface AfterBeanDiscoveryThe event type of the second event fired by the container when it has fully completed the bean discovery process, validated that there are no definition errors relating to the discovered beans, and registered
BeanandObserverMethodobjects for the discovered beans, but before detecting deployment problems.A portable extension may take advantage of this event to register beans, interceptors, decorators, observer methods and custom context objects with the container.
void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) { ... }If any observer method of the
AfterBeanDiscoveryevent throws an exception, the exception is treated as a definition error by the container.- Author:
- David Allen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddBean(Bean<?> bean)Fires an event of typeProcessBeancontaining the givenBeanand then registers theBeanwith the container, thereby making it available for injection into other beans.voidaddContext(Context context)Registers a customContextobject with the container.voidaddDefinitionError(java.lang.Throwable t)Registers a definition error with the container, causing the container to abort deployment after all observers have been notified.voidaddObserverMethod(ObserverMethod<?> observerMethod)Fires an event of typeProcessObserverMethodcontaining the givenObserverMethodand then registers theObserverMethodwith the container, thereby making it available for event notifications.<T> AnnotatedType<T>getAnnotatedType(java.lang.Class<T> type, java.lang.String id)Obtain theAnnotatedTypethat may be used to read the annotations of the given class or interface as defined during container initialization.<T> java.lang.Iterable<AnnotatedType<T>>getAnnotatedTypes(java.lang.Class<T> type)Obtain theAnnotatedTypes that may be used to read the annotations of the given class or interface as defined during container initialization.
-
-
-
Method Detail
-
addDefinitionError
void addDefinitionError(java.lang.Throwable t)
Registers a definition error with the container, causing the container to abort deployment after all observers have been notified.- Parameters:
t- The definition error as aThrowable- Throws:
java.lang.IllegalStateException- if called outside of the observer method invocation
-
addBean
void addBean(Bean<?> bean)
Fires an event of typeProcessBeancontaining the givenBeanand then registers theBeanwith the container, thereby making it available for injection into other beans. The givenBeanmay implementInterceptororDecorator.- Parameters:
bean- The bean to add to the deployment- Throws:
java.lang.IllegalStateException- if called outside of the observer method invocation
-
addObserverMethod
void addObserverMethod(ObserverMethod<?> observerMethod)
Fires an event of typeProcessObserverMethodcontaining the givenObserverMethodand then registers theObserverMethodwith the container, thereby making it available for event notifications.- Parameters:
observerMethod- The custom observer method to add to the deployment- Throws:
java.lang.IllegalStateException- if called outside of the observer method invocation
-
addContext
void addContext(Context context)
Registers a customContextobject with the container.- Parameters:
context- The custom context to add to the deployment- Throws:
java.lang.IllegalStateException- if called outside of the observer method invocation
-
getAnnotatedType
<T> AnnotatedType<T> getAnnotatedType(java.lang.Class<T> type, java.lang.String id)
Obtain theAnnotatedTypethat may be used to read the annotations of the given class or interface as defined during container initialization.- Type Parameters:
T- the class or interface- Parameters:
type- theClassobjectid- the type identifier. If null, the fully qualifier class name of type is used- Returns:
- the
AnnotatedType - Throws:
java.lang.IllegalStateException- if called outside of the observer method invocation- Since:
- 1.1
-
getAnnotatedTypes
<T> java.lang.Iterable<AnnotatedType<T>> getAnnotatedTypes(java.lang.Class<T> type)
Obtain theAnnotatedTypes that may be used to read the annotations of the given class or interface as defined during container initialization.- Type Parameters:
T- the class or interface- Parameters:
type- theClassobject- Returns:
- the
AnnotatedTypes - Throws:
java.lang.IllegalStateException- if called outside of the observer method invocation- Since:
- 1.1
-
-