Package com.helger.base.system
Enum Class EJavaVersion
- All Implemented Interfaces:
Serializable,Comparable<EJavaVersion>,Constable
Enumeration for representing the current Java JDK version.
- Author:
- Philip Helger
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull EJavaVersionstatic @NonNull EJavaVersiongetFromMajorAndMinor(int nMajor, int nMinor) Get the matching Java version from a class version.static @NonNull EJavaVersiongetFromVersionNumber(double dVersion) Find the Java version matching the given version number.booleanbooleanisLTS()protected booleanisMatchingVersion(double dVersion) booleanisNewerOrEqualsThan(@NonNull EJavaVersion eJavaVersion) Check if this java version is newer or equals than the passed versionbooleanisOlderOrEqualsThan(@NonNull EJavaVersion eJavaVersion) Check if this java version is older or equals than the passed versionbooleanstatic EJavaVersionReturns the enum constant of this class with the specified name.static EJavaVersion[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNKNOWN
-
JDK_1_1
-
JDK_1_2
-
JDK_1_3
-
JDK_1_4
-
JDK_1_5
-
JDK_1_6
-
JDK_1_7
-
JDK_1_8
-
JDK_9
-
JDK_10
-
JDK_11
-
JDK_12
-
JDK_13
-
JDK_14
-
JDK_15
-
JDK_16
-
JDK_17
-
JDK_18
-
JDK_19
-
JDK_20
-
JDK_21
-
JDK_22
-
JDK_23
-
JDK_24
-
JDK_25
-
JDK_26
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isMatchingVersion
protected boolean isMatchingVersion(double dVersion) -
isCurrentVersion
public boolean isCurrentVersion()- Returns:
trueif this is the current version,falseotherwise
-
isSupportedVersion
public boolean isSupportedVersion()- Returns:
trueif this Java version is supported by the current Java Version. It is expected that all versions are backward compatible.
-
isOlderOrEqualsThan
Check if this java version is older or equals than the passed version- Parameters:
eJavaVersion- the Java version to be checked. May not benull.- Returns:
trueif this Java version is old or equal than the passed version.
-
isNewerOrEqualsThan
Check if this java version is newer or equals than the passed version- Parameters:
eJavaVersion- the Java version to be checked. May not benull.- Returns:
trueif this Java version is newer or equal than the passed version.
-
isLTS
public boolean isLTS()- Returns:
trueif it is a "Long Term Support" (LTS) version,falseif not
-
getCurrentVersion
- Returns:
- The current Java version. If the Java version could not be determined,
UNKNOWNis returned and nevernull.
-
getFromMajorAndMinor
Get the matching Java version from a class version.- Parameters:
nMajor- Major version numbernMinor- Minor version number- Returns:
UNKNOWNif the version could not be determined.
-
getFromVersionNumber
Find the Java version matching the given version number.- Parameters:
dVersion- The version number to search for.- Returns:
- The matching Java version or
UNKNOWNif no match was found. Nevernull.
-