Enum Class ModuleState

java.lang.Object
java.lang.Enum<ModuleState>
dev.engine.core.module.ModuleState
All Implemented Interfaces:
Serializable, Comparable<ModuleState>, Constable

public enum ModuleState extends Enum<ModuleState>
Represents the lifecycle state of a game module.

States progress in a linear sequence and only forward transitions are permitted. Use canTransitionTo(ModuleState) to validate a state change before applying it.

Valid transitions:

  • CREATED -> INITIALIZING
  • INITIALIZING -> RUNNING
  • RUNNING -> DEINITIALIZING
  • DEINITIALIZING -> CLEANED_UP
  • Enum Constant Details

    • CREATED

      public static final ModuleState CREATED
      Module has been created but not yet initialised.
    • INITIALIZING

      public static final ModuleState INITIALIZING
      Module is currently running its initialisation logic.
    • RUNNING

      public static final ModuleState RUNNING
      Module is fully initialised and active.
    • DEINITIALIZING

      public static final ModuleState DEINITIALIZING
      Module is currently running its de-initialisation logic.
    • CLEANED_UP

      public static final ModuleState CLEANED_UP
      Module has been fully de-initialised and all resources released.
  • Method Details

    • values

      public static ModuleState[] 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

      public static ModuleState valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • canTransitionTo

      public boolean canTransitionTo(ModuleState next)
      Returns true if transitioning from this state to next is permitted.
      Parameters:
      next - the target state to transition to; must not be null
      Returns:
      true if the transition is valid, false otherwise