-
@Retention(value=RUNTIME) @Target(value=TYPE) @Inherited public @interface FacesConverter
The presence of this annotation on a class automatically registers the class with the runtime as a
Converter
. The value of thevalue()
attribute is taken to be converter-id, the value of theforClass()
attribute is taken to be converter-for-class and the fully qualified class name of the class to which this annotation is attached is taken to be the converter-class. The implementation must guarantee that for each class annotated withFacesConverter
, found with the algorithm in section JSF.11.5, the proper variant ofApplication.addConverter()
is called. If converter-id is not the empty string,Application.addConverter(java.lang.String,java.lang.String)
is called, passing the derived converter-id as the first argument and the derived converter-class as the second argument. If converter-id is the empty string,Application.addConverter(java.lang.Class,java.lang.String)
is called, passing the converter-for-class as the first argument and the derived converter-class as the second argument. The implementation must guarantee that all such calls toaddConverter()
happen during application startup time and before any requests are serviced.The preceding text contains an important subtlety which application users should understand. It is not possible to use a single
@FacesConverter
annotation to register a singleConverter
implementation both in theby-class
and theby-converter-id
data structures. One way to achieve this result is to put the actual converter logic in an abstract base class, without a@FacesConverter
annotation, and derive two sub-classes, each with a@FacesConverter
annotation. One sub-class has avalue
attribute but noforClass
attribute, and the other sub-class has the converse.Please see the ViewDeclarationLanguage documentation for
<h:selectManyListBox>
for another important subtlety regarding converters and collections.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element and Description Class
forClass
The value of this annotation attribute is taken to be the converter-for-class with which instances of this class of converter can be instantiated by calling
Application.createConverter(java.lang.Class)
.String
value
The value of this annotation attribute is taken to be the converter-id with which instances of this class of converter can be instantiated by calling
Application.createConverter(java.lang.String)
.
-
-
-
Element Detail
-
value
public abstract String value
The value of this annotation attribute is taken to be the converter-id with which instances of this class of converter can be instantiated by calling
Application.createConverter(java.lang.String)
.- Default:
- ""
-
-
-
forClass
public abstract Class forClass
The value of this annotation attribute is taken to be the converter-for-class with which instances of this class of converter can be instantiated by calling
Application.createConverter(java.lang.Class)
.- Default:
- java.lang.Object.class
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/faces/convert/FacesConverter.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.