java.lang.Object
tech.guilhermekaua.spigotboot.inventoryapi.internal.registry.ViewRegistry

@Internal public final class ViewRegistry extends Object
Registry of view singletons and their frozen configs, keyed by view class.

Boot-time discovery and dependency-manager instantiation happen in initialize(Context), mirroring the 2.x InventoryRegistry bootstrap; views can also be registered directly via register(View).

  • Constructor Details

    • ViewRegistry

      public ViewRegistry()
      Creates a registry without discovery support; views are registered directly through register(View).
    • ViewRegistry

      public ViewRegistry(@NotNull @NotNull ViewDiscoveryService discoveryService)
      Creates the registry with discovery support.
      Parameters:
      discoveryService - the discovery service used by initialize(Context)
  • Method Details

    • initialize

      public void initialize(@NotNull @NotNull Context context) throws Exception
      Discovers @RegisterView classes under the host plugin's base package, instantiates each through the dependency manager and registers it. A view that fails to instantiate or register is logged SEVERE and skipped; the remaining views still register.
      Parameters:
      context - the host plugin's application context
      Throws:
      Exception - when context access fails
    • register

      public void register(@NotNull @NotNull View instance)
      Registers a view instance directly: freezes its token table, runs onInit once and validates the resulting config.
      Parameters:
      instance - the view singleton to register
      Throws:
      ViewConfigurationException - when the built config violates the validation rules or a pagination layout-char target does not match the declared layout
      IllegalStateException - when the view class is already registered
    • find

      @NotNull public @NotNull Optional<RegisteredView> find(@NotNull @NotNull Class<? extends View> type)
      Looks up the registration of a view class.
      Parameters:
      type - the view class to resolve
      Returns:
      the registration, or empty when the class is not registered
    • all

      @NotNull public @NotNull Collection<RegisteredView> all()
      Returns every registration in registration order.
      Returns:
      all registrations, unmodifiable