Class Quality

java.lang.Object
org.glassfish.jersey.message.internal.Quality

public final class Quality extends Object
Quality parameter constants.
  • Field Details

    • QUALIFIED_COMPARATOR

      public static final Comparator<Qualified> QUALIFIED_COMPARATOR
      A "highest first" qualified element comparator. An element with higher quality value will be sorted ahead of elements with lower quality value.
    • QUALITY_VALUE_COMPARATOR

      public static final Comparator<Integer> QUALITY_VALUE_COMPARATOR
      A "highest first" quality value comparator. A higher quality value will be sorted ahead of a lower quality value.
    • QUALITY_PARAMETER_NAME

      public static final String QUALITY_PARAMETER_NAME
      Quality HTTP header parameter name.
      See Also:
    • QUALITY_SOURCE_PARAMETER_NAME

      public static final String QUALITY_SOURCE_PARAMETER_NAME
      Quality source HTTP header parameter name.
      See Also:
    • MINIMUM

      public static final int MINIMUM
      Minimum quality value.
      See Also:
    • MAXIMUM

      public static final int MAXIMUM
      Maximum quality value.
      See Also:
    • DEFAULT

      public static final int DEFAULT
      Default quality value.
      See Also:
  • Constructor Details

    • Quality

      private Quality()
      Prevents instantiation.
  • Method Details

    • enhanceWithQualityParameter

      static Map<String,String> enhanceWithQualityParameter(Map<String,String> parameters, String qualityParamName, int quality)
      Add a quality parameter to a HTTP header parameter map (if needed).
      Parameters:
      parameters - a map of HTTP header parameters.
      qualityParamName - name of the quality parameter ("q" or "qs").
      quality - quality value in [ppm].
      Returns:
      parameter map containing the proper quality parameter if necessary.
    • compare

      private static int compare(int x, int y)
      Compares two int values numerically. The value returned is identical to what would be returned by:
          Integer.valueOf(x).compareTo(Integer.valueOf(y))
       
      Note: Taken from Integer.compare() from JDK 7.
      Parameters:
      x - the first int to compare
      y - the second int to compare
      Returns:
      the value 0 if x == y; a value less than 0 if x < y; and a value greater than 0 if x > y
    • qualityValueToString

      private static String qualityValueToString(float quality)