Enum Class TopLevelType

java.lang.Object
java.lang.Enum<TopLevelType>
org.refcodes.web.TopLevelType
All Implemented Interfaces:
Serializable, Comparable<TopLevelType>, Constable, org.refcodes.mixin.NameAccessor

public enum TopLevelType extends Enum<TopLevelType> implements org.refcodes.mixin.NameAccessor
The TopLevelType is the top-level part of a HTTP Media-Type. See MediaType for a full list of the so called HTTP Media-Types. Given the HTTP Media-Type "application/json", "application" is considered to be the top-level Media-Type and "json" to be the Sub-Media-Type. As of common speaking, the Sub-Media-Type is usually called Media-Type. Therefore the Sub-Media-Types are gathered in the MediaType enumeration to avoid misunderstanding.
  • Enum Constant Details

  • Method Details

    • values

      public static TopLevelType[] 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 TopLevelType 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
    • getName

      public String getName()
      Gets the name.
      Specified by:
      getName in interface org.refcodes.mixin.NameAccessor
      Returns:
      the name
    • fromHttpTopLevelType

      public static TopLevelType fromHttpTopLevelType(String aHttpTopLevelType)
      Returns that TopLevelType represented by the given HTTP Top-Level-Media-Type. If the HTTP Media-Type contains the Media-Sub-Type portion (in terms of MediaType), then the provided HTTP Media-Type till the "/" slash is evaluated. For example "application/json" as well as "application" will return APPLICATION.
      Parameters:
      aHttpTopLevelType - The HTTP Media-Type for which to determine the TopLevelType.
      Returns:
      The determined TopLevelType or null if none was determinable.