|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.client.data.Metadata
org.restlet.client.data.MediaType
public final class MediaType
Media type used in representations and preferences. The Metadata.getName()
method returns a full String representation of the media type including the
parameters.
Field Summary | |
---|---|
static MediaType |
ALL
|
static MediaType |
APPLICATION_ALL
|
static MediaType |
APPLICATION_ALL_XML
|
static MediaType |
APPLICATION_ATOM
|
static MediaType |
APPLICATION_JAVA_OBJECT_GWT
|
static MediaType |
APPLICATION_JAVASCRIPT
|
static MediaType |
APPLICATION_JSON
|
static MediaType |
APPLICATION_WWW_FORM
|
static MediaType |
APPLICATION_XHTML
|
static MediaType |
APPLICATION_XHTML_XML
Deprecated. Use APPLICATION_XHTML instead. |
static MediaType |
APPLICATION_XMI_XML
|
static MediaType |
APPLICATION_XML
|
static MediaType |
TEXT_ALL
|
static MediaType |
TEXT_CSS
|
static MediaType |
TEXT_HTML
|
static MediaType |
TEXT_JAVASCRIPT
|
static MediaType |
TEXT_PLAIN
|
static MediaType |
TEXT_URI_LIST
|
static MediaType |
TEXT_XML
|
Constructor Summary | |
---|---|
MediaType(String name)
Constructor. |
|
MediaType(String name,
Series<Parameter> parameters)
Constructor. |
|
MediaType(String name,
Series<Parameter> parameters,
String description)
Constructor. |
|
MediaType(String name,
String description)
Constructor. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
boolean |
equals(Object obj,
boolean ignoreParameters)
Test the equality of two media types, with the possibility to ignore the parameters. |
String |
getMainType()
Returns the main type. |
static MediaType |
getMostSpecific(MediaType... mediaTypes)
Returns the first of the most specific media type of the given array of MediaType s. |
Series<Parameter> |
getParameters()
Returns the unmodifiable list of parameters. |
MediaType |
getParent()
Returns the parent metadata if available or null. In case the media type has parameters, this method returns the concatenation of the main type and the subtype. |
String |
getSubType()
Returns the sub-type. |
int |
hashCode()
|
boolean |
includes(Metadata included)
Indicates if a given media type is included in the current one. |
boolean |
isConcrete()
Checks if the current media type is concrete. |
static MediaType |
register(String name,
String description)
Register a media type as a known type that can later be retrieved using valueOf(String) . |
String |
toString()
Returns the metadata name. |
static MediaType |
valueOf(String name)
Returns the media type associated to a name. |
Methods inherited from class org.restlet.client.data.Metadata |
---|
getDescription, getName, isCompatible |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final MediaType ALL
public static final MediaType APPLICATION_ALL
public static final MediaType APPLICATION_ALL_XML
public static final MediaType APPLICATION_ATOM
public static final MediaType APPLICATION_JAVA_OBJECT_GWT
public static final MediaType APPLICATION_JAVASCRIPT
public static final MediaType APPLICATION_JSON
public static final MediaType APPLICATION_WWW_FORM
public static final MediaType APPLICATION_XHTML
@Deprecated public static final MediaType APPLICATION_XHTML_XML
APPLICATION_XHTML
instead.public static final MediaType APPLICATION_XMI_XML
public static final MediaType APPLICATION_XML
public static final MediaType TEXT_ALL
public static final MediaType TEXT_CSS
public static final MediaType TEXT_HTML
public static final MediaType TEXT_JAVASCRIPT
public static final MediaType TEXT_PLAIN
public static final MediaType TEXT_URI_LIST
public static final MediaType TEXT_XML
Constructor Detail |
---|
public MediaType(String name)
name
- The name.public MediaType(String name, Series<Parameter> parameters)
name
- The name.parameters
- The list of parameters.public MediaType(String name, Series<Parameter> parameters, String description)
name
- The name.parameters
- The list of parameters.description
- The description.public MediaType(String name, String description)
name
- The name.description
- The description.Method Detail |
---|
public static MediaType getMostSpecific(MediaType... mediaTypes) throws IllegalArgumentException
MediaType
s.
Examples:
mediaTypes
- An array of media types.
IllegalArgumentException
- If the array is null or empty.public static MediaType register(String name, String description)
valueOf(String)
. If the type already exists, the existing type
is returned, otherwise a new instance is created.
name
- The name.description
- The description.
public static MediaType valueOf(String name)
name
- The name.
public boolean equals(Object obj)
equals
in class Metadata
public boolean equals(Object obj, boolean ignoreParameters)
obj
- The object to compare to.ignoreParameters
- Indicates if parameters should be ignored during comparison.
public String getMainType()
public Series<Parameter> getParameters()
public MediaType getParent()
ALL
media type if it is already
the ALL
media type, or null.
getParent
in class Metadata
public String getSubType()
public int hashCode()
hashCode
in class Metadata
public boolean includes(Metadata included)
Examples:
includes
in class Metadata
included
- The media type to test for inclusion.
Metadata.isCompatible(Metadata)
public boolean isConcrete()
public String toString()
Metadata
toString
in class Metadata
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |