Class Version

    • Method Detail

      • version

        public static Version version​(int major,
                                      int minor,
                                      String patch,
                                      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​(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 String patch()
        Returns the version patch segment.
        Returns:
        patch number
      • build

        public 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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object