Package migratedb.v1.core.api
Class Version
- java.lang.Object
-
- migratedb.v1.core.api.Version
-
- All Implemented Interfaces:
Comparable<Version>
public final class Version extends Object implements Comparable<Version>
Note: "1.0" and "1.0.0" are considered equivalent bycompareTo(Version)andequals(Object)!
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Version o)booleanequals(Object o)BigIntegergetMajor()StringgetMajorAsString()StringgetMinorAsString()inthashCode()booleanisAtLeast(String otherVersion)Convenience method for quickly checking whether this version is at least as new as this other version.booleanisMajorNewerThan(String otherVersion)Convenience method for quickly checking whether this major version is newer than this other major version.booleanisNewerThan(String otherVersion)Convenience method for quickly checking whether this version is newer than this other version.static Versionparse(String version)Parses a version fromversion.StringtoString()
-
-
-
Method Detail
-
isAtLeast
public boolean isAtLeast(String otherVersion)
Convenience method for quickly checking whether this version is at least as new as this other version.- Parameters:
otherVersion- The other version.- Returns:
trueif this version is equal or newer,falseif it is older.
-
isNewerThan
public boolean isNewerThan(String otherVersion)
Convenience method for quickly checking whether this version is newer than this other version.- Parameters:
otherVersion- The other version.- Returns:
trueif this version is newer,falseif it is not.
-
isMajorNewerThan
public boolean isMajorNewerThan(String otherVersion)
Convenience method for quickly checking whether this major version is newer than this other major version.- Parameters:
otherVersion- The other version.- Returns:
trueif this major version is newer,falseif it is not.
-
getMajor
public BigInteger getMajor()
- Returns:
- The major version.
-
getMajorAsString
public String getMajorAsString()
- Returns:
- The major version as a string.
-
getMinorAsString
public String getMinorAsString()
- Returns:
- The minor version as a string.
-
compareTo
public int compareTo(Version o)
- Specified by:
compareToin interfaceComparable<Version>
-
-