-
- Type Parameters:
T
- The class of object produced by the producer
- All Known Subinterfaces:
- InjectionTarget<T>
public interface Producer<T>
Provides a generic operation for producing an instance of a type.
- Author:
- Pete Muir, David Allen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
dispose(T instance)
Destroys the instance.Set<InjectionPoint>
getInjectionPoints()
Returns the set of allInjectionPoints
.T
produce(CreationalContext<T> ctx)
Causes an instance to be produced via theProducer
.
-
-
-
Method Detail
-
produce
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 annotatedInject
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
- TheCreationalContext
to use for the produced object- Returns:
- the instance produced
-
dispose
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
- The instance to dispose
-
getInjectionPoints
Set<InjectionPoint> getInjectionPoints()
Returns the set of all
InjectionPoints
. If theProducer
represents a class, then this returns returns the set ofInjectionPoint
objects representing all injected fields, bean constructor parameters and initializer method parameters. For a producer method, this returns the set ofInjectionPoint
objects representing all parameters of the producer method.- Returns:
- the set of all injection points for the producer
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
22/08/2025 01:37:12 Cette version de la page est en cache (à la date du 22/08/2025 01:37:12) afin d'accélérer le traitement.Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.
Document créé le 11/06/2005, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/enterprise/inject/spi/producer.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.