Top Description Methods
javax.enterprise.inject.spi

public Interface AfterBeanDiscovery

Imports
javax.enterprise.context.spi.Context, javax.enterprise.inject.spi.configurator.BeanConfigurator, .ObserverMethodConfigurator

The 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 javax.enterprise.inject.spi.Bean and javax.enterprise.inject.spi.ObserverMethod objects 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 AfterBeanDiscovery event throws an exception, the exception is treated as a definition error by the container.

Authors
David Allen, Antoine Sabot-Durand

Method Summary

Modifier and TypeMethod and Description
public void
addBean(Bean<?>
The bean to add to the deployment
bean
)

Fires an event of type javax.enterprise.inject.spi.ProcessBean containing the given javax.enterprise.inject.spi.Bean and then registers the javax.enterprise.inject.spi.Bean with the container, thereby making a bean which is not an interceptor nor a decorator available for injection into other beans.

public <T> BeanConfigurator<T>

Returns:

a non reusable BeanConfigurator to configure the bean to add
addBean
()

Obtains a new BeanConfigurator to configure a new Bean and add it at the end of the observer invocation.

public void
addContext(Context
The custom context to add to the deployment
context
)

Registers a custom javax.enterprise.context.spi.Context object with the container.

public void
addDefinitionError(Throwable
The definition error as a java.lang.Throwable
t
)

Registers a definition error with the container, causing the container to abort deployment after all observers have been notified.

public void
addObserverMethod(ObserverMethod<?>
The custom observer method to add to the deployment
observerMethod
)

Fires an event of type javax.enterprise.inject.spi.ProcessObserverMethod containing the given javax.enterprise.inject.spi.ObserverMethod and then registers the javax.enterprise.inject.spi.ObserverMethod with the container, thereby making it available for event notifications.

public <T> ObserverMethodConfigurator<T>

Returns:

a non reusable ObserverMethodConfigurator instance
addObserverMethod
()

obtains a new ObserverMethodConfigurator to configure a new ObserverMethod and add it at the end of the observer invocation.

public <
the class or interface
T
>
AnnotatedType<T>

Returns:

the AnnotatedType
getAnnotatedType
(Class<T>
the java.lang.Class object
type
,
String
the type identifier. If null, the fully qualifier class name of type is used
id
)

Obtain the AnnotatedType that may be used to read the annotations of the given class or interface as defined during container initialization.

public <
the class or interface
T
>
Iterable<AnnotatedType<T>>

Returns:

the AnnotatedTypes
getAnnotatedTypes
(Class<T>
the java.lang.Class object
type
)

Obtain the AnnotatedTypes that may be used to read the annotations of the given class or interface as defined during container initialization.

Method Detail

addBeanback to summary
public void addBean(Bean<?> bean)

Fires an event of type javax.enterprise.inject.spi.ProcessBean containing the given javax.enterprise.inject.spi.Bean and then registers the javax.enterprise.inject.spi.Bean with the container, thereby making a bean which is not an interceptor nor a decorator available for injection into other beans. The given javax.enterprise.inject.spi.Bean may implement javax.enterprise.inject.spi.Interceptor or javax.decorator.Decorator.

Parameters
bean:Bean<?>

The bean to add to the deployment

Exceptions
IllegalStateException:
if called outside of the observer method invocation
addBeanback to summary
public <T> BeanConfigurator<T> addBean()

Obtains a new BeanConfigurator to configure a new Bean and add it at the end of the observer invocation. It will then fire an event of type javax.enterprise.inject.spi.ProcessBean containing the built javax.enterprise.inject.spi.Bean from this configuration and then register it with the container, thereby making it available for injection into other beans. Each call returns a new BeanConfigurator.

Returns:BeanConfigurator<T>

a non reusable BeanConfigurator to configure the bean to add

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
2.0
addContextback to summary
public void addContext(Context context)

Registers a custom javax.enterprise.context.spi.Context object with the container.

Parameters
context:Context

The custom context to add to the deployment

Exceptions
IllegalStateException:
if called outside of the observer method invocation
addDefinitionErrorback to summary
public void addDefinitionError(Throwable t)

Registers a definition error with the container, causing the container to abort deployment after all observers have been notified.

Parameters
t:Throwable

The definition error as a java.lang.Throwable

Exceptions
IllegalStateException:
if called outside of the observer method invocation
addObserverMethodback to summary
public void addObserverMethod(ObserverMethod<?> observerMethod)

Fires an event of type javax.enterprise.inject.spi.ProcessObserverMethod containing the given javax.enterprise.inject.spi.ObserverMethod and then registers the javax.enterprise.inject.spi.ObserverMethod with the container, thereby making it available for event notifications.

Parameters
observerMethod:ObserverMethod<?>

The custom observer method to add to the deployment

Exceptions
IllegalStateException:
if called outside of the observer method invocation
addObserverMethodback to summary
public <T> ObserverMethodConfigurator<T> addObserverMethod()

obtains a new ObserverMethodConfigurator to configure a new ObserverMethod and add it at the end of the observer invocation. It will then fire an event of type javax.enterprise.inject.spi.ProcessObserverMethod containing the built javax.enterprise.inject.spi.ObserverMethod from this configuration and then registers the javax.enterprise.inject.spi.ObserverMethod with the container, thereby making it available for event notifications. Each call returns a new ObserverMethodConfigurator.

Returns:ObserverMethodConfigurator<T>

a non reusable ObserverMethodConfigurator instance

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
2.0
getAnnotatedTypeback to summary
public <T> AnnotatedType<T> getAnnotatedType(Class<T> type, String id)

Obtain the AnnotatedType that may be used to read the annotations of the given class or interface as defined during container initialization.

Parameters
<T>
the class or interface
type:Class<T>

the java.lang.Class object

id:String

the type identifier. If null, the fully qualifier class name of type is used

Returns:AnnotatedType<T>

the AnnotatedType

Exceptions
IllegalStateException:
if called outside of the observer method invocation
Since
1.1
getAnnotatedTypesback to summary
public <T> Iterable<AnnotatedType<T>> getAnnotatedTypes(Class<T> type)

Obtain the AnnotatedTypes that may be used to read the annotations of the given class or interface as defined during container initialization.

Parameters
<T>
the class or interface
type:Class<T>

the java.lang.Class object

Returns:Iterable<AnnotatedType<T>>

the AnnotatedTypes

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