public class Version extends Object implements Comparable<Version>
| Constructor and Description |
|---|
Version(String str)
Deprecated.
use
create(String) instead. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Version o)
Compares this version to the given one, segment by segment with a special
"SNAPSHOT" handling.
|
static Version |
create(String str)
Creates a new version from the given string.
|
static Version |
create(String[] segments)
Creates a new version from version segments
|
boolean |
equals(Object o) |
String[] |
getNormalizedSegments()
Returns all segments.
|
int |
hashCode() |
String |
toString() |
public static final Version EMPTY
public Version(String str)
create(String) instead.str - the version string.public static Version create(String str)
str - the version string.EMPTY if str is an empty string.public static Version create(String[] segments)
segments - version segmentsEMPTY if segments is empty.public String[] getNormalizedSegments()
public int compareTo(Version o)
Examples:
"1" < "2" "1.0" < "2" "2.0.1" < "2.1" "2.1" < "2.1.1" "2.9" < "2.11" "2.1" > "2.1-SNAPSHOT" "2.1" > "2.1-R1234556" "2.1-R12345" < "2.1-SNAPSHOT"
compareTo in interface Comparable<Version>o - the other versionCopyright © 2017 The Apache Software Foundation. All rights reserved.