public class Variant extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Variant.VariantListBuilder
A builder for a list of representation variants.
|
Constructor and Description |
---|
Variant(MediaType mediaType,
Locale language,
String encoding)
Create a new instance of Variant.
|
Variant(MediaType mediaType,
String language,
String encoding)
Create a new instance of Variant.
|
Variant(MediaType mediaType,
String language,
String country,
String encoding)
Create a new instance of Variant.
|
Variant(MediaType mediaType,
String language,
String country,
String languageVariant,
String encoding)
Create a new instance of Variant.
|
Modifier and Type | Method and Description |
---|---|
static Variant.VariantListBuilder |
encodings(String... encodings)
Create a
Variant.VariantListBuilder initialized with a set of supported
encodings. |
boolean |
equals(Object obj)
Compares obj to this variant to see if they are the same
considering all property values.
|
String |
getEncoding()
Get the encoding of the variant.
|
Locale |
getLanguage()
Get the language of the variant.
|
String |
getLanguageString()
Get the string representation of the variant language,
or
null if no language has been set. |
MediaType |
getMediaType()
Get the media type of the variant.
|
int |
hashCode()
Generate hash code from variant properties.
|
static Variant.VariantListBuilder |
languages(Locale... languages)
Create a
Variant.VariantListBuilder initialized with a set of supported
languages. |
static Variant.VariantListBuilder |
mediaTypes(MediaType... mediaTypes)
Create a
Variant.VariantListBuilder initialized with a set of supported
media types. |
String |
toString() |
public Variant(MediaType mediaType, String language, String encoding)
mediaType
- the media type of the variant - may be null
.language
- the language of the variant (two-letter ISO-639 code);
may be null
.encoding
- the content encoding of the variant - may be null
.IllegalArgumentException
- if all the parameters are null
.public Variant(MediaType mediaType, String language, String country, String encoding)
mediaType
- the media type of the variant - may be null
.language
- the language of the variant (two-letter ISO-639 code);
may be null
.country
- uppercase two-letter ISO-3166 language code of the variant;
may be null
provided language
is null
too.encoding
- the content encoding of the variant - may be null
.IllegalArgumentException
- if all the parameters are null
.public Variant(MediaType mediaType, String language, String country, String languageVariant, String encoding)
mediaType
- the media type of the variant - may be null
.language
- the language of the variant (two-letter ISO-639 code);
may be null
.country
- uppercase two-letter ISO-3166 language code of the variant;
may be null
provided language
is null
too.languageVariant
- vendor and browser specific language code of the variant
(see also Locale
class description);
may be null
provided language
and
country
are null
too.encoding
- the content encoding of the variant - may be null
.IllegalArgumentException
- if all the parameters are null
.public Variant(MediaType mediaType, Locale language, String encoding)
mediaType
- the media type of the variant - may be null
.language
- the language of the variant - may be null
.encoding
- the content encoding of the variant - may be null
.IllegalArgumentException
- if all the parameters are null
.public Locale getLanguage()
null
if none set.public String getLanguageString()
null
if no language has been set.null
if none set.public MediaType getMediaType()
null
if none set.public String getEncoding()
null
if none set.public static Variant.VariantListBuilder mediaTypes(MediaType... mediaTypes)
Variant.VariantListBuilder
initialized with a set of supported
media types.mediaTypes
- the available mediaTypes. If specific char-sets
are supported they should be included as parameters of the respective
media type.IllegalArgumentException
- if mediaTypes is null or
contains no elements.public static Variant.VariantListBuilder languages(Locale... languages)
Variant.VariantListBuilder
initialized with a set of supported
languages.languages
- the available languages.IllegalArgumentException
- if languages is null or
contains no elements.public static Variant.VariantListBuilder encodings(String... encodings)
Variant.VariantListBuilder
initialized with a set of supported
encodings.encodings
- the available encodings.IllegalArgumentException
- if encodings is null or
contains no elements.public int hashCode()
public boolean equals(Object obj)
Copyright © 1996-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.