Enum Class XContentType

java.lang.Object
java.lang.Enum<XContentType>
org.opensearch.common.xcontent.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.
  • Enum Constant Details

    • JSON

      public static final XContentType JSON
      A JSON based content type.
    • SMILE

      public static final XContentType SMILE
      The jackson based smile binary format. Fast and compact binary format.
    • YAML

      public static final XContentType YAML
      A YAML based content type.
    • CBOR

      public static final XContentType CBOR
      A CBOR based content type.
  • Method Details

    • values

      public static XContentType[] 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

      public static XContentType valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getMediaTypeParser

      public static org.opensearch.core.xcontent.MediaTypeParser getMediaTypeParser()
      gets the MediaTypeParser singleton for use outside class
    • fromFormat

      public static XContentType fromFormat(String mediaType)
      Accepts a format string, which is most of the time is equivalent to MediaType.subtype() and attempts to match the value to an XContentType. The comparisons are done in lower case format. This method will return null if no match is found
    • fromMediaType

      public static XContentType fromMediaType(String mediaTypeHeaderValue)
      Attempts to match the given media type with the known XContentType values. This match is done in a case-insensitive manner. The provided media type can optionally has parameters. This method is suitable for parsing of the Content-Type and Accept HTTP headers. This method will return null if no match is found
    • index

      public int index()
    • type

      public String type()
      Specified by:
      type in interface org.opensearch.core.xcontent.MediaType
    • format

      public String format()
      Specified by:
      format in interface org.opensearch.core.xcontent.MediaType
    • fromMediaType

      public static XContentType fromMediaType(org.opensearch.core.xcontent.MediaType mediaType)
      Converts from a MediaType to an explicit XContentType