Top Description Methods
javax.enterprise.inject.spi

public Interface BeforeBeanDiscovery

Imports
javax.enterprise.context.NormalScope, javax.enterprise.inject.Stereotype, javax.enterprise.inject.spi.configurator.AnnotatedTypeConfigurator, javax.inject.Qualifier, .Scope, javax.interceptor.InterceptorBinding, java.lang.annotation.Annotation

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.

Authors
Pete Muir, David Allen, Antoine Sabot-Durand

Method Summary

Modifier and TypeMethod and Description
public void
addAnnotatedType(AnnotatedType<?>
The javax.enterprise.inject.spi.AnnotatedType to add for later scanning
type
)

Adds a given javax.enterprise.inject.spi.AnnotatedType to the set of types which will be scanned during bean discovery.

public void
addAnnotatedType(AnnotatedType<?>
The javax.enterprise.inject.spi.AnnotatedType to add for later scanning
type
,
String
the identifier used to distinguish this AnnotatedType from an other one based on the same underlying type
id
)

Adds a given javax.enterprise.inject.spi.AnnotatedType to the set of types which will be scanned during bean discovery.

public <T> AnnotatedTypeConfigurator<T>

Returns:

a non reusable AnnotatedTypeConfigurator to configure the new AnnotatedType
addAnnotatedType
(Class<T>
class used to initialized the type and annotations on the AnnotatedTypeConfigurator
type
,
String
the identifier used to distinguish this AnnotatedType from an other one based on the same underlying type
id
)

Obtains a new AnnotatedTypeConfigurator to configure a new javax.enterprise.inject.spi.AnnotatedType and add it to the set of types which will be scanned during bean discovery at the end of the observer invocation

Thanks to the id parameter, this method allows multiple annotated types, based on the same underlying type, to be defined with a builder.

public void
addInterceptorBinding(AnnotatedType<? extends Annotation>
The annotation type to treat as an interceptor binding type
bindingType
)

Declares an annotation type as an interceptor binding type.

public void
addInterceptorBinding(Class<? extends Annotation>
The annotation type to treat as an interceptor binding type
bindingType
,
Annotation...
An optional list of annotations defining the interceptor
bindingTypeDef
)

Declares an annotation type as an interceptor binding type, and specifies its meta-annotations.

public void
addQualifier(Class<? extends Annotation>
The annotation to treat as a qualifier
qualifier
)

Declares an annotation type as a javax.inject.Qualifier qualifier type.

public void
addQualifier(AnnotatedType<? extends Annotation>
The annotation to treat as a qualifier
qualifier
)

Declares an annotation type as a javax.inject.Qualifier qualifier type.

public void
addScope(Class<? extends Annotation>
The annotation type to treat as a scope type
scopeType
,
boolean
Indicates if the scope is normal
normal
,
boolean
Indicates if the scope is passivation capable
passivating
)

Declares an annotation type as a scope type.

public void
addStereotype(Class<? extends Annotation>
The annotation type to treat as a stereotype
stereotype
,
Annotation...
An optional list of annotations defining the stereotype
stereotypeDef
)

Declares an annotation type as a stereotype, and specifies its meta-annotations.

public <T extends Annotation> AnnotatedTypeConfigurator<T>

Returns:

a non reusable AnnotatedTypeConfigurator to configure the interceptor binding
configureInterceptorBinding
(Class<T>
The annotation class used to initialized the configurator
bindingType
)

Obtains a new AnnotatedTypeConfigurator to configure a new javax.enterprise.inject.spi.AnnotatedType and declares it as an interceptor binding type.

public <T extends Annotation> AnnotatedTypeConfigurator<T>

Returns:

a non reusable AnnotatedTypeConfigurator to configure the qualifier
configureQualifier
(Class<T>
The annotation class used to initialized the configurator
qualifier
)

Obtains a new AnnotatedTypeConfigurator to configure a new javax.enterprise.inject.spi.AnnotatedType and declares it as a javax.inject.Qualifier qualifier type.

Method Detail

addAnnotatedTypeback to summary
public void addAnnotatedType(AnnotatedType<?> type)

Adds a given javax.enterprise.inject.spi.AnnotatedType to the set of types which will be scanned during bean discovery.

This method is deprecated from CDI 1.1 and addAnnotatedType(AnnotatedType, String) should be used instead.

Parameters
type:AnnotatedType<?>

The javax.enterprise.inject.spi.AnnotatedType to add for later scanning

