Class VersionRange
- java.lang.Object
-
- net.adoptopenjdk.icedteaweb.jnlp.version.VersionRange
-
public class VersionRange extends java.lang.ObjectA 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 ( " " element) * version-range ::= simple-range ( "&" simple-range) * simple-range ::= version-id | version-id modifier modifier ::= "+" | "*"See JSR-56 Specification, Appendix A.
- See Also:
JNLPVersionPatterns
-
-
Field Summary
Fields Modifier and Type Field Description private SimpleRange[]simpleRanges
-
Constructor Summary
Constructors Modifier Constructor Description privateVersionRange(SimpleRange[] simpleRanges)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(java.lang.String versionId)Check if this version-range contains the givenversionId.booleancontains(VersionId versionId)Check if this version-range contains the givenversionId.booleanequals(java.lang.Object otherVersionRange)static VersionRangefromString(java.lang.String versionRange)Construct a version-range by the givenversionRange.(package private) VersionIdgetExactVersion()(package private) booleanhasGreaterThanOrEqualMatchModifier()Checks whether this version-range represents a range with a greater or equal modifier.(package private) booleanhasPrefixMatchModifier()Checks whether this version-range represents a range with a prefix match modifier.(package private) booleanisCompoundVersion()(package private) booleanisEqualTo(VersionRange otherVersionRange)(package private) booleanisExactVersion()Checks whether this version-range represents a plain (exact) version without any postfix modifiers.java.lang.StringtoString()Provides a string representation of thisVersionRange.
-
-
-
Field Detail
-
simpleRanges
private final SimpleRange[] simpleRanges
-
-
Constructor Detail
-
VersionRange
private VersionRange(SimpleRange[] simpleRanges)
-
-
Method Detail
-
isCompoundVersion
boolean isCompoundVersion()
- Returns:
trueif this version-range is a compound range using an ampersand (&), false otherwise
-
isExactVersion
boolean isExactVersion()
Checks whether this version-range represents a plain (exact) version without any postfix modifiers.- Returns:
trueif this version-range does not have any modifiers,falseotherwise.
-
getExactVersion
VersionId getExactVersion()
- Returns:
- the exact version if this version-range is one
- Throws:
java.lang.IllegalStateException- if this version-range is not one
-
hasPrefixMatchModifier
boolean hasPrefixMatchModifier()
Checks whether this version-range represents a range with a prefix match modifier.- Returns:
trueif this version-range is not a compound range and its only simple range has a prefix match modifier,falseotherwise.
-
hasGreaterThanOrEqualMatchModifier
boolean hasGreaterThanOrEqualMatchModifier()
Checks whether this version-range represents a range with a greater or equal modifier.- Returns:
trueif this version-range is not a compound range and its only simple range has a greater or equal modifier,falseotherwise.
-
fromString
public static VersionRange fromString(java.lang.String versionRange)
Construct a version-range by the givenversionRange.- Parameters:
versionRange- a version-range- Returns:
- a version-id
-
contains
public boolean contains(java.lang.String versionId)
Check if this version-range contains the givenversionId.- Parameters:
versionId- a version-id- Returns:
trueif this version-range containsversionId,falseotherwise.
-
contains
public boolean contains(VersionId versionId)
Check if this version-range contains the givenversionId.- Parameters:
versionId- a version-id- Returns:
trueif this version-range containsversionId,falseotherwise.
-
isEqualTo
boolean isEqualTo(VersionRange otherVersionRange)
-
equals
public boolean equals(java.lang.Object otherVersionRange)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
Provides a string representation of thisVersionRange.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this version-range
-
-