Enum Class RestContentType

java.lang.Object
java.lang.Enum<RestContentType>
com.bonitasoft.processbuilder.enums.RestContentType
All Implemented Interfaces:
Serializable, Comparable<RestContentType>, Constable

public enum RestContentType extends Enum<RestContentType>
Defines the supported content types for REST service requests and responses.
Since:
1.0
Author:
Bonitasoft
  • Enum Constant Details

    • JSON

      public static final RestContentType JSON
      JSON content type (application/json).
    • XML

      public static final RestContentType XML
      XML content type (application/xml).
    • TEXT_PLAIN

      public static final RestContentType TEXT_PLAIN
      Plain text content type (text/plain).
    • TEXT_HTML

      public static final RestContentType TEXT_HTML
      HTML content type (text/html).
    • FORM_URLENCODED

      public static final RestContentType FORM_URLENCODED
      Form URL encoded content type (application/x-www-form-urlencoded).
    • MULTIPART_FORM_DATA

      public static final RestContentType MULTIPART_FORM_DATA
      Multipart form data content type (multipart/form-data).
    • BINARY

      public static final RestContentType BINARY
      Binary/octet-stream content type (application/octet-stream).
    • PDF

      public static final RestContentType PDF
      PDF content type (application/pdf).
  • Method Details

    • values

      public static RestContentType[] 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 RestContentType 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
    • getMimeType

      public String getMimeType()
      Gets the MIME type string.
      Returns:
      The MIME type (e.g., "application/json")
    • getKey

      public String getKey()
      Alias for getMimeType() to maintain consistency with other enums.
      Returns:
      The MIME type string
    • getDescription

      public String getDescription()
      Gets a brief description of the content type.
      Returns:
      The description
    • isValid

      public static boolean isValid(String input)
      Checks if a given MIME type corresponds to a valid content type.
      Parameters:
      input - The MIME type to validate (case-insensitive)
      Returns:
      true if the MIME type is valid
    • fromMimeType

      public static Optional<RestContentType> fromMimeType(String mimeType)
      Finds a content type by its MIME type (case-insensitive).
      Parameters:
      mimeType - The MIME type to search for
      Returns:
      Optional containing the matching content type, or empty if not found
    • getAllData

      public static Map<String,String> getAllData()
      Retrieves all content types as a read-only Map.
      Returns:
      A map containing all content type data (MimeType -> Description)
    • getAllKeysList

      public static List<String> getAllKeysList()
      Retrieves all MIME types as a read-only List.
      Returns:
      A list containing all MIME type strings
    • isTextBased

      public boolean isTextBased()
      Checks if this content type is text-based (can be logged as string).
      Returns:
      true if the content is text-based
    • isJson

      public boolean isJson()
      Checks if this content type is JSON.
      Returns:
      true if this is JSON content type
    • isXml

      public boolean isXml()
      Checks if this content type is XML.
      Returns:
      true if this is XML content type