| Constructor and Description |
|---|
Version(java.lang.String versionString)
Initializes a newly created Version object that represents the parsed version information.
|
Version(java.lang.String versionString,
boolean throwExceptions)
Initializes a newly created Version object that represents the parsed version information.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Version version) |
boolean |
equals(java.lang.Object o) |
int |
getMajor()
Returns the major version.
|
int |
getMinor()
Returns the minor version.
|
java.lang.String |
getOriginalString()
Returns the initial string
|
int |
getPatch()
Returns the patch version.
|
java.util.List<java.lang.Integer> |
getSubversionNumbers()
Returns a list with all numeric version parts.
|
java.lang.String |
getSuffix()
Returns the suffix.
|
int |
hashCode() |
boolean |
isAtLeast(java.lang.String otherVersion)
Checks if the Version object is equal or higher than
otherVersion. |
boolean |
isAtLeast(java.lang.String otherVersion,
boolean ignoreSuffix)
Checks if the Version object is equal or higher than
otherVersion. |
boolean |
isAtLeast(Version otherVersion)
Checks if the Version object is equal or higher than
otherVersion. |
boolean |
isAtLeast(Version otherVersion,
boolean ignoreSuffix)
Checks if the Version object is equal or higher than
otherVersion. |
boolean |
isEqual(java.lang.String otherVersion)
Checks if the Version object is equal to
otherVersion. |
boolean |
isEqual(Version otherVersion)
Checks if the Version object is equal to
otherVersion. |
boolean |
isHigherThan(java.lang.String otherVersion)
Checks if the Version object is higher than
otherVersion. |
boolean |
isHigherThan(Version otherVersion)
Checks if the Version object is higher than
otherVersion. |
boolean |
isLowerThan(java.lang.String otherVersion)
Checks if the Version object is lower than
otherVersion. |
boolean |
isLowerThan(Version otherVersion)
Checks if the Version object is lower than
otherVersion. |
public Version(@Nullable
java.lang.String versionString)
versionString could not get parsed.versionString - the string representing the version.Version(String versionString, boolean throwExceptions)public Version(@Nullable
java.lang.String versionString,
boolean throwExceptions)
throwExceptions is true and versionString could not get parsed.versionString - the string representing the version.throwExceptions - controls whether invalid versionString should cause exceptions.java.lang.NullPointerException - if versionString is null.java.lang.IllegalArgumentException - if versionString does not start with a numeric character.Version(String versionString)public int getMajor()
public int getMinor()
public int getPatch()
@Nonnull public java.util.List<java.lang.Integer> getSubversionNumbers()
@Nonnull public java.lang.String getSuffix()
@Nullable public java.lang.String getOriginalString()
public boolean isHigherThan(java.lang.String otherVersion)
otherVersion.otherVersion - a string representing another version.true if Version object is higher than otherVersion or otherVersion could not get
parsed. False if the Version is lower or equal.isHigherThan(Version otherVersion)public boolean isHigherThan(Version otherVersion)
otherVersion.otherVersion - a Version object representing another version.true if Version object is higher than otherVersion or otherVersion could not get
parsed. False if the Version is lower or equal.isHigherThan(String otherVersion)public boolean isLowerThan(java.lang.String otherVersion)
otherVersion.otherVersion - a string representing another version.true if Version object is lower than otherVersion. False if the Version is higher,
equal or otherVersion could not get parsed.isLowerThan(Version otherVersion)public boolean isLowerThan(Version otherVersion)
otherVersion.otherVersion - a Version object representing another version.true if Version object is lower than otherVersion. False if the Version is higher,
equal or otherVersion could not get parsed.isLowerThan(String otherVersion)public boolean isEqual(java.lang.String otherVersion)
otherVersion.otherVersion - a string representing another version.true if Version object and otherVersion are logically equal. False if the Version
is higher, lower or otherVersion could not get parsed.isEqual(Version otherVersion)public boolean isEqual(Version otherVersion)
otherVersion.otherVersion - a Version object representing another version.true if Version object and otherVersion are logically equal. False if the Version
is higher, lower or otherVersion could not get parsed.isEqual(String otherVersion)public boolean isAtLeast(java.lang.String otherVersion)
otherVersion.otherVersion - a string representing another version.true if the version is equal or higher than otherVersion. False if the version
is lower than otherVersion.isAtLeast(Version otherVersion)public boolean isAtLeast(Version otherVersion)
otherVersion.otherVersion - a Version object representing another version.true if the version is equal or higher than otherVersion. False if the version
is lower than otherVersion.isAtLeast(String otherVersion)public boolean isAtLeast(java.lang.String otherVersion,
boolean ignoreSuffix)
otherVersion.otherVersion - a string representing another version.ignoreSuffix - controls whether suffixes should be ignored.true if the version is equal or higher than otherVersion. False if the version
is lower than otherVersion.isAtLeast(Version otherVersion, boolean ignoreSuffix)public boolean isAtLeast(Version otherVersion, boolean ignoreSuffix)
otherVersion.otherVersion - a Version object representing another version.ignoreSuffix - controls whether suffixes should be ignored.true if the version is equal or higher than otherVersion. False if the version
is lower than otherVersion.isAtLeast(String otherVersion, boolean ignoreSuffix)public final int compareTo(@Nonnull
Version version)
compareTo in interface java.lang.Comparable<Version>public final boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Object