Class EnumRegistry<T extends ExtensibleEnum>
java.lang.Object
org.episteme.core.util.EnumRegistry<T>
Registry for ExtensibleEnum values.
Manages registration and lookup of enum-like values, supporting both built-in and user-defined values.
Usage example:
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns only built-in values.booleanChecks if a name is registered.intGets the next available ordinal for new values.static <T extends ExtensibleEnum>
EnumRegistry<T> getRegistry(Class<T> type) names()Returns all registered names.static <T extends ExtensibleEnum>
voidvoidRegisters a new enum value.intsize()Returns the number of registered values.Returns only user-defined values.valueOf(int ordinal) Returns the value with the specified ordinal.static <T extends ExtensibleEnum>
TReturns the value with the specified name.valueOfRequired(String name) Returns the value with the specified name.values()Returns all registered values.static <T extends ExtensibleEnum>
List<T>
-
Constructor Details
-
EnumRegistry
public EnumRegistry()
-
-
Method Details
-
getRegistry
-
register
-
valueOf
-
values
-
register
Registers a new enum value.- Parameters:
value- the value to register- Throws:
IllegalArgumentException- if name already registered
-
getNextOrdinal
public int getNextOrdinal()Gets the next available ordinal for new values. -
valueOf
-
valueOfRequired
Returns the value with the specified name.- Parameters:
name- the name- Returns:
- the value
- Throws:
IllegalArgumentException- if not found
-
valueOf
Returns the value with the specified ordinal. -
values
-
names
-
size
public int size()Returns the number of registered values. -
contains
Checks if a name is registered. -
builtInValues
-
userDefinedValues
-