Class Quality
java.lang.Object
org.glassfish.jersey.message.internal.Quality
Quality parameter constants.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Default quality value.static final int
Maximum quality value.static final int
Minimum quality value.static final Comparator<Qualified>
A "highest first" qualified element comparator.static final String
Quality HTTP header parameter name.static final String
Quality source HTTP header parameter name.static final Comparator<Integer>
A "highest first" quality value comparator. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
compare
(int x, int y) Compares twoint
values numerically.enhanceWithQualityParameter
(Map<String, String> parameters, String qualityParamName, int quality) Add a quality parameter to a HTTP header parameter map (if needed).private static String
qualityValueToString
(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 twoint
values 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 firstint
to comparey
- the secondint
to compare- Returns:
- the value
0
ifx == y
; a value less than0
ifx < y
; and a value greater than0
ifx > y
-
qualityValueToString
-