Interface AfterTypeDiscovery
This event type is thrown by the container after type discovery is complete. If any observer method of the
AfterTypeDiscovery
event throws an exception, the exception is treated as a definition error by the container.
Any observer of this event is permitted to add classes to, or remove classes from, the list of alternatives, list of
interceptors or list of decorators. The container will use the final values of these lists, after all observers have been
called, to determine the enabled alternatives, interceptors, and decorators for application.
Changes made to these lists after the invocation of the last observer method of the AfterTypeDiscovery
are ignored.
CDI Lite implementations are not required to provide support for Portable Extensions.
- Since:
- 1.1
- Author:
- Pete Muir, Antoine Sabot-Durand
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAnnotatedType
(AnnotatedType<?> type, String id) Adds a givenAnnotatedType
to the set of types which will be scanned during bean discovery.<T> AnnotatedTypeConfigurator
<T> addAnnotatedType
(Class<T> type, String id) Obtains a newAnnotatedTypeConfigurator
to configure a newAnnotatedType
and add it to the set of types which will be scanned during bean discovery at the end of the observer invocation.
-
Method Details
-
getAlternatives
- Returns:
- the list of enabled alternatives for the application, sorted by priority in ascending order. Alternatives enabled for a bean archive are not included.
- Throws:
IllegalStateException
- if called outside of the observer method invocation
-
getInterceptors
- Returns:
- the list of enabled interceptors for the application, sorted by priority in ascending order. Interceptors enabled for a bean archive are not included.
- Throws:
IllegalStateException
- if called outside of the observer method invocation
-
getDecorators
- Returns:
- the list of enabled decorators for the application, sorted by priority in ascending order. Decorators enabled for a bean archive are not included.
- Throws:
IllegalStateException
- if called outside of the observer method invocation
-
addAnnotatedType
Adds a given
AnnotatedType
to the set of types which will be scanned during bean discovery.Thanks to the id parameter, this method allows multiple annotated types, based on the same underlying type, to be defined.
AnnotatedType
s discovered by the container use the fully qualified class name ofAnnotatedType.getJavaClass()
to identify the type.AfterBeanDiscovery.getAnnotatedType(Class, String)
andAfterBeanDiscovery.getAnnotatedTypes(Class)
allows annotated types to be obtained by identifier.- Parameters:
type
- TheAnnotatedType
to add for later scanningid
- the identifier used to distinguish this AnnotatedType from an other one based on the same underlying type- Throws:
IllegalStateException
- if called outside of the observer method invocation
-
addAnnotatedType
Obtains a new
AnnotatedTypeConfigurator
to configure a newAnnotatedType
and add it to the set of types which will be scanned during bean discovery at the end of the observer invocation. Calling this method multiple times will return a new AnnotatedTypeConfigurator.Thanks to the id parameter, this method allows multiple annotated types, based on the same underlying type, to be defined.
AnnotatedType
s discovered by the container use the fully qualified class name ofAnnotatedType.getJavaClass()
to identify the type.AfterBeanDiscovery.getAnnotatedType(Class, String)
andAfterBeanDiscovery.getAnnotatedTypes(Class)
allows annotated types to be obtained by identifier.- Type Parameters:
T
- annotatated instance type- Parameters:
type
- class used to initialized the type and annotations on theAnnotatedTypeConfigurator
id
- the identifier used to distinguish this AnnotatedType from an other one based on the same underlying type- Returns:
- a non reusable
AnnotatedTypeConfigurator
to configure the new AnnotatedType - Throws:
IllegalStateException
- if called outside of the observer method invocation- Since:
- 2.0
-