public class Variant
extends java.lang.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,
java.util.Locale language,
java.lang.String encoding)
Create a new instance of Variant
|
Modifier and Type | Method and Description |
---|---|
static Variant.VariantListBuilder |
encodings(java.lang.String... encodings)
Create a
Variant.VariantListBuilder initialized with a set of supported
encodings. |
boolean |
equals(java.lang.Object obj)
Compares obj to this variant to see if they are the same
considering all property values.
|
java.lang.String |
getEncoding()
Get the encoding of the variant
|
java.util.Locale |
getLanguage()
Get the language of the variant
|
MediaType |
getMediaType()
Get the media type of the variant
|
int |
hashCode()
Generate hash code from variant properties.
|
static Variant.VariantListBuilder |
languages(java.util.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. |
java.lang.String |
toString() |
public Variant(MediaType mediaType, java.util.Locale language, java.lang.String encoding)
mediaType
- the media type of the variant - may be nulllanguage
- the language of the variant - may be nullencoding
- the content encoding of the variant - may be nulljava.lang.IllegalArgumentException
- if all three parameters are
nullpublic java.util.Locale getLanguage()
public MediaType getMediaType()
public java.lang.String getEncoding()
public static Variant.VariantListBuilder mediaTypes(MediaType... mediaTypes)
Variant.VariantListBuilder
initialized with a set of supported
media types.mediaTypes
- the available mediaTypes. If specific charsets
are supported they should be included as parameters of the respective
media type.java.lang.IllegalArgumentException
- if mediaTypes is null or
contains no elements.public static Variant.VariantListBuilder languages(java.util.Locale... languages)
Variant.VariantListBuilder
initialized with a set of supported
languages.languages
- the available languages.java.lang.IllegalArgumentException
- if languages is null or
contains no elements.public static Variant.VariantListBuilder encodings(java.lang.String... encodings)
Variant.VariantListBuilder
initialized with a set of supported
encodings.encodings
- the available encodings.java.lang.IllegalArgumentException
- if encodings is null or
contains no elements.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare topublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2016 Oracle Corporation. All Rights Reserved.