Enum Class ServiceLifeCycle
- All Implemented Interfaces:
Serializable,Comparable<ServiceLifeCycle>,Constable
Represents the state in which a service can be.
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateServiceLifeCycle(int... possibleChangeTargetOrdinals) Creates a new service lifecycle instance. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanChangeTo(@NonNull ServiceLifeCycle target) Checks if this lifecycle can be changed to the given target lifecycle.static ServiceLifeCycleReturns the enum constant of this class with the specified name.static ServiceLifeCycle[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
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
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
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
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 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.
-