org.codehaus.enunciate.rest
Class MimeType

java.lang.Object
  extended by org.codehaus.enunciate.rest.MimeType
All Implemented Interfaces:
java.lang.Comparable<MimeType>

public class MimeType
extends java.lang.Object
implements java.lang.Comparable<MimeType>

Helper class for content type.

Author:
Ryan Heaton

Constructor Summary
MimeType(java.lang.String type, java.lang.String subtype)
           
MimeType(java.lang.String type, java.lang.String subtype, float quality)
           
 
Method Summary
 int compareTo(MimeType other)
          Content type are ordered first by quality then by type, then by subtype.
 float getQuality()
           
 java.lang.String getSubtype()
           
 java.lang.String getType()
           
 boolean isAcceptable(MimeType mimeType)
          Whether the specified content type is acceptable by this content type.
static MimeType parse(java.lang.String spec)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MimeType

public MimeType(java.lang.String type,
                java.lang.String subtype)

MimeType

public MimeType(java.lang.String type,
                java.lang.String subtype,
                float quality)
Method Detail

parse

public static MimeType parse(java.lang.String spec)

getType

public java.lang.String getType()

getSubtype

public java.lang.String getSubtype()

getQuality

public float getQuality()

compareTo

public int compareTo(MimeType other)
Content type are ordered first by quality then by type, then by subtype.

Specified by:
compareTo in interface java.lang.Comparable<MimeType>
Parameters:
other - Content type to compare to.
Returns:
The comparison.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isAcceptable

public boolean isAcceptable(MimeType mimeType)
Whether the specified content type is acceptable by this content type.

Parameters:
mimeType - The content type.
Returns:
Whether the specified content type is acceptable by this content type.