Package org.apache.juneau
Class StringRange
java.lang.Object
org.apache.juneau.StringRange
Represents a single value in a comma-delimited header value that optionally contains a quality metric for
comparison and extension parameters.
Similar in concept to MediaRanges
except instead of media types (e.g.
An example of a type range is a value in an
See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue if the specified object is also aStringRange , and has the same qValue, type, parameters, and extensions.forEachExtension
(Consumer<NameValuePair> action) Performs an action on the optional set of custom extensions defined for this type.Returns the optional set of custom extensions defined for this type.getName()
Returns the name of this string range.Returns the'q' (quality) value for this type, as described in Section 3.9 of RFC2616.int
hashCode()
Returns a hash based on this instance'smedia-type .int
Performs a match of this string range against the specified name.toString()
-
Constructor Details
-
StringRange
Constructor.- Parameters:
value
- The raw string range string.
A value ofnull gets interpreted as matching anything (e.g."*" ).
-
StringRange
Constructor.- Parameters:
e
- The parsed string range element.
-
-
Method Details
-
getName
Returns the name of this string range.This is the primary value minus the quality or other parameters.
- Returns:
- The name of this string range.
-
getQValue
Returns the'q' (quality) value for this type, as described in Section 3.9 of RFC2616.The quality value is a float between
0.0 (unacceptable) and1.0 (most acceptable).If 'q' value doesn't make sense for the context (e.g. this range was extracted from a
"content-*" header, as opposed to"accept-*" header, its value will always be"1" .- Returns:
- The 'q' value for this type, never
null .
-
getExtensions
Returns the optional set of custom extensions defined for this type.Values are lowercase and never
null .- Returns:
- The optional list of extensions, never
null .
-
forEachExtension
Performs an action on the optional set of custom extensions defined for this type.- Parameters:
action
- The action to perform.- Returns:
- This object.
-
equals
Returnstrue if the specified object is also aStringRange , and has the same qValue, type, parameters, and extensions. -
hashCode
Returns a hash based on this instance'smedia-type . -
match
Performs a match of this string range against the specified name.- Parameters:
name
- The name being compared against.- Returns:
- 0 = no match, 100 = perfect match, 50 = meta-match.
-
toString
-