Class Version

java.lang.Object
com.atlassian.bamboo.util.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 Details

    • Version

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

      public Version(int major, int minor)
    • Version

      public Version(int major)
  • Method Details

    • compareTo

      public int compareTo(@NotNull @NotNull Version o)
      Specified by:
      compareTo in interface Comparable<Version>
    • isGreaterThan

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

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

      public boolean isLessThan(@NotNull @NotNull Version version)
    • of

      public static Version of(@NotNull @NotNull String version) throws IllegalArgumentException
      Supported formats: - 1.2.3 - 1.2 - 1
      Parameters:
      version - to be parsed
      Returns:
      Version
      Throws:
      IllegalArgumentException - if can't parse
    • 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()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object
    • setVersionString

      public void setVersionString(String versionString)
    • setProductName

      public void setProductName(String productName)