- java.lang.Object
-
- javax.ws.rs.core.Variant.VariantListBuilder
-
-
Constructor Summary
Constructors Modifier Constructor and Description protected
VariantListBuilder()
Protected constructor, use the staticnewInstance
method to obtain an instance.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract Variant.VariantListBuilder
add()
Add the current combination of metadata to the list of supported variants, after this method is called the current combination of metadata is emptied.abstract List<Variant>
build()
Add the current combination of metadata to the list of supported variants (provided the current combination of metadata is not empty) and build a list of representation variants from the current state of the builder.abstract Variant.VariantListBuilder
encodings(String... encodings)
Set the encoding(s) for this variant.abstract Variant.VariantListBuilder
languages(Locale... languages)
Set the language(s) for this variant.abstract Variant.VariantListBuilder
mediaTypes(MediaType... mediaTypes)
Set the media type(s) for this variant.static Variant.VariantListBuilder
newInstance()
Create a new builder instance.
-
-
-
Constructor Detail
-
VariantListBuilder
protected VariantListBuilder()
Protected constructor, use the staticnewInstance
method to obtain an instance.
-
-
Method Detail
-
newInstance
public static Variant.VariantListBuilder newInstance()
Create a new builder instance.- Returns:
- a new builder instance.
-
build
public abstract List<Variant> build()
Add the current combination of metadata to the list of supported variants (provided the current combination of metadata is not empty) and build a list of representation variants from the current state of the builder. After this method is called the builder is reset to an empty state.- Returns:
- a list of representation variants.
-
add
public abstract Variant.VariantListBuilder add()
Add the current combination of metadata to the list of supported variants, after this method is called the current combination of metadata is emptied.If more than one value is supplied for one or more of the variant properties then a variant will be generated for each possible combination. E.g. in the following
list
would have five (4 + 1) members:List
list = VariantListBuilder.newInstance() .languages(Locale.ENGLISH, Locale.FRENCH).encodings("zip", "identity").add() .languages(Locale.GERMAN).mediaTypes(MediaType.TEXT_PLAIN_TYPE).add() .build() Note that it is not necessary to call the
add()
method immediately before the build method is called. E.g. the resulting list produced in the example above would be identical to the list produced by the following code:List
list = VariantListBuilder.newInstance() .languages(Locale.ENGLISH, Locale.FRENCH).encodings("zip", "identity").add() .languages(Locale.GERMAN).mediaTypes(MediaType.TEXT_PLAIN_TYPE) .build() - Returns:
- the updated builder.
- Throws:
IllegalStateException
- if there is not at least one mediaType, language or encoding set for the current variant.
-
languages
public abstract Variant.VariantListBuilder languages(Locale... languages)
Set the language(s) for this variant.- Parameters:
languages
- the available languages.- Returns:
- the updated builder.
-
encodings
public abstract Variant.VariantListBuilder encodings(String... encodings)
Set the encoding(s) for this variant.- Parameters:
encodings
- the available encodings.- Returns:
- the updated builder.
-
mediaTypes
public abstract Variant.VariantListBuilder mediaTypes(MediaType... mediaTypes)
Set the media type(s) for this variant.- Parameters:
mediaTypes
- the available mediaTypes. If specific charsets are supported they should be included as parameters of the respective media type.- Returns:
- the updated builder.
-
-
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/ws/rs/core/Variant.VariantListBuilder.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.