Class Quality
java.lang.Object
org.glassfish.jersey.message.internal.Quality
Quality parameter constants.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault quality value.static final intMaximum quality value.static final intMinimum quality value.static final Comparator<Qualified> A "highest first" qualified element comparator.static final StringQuality HTTP header parameter name.static final StringQuality source HTTP header parameter name.static final Comparator<Integer> A "highest first" quality value comparator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intcompare(int x, int y) Compares twointvalues numerically.enhanceWithQualityParameter(Map<String, String> parameters, String qualityParamName, int quality) Add a quality parameter to a HTTP header parameter map (if needed).private static StringqualityValueToString(float quality)
-
Field Details
-
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
A "highest first" quality value comparator. A higher quality value will be sorted ahead of a lower quality value. -
QUALITY_PARAMETER_NAME
Quality HTTP header parameter name.- See Also:
-
QUALITY_SOURCE_PARAMETER_NAME
Quality source HTTP header parameter name.- See Also:
-
MINIMUM
public static final int MINIMUMMinimum quality value.- See Also:
-
MAXIMUM
public static final int MAXIMUMMaximum quality value.- See Also:
-
DEFAULT
public static final int DEFAULTDefault 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 twointvalues numerically. The value returned is identical to what would be returned by:Integer.valueOf(x).compareTo(Integer.valueOf(y))Note: Taken fromInteger.compare()from JDK 7.- Parameters:
x- the firstintto comparey- the secondintto compare- Returns:
- the value
0ifx == y; a value less than0ifx < y; and a value greater than0ifx > y
-
qualityValueToString
-