Class Version

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

    public final class Version
    extends java.lang.Object
    implements java.lang.Comparable<Version>
    Comparable version information.

    The typical convention is to use 3 digit version numbers major.minor.patch, but 1 or two digits are also supported.

    If no . is used it is interpreted as a single digit version number or as plain alphanumeric if it couldn't be parsed as a number.

    It may also have a qualifier at the end for 2 or 3 digit version numbers such as "1.2-RC1". For 1 digit with qualifier, 1-RC1, it is interpreted as plain alphanumeric.

    It has support for https://github.com/dwijnand/sbt-dynver format with + or - separator. The number of commits from the tag is handled as a numeric part. For example 1.0.0+3-73475dce26 is less than 1.0.0+10-ed316bd024 (3 < 10).

    • Constructor Detail

      • Version

        public Version​(java.lang.String version)
    • Method Detail

      • Zero

        public static Version Zero()
      • apply

        public static Version apply​(java.lang.String version)
      • version

        public java.lang.String version()
      • compareTo

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

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

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