public final class Version extends Object implements Comparable<Version>
Modifier and Type | Field and Description |
---|---|
static String |
FORMAT_LONG |
static String |
FORMAT_MINIMAL |
static String |
FORMAT_SHORT |
static String |
TOO_SHORT |
Modifier and Type | Method and Description |
---|---|
String |
build()
Returns the version build string.
|
int |
compareTo(Version other) |
boolean |
equals(Object obj) |
static Version |
fromInt(int version)
Returns an version from integer.
|
int |
hashCode() |
int |
major()
Returns the major version number.
|
int |
minor()
Returns the minor version number.
|
String |
patch()
Returns the version patch segment.
|
int |
toInt()
Returns an integer representation of the version.
|
String |
toString() |
static Version |
version(int major,
int minor,
String patch,
String build)
Creates a new version from the specified constituent numbers.
|
static Version |
version(String string)
Creates a new version by parsing the specified string.
|
public static final String FORMAT_MINIMAL
public static final String FORMAT_SHORT
public static final String FORMAT_LONG
public static final String TOO_SHORT
public static Version version(int major, int minor, String patch, String build)
major
- major version numberminor
- minor version numberpatch
- version patch segmentbuild
- optional build stringpublic static Version version(String string)
string
- version stringpublic static Version fromInt(int version)
The version integer must be in the following format (big endian):
version
- the version integerpublic int major()
public int minor()
public String patch()
public String build()
public int toInt()
The version integer can be used to compare two versions to one another. The integer representation of the version number is in the following format (big endian):
patch()
is not a number, it will default to 0
.public int compareTo(Version other)
compareTo
in interface Comparable<Version>