public class Version extends Object implements Comparable<Version>
Constructor and Description |
---|
Version(int... parts)
Creates a new
Version from the given integer values. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Version that) |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
is(Version version)
Returns whether the current
Version is the same as the given one. |
boolean |
isGreaterThan(Version version)
Returns whether the current
Version is greater (newer) than the given one. |
boolean |
isGreaterThanOrEqualTo(Version version)
Returns whether the current
Version is greater (newer) or the same as the given one. |
boolean |
isLessThan(Version version)
Returns whether the current
Version is less (older) than the given one. |
boolean |
isLessThanOrEqualTo(Version version)
Returns whether the current
Version is less (older) or equal to the current one. |
static Version |
javaVersion()
Returns the Java version of the running JVM.
|
static Version |
parse(String version)
Parses the given string representation of a version into a
Version object. |
String |
toString() |
public Version(int... parts)
Version
from the given integer values. At least one value has to be given but a maximum of 4.parts
- must not be null or empty.public static Version parse(String version)
Version
object.version
- must not be null or empty.public static Version javaVersion()
public boolean isGreaterThan(Version version)
Version
is greater (newer) than the given one.version
- public boolean isGreaterThanOrEqualTo(Version version)
Version
is greater (newer) or the same as the given one.version
- public boolean is(Version version)
Version
is the same as the given one.version
- public boolean isLessThan(Version version)
Version
is less (older) than the given one.version
- public boolean isLessThanOrEqualTo(Version version)
Version
is less (older) or equal to the current one.version
- public int compareTo(Version that)
compareTo
in interface Comparable<Version>
Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.