Class TypedRegistry<T,Y>

java.lang.Object
com.github.darksoulq.abyssallib.server.registry.Registry<T>
com.github.darksoulq.abyssallib.server.registry.TypedRegistry<T,Y>

public class TypedRegistry<T,Y> extends Registry<T>
  • Constructor Details

    • TypedRegistry

      public TypedRegistry(Function<T,Y> typeExtractor)
  • Method Details

    • register

      public void register(String id, T object)
      Description copied from class: Registry
      Registers a new object with a unique identifier.

      If the ID is already present in the registry, the registration is rejected and a severe error is logged to the console to prevent accidental overwrites.

      Overrides:
      register in class Registry<T>
      Parameters:
      id - The unique string identifier for the object.
      object - The object instance to register.
    • remove

      public T remove(String id)
      Description copied from class: Registry
      Removes an entry from the registry by its ID.

      Warning: This method is intended for internal use only. Removing entries from a registry at runtime can cause significant issues with existing data references and serialization.

      Overrides:
      remove in class Registry<T>
      Parameters:
      id - The ID of the entry to remove.
      Returns:
      The object that was removed, or null if the ID was not found.
    • clear

      public void clear()
      Overrides:
      clear in class Registry<T>
    • getByType

      public <R extends T> List<R> getByType(Y type)