Enum EJavaVersion

java.lang.Object
java.lang.Enum<EJavaVersion>
com.helger.commons.system.EJavaVersion
All Implemented Interfaces:
Serializable, Comparable<EJavaVersion>, java.lang.constant.Constable

public enum EJavaVersion extends Enum<EJavaVersion>
Enumeration for representing the current Java JDK version.
Author:
Philip Helger
  • Enum Constant Details

  • Method Details

    • values

      public static EJavaVersion[] 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

      public static EJavaVersion valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • isMatchingVersion

      protected boolean isMatchingVersion(double dVersion)
    • isCurrentVersion

      public boolean isCurrentVersion()
      Returns:
      true if this is the current version, false otherwise
    • isSupportedVersion

      public boolean isSupportedVersion()
      Returns:
      true if this Java version is supported by the current Java Version. It is expected that all versions are backward compatible.
    • isOlderOrEqualsThan

      public boolean isOlderOrEqualsThan(@Nonnull EJavaVersion eJavaVersion)
      Check if this java version is older or equals than the passed version
      Parameters:
      eJavaVersion - the Java version to be checked. May not be null.
      Returns:
      true if this Java version is old or equal than the passed version.
    • isNewerOrEqualsThan

      public boolean isNewerOrEqualsThan(@Nonnull EJavaVersion eJavaVersion)
      Check if this java version is newer or equals than the passed version
      Parameters:
      eJavaVersion - the Java version to be checked. May not be null.
      Returns:
      true if this Java version is newer or equal than the passed version.
    • isLTS

      public boolean isLTS()
      Returns:
      true if it is a "Long Term Support" (LTS) version, false if not
    • getCurrentVersion

      @Nonnull public static EJavaVersion getCurrentVersion()
      Returns:
      The current Java version. If the Java version could not be determined, UNKNOWN is returned and never null.
    • getFromMajorAndMinor

      @Nonnull public static EJavaVersion getFromMajorAndMinor(int nMajor, int nMinor)
      Get the matching Java version from a class version.
      Parameters:
      nMajor - Major version number
      nMinor - Minor version number
      Returns:
      UNKNOWN if the version could not be determined.
    • getFromVersionNumber

      @Nonnull public static EJavaVersion getFromVersionNumber(double dVersion)