Enum Class JavaVersion

java.lang.Object
java.lang.Enum<JavaVersion>
com.github.toolarium.common.util.JavaVersion
All Implemented Interfaces:
Serializable, Comparable<JavaVersion>, Constable

public enum JavaVersion extends Enum<JavaVersion>
The java version information. See https://javaalmanac.io/bytecode/versions/
  • Enum Constant Details

  • Method Details

    • values

      public static JavaVersion[] 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 JavaVersion 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
    • getJavaVersion

      public Version getJavaVersion()
      Get the java version
      Returns:
      the java version
    • getClassVersion

      public Version getClassVersion()
      Get the class version
      Returns:
      the class version
    • toString

      public String toString()
      Overrides:
      toString in class Enum<JavaVersion>
      See Also:
    • resolveJavaVersion

      public static JavaVersion resolveJavaVersion()
      Get the Java version as string
      Returns:
      the java version as string
    • resolveJavaVersion

      public static JavaVersion resolveJavaVersion(String classFilename) throws IOException
      Read the java version information
      Parameters:
      classFilename - the class filename
      Returns:
      the java version information
      Throws:
      IOException - in case of error
    • resolveJavaVersion

      public static JavaVersion resolveJavaVersion(InputStream classStream) throws IOException
      Read the java version information
      Parameters:
      classStream - the class file stream
      Returns:
      the java version information
      Throws:
      IOException - in case of error
    • resolveJavaVersion

      protected static JavaVersion resolveJavaVersion(int majorInput, int minorInput)
      Resolve the java version
      Parameters:
      majorInput - the major version
      minorInput - the minor version
      Returns:
      the java version information
    • convertJavaVersion

      public static JavaVersion convertJavaVersion(String version)
      Convert java version
      Parameters:
      version - the version number
      Returns:
      the java version information