The container fires an event of this type for each producer method or field of each enabled bean, including resources.
Any observer of this event is permitted to wrap and/or replace the Producer by calling either
setProducer(Producer) or configureProducer(). If both methods are called within an observer notification an
IllegalStateException is thrown. The container must use the final value of this property, after all observers have
been called, whenever it calls the producer or disposer.
For example, this observer decorates the Producer for the all producer methods and field of type
EntityManager.
void decorateEntityManager(@Observes ProcessProducer<?, EntityManager> pp) {
pit.setProducer(decorate(pp.getProducer()));
}
If any observer method of a ProcessProducer 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.
Producer
| Modifier and Type | Method and Description |
|---|---|
| public void | addDefinitionError(Throwable
The definition error to register as a t)java.lang.ThrowableRegisters a definition error with the container, causing the container to abort deployment after bean discovery is complete. |
| public ProducerConfigurator | configureProducer()
Returns a |
| public AnnotatedMember | Returns: theAnnotatedMember representing the producerReturns the |
| public Producer | Returns: theProducer invoker object used by the containerReturns the |
| public void | setProducer(Producer<X>
the new producer)Producer object to useReplaces the |
| addDefinitionError | back to summary |
|---|---|
| public void addDefinitionError(Throwable t) Registers a definition error with the container, causing the container to abort deployment after bean discovery is complete.
| |
| configureProducer | back to summary |
|---|---|
| public ProducerConfigurator Returns a Each call returns the same configurator instance within an observer notification.
| |
| getAnnotatedMember | back to summary |
|---|---|
| public AnnotatedMember Returns the
| |
| getProducer | back to summary |
|---|---|
| public Producer Returns the
| |
| setProducer | back to summary |
|---|---|
| public void setProducer(Producer<X> producer) Replaces the
| |