Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package javax.enterprise.inject.spi;

An ProducerFactory can create an Producer for a given bean.

The ProducerFactory obtained from BeanManager.getProducerFactory(javax.enterprise.inject.spi.AnnotatedMethod,javax.enterprise.inject.spi.Bean) or BeanManager.getProducerFactory(javax.enterprise.inject.spi.AnnotatedField,javax.enterprise.inject.spi.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));

Pete Muir
public interface ProducerFactory<X> {

Create a new producer for a bean.

bean the bean to create the producer for, or null if creating a non-contextual object
the producer
    public <T> Producer<T> createProducer(Bean<T> bean);
New to GrepCode? Check out our FAQ X