Package org.refcodes.net
Enum TopLevelType
- java.lang.Object
-
- java.lang.Enum<TopLevelType>
-
- org.refcodes.net.TopLevelType
-
- All Implemented Interfaces:
Serializable
,Comparable<TopLevelType>
,org.refcodes.mixin.NameAccessor
public enum TopLevelType extends Enum<TopLevelType> implements org.refcodes.mixin.NameAccessor
TheTopLevelType
is the top-level part of a HTTP Media-Type. SeeMediaType
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 theMediaType
enumeration to avoid misunderstanding.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TopLevelType
fromHttpTopLevelType(String aHttpTopLevelType)
Returns thatTopLevelType
represented by the given HTTP Top-Level-Media-Type.String
getName()
Gets the name.static TopLevelType
valueOf(String name)
Returns the enum constant of this type with the specified name.static TopLevelType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
WILDCARD
public static final TopLevelType WILDCARD
-
NONE
public static final TopLevelType NONE
-
UNKNOWN
public static final TopLevelType UNKNOWN
-
APPLICATION
public static final TopLevelType APPLICATION
-
AUDIO
public static final TopLevelType AUDIO
-
IMAGE
public static final TopLevelType IMAGE
-
MESSAGE
public static final TopLevelType MESSAGE
-
MODEL
public static final TopLevelType MODEL
-
TEXT
public static final TopLevelType TEXT
-
MULTIPART
public static final TopLevelType MULTIPART
-
VIDEO
public static final TopLevelType VIDEO
-
-
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 nameNullPointerException
- if the argument is null
-
getName
public String getName()
Gets the name.- Specified by:
getName
in interfaceorg.refcodes.mixin.NameAccessor
- Returns:
- the name
-
fromHttpTopLevelType
public static TopLevelType fromHttpTopLevelType(String aHttpTopLevelType)
Returns thatTopLevelType
represented by the given HTTP Top-Level-Media-Type. If the HTTP Media-Type contains the Media-Sub-Type portion (in terms ofMediaType
), then the provided HTTP Media-Type till the "/" slash is evaluated. For example "application/json" as well as "application" will returnAPPLICATION
.- Parameters:
aHttpTopLevelType
- The HTTP Media-Type for which to determine theTopLevelType
.- Returns:
- The determined
TopLevelType
or null if none was determinable.
-
-