Enum Class ModuleLifeCycle

java.lang.Object
java.lang.Enum<ModuleLifeCycle>
eu.cloudnetservice.driver.module.ModuleLifeCycle
All Implemented Interfaces:
Serializable, Comparable<ModuleLifeCycle>, Constable

public enum ModuleLifeCycle extends Enum<ModuleLifeCycle>
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 java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The 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 the UNUSABLE state shortly.
    In this state the module wrapper instance is empty, it is not associated with a module anymore.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int[]
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    ModuleLifeCycle(int... possibleChangeTargetOrdinals)
    Creates a new module lifecycle enum constant instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if a module can change from this state to the given target.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • CREATED

      public static final ModuleLifeCycle CREATED
      The initial state of a module until the module gets loaded. Defined module tasks for this state will never fire.
    • LOADED

      public static final ModuleLifeCycle LOADED
      Used when the module instance was just created. In this stage no modules the module might depend on must be loaded.
    • STARTED

      public static final ModuleLifeCycle STARTED
      In this state the module is started and every module dependency declared by the module was started before.
    • RELOADING

      public static final ModuleLifeCycle RELOADING
      In this state the reloaded task of the module is called. The module itself is actually not unloaded
    • STOPPED

      public static final ModuleLifeCycle STOPPED
      In this state the module is still loadable, it's only idling and not doing anything anymore.
    • UNLOADED

      public static final ModuleLifeCycle UNLOADED
      In this state the module is completely unloaded and will switch to the UNUSABLE state shortly.
    • UNUSABLE

      public static final ModuleLifeCycle 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

      public static ModuleLifeCycle[] 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 ModuleLifeCycle 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
    • canChangeTo

      public boolean canChangeTo(@NonNull @NonNull ModuleLifeCycle target)
      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.