Class VersionRange
- java.lang.Object
-
- org.apache.jackrabbit.vault.packaging.VersionRange
-
public class VersionRange extends Object
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 Modifier and Type Field Description static VersionRange
INFINITE
Infinite (covers all) range.
-
Constructor Summary
Constructors Constructor Description VersionRange(Version v)
Creates 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static VersionRange
fromString(String str)
Creates a range from a stringVersion
getHigh()
Returns the upper boundVersion
getLow()
Returns the lower boundint
hashCode()
boolean
isHighInclusive()
Returnstrue
if the upper bound is inclusiveboolean
isInRange(Version v)
Checks if the given version is in this range.boolean
isLowInclusive()
Returnstrue
if the lower bound is inclusiveString
toString()
-
-
-
Field Detail
-
INFINITE
public static final VersionRange INFINITE
Infinite (covers all) range.
-
-
Constructor Detail
-
VersionRange
public VersionRange(Version low, boolean lowIncl, Version high, boolean highIncl)
Creates a new version range.- Parameters:
low
- lower bound ornull
lowIncl
- specifies if lower bound is inclusivehigh
- upper bound ornull
highIncl
- specifies if upper bound is inclusive- Throws:
IllegalArgumentException
- if bounds are not valid
-
VersionRange
public VersionRange(Version v)
Creates a new version range that exactly includes the given version.- Parameters:
v
- the version.
-
-
Method Detail
-
getLow
public Version getLow()
Returns the lower bound- Returns:
- the lower bound or
null
-
isLowInclusive
public boolean isLowInclusive()
Returnstrue
if the lower bound is inclusive- Returns:
true
if the lower bound is inclusive
-
getHigh
public Version getHigh()
Returns the upper bound- Returns:
- the upper bound or
null
-
isHighInclusive
public boolean isHighInclusive()
Returnstrue
if the upper bound is inclusive- Returns:
true
if the upper bound is inclusive
-
isInRange
public boolean isInRange(Version v)
Checks if the given version is in this range.- Parameters:
v
- the version to check- Returns:
true
if the given version is in this range.
-
fromString
public static VersionRange fromString(String str)
Creates a range from a string- Parameters:
str
- string- Returns:
- the version range
-
-