Class Version

java.lang.Object
org.nuxeo.runtime.Version
All Implemented Interfaces:
Serializable, Comparable<Version>

public class Version extends Object implements Serializable, Comparable<Version>
A version consists of three fields, denoting the major version, the minor version, and the update version. Example: 3.1.2.
Author:
Bogdan Stefanescu
See Also:
  • Field Details

    • ZERO

      public static final Version ZERO
    • MIN

      public static final Version MIN
    • MAX

      public static final Version MAX
  • Constructor Details

    • Version

      public Version(int major, int minor, int update)
      Creates a new version object given the major, minor and update version numbers.
      Parameters:
      major - the major version
      minor - the minor version
      update - the update version
  • Method Details

    • parseString

      public static Version parseString(String version)
      Creates a new version object given a string representation of the version.
      Parameters:
      version - the version string
      Returns:
      the version object
      Throws:
      NumberFormatException - if the version string is invalid
    • isGreaterThan

      public boolean isGreaterThan(Version version)
      Tests if the current version is greater than the given one.
      Parameters:
      version - the version to compare to the current one
      Returns:
      true if the current version is greater, false otherwise
    • isGreaterOrEqualThan

      public boolean isGreaterOrEqualThan(Version version)
      Tests if the current version is greater or equal to the given one.
      Parameters:
      version - the version to compare to the current one
      Returns:
      if the current version is greater or equal, false otherwise
    • isEqualTo

      public boolean isEqualTo(Version version)
      Tests if the current version is equal to the given one.
      Parameters:
      version - the version to compare to the current one
      Returns:
      if the current version is equal to the given one, false otherwise
    • getMinorVersion

      public int getMinorVersion()
      Gets the minor version field.
      Returns:
      the minor
    • getMajorVersion

      public int getMajorVersion()
      Gets the major version field.
      Returns:
      the major
    • getUpdateVersion

      public int getUpdateVersion()
      Gets the update version field.
      Returns:
      the update
    • toString

      public String toString()
      Gets the string representation of this version.

      The string representation can be used in parseString(String) to create a version object.

      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Version v)
      Specified by:
      compareTo in interface Comparable<Version>