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:
  • 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