Package org.elasticsearch.xcontent
Enum Class XContentType
- All Implemented Interfaces:
Serializable
,Comparable<XContentType>
,Constable
The content type of
XContent
.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic XContentType
fromMediaType
(String mediaType) Attempts to match the given media type with the knownXContentType
values.static XContentType
fromMediaTypeOrFormat
(String mediaType) Accepts either a format string, which is equivalent toshortName()
or a media type that optionally has parameters and attempts to match the value to anXContentType
.int
index()
abstract String
abstract String
static XContentType
Returns 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.abstract XContent
xContent()
-
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.
-
-
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
-
fromMediaTypeOrFormat
Accepts either a format string, which is equivalent toshortName()
or a media type that optionally has parameters and attempts to match the value to anXContentType
. The comparisons are done in lower case format and this method also supports a wildcard accept forapplication/*
. This method can be used to parse theAccept
HTTP header or a format query string parameter. This method will returnnull
if no match is found -
fromMediaType
Attempts to match the given media type with the knownXContentType
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 theContent-Type
HTTP header. This method will returnnull
if no match is found -
index
public int index() -
mediaType
-
shortName
-
xContent
-
mediaTypeWithoutParameters
-