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 by compareTo(Version) and equals(Object)!
  • Method Details

    • parse

      public static Version parse(String version)
      Parses a version from version.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      Version as String.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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:
      true if this version is equal or newer, false if 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:
      true if this version is newer, false if 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:
      true if this major version is newer, false if 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:
      compareTo in interface Comparable<Version>