public enum JavaVersion extends Enum<JavaVersion>
This class relies on the java.lang.Runtime.Version.major()
method
available since Java 9, therefore it's accessed via reflection. If
java.lang.Runtime.Version
is not present, we treat the runtime
environment as Java 8. Also, if there is any exception thrown during the
reflective access, we fall back to Java 8.
Since we rely on a public Java API returning the major Java version version comparisons can be done safely even with versions that didn't exist at the time the given Hazelcast version was released. See {@link FutureJavaVersion).
Enum Constant and Description |
---|
JAVA_10 |
JAVA_11 |
JAVA_12 |
JAVA_13 |
JAVA_14 |
JAVA_8 |
JAVA_9 |
Modifier and Type | Method and Description |
---|---|
int |
getMajorVersion()
Returns the major version.
|
static boolean |
isAtLeast(JavaVersion version)
Check if the current runtime version is at least the given version.
|
static boolean |
isAtMost(JavaVersion version)
Check if the current runtime version is at most the given version.
|
static JavaVersion |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static JavaVersion[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final JavaVersion JAVA_8
public static final JavaVersion JAVA_9
public static final JavaVersion JAVA_10
public static final JavaVersion JAVA_11
public static final JavaVersion JAVA_12
public static final JavaVersion JAVA_13
public static final JavaVersion JAVA_14
public static JavaVersion[] values()
for (JavaVersion c : JavaVersion.values()) System.out.println(c);
public static JavaVersion valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic int getMajorVersion()
public static boolean isAtLeast(JavaVersion version)
version
- version to be compared against the current runtime versionpublic static boolean isAtMost(JavaVersion version)
version
- version to be compared against the current runtime versionCopyright © 2019 Hazelcast, Inc.. All rights reserved.