Class PluginModuleManager

java.lang.Object
com.thewinterframework.plugin.module.PluginModuleManager
All Implemented Interfaces:
Iterable<Class<? extends PluginModule>>

public class PluginModuleManager extends Object implements Iterable<Class<? extends PluginModule>>

This class is responsible for scanning, registering, loading, enabling, and disabling plugin modules.

  • Constructor Details

    • PluginModuleManager

      public PluginModuleManager(WinterPlugin plugin)
  • Method Details

    • scanModules

      public boolean scanModules()
      Scans the modules for the plugin.
      Returns:
      true if the modules were scanned successfully, false otherwise.
    • registerModule

      public boolean registerModule(Class<? extends PluginModule> module)
      Registers the given module.
      Parameters:
      module - the module to register.
      Returns:
      true if the module was registered successfully, false otherwise.
    • loadModules

      public boolean loadModules()
      Loads the registered modules.
      Returns:
      true if the modules were loaded successfully, false otherwise.
    • injectModules

      public boolean injectModules()
      Injects the modules.
      Returns:
      true if the modules were injected successfully, false otherwise.
    • enableModules

      public boolean enableModules()
      Enables the modules.
      Returns:
      true if the modules were enabled successfully, false otherwise.
    • disableModules

      public boolean disableModules()
      Disables the modules.
      Returns:
      true if the modules were disabled successfully, false otherwise.
    • isRegistered

      public boolean isRegistered(Class<? extends PluginModule> clazz)
      Checks if the given module is registered.
      Parameters:
      clazz - the module class to check.
      Returns:
      true if the module is registered, false otherwise.
    • getModule

      @Nullable public <T extends PluginModule> T getModule(Class<T> clazz)
      Gets the module of the given class.
      Type Parameters:
      T - the type of the module.
      Parameters:
      clazz - the module class to get.
      Returns:
      the module of the given class, or null if the module is not registered.
    • asGuiceModules

      public Set<com.google.inject.Module> asGuiceModules()
      Gets the registered modules.
      Returns:
      the registered modules.
    • iterator

      @NotNull public @NotNull Iterator<Class<? extends PluginModule>> iterator()
      Specified by:
      iterator in interface Iterable<Class<? extends PluginModule>>