Package com.authlete.common.util
Class Version
- java.lang.Object
-
- com.authlete.common.util.Version
-
- All Implemented Interfaces:
Serializable
,Comparable<Version>
public class Version extends Object implements Comparable<Version>, Serializable
A class that represents a version number consisting of a major number, a minor number and a patch number.- Since:
- 3.54
- See Also:
- Semantic Versioning, Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Version version)
boolean
equals(Object o)
int
getMajor()
Get the major number.int
getMinor()
Get the minor number.int
getPatch()
Get the patch number.boolean
greaterThan(Version other)
Judge whether this version is greater than the given version.boolean
greaterThanOrEqualTo(Version other)
Judge whether this version is greater than or equal to the given version.int
hashCode()
boolean
lessThan(Version other)
Judge whether this version is less than the given version.boolean
lessThanOrEqualTo(Version other)
Judge whether this version is less than or equal to the given version.String
toString()
-
-
-
Constructor Detail
-
Version
public Version(int major, int minor)
A constructor with a major number and a minor number.This constructor is an alias of
Version
(major, minor, 0)
.- Parameters:
major
- A major number.minor
- A minor number.
-
Version
public Version(int major, int minor, int patch)
A constructor with a major number, a minor number and a patch number.- Parameters:
major
- A major number.minor
- A minor number.patch
- A patch number.
-
-
Method Detail
-
getMajor
public int getMajor()
Get the major number.- Returns:
- The major number.
-
getMinor
public int getMinor()
Get the minor number.- Returns:
- The minor number.
-
getPatch
public int getPatch()
Get the patch number.- Returns:
- The patch number.
-
compareTo
public int compareTo(Version version)
- Specified by:
compareTo
in interfaceComparable<Version>
-
greaterThan
public boolean greaterThan(Version other)
Judge whether this version is greater than the given version.- Parameters:
other
- A version to compare to.- Returns:
true
if this version is greater than the given version.
-
greaterThanOrEqualTo
public boolean greaterThanOrEqualTo(Version other)
Judge whether this version is greater than or equal to the given version.- Parameters:
other
- A version to compare to.- Returns:
true
if this version is greater than or equal to the given version.
-
lessThan
public boolean lessThan(Version other)
Judge whether this version is less than the given version.- Parameters:
other
- A version to compare to.- Returns:
true
if this version is less than the given version.
-
lessThanOrEqualTo
public boolean lessThanOrEqualTo(Version other)
Judge whether this version is less than or equal to the given version.- Parameters:
other
- A version to compare to.- Returns:
true
if this version is less than or equal to the given version.
-
-