Package com.atlassian.bamboo.util
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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(@NotNull Version o)booleanequals(Object o)intgetMajor()intgetMicro()intgetMinor()inthashCode()booleanisGreaterOrEqualTo(@NotNull Version version)booleanisGreaterThan(@NotNull Version version)booleanisLessThan(@NotNull Version version)static Versionlenient(@NotNull String version)Supported formats: - 1.2.3 - 1.2 - 1 all optionally followed by non digit or dot trailing characters.static Versionof(@NotNull String version)Supported formats: - 1.2.3 - 1.2 - 1voidsetProductName(String productName)voidsetVersionString(String versionString)StringtoString()
-
-
-
Method Detail
-
compareTo
public int compareTo(@NotNull @NotNull Version o)- Specified by:
compareToin interfaceComparable<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()
-
setVersionString
public void setVersionString(String versionString)
-
setProductName
public void setProductName(String productName)
-
-