public 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.
Modifier and Type | Method and Description |
---|---|
void |
addAnnotatedType(AnnotatedType<?> type,
java.lang.String id)
Adds a given
AnnotatedType to the set of types which will be scanned during bean
discovery. |
<T> AnnotatedTypeConfigurator<T> |
addAnnotatedType(java.lang.Class<T> type,
java.lang.String id)
Obtains a new
AnnotatedTypeConfigurator to configure a new AnnotatedType and
add it to the set of types which will be scanned during bean discovery at the end of the observer invocation. |
java.util.List<java.lang.Class<?>> |
getAlternatives() |
java.util.List<java.lang.Class<?>> |
getDecorators() |
java.util.List<java.lang.Class<?>> |
getInterceptors() |
java.util.List<java.lang.Class<?>> getAlternatives()
java.lang.IllegalStateException
- if called outside of the observer method invocationjava.util.List<java.lang.Class<?>> getInterceptors()
java.lang.IllegalStateException
- if called outside of the observer method invocationjava.util.List<java.lang.Class<?>> getDecorators()
java.lang.IllegalStateException
- if called outside of the observer method invocationvoid addAnnotatedType(AnnotatedType<?> type, java.lang.String id)
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 of AnnotatedType.getJavaClass()
to identify the
type.
AfterBeanDiscovery.getAnnotatedType(Class, String)
and AfterBeanDiscovery.getAnnotatedTypes(Class)
allows
annotated types to be obtained by identifier.
type
- The AnnotatedType
to add for later scanningid
- the identifier used to distinguish this AnnotatedType from an other one based on the same underlying typejava.lang.IllegalStateException
- if called outside of the observer method invocation<T> AnnotatedTypeConfigurator<T> addAnnotatedType(java.lang.Class<T> type, java.lang.String id)
Obtains a new AnnotatedTypeConfigurator
to configure a new AnnotatedType
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 of AnnotatedType.getJavaClass()
to identify the
type.
AfterBeanDiscovery.getAnnotatedType(Class, String)
and AfterBeanDiscovery.getAnnotatedTypes(Class)
allows
annotated types to be obtained by identifier.
T
- annotatated instance typetype
- class used to initialized the type and annotations on the AnnotatedTypeConfigurator
id
- the identifier used to distinguish this AnnotatedType from an other one based on the same underlying typeAnnotatedTypeConfigurator
to configure the new AnnotatedTypejava.lang.IllegalStateException
- if called outside of the observer method invocation