Enum XContentType
java.lang.Object
java.lang.Enum<XContentType>
org.elasticsearch.common.xcontent.XContentType
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<XContentType>,java.lang.constant.Constable
public enum XContentType extends java.lang.Enum<XContentType>
The content type of
XContent.-
Nested Class Summary
-
Enum Constant Summary
-
Method Summary
Modifier and Type Method Description static XContentTypefromMediaType(java.lang.String mediaType)Attempts to match the given media type with the knownXContentTypevalues.static XContentTypefromMediaTypeOrFormat(java.lang.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.intindex()java.lang.StringmediaType()abstract java.lang.StringmediaTypeWithoutParameters()abstract java.lang.StringshortName()static XContentTypevalueOf(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 XContentxContent()
-
Enum Constant Details
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- 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 theAcceptHTTP header or a format query string parameter. 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 should not include any parameters. This method is suitable for parsing part of theContent-TypeHTTP header. This method will returnnullif no match is found -
index
public int index() -
mediaType
public java.lang.String mediaType() -
shortName
public abstract java.lang.String shortName() -
xContent
-
mediaTypeWithoutParameters
public abstract java.lang.String mediaTypeWithoutParameters()
-