public class ComparableVersion extends Object implements Comparable<ComparableVersion>
Generic implementation of version comparison.
Features:-
' (hyphen) and '.
' (dot) separators,1.0alpha1 => [1, 0, alpha, 1]
alpha
or a
beta
or b
milestone
or m
rc
or cr
snapshot
(the empty string)
or ga
or final
sp
Constructor and Description |
---|
ComparableVersion(String version) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ComparableVersion o) |
boolean |
equals(Object o) |
String |
getCanonical() |
int |
hashCode() |
static void |
main(String... args)
Main to test version parsing and comparison.
|
void |
parseVersion(String version) |
String |
toString() |
public ComparableVersion(String version)
public final void parseVersion(String version)
public int compareTo(ComparableVersion o)
compareTo
in interface Comparable<ComparableVersion>
public String getCanonical()
public static void main(String... args)
args
- the version strings to parse and compareCopyright © 2001–2017 The Apache Software Foundation. All rights reserved.