Class EnumRegistry<T extends ExtensibleEnum>

java.lang.Object
org.episteme.core.util.EnumRegistry<T>

public class EnumRegistry<T extends ExtensibleEnum> extends Object
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 Details

    • EnumRegistry

      public EnumRegistry()
  • Method Details

    • getRegistry

      public static <T extends ExtensibleEnum> EnumRegistry<T> getRegistry(Class<T> type)
    • register

      public static <T extends ExtensibleEnum> void register(Class<T> type, T value)
    • valueOf

      public static <T extends ExtensibleEnum> T valueOf(Class<T> type, String name)
    • values

      public static <T extends ExtensibleEnum> List<T> values(Class<T> type)
    • register

      public void register(T value)
      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

      public T valueOf(String name)
      Returns the value with the specified name.
      Parameters:
      name - the name
      Returns:
      the value, or null if not found
    • valueOfRequired

      public T valueOfRequired(String name)
      Returns the value with the specified name.
      Parameters:
      name - the name
      Returns:
      the value
      Throws:
      IllegalArgumentException - if not found
    • valueOf

      public T valueOf(int ordinal)
      Returns the value with the specified ordinal.
    • values

      public List<T> values()
      Returns all registered values.
    • names

      public Set<String> names()
      Returns all registered names.
    • size

      public int size()
      Returns the number of registered values.
    • contains

      public boolean contains(String name)
      Checks if a name is registered.
    • builtInValues

      public List<T> builtInValues()
      Returns only built-in values.
    • userDefinedValues

      public List<T> userDefinedValues()
      Returns only user-defined values.