public class VersionNumber extends Object implements Comparable<VersionNumber>
VersionNumber
s are Comparable
.
We allow a component to be not just a number, but also "ea", "ea1", "ea2". "ea" is treated as "ea0", and eaN < M for any M > 0.
'*' is also allowed as a component, and '*' > M for any M > 0.
'SNAPSHOT' is also allowed as a component, and "N.SNAPSHOT" is interpreted as "N-1.*"
2.0.* > 2.0.1 > 2.0.1-SNAPSHOT > 2.0.0.99 > 2.0.0 > 2.0.ea > 2.0
Constructor and Description |
---|
VersionNumber(String num)
Parses a string like "1.0.2" into the version number.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(VersionNumber rhs) |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isNewerThan(VersionNumber rhs) |
boolean |
isOlderThan(VersionNumber rhs) |
String |
toString() |
public VersionNumber(String num)
IllegalArgumentException
- if the parsing fails.public boolean isOlderThan(VersionNumber rhs)
public boolean isNewerThan(VersionNumber rhs)
public int compareTo(VersionNumber rhs)
compareTo
in interface Comparable<VersionNumber>
Copyright © 2015. All rights reserved.