Package com.helger.commons.system
Enum EJavaVersion
- All Implemented Interfaces:
Serializable,Comparable<EJavaVersion>,java.lang.constant.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 EJavaVersionstatic EJavaVersiongetFromMajorAndMinor(int nMajor, int nMinor) Get the matching Java version from a class version.static EJavaVersiongetFromVersionNumber(double dVersion) booleanbooleanisLTS()protected booleanisMatchingVersion(double dVersion) booleanisNewerOrEqualsThan(EJavaVersion eJavaVersion) Check if this java version is newer or equals than the passed versionbooleanisOlderOrEqualsThan(EJavaVersion eJavaVersion) Check if this java version is older or equals than the passed versionbooleanstatic EJavaVersionReturns the enum constant of this type with the specified name.static EJavaVersion[]values()Returns an array containing the constants of this enum type, 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
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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
-