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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrue 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.inthashCode()Returns a hash based on this instance'smedia-type .intPerforms a match of this string range against the specified name.toString()
-
Constructor Details
-
StringRange
Constructor.- Parameters:
e- The parsed string range element.
-
StringRange
Constructor.- Parameters:
value- The raw string range string.
A value ofnull gets interpreted as matching anything (e.g."*" ).
-
-
Method Details
-
equals
Returnstrue if the specified object is also aStringRange , and has the same qValue, type, parameters, and extensions. -
forEachExtension
Performs an action on the optional set of custom extensions defined for this type.- Parameters:
action- The action to perform.- Returns:
- This object.
-
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 .
-
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 .
-
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
-