public class WeightedMediaType extends MediaType implements Comparable<WeightedMediaType>
APPLICATION_ATOM_XML, APPLICATION_ATOM_XML_TYPE, APPLICATION_FORM_URLENCODED, APPLICATION_FORM_URLENCODED_TYPE, APPLICATION_JSON, APPLICATION_JSON_TYPE, APPLICATION_OCTET_STREAM, APPLICATION_OCTET_STREAM_TYPE, APPLICATION_SVG_XML, APPLICATION_SVG_XML_TYPE, APPLICATION_XHTML_XML, APPLICATION_XHTML_XML_TYPE, APPLICATION_XML, APPLICATION_XML_TYPE, CHARSET_PARAMETER, MEDIA_TYPE_WILDCARD, MULTIPART_FORM_DATA, MULTIPART_FORM_DATA_TYPE, TEXT_HTML, TEXT_HTML_TYPE, TEXT_PLAIN, TEXT_PLAIN_TYPE, TEXT_XML, TEXT_XML_TYPE, WILDCARD, WILDCARD_TYPE
Modifier and Type | Method and Description |
---|---|
int |
compareTo(WeightedMediaType o) |
boolean |
equals(Object obj)
Compares
obj to this media type to see if they are the same by comparing
type, subtype and parameters. |
float |
getWeight() |
boolean |
isCompatible(MediaType other)
Non-equal properties should not be compatible
|
static WeightedMediaType |
parse(MediaType tmp) |
static WeightedMediaType |
valueOf(String type) |
getParameters, getSubtype, getType, hashCode, isWildcardSubtype, isWildcardType, toString, withCharset
public float getWeight()
public int compareTo(WeightedMediaType o)
compareTo
in interface Comparable<WeightedMediaType>
public boolean isCompatible(MediaType other)
isCompatible
in class MediaType
other
- the media type to compare with.public static WeightedMediaType valueOf(String type)
public static WeightedMediaType parse(MediaType tmp)
public boolean equals(Object obj)
MediaType
obj
to this media type to see if they are the same by comparing
type, subtype and parameters. Note that the case-sensitivity of parameter
values is dependent on the semantics of the parameter name, see
HTTP/1.1.
This method assumes that values are case-sensitive.
Note that the equals(...)
implementation does not perform
a class equality check (this.getClass() == obj.getClass()
). Therefore
any class that extends from MediaType
class and needs to override
one of the equals(...)
and MediaType.hashCode()
methods must
always override both methods to ensure the contract between
Object.equals(java.lang.Object)
and Object.hashCode()
does
not break.Copyright © 2017 JBoss by Red Hat. All rights reserved.