SealedMode (Groovy 5.0.0)
Description: declaration: package: groovy.transform, enum: SealedMode

Package groovy.transform

# Enum SealedMode

java.lang.Object
java.lang.Enum<SealedMode>
groovy.transform.SealedMode

All Implemented Interfaces:
  `Serializable`, `Comparable<SealedMode>`, `java.lang.constant.Constable`

public enum SealedMode extends Enum<SealedMode>
Intended mode to use for sealed classes when using the `@Sealed` annotation (or `sealed` keyword).

Since:
  4.0.0
See Also:
  - `Sealed`

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class java.lang.Enum

  `Enum.EnumDesc<E extends Enum<E>>`

- ## Enum Constant Summary

  Enum Constants
  Enum Constant
  Description
  `AUTO`
  Produce native sealed classes when compiling for a suitable target bytecode (JDK17+) and automatically emulate the concept on earlier JDKs.
  `EMULATE`
  Indicate the sealed nature using annotations.
  `NATIVE`
  Produce Java-like code with sealed nature indicated by "native" bytecode information (JEP 360/397/409).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static SealedMode`
  `valueOf(String name)`
  Returns the enum constant of this type with the specified name.
  `static SealedMode[]`
  `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, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

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

- ## Enum Constant Details

  - ### EMULATE

    public static final SealedMode EMULATE
    Indicate the sealed nature using annotations. This allows sealed hierarchies in earlier JDKs but for integration purposes won't be recognised by Java.

  - ### NATIVE

    public static final SealedMode NATIVE
    Produce Java-like code with sealed nature indicated by "native" bytecode information (JEP 360/397/409). Produces a compile-time error when used on earlier JDKs.

  - ### AUTO

    public static final SealedMode AUTO
    Produce native sealed classes when compiling for a suitable target bytecode (JDK17+) and automatically emulate the concept on earlier JDKs.

- ## Method Details

  - ### values

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