Interface CategoryRegistry


public interface CategoryRegistry
A class for registry of Category.
  • Method Details

    • get

      @NotNull static @NotNull CategoryRegistry get()
      Gets the CategoryRegistry instance.
      Returns:
      the CategoryRegistry instance
    • register

      void register(@NotNull @NotNull String name, @NotNull @NotNull Category category)
      Registers a new Category.
      Parameters:
      name - the name to register Category
      category - the Category to register
    • unregister

      void unregister(@NotNull @NotNull String name)
      Unregisters a Category by its registered name.
      Parameters:
      name - the name of Category to unregister
    • unregister

      void unregister(@NotNull @NotNull Category category)
      Unregisters a Category.

      This method unregisters Category for the same instance as the argument.

      Parameters:
      category - the Category to unregister
    • unregisterAll

      void unregisterAll()
      Unregisters all Category.
    • getByName

      @NotNull @NotNull Optional<Category> getByName(@NotNull @NotNull String name)
      Gets the Category that registered with the specified name.
      Parameters:
      name - the name to search for Category
      Returns:
      the Optional that will have Category
    • getRegisteredName

      @NotNull @NotNull String getRegisteredName(@NotNull @NotNull Category category)
      Gets the name of Category.
      Parameters:
      category - the Category to search for its name
      Returns:
      the registered name
      Throws:
      IllegalStateException - if the given Category is not registered to this registry
    • names

      @NotNull @NotNull @Unmodifiable List<String> names()
      Gets the list of registered names.
      Returns:
      the list of registered names
    • values

      @NotNull @NotNull @Unmodifiable List<Category> values()
      Gets the list of registered Category.
      Returns:
      the list of registered Category
    • asMap

      @NotNull @NotNull @Unmodifiable Map<String,Category> asMap()
      Converts this CategoryRegistry to Map.
      Returns:
      the Map of this registry
    • getCustomItemCategory

      @NotNull @NotNull Category getCustomItemCategory()
      Gets the Category for custom items.
      Returns:
      the Category for custom items