Enum Class ModuleLifeCycle
- All Implemented Interfaces:
Serializable, Comparable<ModuleLifeCycle>, Constable
The module lifecycle represents the state of a module. Each Module is only ever in exactly one of these lifecycles.
Note: The lifecycles can't change from one to another without visiting a lifecycle in between.
- Since:
- 4.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe initial state of a module until the module gets loaded.Used when the module instance was just created.In this state the reloaded task of the module is called.In this state the module is started and every module dependency declared by the module was started before.In this state the module is still loadable, it's only idling and not doing anything anymore.In this state the module is completely unloaded and will switch to theUNUSABLEstate shortly.In this state the module wrapper instance is empty, it is not associated with a module anymore. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateModuleLifeCycle(int... possibleChangeTargetOrdinals) Creates a new module lifecycle enum constant instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanChangeTo(@NonNull ModuleLifeCycle target) Checks if a module can change from this state to the given target.static ModuleLifeCycleReturns the enum constant of this class with the specified name.static ModuleLifeCycle[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CREATED
The initial state of a module until the module gets loaded. Defined module tasks for this state will never fire. -
LOADED
Used when the module instance was just created. In this stage no modules the module might depend on must be loaded. -
STARTED
In this state the module is started and every module dependency declared by the module was started before. -
RELOADING
In this state the reloaded task of the module is called. The module itself is actually not unloaded -
STOPPED
In this state the module is still loadable, it's only idling and not doing anything anymore. -
UNLOADED
In this state the module is completely unloaded and will switch to theUNUSABLEstate shortly. -
UNUSABLE
In this state the module wrapper instance is empty, it is not associated with a module anymore. Defined module tasks for this state will never fire.
-
-
Field Details
-
possibleChangeTargetOrdinals
private final int[] possibleChangeTargetOrdinals
-
-
Constructor Details
-
ModuleLifeCycle
private ModuleLifeCycle(int... possibleChangeTargetOrdinals) Creates a new module lifecycle enum constant instance.- Parameters:
possibleChangeTargetOrdinals- all ordinal indexes of other lifecycles this lifecycle can be changed to.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
canChangeTo
Checks if a module can change from this state to the given target.- Parameters:
target- the target state the module want's to change to.- Returns:
- if the module can change from the current into the target state.
- Throws:
NullPointerException- if target is null.
-