Class Variant.VariantListBuilder
java.lang.Object
javax.ws.rs.core.Variant.VariantListBuilder
- Enclosing class:
Variant
A builder for a list of representation variants.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected constructor, use the staticnewInstancemethod to obtain an instance. -
Method Summary
Modifier and TypeMethodDescriptionabstract Variant.VariantListBuilderadd()Add the current combination of metadata to the list of supported variants, after this method is called the current combination of metadata is emptied.build()Build a list of representation variants from the current state of the builder.abstract Variant.VariantListBuilderSet the encoding[s] for this variant.abstract Variant.VariantListBuilderSet the language[s] for this variant.abstract Variant.VariantListBuildermediaTypes(MediaType... mediaTypes) Set the media type[s] for this variant.static Variant.VariantListBuilderCreate a new builder instance.
-
Constructor Details
-
VariantListBuilder
protected VariantListBuilder()Protected constructor, use the staticnewInstancemethod to obtain an instance.
-
-
Method Details
-
newInstance
Create a new builder instance.- Returns:
- a new Builder
-
build
-
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 followinglistwould have four members:List
list = VariantListBuilder.newInstance().languages("en","fr") .encodings("zip", "identity").add().build() - Returns:
- the updated builder
- Throws:
IllegalStateException- if there is not at least one mediaType, language or encoding set for the current variant.
-
languages
Set the language[s] for this variant.- Parameters:
languages- the available languages- Returns:
- the updated builder
-
encodings
Set the encoding[s] for this variant.- Parameters:
encodings- the available encodings- Returns:
- the updated builder
-
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
-