Enum TopLevelType

  • All Implemented Interfaces:
    Serializable, Comparable<TopLevelType>, 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.
    • Method Detail

      • values

        public static TopLevelType[] 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 (TopLevelType c : TopLevelType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TopLevelType 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
      • 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.