Class VersionString
java.lang.Object
net.adoptopenjdk.icedteaweb.jnlp.version.VersionString
A version-string is a list of version-ranges separated by spaces. A version-range is either a version-id,
a version-id followed by a star (*), a version-id followed by a plus sign (+) , or two version-ranges
combined using an ampersand (&). The star means prefix match, the plus sign means this version or
greater, and the ampersand means the logical and-ing of the two version-ranges.
The syntax of version-strings is:
version-string ::= version-range ( " " version-range) *
version-range ::= simple-range ( "&" simple-range) *
simple-range ::= version-id | version-id modifier
modifier ::= "+" | "*"
See JSR-56 Specification, Appendix A.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) intCompares two version-ids in the context of this version-string.booleanChecks if this version-string (list of exact version-ids or version ranges) contains the givenversionId.booleanChecks if this version-string (list of exact version-ids or version ranges) contains the givenversionId.booleanbooleanstatic VersionStringfromString(String versionString) Construct a version-string by the givenversionString.private intindexOfFirstRangeContaining(VersionId versionId) booleantoString()Provides string representation of this version-string.
-
Field Details
-
ANY_VERSION
-
versionRanges
-
-
Constructor Details
-
VersionString
-
-
Method Details
-
fromString
Construct a version-string by the givenversionString.- Parameters:
versionString- a version-string- Returns:
- a versionString
-
containsSingleVersionRange
public boolean containsSingleVersionRange()- Returns:
trueif this version-string consists of only a single version-range,falseotherwise.
-
isExactVersion
public boolean isExactVersion()- Returns:
trueif this version-string consists of a single version-range which is an exact match,falseotherwise.
-
getExactVersion
- Returns:
- the exact version if this version-string is one
- Throws:
IllegalStateException- if this version-string is not none
-
contains
Checks if this version-string (list of exact version-ids or version ranges) contains the givenversionId.- Parameters:
versionId- a version-id- Returns:
trueif this version-string contains the givenversionId,falseotherwise
-
contains
Checks if this version-string (list of exact version-ids or version ranges) contains the givenversionId.- Parameters:
versionId- a version-id- Returns:
trueif this version-string contains the givenversionId,falseotherwise
-
compare
Compares two version-ids in the context of this version-string. This implementation follows the specification of aComparator.If two or more version-id match the given version-string, the JNLP Client should use the one matching the earlier version-range in the version-string.
If two or more version-id match a given version-range, the JNLP Client should use the one with the highest version-id.
See JSR-56 Specification, Appendix A.
- Parameters:
versionId1- a version-idversionId2- a version-id- Returns:
- a negative int if versionId1 is less than versionId2, a positive int if versionId1 is after than versionId2 or zero if they are equal.
-
indexOfFirstRangeContaining
-
equals
-
toString
-