com.holonplatform.http

## Enum MediaType

- java.lang.Object
- - java.lang.Enum<MediaType>
  - - com.holonplatform.http.MediaType

- All Implemented Interfaces:
    Serializable, Comparable<MediaType>

      public enum MediaType
      extends Enum<MediaType>

  Enumeration of common media types used by REST services.
  Since:
    5.0.0

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `APPLICATION_FORM_URLENCODED` application/x-www-form-urlencoded media type
    `APPLICATION_JSON` application/json media type
    `APPLICATION_JSON_UTF8` application/json media type with UTF8 charset parameter
    `APPLICATION_OCTET_STREAM` application/octet-stream media type
    `APPLICATION_PDF` application/pdf media type
    `APPLICATION_SVG_XML` application/svg+xml media type
    `APPLICATION_XML` application/xml media type
    `IMAGE_GIF` image/gif media type
    `IMAGE_JPEG` image/jpeg media type
    `IMAGE_PNG` image/png media type
    `MULTIPART_FORM_DATA` multipart/form-data media type
    `TEXT_HTML` text/html media type
    `TEXT_MARKDOWN` text/markdown media type
    `TEXT_PLAIN` text/plain media type
    `TEXT_XML` text/xml media type
    `WILDCARD` Wildcard media type

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getParameters()` Get media type parameters string
    `String` | `getSubtype()` Gets the sub type
    `String` | `getType()` Gets the primary type
    `String` | `toString()` Returns the media type representation in the conventional HTTP header form, i.e.
    `static MediaType` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static MediaType[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### WILDCARD

          public static final MediaType WILDCARD

      Wildcard media type

    - #### TEXT_PLAIN

          public static final MediaType TEXT_PLAIN

      text/plain media type

    - #### TEXT_XML

          public static final MediaType TEXT_XML

      text/xml media type

    - #### TEXT_HTML

          public static final MediaType TEXT_HTML

      text/html media type

    - #### TEXT_MARKDOWN

          public static final MediaType TEXT_MARKDOWN

      text/markdown media type

    - #### APPLICATION_JSON

          public static final MediaType APPLICATION_JSON

      application/json media type

    - #### APPLICATION_JSON_UTF8

          public static final MediaType APPLICATION_JSON_UTF8

      application/json media type with UTF8 charset parameter

    - #### APPLICATION_FORM_URLENCODED

          public static final MediaType APPLICATION_FORM_URLENCODED

      application/x-www-form-urlencoded media type

    - #### MULTIPART_FORM_DATA

          public static final MediaType MULTIPART_FORM_DATA

      multipart/form-data media type

    - #### APPLICATION_XML

          public static final MediaType APPLICATION_XML

      application/xml media type

    - #### APPLICATION_SVG_XML

          public static final MediaType APPLICATION_SVG_XML

      application/svg+xml media type

    - #### APPLICATION_OCTET_STREAM

          public static final MediaType APPLICATION_OCTET_STREAM

      application/octet-stream media type

    - #### APPLICATION_PDF

          public static final MediaType APPLICATION_PDF

      application/pdf media type

    - #### IMAGE_GIF

          public static final MediaType IMAGE_GIF

      image/gif media type

    - #### IMAGE_JPEG

          public static final MediaType IMAGE_JPEG

      image/jpeg media type

    - #### IMAGE_PNG

          public static final MediaType IMAGE_PNG

      image/png media type

  - ### Method Detail

    - #### values

          public static MediaType[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (MediaType c : MediaType.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static MediaType valueOf(String name)

      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:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### getType

          public String getType()

      Gets the primary type
      Returns:
        Primary type string

    - #### getSubtype

          public String getSubtype()

      Gets the sub type
      Returns:
        Sub type string

    - #### getParameters

          public String getParameters()

      Get media type parameters string
      Returns:
        Media type parameters, or `null` if none

    - #### toString

          public String toString()

      Returns the media type representation in the conventional HTTP header form, i.e. `type/subtype`.
      Overrides:
        `toString` in class `Enum<MediaType>`
      Returns:
        Media type representation

Copyright © 2019 The Holon Platform. All rights reserved.