Enum Class XContentType

All Implemented Interfaces:
Serializable, Comparable<XContentType>, Constable

public enum XContentType extends Enum<XContentType>
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.
      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.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromMediaTypeOrFormat

      public static XContentType fromMediaTypeOrFormat(String mediaType)
      Accepts either a format string, which is equivalent to shortName() or a media type that optionally has parameters and attempts to match the value to an XContentType. The comparisons are done in lower case format and this method also supports a wildcard accept for application/*. This method can be used to parse the Accept HTTP header or a format query string parameter. This method will return null if no match is found
    • fromMediaType

      public static XContentType fromMediaType(String mediaType)
      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 should not include any parameters. This method is suitable for parsing part of the Content-Type HTTP header. This method will return null if no match is found
    • index

      public int index()
    • mediaType

      public String mediaType()
    • shortName

      public abstract String shortName()
    • xContent

      public abstract XContent xContent()
    • mediaTypeWithoutParameters

      public abstract String mediaTypeWithoutParameters()