X
- type of the bean containing the producerpublic interface ProducerFactory<X>
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)); } });
Modifier and Type | Method and Description |
---|---|
<T> Producer<T> |
createProducer(Bean<T> bean)
Create a new producer for a bean.
|
Copyright © 1996-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.