Package groovy.transform
Enum SealedMode
- All Implemented Interfaces:
Serializable
,Comparable<SealedMode>
,java.lang.constant.Constable
Intended mode to use for sealed classes when using the
@Sealed
annotation (or sealed
keyword).- Since:
- 4.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionProduce native sealed classes when compiling for a suitable target bytecode (JDK17+) and automatically emulate the concept on earlier JDKs.Indicate the sealed nature using annotations.Produce Java-like code with sealed nature indicated by "native" bytecode information (JEP 360/397/409). -
Method Summary
Modifier and TypeMethodDescriptionstatic SealedMode
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.
-
Enum Constant Details
-
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
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
Produce native sealed classes when compiling for a suitable target bytecode (JDK17+) and automatically emulate the concept on earlier JDKs.
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-