Exceptions
IllegalStateException:
if called outside of the observer method invocation
addAnnotatedTypeback to summary
public void addAnnotatedType(AnnotatedType<?> type, String id)

Adds a given javax.enterprise.inject.spi.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. AnnotatedTypes 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.

Parameters
type:AnnotatedType<?>

The javax.enterprise.inject.spi.AnnotatedType to add for later scanning

id:String

the identifier used to distinguish this AnnotatedType from an other one based on the same underlying type

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
1.1
addAnnotatedTypeback to summary
public <T> AnnotatedTypeConfigurator<T> addAnnotatedType(Class<T> type, String id)

Obtains a new AnnotatedTypeConfigurator to configure a new javax.enterprise.inject.spi.AnnotatedType and add it to the set of types which will be scanned during bean discovery at the end of the observer invocation

Thanks to the id parameter, this method allows multiple annotated types, based on the same underlying type, to be defined with a builder. AnnotatedTypes 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.

Each call returns a new AnnotatedTypeConfigurator
Parameters
type:Class<T>

class used to initialized the type and annotations on the AnnotatedTypeConfigurator

id:String

the identifier used to distinguish this AnnotatedType from an other one based on the same underlying type

Returns:AnnotatedTypeConfigurator<T>

a non reusable AnnotatedTypeConfigurator to configure the new AnnotatedType

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
2.0
addInterceptorBindingback to summary
public void addInterceptorBinding(AnnotatedType<? extends 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:AnnotatedType<? extends Annotation>

The annotation type to treat as an interceptor binding type

Exceptions
IllegalStateException:
if called outside of the observer method invocation
addInterceptorBindingback to summary
public void addInterceptorBinding(Class<? extends Annotation> bindingType, 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:Class<? extends Annotation>

The annotation type to treat as an interceptor binding type

bindingTypeDef:Annotation[]

An optional list of annotations defining the interceptor

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
1.1
addQualifierback to summary
public void addQualifier(Class<? extends Annotation> qualifier)

Declares an annotation type as a javax.inject.Qualifier qualifier type.

This is only required if you wish to make an annotation a qualifier without adding Qualifier to it.

Parameters
qualifier:Class<? extends Annotation>

The annotation to treat as a qualifier

Exceptions
IllegalStateException:
if called outside of the observer method invocation
addQualifierback to summary
public void addQualifier(AnnotatedType<? extends Annotation> qualifier)

Declares an annotation type as a javax.inject.Qualifier qualifier type.

This is only required if you wish to make an annotation a qualifier without adding Qualifier to it.

Parameters
qualifier:AnnotatedType<? extends Annotation>

The annotation to treat as a qualifier

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
1.1
addScopeback to summary
public void addScope(Class<? extends 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 or Scope annotations to it. You can also use this method to override an existing normal scope definition.

Parameters
scopeType:Class<? extends Annotation>

The annotation type to treat as a scope type

normal:boolean

Indicates if the scope is normal

passivating:boolean

Indicates if the scope is passivation capable

Exceptions
IllegalStateException:
if called outside of the observer method invocation
See Also
AfterBeanDiscovery#addContext(javax.enterprise.context.spi.Context)
addStereotypeback to summary
public void addStereotype(Class<? extends Annotation> stereotype, 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:Class<? extends Annotation>

The annotation type to treat as a stereotype

stereotypeDef:Annotation[]

An optional list of annotations defining the stereotype

Exceptions
IllegalStateException:
if called outside of the observer method invocation
configureInterceptorBindingback to summary
public <T extends Annotation> AnnotatedTypeConfigurator<T> configureInterceptorBinding(Class<T> bindingType)

Obtains a new AnnotatedTypeConfigurator to configure a new javax.enterprise.inject.spi.AnnotatedType 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 (like javax.enterprise.util.Nonbinding on its members.

Parameters
bindingType:Class<T>

The annotation class used to initialized the configurator

Returns:AnnotatedTypeConfigurator<T>

a non reusable AnnotatedTypeConfigurator to configure the interceptor binding

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
2.0
configureQualifierback to summary
public <T extends Annotation> AnnotatedTypeConfigurator<T> configureQualifier(Class<T> qualifier)

Obtains a new AnnotatedTypeConfigurator to configure a new javax.enterprise.inject.spi.AnnotatedType and declares it as a javax.inject.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 (like javax.enterprise.util.Nonbinding on its members.

Parameters
qualifier:Class<T>

The annotation class used to initialized the configurator

Returns:AnnotatedTypeConfigurator<T>

a non reusable AnnotatedTypeConfigurator to configure the qualifier

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
2.0