Class Version

  • All Implemented Interfaces:
    Comparable<Version>

    public class Version
    extends Object
    implements Comparable<Version>
    Use this class to compare different versions. Supports only major.minor.micro format. Each field is number
    • Constructor Detail

      • Version

        public Version​(int major,
                       int minor,
                       int micro)
      • Version

        public Version​(int major,
                       int minor)
      • Version

        public Version​(int major)
    • Method Detail

      • isGreaterThan

        public boolean isGreaterThan​(@NotNull
                                     @NotNull Version version)
      • isGreaterOrEqualTo

        public boolean isGreaterOrEqualTo​(@NotNull
                                          @NotNull Version version)
      • isLessThan

        public boolean isLessThan​(@NotNull
                                  @NotNull Version version)
      • lenient

        public static Version lenient​(@NotNull
                                      @NotNull String version)
                               throws IllegalArgumentException
        Supported formats: - 1.2.3 - 1.2 - 1 all optionally followed by non digit or dot trailing characters.
        Parameters:
        version - to be parsed
        Returns:
        Version
        Throws:
        IllegalArgumentException - if can't parse
      • getMajor

        public int getMajor()
      • getMinor

        public int getMinor()
      • getMicro

        public int getMicro()
      • hashCode

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

        public void setVersionString​(String versionString)
      • setProductName

        public void setProductName​(String productName)