-
public interface BeforeBeanDiscovery
This event type is thrown by the container before the bean discovery process begins. If any observer method of the
BeforeBeanDiscovery
event throws an exception, the exception is treated as a definition error by the container.CDI Lite implementations are not required to provide support for Portable Extensions.
- Author:
- Pete Muir, David Allen, Antoine Sabot-Durand
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAnnotatedType(AnnotatedType<?> type, java.lang.String id)
Adds a givenAnnotatedType
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 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 invocationvoid
addInterceptorBinding(AnnotatedType<? extends java.lang.annotation.Annotation> bindingType)
Declares an annotation type as an interceptor binding type.void
addInterceptorBinding(java.lang.Class<? extends java.lang.annotation.Annotation> bindingType, java.lang.annotation.Annotation... bindingTypeDef)
Declares an annotation type as an interceptor binding type, and specifies its meta-annotations.void
addQualifier(AnnotatedType<? extends java.lang.annotation.Annotation> qualifier)
Declares an annotation type as a Qualifier qualifier type.void
addQualifier(java.lang.Class<? extends java.lang.annotation.Annotation> qualifier)
Declares an annotation type as a Qualifier qualifier type.void
addScope(java.lang.Class<? extends java.lang.annotation.Annotation> scopeType, boolean normal, boolean passivating)
Declares an annotation type as a scope type.void
addStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype, java.lang.annotation.Annotation... stereotypeDef)
Declares an annotation type as a stereotype, and specifies its meta-annotations.<T extends java.lang.annotation.Annotation>
AnnotatedTypeConfigurator<T>configureInterceptorBinding(java.lang.Class<T> bindingType)
Obtains a newAnnotatedTypeConfigurator
to configure a newAnnotatedType
and declares it as an interceptor binding type.<T extends java.lang.annotation.Annotation>
AnnotatedTypeConfigurator<T>configureQualifier(java.lang.Class<T> qualifier)
Obtains a newAnnotatedTypeConfigurator
to configure a newAnnotatedType
and declares it as a Qualifier qualifier type.
-
-
-
Method Detail
-
addQualifier
void addQualifier(java.lang.Class<? extends java.lang.annotation.Annotation> qualifier)
Declares an annotation type as a Qualifier qualifier type.
This is only required if you wish to make an annotation a qualifier without adding
Qualifier
to it.- Parameters:
qualifier
- The annotation to treat as a qualifier- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation
-
addQualifier
void addQualifier(AnnotatedType<? extends java.lang.annotation.Annotation> qualifier)
Declares an annotation type as a Qualifier qualifier type.
This is only required if you wish to make an annotation a qualifier without adding
Qualifier
to it.- Parameters:
qualifier
- The annotation to treat as a qualifier- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation- Since:
- 1.1
-
addScope
void addScope(java.lang.Class<? extends java.lang.annotation.Annotation> scopeType, boolean normal, boolean passivating)
Declares an annotation type as a scope type.
This is only required if you wish to make an annotation a scope type without adding the
NormalScope
orScope
annotations to it. You can also use this method to override an existing normal scope definition.- Parameters:
scopeType
- The annotation type to treat as a scope typenormal
- Indicates if the scope is normalpassivating
- Indicates if the scope is passivation capable- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation- See Also:
AfterBeanDiscovery.addContext(Context)
-
addStereotype
void addStereotype(java.lang.Class<? extends java.lang.annotation.Annotation> stereotype, java.lang.annotation.Annotation... stereotypeDef)
Declares an annotation type as a stereotype, and specifies its meta-annotations.
This is only required if you wish to make an annotation a stereotype without adding
Stereotype
to it. You can also use this method to override an existing stereotype definition.- Parameters:
stereotype
- The annotation type to treat as a stereotypestereotypeDef
- An optional list of annotations defining the stereotype- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation
-
addInterceptorBinding
void addInterceptorBinding(AnnotatedType<? extends java.lang.annotation.Annotation> bindingType)
Declares an annotation type as an interceptor binding type.
This is only required if you wish to make an annotation an interceptor binding type without adding
InterceptorBinding
to it.- Parameters:
bindingType
- The annotation type to treat as an interceptor binding type- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation
-
addInterceptorBinding
void addInterceptorBinding(java.lang.Class<? extends java.lang.annotation.Annotation> bindingType, java.lang.annotation.Annotation... bindingTypeDef)
Declares an annotation type as an interceptor binding type, and specifies its meta-annotations.
This is only required if you wish to make an annotation an interceptor binding type without adding
InterceptorBinding
to it.- Parameters:
bindingType
- The annotation type to treat as an interceptor binding typebindingTypeDef
- An optional list of annotations defining the interceptor- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation- Since:
- 1.1
-
addAnnotatedType
void 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 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:
java.lang.IllegalStateException
- if called outside of the observer method invocation- Since:
- 1.1
-
addAnnotatedType
<T> AnnotatedTypeConfigurator<T> addAnnotatedType(java.lang.Class<T> type, java.lang.String id)
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 invocationThanks to the id parameter, this method allows multiple annotated types, based on the same underlying type, to be defined with a builder.
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
- class 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:
java.lang.IllegalStateException
- if called outside of the observer method invocation- Since:
- 2.0
-
configureQualifier
<T extends java.lang.annotation.Annotation> AnnotatedTypeConfigurator<T> configureQualifier(java.lang.Class<T> qualifier)
Obtains a new
AnnotatedTypeConfigurator
to configure a newAnnotatedType
and declares it as a Qualifier qualifier type.This is only required if you wish to make an annotation a qualifier without adding
Qualifier
to it and need to easily add other annotations (likeNonbinding
on its members.- Type Parameters:
T
- qualifier type- Parameters:
qualifier
- The annotation class used to initialized the configurator- Returns:
- a non reusable
AnnotatedTypeConfigurator
to configure the qualifier - Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation- Since:
- 2.0
-
configureInterceptorBinding
<T extends java.lang.annotation.Annotation> AnnotatedTypeConfigurator<T> configureInterceptorBinding(java.lang.Class<T> bindingType)
Obtains a new
AnnotatedTypeConfigurator
to configure a newAnnotatedType
and declares it as an interceptor binding type.This is only required if you wish to make an annotation an interceptor binding type without adding
InterceptorBinding
to it and need to easily add other annotations (likeNonbinding
on its members.- Type Parameters:
T
- binding class type- Parameters:
bindingType
- The annotation class used to initialized the configurator- Returns:
- a non reusable
AnnotatedTypeConfigurator
to configure the interceptor binding - Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation- Since:
- 2.0
-
-