Class VersionRange
java.lang.Object
org.apache.jackrabbit.vault.packaging.VersionRange
Implements a version range
The string representation is either
- the empty string, which means all versions match
- or a simple version string consisting of arbitrarily many alphanumeric segments separated by
.. Those segments must not include a,. This means everything from the given version will match (i.e. upper bound unlimited). - or a real range in the form
'['|'('<lowerBound>,(<upperBound>']'|')'), where[]means inclusive and()means exclusive bounds. Both the lowerBound and upperBound must follow the grammar from the simple version string.
- Since:
- 2.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new version range that exactly includes the given version.VersionRange(Version low, boolean lowIncl, Version high, boolean highIncl) Creates a new version range. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic VersionRangefromString(String str) Creates a range from a stringgetHigh()Returns the upper boundgetLow()Returns the lower boundinthashCode()booleanReturnstrueif the upper bound is inclusivebooleanChecks if the given version is in this range.booleanReturnstrueif the lower bound is inclusivetoString()
-
Field Details
-
INFINITE
Infinite (covers all) range.
-
-
Constructor Details
-
VersionRange
Creates a new version range.- Parameters:
low- lower bound ornulllowIncl- specifies if lower bound is inclusivehigh- upper bound ornullhighIncl- specifies if upper bound is inclusive- Throws:
IllegalArgumentException- if bounds are not valid
-
VersionRange
Creates a new version range that exactly includes the given version.- Parameters:
v- the version.
-
-
Method Details
-
getLow
Returns the lower bound- Returns:
- the lower bound or
null
-
isLowInclusive
public boolean isLowInclusive()Returnstrueif the lower bound is inclusive- Returns:
trueif the lower bound is inclusive
-
getHigh
Returns the upper bound- Returns:
- the upper bound or
null
-
isHighInclusive
public boolean isHighInclusive()Returnstrueif the upper bound is inclusive- Returns:
trueif the upper bound is inclusive
-
hashCode
public int hashCode() -
equals
-
toString
-
isInRange
Checks if the given version is in this range.- Parameters:
v- the version to check- Returns:
trueif the given version is in this range.
-
fromString
Creates a range from a string- Parameters:
str- string- Returns:
- the version range
-