@Immutable public final class VersionRange extends Object implements Comparable<VersionRange>, Serializable
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_VERSION_RANGE_STRING
Default version range string.
|
| Constructor and Description |
|---|
VersionRange(String sVersionString)
Construct a version range object from a string.
|
VersionRange(Version aFloorVersion,
boolean bIncludeFloorVersion,
Version aCeilingVersion,
boolean bIncludeCeilingVersion)
Create a new version range depicted by two versions.
|
VersionRange(Version aFloorVersion,
Version aCeilingVersion)
Create a new version range depicted by two versions, assuming that both the
floor and the ceiling version should be included meaning we have an
inclusive interval.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(VersionRange rhs)
Compare this version range to another version range.
|
boolean |
equals(Object o) |
String |
getAsString()
Converts the version range to a string.
|
String |
getAsString(boolean bPrintZeroElements)
Converts the version range to a string.
|
Version |
getCeilVersion() |
Version |
getFloorVersion() |
int |
hashCode() |
boolean |
isIncludingCeil() |
boolean |
isIncludingFloor() |
String |
toString() |
boolean |
versionMatches(Version rhs) |
public static final String DEFAULT_VERSION_RANGE_STRING
public VersionRange(@Nullable String sVersionString)
sVersionString - the version range in a string format as depicted aboveIllegalArgumentException - if the floor version is < than the ceiling versionpublic VersionRange(@Nonnull Version aFloorVersion, @Nullable Version aCeilingVersion)
aFloorVersion - the floor version of the range - may not be nullaCeilingVersion - the ceiling version of the range - may be nullIllegalArgumentException - if the floor version to be used is > the ceiling version or if
the floor version is null.public VersionRange(@Nonnull Version aFloorVersion, boolean bIncludeFloorVersion, @Nullable Version aCeilingVersion, boolean bIncludeCeilingVersion)
aFloorVersion - the floor version of the range - may not be nullbIncludeFloorVersion - if true, a >= comparison is used on the version number, else a
> comparison is usedaCeilingVersion - the ceiling version of the range - may be nullbIncludeCeilingVersion - if true, a <= comparison is used on the version number, else a
< comparison is usedIllegalArgumentException - if the floor version to be used is > the ceiling version or if
the floor version is null.public boolean isIncludingFloor()
public boolean isIncludingCeil()
public int compareTo(@Nonnull VersionRange rhs)
compareTo in interface Comparable<VersionRange>rhs - the version range to compare to@Nonnull public String getAsString()
@Nonnull public String getAsString(boolean bPrintZeroElements)
bPrintZeroElements - If true than trailing zeroes are printed, otherwise
printed zeroes are not printed.null.Copyright © 2014–2016 Philip Helger. All rights reserved.