public class BasicMediaRangeArrayHeader extends BasicStringHeader
Accept: application/json;q=0.9,text/xml;q=0.1
Constructor and Description |
---|
BasicMediaRangeArrayHeader(String name,
Object value)
Constructor
|
Modifier and Type | Method and Description |
---|---|
MediaRanges |
asMediaRanges()
Returns this header as a
MediaRanges object. |
MediaRange |
getRange(int index)
Returns the
MediaRange at the specified index. |
List<MediaRange> |
getRanges()
Returns the media ranges that make up this object.
|
String |
getValue() |
boolean |
hasSubtypePart(String part)
Convenience method for searching through all of the subtypes of all the media ranges in this header for the
presence of a subtype fragment.
|
int |
match(List<? extends MediaType> mediaTypes)
Given a list of media types, returns the best match for this
|
static BasicMediaRangeArrayHeader |
of(String name,
Object value)
Convenience creator.
|
static BasicMediaRangeArrayHeader |
of(String name,
Supplier<?> value)
Convenience creator using supplier.
|
assertString
assertName, assertValue, canCast, cast, eqIC, equals, getElements, getName, getRawValue, hashCode, isSupplier, of, ofPair, toString, unwrap
public BasicMediaRangeArrayHeader(String name, Object value)
public static BasicMediaRangeArrayHeader of(String name, Object value)
name
- The header name.value
- The header value.
String
BasicMediaRangeArrayHeader
object, or public static BasicMediaRangeArrayHeader of(String name, Supplier<?> value)
Header value is re-evaluated on each call to getValue()
.
name
- The header name.value
- The header value supplier.
String
BasicMediaRangeArrayHeader
object, or public MediaRanges asMediaRanges()
MediaRanges
object.MediaRanges
object.public int match(List<? extends MediaType> mediaTypes)
Note that fuzzy matching is allowed on the media types where the
For example, given identical q-values and an
The purpose for this is to allow serializers to match when artifacts such as
mediaTypes
- The media types to match against.public MediaRange getRange(int index)
MediaRange
at the specified index.index
- The index position of the media range.MediaRange
at the specified index or public boolean hasSubtypePart(String part)
For example, given the header hasSubtypePart(
returns
part
- The media type subtype fragment.public List<MediaRange> getRanges()
public String getValue()
getValue
in interface NameValuePair
getValue
in class BasicStringHeader
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.