Enum 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).
See Also:
  • Enum Constant Details


      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.
      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.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null