Class QualitySourceMediaType

  • All Implemented Interfaces:
    Qualified

    public class QualitySourceMediaType
    extends MediaType
    implements Qualified
    A quality source media type.
    Author:
    Paul Sandoz, Marek Potociar
    • Method Detail

      • getQuality

        public int getQuality()
        Get quality source factor value (in [ppt]).
        Specified by:
        getQuality in interface Qualified
        Returns:
        quality source factor value.
      • getQualitySource

        public static int getQualitySource​(MediaType mediaType)
                                    throws IllegalArgumentException
        Extract quality source information from the supplied MediaType value. If no quality source parameter is present in the media type, default quality is returned.
        Parameters:
        mediaType - media type.
        Returns:
        quality source parameter value or default quality, if no quality source parameter is present.
        Throws:
        IllegalArgumentException - in case the quality source parameter value could not be parsed.
      • 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.
      • toString

        public String toString()
        Description copied from class: MediaType
        Convert the media type to a string suitable for use as the value of a corresponding HTTP header.
        Overrides:
        toString in class MediaType
        Returns:
        a string version of the media type.