| Modifier and Type | Field and Description |
|---|---|
static Version |
NULL_VALUE |
private static java.util.regex.Pattern |
PATTERN |
private int[] |
segments |
private static java.lang.String |
SEPARATOR |
| Modifier | Constructor and Description |
|---|---|
private |
Version()
Represents the null-Version (not given).
|
|
Version(int... version)
Constructor of the version class.
|
|
Version(java.lang.String version)
Creates a new version by parsing a string.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(Version version1,
Version version2)
Compares two versions considering null for both parameters and results in:
-1 : this is smaller <=> given version and this is bigger.
0 : given version and this are equal
|
int |
compareTo(Version version)
Compares two versions and results in:
-1 : this is smaller <=> given version and this is bigger.
0 : given version and this are equal
|
boolean |
equals(java.lang.Object obj) |
static boolean |
equals(Version version1,
Version version2)
Returns whether two versions are equal.
|
Version |
getIncrementedVersion()
Returns a version that is one higher in the first segment than the actual version.
|
int |
getSegment(int index)
Returns the version segment specified by
index. |
int |
getSegmentCount()
Returns the number of the segments.
|
java.lang.String |
getVersion()
Returns the version in a textual form.
|
int |
hashCode() |
static boolean |
isVersion(java.lang.String string)
Returns whether the given
string denotes a version. |
java.lang.String |
toString()
Returns a textual representation of this instance.
|
static java.lang.String |
toString(Version version)
Returns the textual version of
version (null-safe). |
public static final Version NULL_VALUE
private static final java.util.regex.Pattern PATTERN
private static final java.lang.String SEPARATOR
private int[] segments
private Version()
public Version(java.lang.String version)
throws VersionFormatException
version - the version string in form i(.i)* with i integer numbersVersionFormatException - in case of format problemspublic Version(int... version)
version - Version numberpublic static final boolean isVersion(java.lang.String string)
string denotes a version.string - the string to be testedtrueif string is a version, false elsepublic java.lang.String getVersion()
public int getSegmentCount()
public int getSegment(int index)
index.index - a 0-based index specifying the segment to be returnedjava.lang.IndexOutOfBoundsException - if
index<0 || index>=getSegmentCount()public int compareTo(Version version)
compareTo in interface java.lang.Comparable<Version>version - version to compare.public java.lang.String toString()
toString in class java.lang.Objectpublic static java.lang.String toString(Version version)
version (null-safe).version - the version to be converted into textpublic static boolean equals(Version version1, Version version2)
version1 - the first version instance (may be null)version2 - the second version instance (may be null)true if version1 equals
version2, false elsepublic static int compare(Version version1, Version version2)
version1 - the first version to compare.version2 - the second version to compare.public Version getIncrementedVersion() throws VersionFormatException
VersionFormatException - in case of format problems.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectCopyright © 2009 - 2018 SSE. All Rights Reserved.