Enum Class EJavaVersion

java.lang.Object
java.lang.Enum<EJavaVersion>
com.helger.base.system.EJavaVersion
All Implemented Interfaces:
Serializable, Comparable<EJavaVersion>, 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 class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EJavaVersion valueOf(String name)
      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 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

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

      public static @NonNull 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

      public static @NonNull EJavaVersion getFromVersionNumber(double dVersion)
      Find the Java version matching the given version number.
      Parameters:
      dVersion - The version number to search for.
      Returns:
      The matching Java version or UNKNOWN if no match was found. Never null.