java.io.Serializable
, java.lang.Comparable<XContentType>
public enum XContentType extends java.lang.Enum<XContentType>
XContent
.Enum Constant | Description |
---|---|
CBOR |
A CBOR based content type.
|
JSON |
A JSON based content type.
|
SMILE |
The jackson based smile binary format.
|
YAML |
A YAML based content type.
|
Modifier and Type | Method | Description |
---|---|---|
static XContentType |
fromMediaType(java.lang.String mediaType) |
Attempts to match the given media type with the known
XContentType values. |
static XContentType |
fromMediaTypeOrFormat(java.lang.String mediaType) |
Accepts either a format string, which is equivalent to
shortName() or a media type that optionally has
parameters and attempts to match the value to an XContentType . |
int |
index() |
|
java.lang.String |
mediaType() |
|
abstract java.lang.String |
mediaTypeWithoutParameters() |
|
abstract java.lang.String |
shortName() |
|
static XContentType |
valueOf(java.lang.String name) |
Returns the enum constant of this type with the specified name.
|
static XContentType[] |
values() |
Returns an array containing the constants of this enum type, in
the order they are declared.
|
abstract XContent |
xContent() |
public static final XContentType JSON
public static final XContentType SMILE
public static final XContentType YAML
public static final XContentType CBOR
public static XContentType[] values()
for (XContentType c : XContentType.values()) System.out.println(c);
public static XContentType valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic static XContentType fromMediaTypeOrFormat(java.lang.String mediaType)
shortName()
or a media type that optionally has
parameters and attempts to match the value to an XContentType
. The comparisons are done in lower case format and this method
also supports a wildcard accept for application/*
. This method can be used to parse the Accept
HTTP header or a
format query string parameter. This method will return null
if no match is foundpublic static XContentType fromMediaType(java.lang.String mediaType)
XContentType
values. This match is done in a case-insensitive manner.
The provided media type should not include any parameters. This method is suitable for parsing part of the Content-Type
HTTP header. This method will return null
if no match is foundpublic int index()
public java.lang.String mediaType()
public abstract java.lang.String shortName()
public abstract XContent xContent()
public abstract java.lang.String mediaTypeWithoutParameters()