Top Description Methods
javax.enterprise.inject.spi

public Interface ProducerFactory<X>

Type Parameters
<X>
type of the bean containing the producer

An ProducerFactory can create an Producer for a given bean.

The ProducerFactory obtained from BeanManager#getProducerFactory(AnnotatedMethod, Bean) or BeanManager#getProducerFactory(AnnotatedField, Bean) is capable of providing container created producers. This factory can be wrapped to add behavior to container created producers.

For example:

BeanAttributes<MyBean> myBeanAttributes = beanManager.createBeanAttributes(myBeanAnnotatedFieldField);
beanManager.createBean(myBeanAttributes, MyBean.class, new ProducerFactory() {

    public <T> Producer<T> createProducer(Bean<T> bean) {
        return new WrappingProducer<T>(beanManager.getProducerFactory(myBeanAnnotatedField).createProducer(bean));
    }
});
Author
Pete Muir
Since
1.1

Method Summary

Modifier and TypeMethod and Description
public <T> Producer<T>

Returns:

the producer
createProducer
(Bean<T>
the bean to create the producer for, or null if creating a non-contextual object
bean
)

Create a new producer for a bean.

Method Detail

createProducerback to summary
public <T> Producer<T> createProducer(Bean<T> bean)

Create a new producer for a bean.

Parameters
bean:Bean<T>

the bean to create the producer for, or null if creating a non-contextual object

Returns:Producer<T>

the producer