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 int
compareTo(@NotNull Version o)
boolean
equals(Object o)
int
getMajor()
int
getMicro()
int
getMinor()
int
hashCode()
boolean
isGreaterOrEqualTo(@NotNull Version version)
boolean
isGreaterThan(@NotNull Version version)
boolean
isLessThan(@NotNull Version version)
static Version
lenient(@NotNull String version)
Supported formats: - 1.2.3 - 1.2 - 1 all optionally followed by non digit or dot trailing characters.static Version
of(@NotNull String version)
Supported formats: - 1.2.3 - 1.2 - 1void
setProductName(String productName)
void
setVersionString(String versionString)
String
toString()
-
-
-
Method Detail
-
compareTo
public int compareTo(@NotNull @NotNull Version o)
- Specified by:
compareTo
in 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)
-
-