Package dev.cwhead.GravesX.module
Class ModuleManager.ControllerImpl
java.lang.Object
dev.cwhead.GravesX.module.ModuleManager.ControllerImpl
- All Implemented Interfaces:
GravesXModuleController
- Enclosing class:
ModuleManager
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)
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a controller bound to the given module. -
Method Summary
Modifier and TypeMethodDescriptionvoidDisables this (current) module.booleandisableModule(String moduleKey) Disables a target module identified by key.voidEnables this (current) module.booleanenableModule(String moduleKey) Enables a target module identified by key.Returns the descriptor for a target module identified by key.Returns the descriptor for this (current) module.booleanReports whether this (current) module is enabled.booleanReports whether a target module is enabled.Returns descriptors for all discovered modules, regardless of enablement.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.cwhead.GravesX.module.GravesXModuleController
getAuthors, getName, getVersion, getWebsite
-
Field Details
-
self
-
-
Constructor Details
-
ControllerImpl
ControllerImpl(ModuleManager.LoadedModule self) Creates a controller bound to the given module.- Parameters:
self- the loaded module represented by this controller- Throws:
NullPointerException- ifselfis null
-
-
Method Details
-
isEnabled
public boolean isEnabled()Reports whether this (current) module is enabled.- Specified by:
isEnabledin interfaceGravesXModuleController- Returns:
trueif the current module is enabled;falseotherwise
-
isEnabled
Reports whether a target module is enabled. ThemoduleKeycan be:- the module.yml
name - the module's simple class name
- the module's fully qualified class name (FQCN)
- Specified by:
isEnabledin interfaceGravesXModuleController- Parameters:
moduleKey- module identifier (module.yml name, simple class name, or FQCN)- Returns:
trueif the target module is enabled;falseotherwise
- the module.yml
-
disableModule
public void disableModule()Disables this (current) module.Idempotent: if already disabled, no action is taken.
- Specified by:
disableModulein interfaceGravesXModuleController
-
disableModule
Disables a target module identified by key.Idempotent: returns
trueif the module becomes or was already disabled.- Specified by:
disableModulein interfaceGravesXModuleController- Parameters:
moduleKey- module identifier (module.yml name, simple class name, or FQCN)- Returns:
trueif the module was found and is now disabled (or already disabled);falseif not found
-
enableModule
public void enableModule()Enables this (current) module.Idempotent: if already enabled, no action is taken.
- Specified by:
enableModulein interfaceGravesXModuleController
-
enableModule
Enables a target module identified by key.Idempotent: returns
trueif the module becomes or was already enabled.- Specified by:
enableModulein interfaceGravesXModuleController- Parameters:
moduleKey- module identifier (module.yml name, simple class name, or FQCN)- Returns:
trueif the module was found and is now enabled (or already enabled);falseif not found
-
getModule
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:
getModulein interfaceGravesXModuleController- Parameters:
moduleKey- module identifier (module.yml name, simple class name, or FQCN)- Returns:
- descriptor for the target module, or
nullif unknown
-
getThisModule
Returns the descriptor for this (current) module.- Specified by:
getThisModulein interfaceGravesXModuleController- Returns:
- non-null descriptor for this controller's module
-
listModules
Returns descriptors for all discovered modules, regardless of enablement.- Specified by:
listModulesin interfaceGravesXModuleController- Returns:
- immutable collection of descriptors for all discovered modules
-