public class JavaVersion extends java.lang.Object implements java.lang.Comparable<JavaVersion>
Modifier and Type | Field and Description |
---|---|
static JavaVersion |
JAVA_SPECIFICATION_VERSION
Represents the System property
java.specification.version |
static JavaVersion |
JAVA_VERSION
Represents the System property
java.version |
private java.lang.String |
rawVersion |
private static java.util.regex.Pattern |
startingDigits |
Modifier | Constructor and Description |
---|---|
private |
JavaVersion(java.lang.String rawVersion) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(JavaVersion other) |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
boolean |
isAtLeast(JavaVersion other)
Verify if this version is at least some other version
|
boolean |
isAtLeast(java.lang.String other)
Verify if this version is at least some other version
|
boolean |
isBefore(JavaVersion other)
Verify if this version is before some other version
|
boolean |
isBefore(java.lang.String other)
Verify if this version is before some other version
|
static JavaVersion |
parse(java.lang.String s)
Lazy parse the version-scheme.
|
private int |
suffixRate(java.lang.String suffix) |
java.lang.String |
toString() |
public static final JavaVersion JAVA_SPECIFICATION_VERSION
java.specification.version
public static final JavaVersion JAVA_VERSION
java.version
private static final java.util.regex.Pattern startingDigits
private java.lang.String rawVersion
public static JavaVersion parse(java.lang.String s)
compareTo(JavaVersion)
s
- the version stringpublic int compareTo(JavaVersion other)
compareTo
in interface java.lang.Comparable<JavaVersion>
private int suffixRate(java.lang.String suffix)
public boolean isBefore(JavaVersion other)
other
- the version to compare withtrue
is this is less than other
, otherwise false
public boolean isBefore(java.lang.String other)
other
- the version to compare withtrue
is this is less than other
, otherwise false
public boolean isAtLeast(JavaVersion other)
other
- the version to compare withtrue
is this is greater than or equal to other
, otherwise false
public boolean isAtLeast(java.lang.String other)
other
- the version to compare withtrue
is this is greater than or equal to other
, otherwise false
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object