Package org.jboss.resteasy.util
Class WeightedMediaType
- java.lang.Object
-
- jakarta.ws.rs.core.MediaType
-
- org.jboss.resteasy.util.WeightedMediaType
-
- All Implemented Interfaces:
Comparable<WeightedMediaType>
public class WeightedMediaType extends MediaType implements Comparable<WeightedMediaType>
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Field Summary
-
Fields inherited from class jakarta.ws.rs.core.MediaType
APPLICATION_ATOM_XML, APPLICATION_ATOM_XML_TYPE, APPLICATION_FORM_URLENCODED, APPLICATION_FORM_URLENCODED_TYPE, APPLICATION_JSON, APPLICATION_JSON_PATCH_JSON, APPLICATION_JSON_PATCH_JSON_TYPE, 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, SERVER_SENT_EVENTS, SERVER_SENT_EVENTS_TYPE, TEXT_HTML, TEXT_HTML_TYPE, TEXT_PLAIN, TEXT_PLAIN_TYPE, TEXT_XML, TEXT_XML_TYPE, WILDCARD, WILDCARD_TYPE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(WeightedMediaType o)booleanequals(Object obj)Comparesobjto this media type to see if they are the same by comparing type, subtype and parameters.floatgetWeight()inthashCode()Generate a hash code from the type, subtype and parameters.booleanisCompatible(MediaType other)Non-equal properties should not be compatiblestatic WeightedMediaTypeparse(MediaType tmp)static WeightedMediaTypevalueOf(String type)-
Methods inherited from class jakarta.ws.rs.core.MediaType
getParameters, getSubtype, getType, isWildcardSubtype, isWildcardType, toString, withCharset
-
-
-
-
Method Detail
-
getWeight
public float getWeight()
-
compareTo
public int compareTo(WeightedMediaType o)
- Specified by:
compareToin interfaceComparable<WeightedMediaType>
-
isCompatible
public boolean isCompatible(MediaType other)
Non-equal properties should not be compatible- Overrides:
isCompatiblein classMediaType- Parameters:
other- the media type to compare with.- Returns:
- true if the types are compatible, false otherwise.
-
valueOf
public static WeightedMediaType valueOf(String type)
-
parse
public static WeightedMediaType parse(MediaType tmp)
-
equals
public boolean equals(Object obj)
Description copied from class:MediaTypeCompares
Note that theobjto 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.equals(...)implementation does not perform a class equality check (this.getClass() == obj.getClass()). Therefore any class that extends fromMediaTypeclass and needs to override one of theequals(...)andMediaType.hashCode()methods must always override both methods to ensure the contract betweenObject.equals(java.lang.Object)andObject.hashCode()does not break.
-
hashCode
public int hashCode()
Description copied from class:MediaTypeGenerate a hash code from the type, subtype and parameters.
Note that theMediaType.equals(java.lang.Object)implementation does not perform a class equality check (this.getClass() == obj.getClass()). Therefore any class that extends fromMediaTypeclass and needs to override one of theMediaType.equals(Object)andhashCode()methods must always override both methods to ensure the contract betweenObject.equals(java.lang.Object)andObject.hashCode()does not break.
-
-