Class ModuleManager.ControllerImpl

java.lang.Object
dev.cwhead.GravesX.module.ModuleManager.ControllerImpl
All Implemented Interfaces:
GravesXModuleController
Enclosing class:
ModuleManager

private final class ModuleManager.ControllerImpl extends Object implements GravesXModuleController
Controller exposed to modules via ModuleContext.getGravesXModules(). Implements GravesXModuleController by delegating lifecycle operations and lookups to the enclosing ModuleManager. Supports both:
  • acting on this module (the one owning the context)
  • acting on a target module identified by key (module.yml name, simple class, or FQCN)
All enable/disable operations are idempotent.
  • Field Details

  • Constructor Details

  • Method Details

    • isEnabled

      public boolean isEnabled()
      Reports whether this (current) module is enabled.
      Specified by:
      isEnabled in interface GravesXModuleController
      Returns:
      true if the current module is enabled; false otherwise
    • isEnabled

      public boolean isEnabled(String moduleKey)
      Reports whether a target module is enabled. The moduleKey can be:
      • the module.yml name
      • the module's simple class name
      • the module's fully qualified class name (FQCN)
      Matching is implementation-defined (typically case-insensitive).
      Specified by:
      isEnabled in interface GravesXModuleController
      Parameters:
      moduleKey - module identifier (module.yml name, simple class name, or FQCN)
      Returns:
      true if the target module is enabled; false otherwise
    • disableModule

      public void disableModule()
      Disables this (current) module.

      Idempotent: if already disabled, no action is taken.

      Specified by:
      disableModule in interface GravesXModuleController
    • disableModule

      public boolean disableModule(String moduleKey)
      Disables a target module identified by key.

      Idempotent: returns true if the module becomes or was already disabled.

      Specified by:
      disableModule in interface GravesXModuleController
      Parameters:
      moduleKey - module identifier (module.yml name, simple class name, or FQCN)
      Returns:
      true if the module was found and is now disabled (or already disabled); false if not found
    • enableModule

      public void enableModule()
      Enables this (current) module.

      Idempotent: if already enabled, no action is taken.

      Specified by:
      enableModule in interface GravesXModuleController
    • enableModule

      public boolean enableModule(String moduleKey)
      Enables a target module identified by key.

      Idempotent: returns true if the module becomes or was already enabled.

      Specified by:
      enableModule in interface GravesXModuleController
      Parameters:
      moduleKey - module identifier (module.yml name, simple class name, or FQCN)
      Returns:
      true if the module was found and is now enabled (or already enabled); false if not found
    • getModule

      public GravesXModuleDescriptor getModule(String moduleKey)
      Returns the descriptor for a target module identified by key.

      The descriptor provides read-only metadata parsed from module.yml (name, version, authors, dependencies, etc.) plus runtime state.

      Specified by:
      getModule in interface GravesXModuleController
      Parameters:
      moduleKey - module identifier (module.yml name, simple class name, or FQCN)
      Returns:
      descriptor for the target module, or null if unknown
    • getThisModule

      public GravesXModuleDescriptor getThisModule()
      Returns the descriptor for this (current) module.
      Specified by:
      getThisModule in interface GravesXModuleController
      Returns:
      non-null descriptor for this controller's module
    • listModules

      public Collection<GravesXModuleDescriptor> listModules()
      Returns descriptors for all discovered modules, regardless of enablement.
      Specified by:
      listModules in interface GravesXModuleController
      Returns:
      immutable collection of descriptors for all discovered modules