Interface Producer<T>
- Type Parameters:
T- The class of object produced by the producer
- All Known Subinterfaces:
InjectionTarget<T>
Provides a generic operation for producing an instance of a type.
CDI Lite implementations are not required to provide support for Producer.
- Author:
- Pete Muir, David Allen
-
Method Summary
Modifier and TypeMethodDescriptionvoidDestroys the instance.Returns the set of allInjectionPoints.produce(CreationalContext<T> ctx) Causes an instance to be produced via theProducer.
-
Method Details
-
produce
Causes an instance to be produced via the
Producer.If the
Producerrepresents a managed bean, this will invoke the constructor annotatedInjectif it exists, or the constructor with no parameters otherwise. If the bean has interceptors or decorators,produce()is responsible for building the interceptors and decorators of the instance.If the
Producerrepresents a producer field or method, this will invoke the producer method on, or access the producer field of, a contextual instance of the bean that declares the producer.- Parameters:
ctx- TheCreationalContextto use for the produced object- Returns:
- the instance produced
-
dispose
Destroys the instance.
If the
Producerrepresents a managed bean, then this operation does only one thing: if the bean is auto-closeable and the class of the contextual instance implementsAutoCloseable,close()is called on the instance.If the
Producerrepresents a producer field or method, this calls the disposer method, if any, on a contextual instance of the bean that declares the disposer method or performs any additional required cleanup, if any, to destroy state associated with a resource. Then, if the bean is auto-closeable and the class of the contextual instance implementsAutoCloseable,close()is called on the instance.- Parameters:
instance- The instance to dispose
-
getInjectionPoints
Set<InjectionPoint> getInjectionPoints()Returns the set of all
InjectionPoints. If theProducerrepresents a managed bean, then this returns the set ofInjectionPointobjects representing all injected fields, bean constructor parameters and initializer method parameters. For a producer method, this returns the set ofInjectionPointobjects representing all parameters of the producer method. For a producer field, this returns an empty set.- Returns:
- the set of all injection points for the producer
-