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
  • Method Details

    • getWeight

      public float getWeight()
    • compareTo

      public int compareTo(WeightedMediaType o)
      Specified by:
      compareTo in interface Comparable<WeightedMediaType>
    • isCompatible

      public boolean isCompatible(MediaType other)
      Non-equal properties should not be compatible
      Overrides:
      isCompatible in class MediaType
      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: MediaType

      Compares 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.
      Overrides:
      equals in class MediaType
      Parameters:
      obj - the object to compare to.
      Returns:
      true if the two media types are the same, false otherwise.
    • hashCode

      public int hashCode()
      Description copied from class: MediaType

      Generate a hash code from the type, subtype and parameters.

      Note that the MediaType.equals(java.lang.Object) 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 MediaType.equals(Object) and hashCode() methods must always override both methods to ensure the contract between Object.equals(java.lang.Object) and Object.hashCode() does not break.
      Overrides:
      hashCode in class MediaType
      Returns:
      a generated hash code.