Enum Class ServiceLifeCycle

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

public enum ServiceLifeCycle extends Enum<ServiceLifeCycle>
Represents the state in which a service can be.
Since:
4.0
  • Enum Constant Details

    • PREPARED

      public static final ServiceLifeCycle PREPARED
      Represents the prepared state. If a service is in this state it can be started, stopped and deleted. It is also the state into which a service changes if it was stopped and auto delete on stop is disabled.
    • RUNNING

      public static final ServiceLifeCycle RUNNING
      The service is running. This does not mean that the service is connected or ready to accept connections from players, it does only mean that the service process was started.
    • STOPPED

      public static final ServiceLifeCycle STOPPED
      The service was stopped. This is more of a marker state as the service will never actually be in that state, it is only used to either the state of the service (which will then publish an update which has the stopped state as the target) or the service will change into the prepared state (if auto delete on stop is disabled) or change in the deleted state (if auto delete on stop is enabled).
    • DELETED

      public static final ServiceLifeCycle DELETED
      The service was removed from the system and is no longer accessible.
  • Field Details

    • possibleChangeTargetOrdinals

      private final int[] possibleChangeTargetOrdinals
  • Constructor Details

    • ServiceLifeCycle

      private ServiceLifeCycle(int... possibleChangeTargetOrdinals)
      Creates a new service lifecycle instance.
      Parameters:
      possibleChangeTargetOrdinals - all ordinal indexes of other lifecycles the lifecycle can change to.
  • Method Details

    • values

      public static ServiceLifeCycle[] 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 ServiceLifeCycle 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 ServiceLifeCycle target)
      Checks if this lifecycle can be changed to the given target lifecycle.
      Parameters:
      target - the target lifecycle to check.
      Returns:
      true if the change from this lifecycle to the given one is acceptable, false otherwise.
      Throws:
      NullPointerException - if the given target lifecycle is null.