|
Spring for Android | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.http.ContentCodingType
public class ContentCodingType
Represents a Compression Type, as defined in the HTTP specification.
Field Summary | |
---|---|
static ContentCodingType |
ALL
Public constant encoding type for * . |
static java.lang.String |
ALL_VALUE
A String equivalent of ALL . |
static ContentCodingType |
GZIP
Public constant encoding type for gzip . |
static java.lang.String |
GZIP_VALUE
A String equivalent of GZIP . |
static ContentCodingType |
IDENTITY
Public constant encoding type for identity . |
static java.lang.String |
IDENTITY_VALUE
A String equivalent of IDENTITY . |
static java.util.Comparator<ContentCodingType> |
QUALITY_VALUE_COMPARATOR
Comparator used by sortByQualityValue(List) . |
Constructor Summary | |
---|---|
ContentCodingType(java.lang.String type)
Create a new ContentCodingType for the given type. |
|
ContentCodingType(java.lang.String type,
double qualityValue)
Create a new ContentCodingType for the given type and quality value. |
|
ContentCodingType(java.lang.String type,
java.util.Map<java.lang.String,java.lang.String> parameters)
Create a new ContentCodingType for the given type, and parameters. |
Method Summary | |
---|---|
int |
compareTo(ContentCodingType other)
Compares this ContentCodingType to another alphabetically. |
boolean |
equals(java.lang.Object other)
|
java.lang.String |
getParameter(java.lang.String name)
Return a generic parameter value, given a parameter name. |
double |
getQualityValue()
Return the quality value, as indicated by a q parameter, if any. |
java.lang.String |
getType()
Return the primary type. |
int |
hashCode()
|
boolean |
includes(ContentCodingType other)
Indicate whether this ContentCodingType includes the given coding type. |
boolean |
isCompatibleWith(ContentCodingType other)
Indicate whether this ContentCodingType is compatible with the given coding type. |
boolean |
isWildcardType()
Indicates whether the type is the wildcard character * or not. |
static ContentCodingType |
parseCodingType(java.lang.String codingType)
Parse the given String into a single ContentCodingType . |
static java.util.List<ContentCodingType> |
parseCodingTypes(java.lang.String codingTypes)
Parse the given, comma-separated string into a list of ContentCodingType objects. |
static void |
sortByQualityValue(java.util.List<ContentCodingType> codingTypes)
Sorts the given list of ContentCodingType objects by quality value. |
java.lang.String |
toString()
|
static java.lang.String |
toString(java.util.Collection<ContentCodingType> codingTypes)
Return a string representation of the given list of ContentCodingType objects. |
static ContentCodingType |
valueOf(java.lang.String value)
Parse the given String value into a ContentCodingType object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final ContentCodingType ALL
*
.
public static final java.lang.String ALL_VALUE
ALL
.
public static final ContentCodingType IDENTITY
identity
.
public static final java.lang.String IDENTITY_VALUE
IDENTITY
.
public static final ContentCodingType GZIP
gzip
.
public static final java.lang.String GZIP_VALUE
GZIP
.
public static final java.util.Comparator<ContentCodingType> QUALITY_VALUE_COMPARATOR
sortByQualityValue(List)
.
Constructor Detail |
---|
public ContentCodingType(java.lang.String type)
ContentCodingType
for the given type.
type
- the typepublic ContentCodingType(java.lang.String type, double qualityValue)
ContentCodingType
for the given type and quality value.
type
- the primary typequalityValue
- the quality value
java.lang.IllegalArgumentException
- if any of the parameters contain illegal characterspublic ContentCodingType(java.lang.String type, java.util.Map<java.lang.String,java.lang.String> parameters)
ContentCodingType
for the given type, and parameters.
type
- the primary typeparameters
- the parameters, may be null
java.lang.IllegalArgumentException
- if any of the parameters contain illegal charactersMethod Detail |
---|
public java.lang.String getType()
public boolean isWildcardType()
*
or not.
public double getQualityValue()
q
parameter, if any. Defaults to 1.0
.
public java.lang.String getParameter(java.lang.String name)
name
- the parameter name
null
if not presentpublic boolean includes(ContentCodingType other)
ContentCodingType
includes the given coding type.
For instance, *
includes gzip
and deflate
other
- the reference coding type with which to compare
true
if this coding type includes the given coding type; false
otherwisepublic boolean isCompatibleWith(ContentCodingType other)
ContentCodingType
is compatible with the given coding type.
For instance, *
is compatible with gzip
, deflate
, and vice versa. In effect, this method
is similar to includes(ContentCodingType)
, except that it is symmetric.
other
- the reference coding type with which to compare
true
if this coding type is compatible with the given coding type; false
otherwisepublic int compareTo(ContentCodingType other)
ContentCodingType
to another alphabetically.
compareTo
in interface java.lang.Comparable<ContentCodingType>
other
- content coding type to compare topublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static ContentCodingType valueOf(java.lang.String value)
ContentCodingType
object.
parseCodingType(String)
public static ContentCodingType parseCodingType(java.lang.String codingType)
ContentCodingType
.
codingType
- the string to parse
java.lang.IllegalArgumentException
- if the string cannot be parsedpublic static java.util.List<ContentCodingType> parseCodingTypes(java.lang.String codingTypes)
ContentCodingType
objects.
This method can be used to parse an Accept-Encoding.
codingTypes
- the string to parse
java.lang.IllegalArgumentException
- if the string cannot be parsedpublic static java.lang.String toString(java.util.Collection<ContentCodingType> codingTypes)
ContentCodingType
objects.
codingTypes
- the string to parse
java.lang.IllegalArgumentException
- if the String cannot be parsedpublic static void sortByQualityValue(java.util.List<ContentCodingType> codingTypes)
ContentCodingType
objects by quality value.
Given two content coding types:
codingTypes
- the list of coding types to be sortedgetQualityValue()
|
Spring for Android | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |