Package org.apache.commons.lang3

# Enum JavaVersion

java.lang.Object
java.lang.Enum<JavaVersion>
org.apache.commons.lang3.JavaVersion

All Implemented Interfaces:
  `Serializable`, `Comparable<JavaVersion>`

public enum JavaVersion extends Enum<JavaVersion>
An enum representing all the versions of the Java specification. This is intended to mirror available values from the java.specification.version System property.

Since:
  3.0

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `JAVA_0_9`
  The Java version reported by Android.
  `JAVA_1_1`
  Java 1.1.
  `JAVA_1_2`
  Java 1.2.
  `JAVA_1_3`
  Java 1.3.
  `JAVA_1_4`
  Java 1.4.
  `JAVA_1_5`
  Java 1.5.
  `JAVA_1_6`
  Java 1.6.
  `JAVA_1_7`
  Java 1.7.
  `JAVA_1_8`
  Java 1.8.
  `JAVA_1_9`
  Deprecated.
  As of release 3.5, replaced by `JAVA_9`
  `JAVA_10`
  Java 10.
  `JAVA_11`
  Java 11.
  `JAVA_12`
  Java 12.
  `JAVA_13`
  Java 13.
  `JAVA_14`
  Java 14.
  `JAVA_15`
  Java 15.
  `JAVA_16`
  Java 16.
  `JAVA_17`
  Java 17.
  `JAVA_18`
  Java 18.
  `JAVA_19`
  Java 19.
  `JAVA_20`
  Java 20.
  `JAVA_21`
  Java 21.
  `JAVA_22`
  Java 22.
  `JAVA_23`
  Java 23.
  `JAVA_24`
  Java 24.
  `JAVA_9`
  Java 9.
  `JAVA_RECENT`
  The most recent Java version.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `atLeast(JavaVersion requiredVersion)`
  Tests whether this version of Java is at least the version of Java passed in.
  `boolean`
  `atMost(JavaVersion requiredVersion)`
  Tests whether this version of Java is at most the version of Java passed in.
  `String`
  `toString()`
  The string value is overridden to return the standard name.
  `static JavaVersion`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static JavaVersion[]`
  `values()`
  Returns an array containing the constants of this enum type, in the order they are declared.

  ### Methods inherited from class java.lang.Enum

  `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf`

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Enum Constant Details

  - ### JAVA_0_9

    public static final JavaVersion JAVA_0_9
    The Java version reported by Android. This is not an official Java version number.

  - ### JAVA_1_1

    public static final JavaVersion JAVA_1_1
    Java 1.1.

  - ### JAVA_1_2

    public static final JavaVersion JAVA_1_2
    Java 1.2.

  - ### JAVA_1_3

    public static final JavaVersion JAVA_1_3
    Java 1.3.

  - ### JAVA_1_4

    public static final JavaVersion JAVA_1_4
    Java 1.4.

  - ### JAVA_1_5

    public static final JavaVersion JAVA_1_5
    Java 1.5.

  - ### JAVA_1_6

    public static final JavaVersion JAVA_1_6
    Java 1.6.

  - ### JAVA_1_7

    public static final JavaVersion JAVA_1_7
    Java 1.7.

  - ### JAVA_1_8

    public static final JavaVersion JAVA_1_8
    Java 1.8.

  - ### JAVA_1_9

    @Deprecated public static final JavaVersion JAVA_1_9
    Deprecated.
    As of release 3.5, replaced by `JAVA_9`
    Java 1.9.

  - ### JAVA_9

    public static final JavaVersion JAVA_9
    Java 9.
    Since:
      3.5

  - ### JAVA_10

    public static final JavaVersion JAVA_10
    Java 10.
    Since:
      3.7

  - ### JAVA_11

    public static final JavaVersion JAVA_11
    Java 11.
    Since:
      3.8

  - ### JAVA_12

    public static final JavaVersion JAVA_12
    Java 12.
    Since:
      3.9

  - ### JAVA_13

    public static final JavaVersion JAVA_13
    Java 13.
    Since:
      3.9

  - ### JAVA_14

    public static final JavaVersion JAVA_14
    Java 14.
    Since:
      3.11

  - ### JAVA_15

    public static final JavaVersion JAVA_15
    Java 15.
    Since:
      3.11

  - ### JAVA_16

    public static final JavaVersion JAVA_16
    Java 16.
    Since:
      3.11

  - ### JAVA_17

    public static final JavaVersion JAVA_17
    Java 17.
    Since:
      3.12.0

  - ### JAVA_18

    public static final JavaVersion JAVA_18
    Java 18.
    Since:
      3.13.0

  - ### JAVA_19

    public static final JavaVersion JAVA_19
    Java 19.
    Since:
      3.13.0

  - ### JAVA_20

    public static final JavaVersion JAVA_20
    Java 20.
    Since:
      3.13.0

  - ### JAVA_21

    public static final JavaVersion JAVA_21
    Java 21.
    Since:
      3.13.0

  - ### JAVA_22

    public static final JavaVersion JAVA_22
    Java 22.
    Since:
      3.15.0

  - ### JAVA_23

    public static final JavaVersion JAVA_23
    Java 23.
    Since:
      3.18.0

  - ### JAVA_24

    public static final JavaVersion JAVA_24
    Java 24.
    Since:
      3.18.0

  - ### JAVA_RECENT

    public static final JavaVersion JAVA_RECENT
    The most recent Java version. Mainly introduced to avoid to break when a new version of Java is used.

- ## Method Details

  - ### values

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

  - ### atLeast

    public boolean atLeast(JavaVersion requiredVersion)
    Tests whether this version of Java is at least the version of Java passed in.

    For example:
    `myVersion.atLeast(JavaVersion.JAVA_1_4)`

    Parameters:
      `requiredVersion` - the version to check against, not null
    Returns:
      true if this version is equal to or greater than the specified version

  - ### atMost

    public boolean atMost(JavaVersion requiredVersion)
    Tests whether this version of Java is at most the version of Java passed in.

    For example:
    `myVersion.atMost(JavaVersion.JAVA_1_4)`

    Parameters:
      `requiredVersion` - the version to check against, not null
    Returns:
      true if this version is equal to or greater than the specified version
    Since:
      3.9

  - ### toString

    public String toString()
    The string value is overridden to return the standard name.

    For example, `"1.5"`.

    Overrides:
      `toString` in class `Enum<JavaVersion>`
    Returns:
      the name, not null