Interface Module<T extends Time>
- Type Parameters:
T- the update context type
- All Known Implementing Classes:
AbstractModule
public interface Module<T extends Time>
Contract for a managed module with a typed update context.
Lifecycle: create -> init -> [update]* -> deinit -> cleanup
-
Method Summary
Modifier and TypeMethodDescriptionReturns the set of module types this module depends on.getState()Returns the current lifecycle state.booleanReturns whether this module is currently enabled for updates.voidCalled once to release all resources.voidonCreate()Called once after registration.voidonDeinit()Called once before cleanup.default voidCalled when the module is disabled (default no-op).default voidonEnable()Called when the module is enabled (default no-op).voidonInit(ModuleManager<T> manager) Called once after all dependencies are initialized.voidCalled per update tick with the strategy-produced context.
-
Method Details
-
onCreate
void onCreate()Called once after registration. Allocate resources here. -
onInit
Called once after all dependencies are initialized.- Parameters:
manager- the module manager that owns this module
-
onUpdate
Called per update tick with the strategy-produced context.- Parameters:
context- the update context for this tick
-
onDeinit
void onDeinit()Called once before cleanup. Reverse of init. -
onCleanup
void onCleanup()Called once to release all resources. -
onEnable
default void onEnable()Called when the module is enabled (default no-op). -
onDisable
default void onDisable()Called when the module is disabled (default no-op). -
getDependencies
-
getState
ModuleState getState()Returns the current lifecycle state.- Returns:
- the module's current
ModuleState
-
isEnabled
boolean isEnabled()Returns whether this module is currently enabled for updates.- Returns:
trueif the module is enabled,falseotherwise
-