Class AbstractModule<T extends Time>
java.lang.Object
dev.engine.core.module.AbstractModule<T>
- Type Parameters:
T- the update context type
- All Implemented Interfaces:
Module<T>
Template-method base class for modules that enforces the lifecycle state machine.
Subclasses override the do* methods to provide custom behaviour at each
lifecycle stage. All public lifecycle methods are final so that the state
machine cannot be circumvented.
The only method a subclass must implement is
;
every other hook defaults to a no-op.invalid reference
#doUpdate(Object)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voiddoCreate()protected voiddoDeinit()protected voiddoInit(ModuleManager<T> manager) protected abstract voidfinal ModuleStategetState()Returns the current lifecycle state.final booleanReturns whether this module is currently enabled for updates.final voidCalled once to release all resources.final voidonCreate()Called once after registration.final voidonDeinit()Called once before cleanup.final voidonInit(ModuleManager<T> manager) Called once after all dependencies are initialized.final voidCalled per update tick with the strategy-produced context.final voidsetEnabled(boolean enabled) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Module
getDependencies, onDisable, onEnable
-
Constructor Details
-
AbstractModule
public AbstractModule()
-
-
Method Details
-
onCreate
-
onInit
-
onUpdate
-
onDeinit
-
onCleanup
-
setEnabled
public final void setEnabled(boolean enabled) -
doCreate
protected void doCreate() -
doInit
-
doUpdate
-
doDeinit
protected void doDeinit() -
doCleanup
protected void doCleanup() -
getModule
-
getState
-
isEnabled
-