-
- Type Parameters:
T
- The class of the bean
public interface ProcessBeanAttributes<T>
The container fires an event of this type for each enabled bean, interceptor or decorator deployed in a bean archive before registering the
Bean
object.Any observer of this event is permitted to wrap and/or replace the
BeanAttributes
by calling eithersetBeanAttributes(BeanAttributes)
orconfigureBeanAttributes()
. If both methods are called within an observer notification anIllegalStateException
is thrown. The container must use the final value of this property, after all observers have been called, to manage instances of the bean.If any observer method of a
ProcessBeanAttributes
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.
- Since:
- 1.1
- Author:
- Pete Muir, Antoine Sabot-Durand
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addDefinitionError(java.lang.Throwable t)
Registers a definition error with the container, causing the container to abort deployment after bean discovery is complete.BeanAttributesConfigurator<T>
configureBeanAttributes()
returns aBeanAttributesConfigurator
initialized with theBeanAttributes
processed by this event to configure a new BeanAttributes that will replace the original one at the end of the observer invocation.Annotated
getAnnotated()
BeanAttributes<T>
getBeanAttributes()
void
ignoreFinalMethods()
Instructs the container to ignore all non-static, final methods with public, protected or default visibility declared on any bean type of the specific bean during validation of injection points that require proxyable bean type.void
setBeanAttributes(BeanAttributes<T> beanAttributes)
Replaces theBeanAttributes
.void
veto()
Forces the container to ignore the bean.
-
-
-
Method Detail
-
getAnnotated
Annotated getAnnotated()
- Returns:
- the
AnnotatedType
representing the managed bean class or session bean class, theAnnotatedMethod
representing the producer field, or theAnnotatedField
representing the producer field - Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation
-
getBeanAttributes
BeanAttributes<T> getBeanAttributes()
- Returns:
- the
BeanAttributes
object that will be used by the container to manage instances of the bean - Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation
-
setBeanAttributes
void setBeanAttributes(BeanAttributes<T> beanAttributes)
Replaces theBeanAttributes
.- Parameters:
beanAttributes
- the newBeanAttributes
to use- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation
-
configureBeanAttributes
BeanAttributesConfigurator<T> configureBeanAttributes()
returns aBeanAttributesConfigurator
initialized with theBeanAttributes
processed by this event to configure a new BeanAttributes that will replace the original one at the end of the observer invocation. Each call returns the same BeanAttributesConfigurator.- Returns:
- a non reusable
BeanAttributesConfigurator
to configure the replacing BeanAttributes - Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation- Since:
- 2.0
-
addDefinitionError
void addDefinitionError(java.lang.Throwable t)
Registers a definition error with the container, causing the container to abort deployment after bean discovery is complete.- Parameters:
t
- the error to add- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation
-
veto
void veto()
Forces the container to ignore the bean.- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation
-
ignoreFinalMethods
void ignoreFinalMethods()
Instructs the container to ignore all non-static, final methods with public, protected or default visibility declared on any bean type of the specific bean during validation of injection points that require proxyable bean type.
These method should never be invoked upon bean instances. Otherwise, unpredictable behavior results.
- Throws:
java.lang.IllegalStateException
- if called outside of the observer method invocation- Since:
- 2.0
-
-