Class Version

  • All Implemented Interfaces:
    java.lang.Comparable<Version>

    public final class Version
    extends java.lang.Object
    implements java.lang.Comparable<Version>
    Representation of the product version.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String build()
      Returns the version build string.
      int compareTo​(Version other)  
      boolean equals​(java.lang.Object obj)  
      static Version fromInt​(int version)
      Returns an version from integer.
      int hashCode()  
      int major()
      Returns the major version number.
      int minor()
      Returns the minor version number.
      java.lang.String patch()
      Returns the version patch segment.
      int toInt()
      Returns an integer representation of the version.
      java.lang.String toString()  
      static Version version​(int major, int minor, java.lang.String patch, java.lang.String build)
      Creates a new version from the specified constituent numbers.
      static Version version​(java.lang.String string)
      Creates a new version by parsing the specified string.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • version

        public static Version version​(int major,
                                      int minor,
                                      java.lang.String patch,
                                      java.lang.String build)
        Creates a new version from the specified constituent numbers.
        Parameters:
        major - major version number
        minor - minor version number
        patch - version patch segment
        build - optional build string
        Returns:
        version descriptor
      • version

        public static Version version​(java.lang.String string)
        Creates a new version by parsing the specified string.
        Parameters:
        string - version string
        Returns:
        version descriptor
      • fromInt

        public static Version fromInt​(int version)
        Returns an version from integer.

        The version integer must be in the following format (big endian):

        • 8-bit unsigned major version
        • 8-bit unsigned minor version
        • 16-bit unsigned patch version
        Parameters:
        version - the version integer
        Returns:
        the version instance
      • major

        public int major()
        Returns the major version number.
        Returns:
        major version number
      • minor

        public int minor()
        Returns the minor version number.
        Returns:
        minor version number
      • patch

        public java.lang.String patch()
        Returns the version patch segment.
        Returns:
        patch number
      • build

        public java.lang.String build()
        Returns the version build string.
        Returns:
        build string
      • toInt

        public int toInt()
        Returns an integer representation of the version.

        The version integer can be used to compare two versions to one another. The integer representation of the version number is in the following format (big endian):

        • 8-bit unsigned major version
        • 8-bit unsigned minor version
        • 16-bit unsigned patch version
        If the patch() is not a number, it will default to 0.
        Returns:
        an integer representation of the version
      • compareTo

        public int compareTo​(Version other)
        Specified by:
        compareTo in interface java.lang.Comparable<Version>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object