public enum TopLevelType extends Enum<TopLevelType> implements org.refcodes.mixin.NameAccessor
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 and Description |
---|
APPLICATION |
AUDIO |
IMAGE |
MESSAGE |
MODEL |
MULTIPART |
NONE |
TEXT |
UNKNOWN |
VIDEO |
Modifier and Type | Method and Description |
---|---|
static TopLevelType |
fromHttpTopLevelType(String aHttpTopLevelType)
Returns that
TopLevelType represented by the given HTTP
Top-Level-Media-Type. |
String |
getName() |
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.
|
public static final TopLevelType NONE
public static final TopLevelType UNKNOWN
public static final TopLevelType APPLICATION
public static final TopLevelType AUDIO
public static final TopLevelType IMAGE
public static final TopLevelType MESSAGE
public static final TopLevelType MODEL
public static final TopLevelType TEXT
public static final TopLevelType MULTIPART
public static final TopLevelType VIDEO
public static TopLevelType[] values()
for (TopLevelType c : TopLevelType.values()) System.out.println(c);
public static TopLevelType valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getName()
getName
in interface org.refcodes.mixin.NameAccessor
public static TopLevelType fromHttpTopLevelType(String aHttpTopLevelType)
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
.aHttpTopLevelType
- The HTTP Media-Type for which to determine the
TopLevelType
.TopLevelType
or null if none was
determinable.Copyright © 2017. All rights reserved.