Comparable<JavaVersion>public class JavaVersion extends Object implements Comparable<JavaVersion>
| Modifier and Type | Field | Description |
|---|---|---|
static JavaVersion |
JAVA_SPECIFICATION_VERSION |
Represents the System property
java.specification.version |
static JavaVersion |
JAVA_VERSION |
Represents the System property
java.version |
| Modifier and Type | Method | Description |
|---|---|---|
JavaVersion |
asMajor() |
If original version starts with
"1.", then remove this part from the version |
int |
compareTo(JavaVersion other) |
|
boolean |
equals(Object obj) |
|
String |
getValue() |
Returns the original version
|
String |
getValue(int groups) |
Returns a value respecting the nuber of groups.
If the original has more groups, the end of that value will be removed. If the original has less groups, the value will be extended this ".0". |
int |
hashCode() |
|
boolean |
isAtLeast(String other) |
Verify if this version is at least some other version
|
boolean |
isAtLeast(JavaVersion other) |
Verify if this version is at least some other version
|
boolean |
isBefore(String other) |
Verify if this version is before some other version
|
boolean |
isBefore(JavaVersion other) |
Verify if this version is before some other version
|
static JavaVersion |
parse(String s) |
Lazy parse the version-scheme.
|
String |
toString() |
public static final JavaVersion JAVA_SPECIFICATION_VERSION
java.specification.versionpublic static final JavaVersion JAVA_VERSION
java.versionpublic static JavaVersion parse(String s)
compareTo(JavaVersion)s - the version string, never nullpublic int compareTo(JavaVersion other)
compareTo in interface Comparable<JavaVersion>public boolean isBefore(JavaVersion other)
other - the version to compare withtrue is this is less than other, otherwise falsepublic boolean isBefore(String other)
other - the version to compare withtrue is this is less than other, otherwise falsepublic boolean isAtLeast(JavaVersion other)
other - the version to compare withtrue is this is greater than or equal to other, otherwise falsepublic boolean isAtLeast(String other)
other - the version to compare withtrue is this is greater than or equal to other, otherwise falsepublic JavaVersion asMajor()
"1.", then remove this part from the versionpublic String getValue()
public String getValue(int groups)
JavaVersion.parse( "1" ).getValue( 1 ) is "1" JavaVersion.parse( "1" ).getValue( 2 ) is "1.0" JavaVersion.parse( "2.1" ).getValue( 1 ) is "2" JavaVersion.parse( "2.1" ).getValue( 2 ) is "2.1"
groups - number of groups to returnCopyright © 2001–2019 Codehaus Plexus. All rights reserved.