Top Description Methods
javax.enterprise.inject.spi

public Interface Producer<T>

Known Direct Subinterfaces
javax.enterprise.inject.spi.InjectionTarget
Type Parameters
<T>
The class of object produced by the producer
Imports
java.util.Set, javax.enterprise.context.spi.CreationalContext

Provides a generic operation for producing an instance of a type.

Authors
Pete Muir, David Allen

Method Summary

Modifier and TypeMethod and Description
public void
dispose(T
The instance to dispose
instance
)

Destroys the instance.

public Set<InjectionPoint>

Returns:

the set of all injection points for the producer
getInjectionPoints
()

Returns the set of all InjectionPoints.

public T

Returns:

the instance produced
produce
(CreationalContext<T>
The javax.enterprise.context.spi.CreationalContext to use for the produced object
ctx
)

Causes an instance to be produced via the Producer.

Method Detail

disposeback to summary
public void dispose(T instance)

Destroys the instance.

If the Producer represents a class, then this operation does nothing.

If the Producer represents 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.

Parameters
instance:T

The instance to dispose

getInjectionPointsback to summary
public Set<InjectionPoint> getInjectionPoints()

Returns the set of all InjectionPoints. If the Producer represents a class, then this returns returns the set of InjectionPoint objects representing all injected fields, bean constructor parameters and initializer method parameters. For a producer method, this returns the set of InjectionPoint objects representing all parameters of the producer method.

Returns:Set<InjectionPoint>

the set of all injection points for the producer

produceback to summary
public T produce(CreationalContext<T> ctx)

Causes an instance to be produced via the Producer.

If the Producer represents a class, this will invoke the constructor annotated javax.inject.Inject if it exists, or the constructor with no parameters otherwise. If the class has interceptors, produce() is responsible for building the interceptors and decorators of the instance.

If the Producer represents 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:CreationalContext<T>

The javax.enterprise.context.spi.CreationalContext to use for the produced object

Returns:T

the instance produced