public class Version extends Object implements Comparable<Version>
| Modifier and Type | Field and Description |
|---|---|
static Version |
DEFAULT_VERSION |
static Version |
EMPTY_REPOSITORY_VERSION |
static Version |
NOT_GIT_VERSION |
| Constructor and Description |
|---|
Version(int major,
int minor,
int patch,
String... qualifiers) |
Version(Version other) |
| Modifier and Type | Method and Description |
|---|---|
Version |
addQualifier(String qualifier)
Creates a new Version object from the current one, but append a new qualifier to it.
|
int |
compareTo(Version o) |
boolean |
equals(Object o) |
int |
getMajor()
Retrieves the MAJOR part of the version object.
|
int |
getMinor()
Retrieves the MINOR part of the version object.
|
int |
getPatch()
Retrieves the PATCH part of the version object.
|
int |
hashCode() |
Version |
increasePatch()
Deprecated.
use
incrementPatch() |
Version |
incrementMajor()
return a new Version object that is a copy of this one where the major number is incremented by one,
the minor and patch are set to 0.
|
Version |
incrementMinor()
return a new Version object that is a copy of this one where the minor number is incremented by one ; patch version is set to 0.
|
Version |
incrementPatch()
return a new Version object that is a copy of this one where the patch number is incremented by one.
|
boolean |
isQualified() |
boolean |
isSnapshot() |
Version |
noQualifier()
Creates a new Version object from the current one, but removes all qualifiers from it.
|
static Version |
parse(String versionAsString)
Creates a
Version object by parsing the given string. |
Version |
removeQualifier(String qualifier)
Creates a new Version object from the current one, but removes the given qualifier from it if it exists.
|
String |
toString() |
public static final Version DEFAULT_VERSION
public static final Version EMPTY_REPOSITORY_VERSION
public static final Version NOT_GIT_VERSION
public Version(Version other)
public Version(int major,
int minor,
int patch,
String... qualifiers)
public int getMajor()
public int getMinor()
public int getPatch()
public Version addQualifier(String qualifier)
qualifier - the qualifier to be addedpublic Version removeQualifier(String qualifier)
qualifier - the qualifier to be removedpublic Version noQualifier()
public static Version parse(String versionAsString)
Version object by parsing the given string.versionAsString - the string to parseIllegalStateException - if the given string doesn't match the versionpublic Version incrementPatch()
public Version incrementMinor()
public Version incrementMajor()
public Version increasePatch()
incrementPatch()public boolean isSnapshot()
public boolean isQualified()
public int compareTo(Version o)
compareTo in interface Comparable<Version>Copyright © 2016–2019 Matthieu Brouillard. All rights reserved.