- All Implemented Interfaces:
Serializable,Comparable<XContentType>,Constable,MediaType
The content type of
XContent.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>Nested classes/interfaces inherited from interface org.elasticsearch.xcontent.MediaType
MediaType.HeaderValue -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionA CBOR based content type.A JSON based content type.The jackson based smile binary format.A Versioned CBOR based content type.A versioned JSON based content type.Versioned jackson based smile binary format.A Versioned YAML based content type.A YAML based content type. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MediaTypeRegistry<XContentType> static final StringFields inherited from interface org.elasticsearch.xcontent.MediaType
COMPATIBLE_WITH_PARAMETER_NAME, VERSION_PATTERN -
Method Summary
Modifier and TypeMethodDescriptionReturns a canonical XContentType for this XContentType.static XContentTypefromFormat(String format) Accepts a format string, which is most of the time is equivalent to MediaType's subtype i.e.static XContentTypefromMediaType(String mediaTypeHeaderValue) Attempts to match the given media type with the knownXContentTypevalues.intindex()abstract Stringstatic XContentTypeofOrdinal(int ordinal) static ByteparseVersion(String mediaType) static XContentTypeReturns the enum constant of this class with the specified name.static XContentType[]values()Returns an array containing the constants of this enum class, in the order they are declared.final XContentxContent()Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface org.elasticsearch.xcontent.MediaType
headerValues, queryParameter
-
Enum Constant Details
-
JSON
A JSON based content type. -
SMILE
The jackson based smile binary format. Fast and compact binary format. -
YAML
A YAML based content type. -
CBOR
A CBOR based content type. -
VND_JSON
A versioned JSON based content type. -
VND_SMILE
Versioned jackson based smile binary format. Fast and compact binary format. -
VND_YAML
A Versioned YAML based content type. -
VND_CBOR
A Versioned CBOR based content type.
-
-
Field Details
-
MEDIA_TYPE_REGISTRY
-
VENDOR_APPLICATION_PREFIX
- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
fromFormat
Accepts a format string, which is most of the time is equivalent to MediaType's subtype i.e.application/jsonand attempts to match the value to anXContentType. The comparisons are done in lower case format. This method will returnnullif no match is found -
fromMediaType
public static XContentType fromMediaType(String mediaTypeHeaderValue) throws IllegalArgumentException Attempts to match the given media type with the knownXContentTypevalues. This match is done in a case-insensitive manner. The provided media type can optionally has parameters. This method is suitable for parsing of theContent-TypeandAcceptHTTP headers. This method will returnnullif no match is found- Throws:
IllegalArgumentException
-
parseVersion
-
index
public int index() -
mediaType
-
xContent
-
mediaTypeWithoutParameters
-
toParsedMediaType
-
canonical
Returns a canonical XContentType for this XContentType. A canonical XContentType is used to serialize or deserialize the data from/to for HTTP. More specialized XContentType types such as vnd* variants still use the general data structure, but may have semantic differences. Example: XContentType.VND_JSON has a canonical XContentType.JSON XContentType.JSON has a canonical XContentType.JSON -
ofOrdinal
-