public class VersionRange extends Object
versions.
A range has a left (lower) endpoint and a right (upper) endpoint. Each
endpoint can be open (excluded from the set) or closed (included in the set).
VersionRange objects are immutable.
| Modifier and Type | Field and Description |
|---|---|
static char |
LEFT_CLOSED
The left endpoint is closed and is included in the range.
|
static char |
LEFT_OPEN
The left endpoint is open and is excluded from the range.
|
static char |
RIGHT_CLOSED
The right endpoint is closed and is included in the range.
|
static char |
RIGHT_OPEN
The right endpoint is open and is excluded from the range.
|
| Constructor and Description |
|---|
VersionRange(Version low,
boolean isLowInclusive,
Version high,
boolean isHighInclusive) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
Version |
getCeiling() |
Version |
getFloor() |
int |
hashCode() |
boolean |
isCeilingInclusive() |
boolean |
isEmpty()
Returns whether this version range is empty.
|
boolean |
isExact()
Returns whether this version range contains only a single version.
|
boolean |
isFloorInclusive() |
boolean |
isInRange(Version version) |
static VersionRange |
parse(String range)
Creates a version range from the specified string.
|
String |
toString() |
public static final char LEFT_OPEN
The value of LEFT_OPEN is '('.
public static final char LEFT_CLOSED
The value of LEFT_CLOSED is '['.
public static final char RIGHT_OPEN
The value of RIGHT_OPEN is ')'.
public static final char RIGHT_CLOSED
The value of RIGHT_CLOSED is ']'.
public static VersionRange parse(String range)
Version range string grammar:
range ::= interval | at least
interval ::= ( '[' | '(' ) left ',' right ( ']' | ')' )
left ::= version
right ::= version
at least ::= version
range - String representation of the version range. The versions in
the range must contain no whitespace. Other whitespace in the
range string is ignored.IllegalArgumentException - If range is improperly formatted.public Version getFloor()
public boolean isFloorInclusive()
public Version getCeiling()
public boolean isCeilingInclusive()
public boolean isInRange(Version version)
public boolean isExact()
true if this version range contains only a single
version; false otherwise.public boolean isEmpty()
true if this version range is empty; false
otherwise.Copyright © 2019. All rights reserved.