E - the type of the dynamic enum instance.public interface CoreDynamicEnum<E extends CoreDynamicEnum<E>>
Dynamic enumerations extend the capabilities of traditional enums in Java. Unlike traditional enums, which have a fixed set of instances, dynamic enumerations can create new instances on-the-fly.
Classes implementing this interface are expected to have properties similar
to traditional enums, such as name and ordinal. The name
is the string identifier of the dynamic enum instance, while the ordinal
represents the position of the dynamic enum instance in the declaration order.
This interface is generally used in conjunction with DynamicEnumClass,
which manages instances of dynamic enumerations.
Example usage with DynamicEnumClass:
DynamicEnumClass<MyDynamicEnum> myDynamicEnums = new DynamicEnumClass<>(MyDynamicEnum.class);
MyDynamicEnum customInstance = myDynamicEnums.valueOf("CustomInstance");
Where MyDynamicEnum is a class implementing CoreDynamicEnum.
| Modifier and Type | Method and Description |
|---|---|
String |
name()
Returns the unique name of this dynamic enum instance.
|
int |
ordinal()
Returns the unique ordinal number of this dynamic enum instance.
|
String name()
int ordinal()
Copyright © 2024. All rights reserved.