Package org.opensearch.common.xcontent
Enum Class XContentType
- All Implemented Interfaces:
Serializable,Comparable<XContentType>,Constable,org.opensearch.core.xcontent.MediaType
public enum XContentType
extends Enum<XContentType>
implements org.opensearch.core.xcontent.MediaType
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
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionformat()static XContentTypefromFormat(String mediaType) Accepts a format string, which is most of the time is equivalent toMediaType.subtype()and attempts to match the value to anXContentType.static XContentTypefromMediaType(String mediaTypeHeaderValue) Attempts to match the given media type with the knownXContentTypevalues.static XContentTypefromMediaType(org.opensearch.core.xcontent.MediaType mediaType) Converts from aMediaTypeto an explicitXContentTypestatic org.opensearch.core.xcontent.MediaTypeParsergets theMediaTypeParsersingleton for use outside classintindex()type()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.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface org.opensearch.core.xcontent.MediaType
mediaType, mediaTypeWithoutParameters, subtype, typeWithSubtype, 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
-
getMediaTypeParser
public static org.opensearch.core.xcontent.MediaTypeParser getMediaTypeParser()gets theMediaTypeParsersingleton for use outside class -
fromFormat
Accepts a format string, which is most of the time is equivalent toMediaType.subtype()and attempts to match the value to anXContentType. The comparisons are done in lower case format. This method will returnnullif no match is found -
fromMediaType
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 -
index
public int index() -
type
- Specified by:
typein interfaceorg.opensearch.core.xcontent.MediaType
-
format
- Specified by:
formatin interfaceorg.opensearch.core.xcontent.MediaType
-
fromMediaType
Converts from aMediaTypeto an explicitXContentType
-