Package dev.cwhead.GravesX.module
Interface GravesXModuleController
public interface GravesXModuleController
Runtime lifecycle controller for GravesX modules.
Implementations are provided by the host (manager/controller). The controller exposed
to a module via ModuleContext.getGravesXModules() can:
- Query enablement state for itself or other modules
- Enable/disable itself (current module)
- Enable/disable another module by key (module.yml name, simple class name, or FQCN)
- Access read-only module descriptors and enumerate all modules
Unless otherwise noted, enable/disable operations are idempotent:
invoking them when the target is already in the requested state returns true
(no-op) and does not throw.
-
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.getAuthors(String moduleKey) Convenience accessor forgetModule(moduleKey).getAuthors().Returns the descriptor for a target module identified by key.default StringConvenience accessor forgetModule(moduleKey).getName().Returns the descriptor for this (current) module.default StringgetVersion(String moduleKey) Convenience accessor forgetModule(moduleKey).getVersion().default StringgetWebsite(String moduleKey) Convenience accessor forgetModule(moduleKey).getWebsite().booleanReports whether this (current) module is enabled.booleanReports whether a target module is enabled.Returns descriptors for all discovered modules, regardless of enablement.
-
Method Details
-
isEnabled
boolean isEnabled()Reports whether this (current) module is enabled.- 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)
- Parameters:
moduleKey- identifier for the target module- Returns:
trueif the target module is enabled;falseif disabled or not found
- the module.yml
-
disableModule
void disableModule()Disables this (current) module.Idempotent: if already disabled, no action is taken.
-
disableModule
Disables a target module identified by key.Idempotent: returns
trueif the module becomes or was already disabled.- Parameters:
moduleKey- identifier for the target module (module.yml name, simple class name, or FQCN)- Returns:
trueif state changed or the module was already disabled;falseif not found
-
enableModule
void enableModule()Enables this (current) module.Idempotent: if already enabled, no action is taken.
-
enableModule
Enables a target module identified by key.Idempotent: returns
trueif the module becomes or was already enabled.- Parameters:
moduleKey- identifier for the target module (module.yml name, simple class name, or FQCN)- Returns:
trueif state changed or the module was 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.- Parameters:
moduleKey- identifier for the target module (module.yml name, simple class name, or FQCN)- Returns:
- a descriptor, or
nullif the module is unknown
-
getThisModule
GravesXModuleDescriptor getThisModule()Returns the descriptor for this (current) module.- Returns:
- a non-null descriptor for the current module
-
listModules
Collection<GravesXModuleDescriptor> listModules()Returns descriptors for all discovered modules, regardless of enablement.- Returns:
- a collection view of all module descriptors (may be empty, never
null)
-
getName
Convenience accessor forgetModule(moduleKey).getName().- Parameters:
moduleKey- identifier for the target module- Returns:
- the module name, or
nullif not found
-
getVersion
Convenience accessor forgetModule(moduleKey).getVersion().- Parameters:
moduleKey- identifier for the target module- Returns:
- the version string, or
nullif not found or unspecified
-
getWebsite
Convenience accessor forgetModule(moduleKey).getWebsite().- Parameters:
moduleKey- identifier for the target module- Returns:
- the website URL, or
nullif not found or unspecified
-
getAuthors
Convenience accessor forgetModule(moduleKey).getAuthors().- Parameters:
moduleKey- identifier for the target module- Returns:
- the authors list,
List.of()if not found or unspecified (nevernull)
-