Class ServiceEnvironment

java.lang.Object
eu.cloudnetservice.driver.service.ServiceEnvironment
All Implemented Interfaces:
Named, Cloneable

public class ServiceEnvironment extends Object implements Named, Cloneable
Represents an environment a service can run in. The environment for example decides which application file gets chosen when starting a service. Environments are grouped in a service environment type and both must be registered on a node which picks up a service using the environment.
Since:
4.0
  • Field Details

    • name

      private final String name
    • environmentType

      private final String environmentType
  • Constructor Details

    • ServiceEnvironment

      protected ServiceEnvironment(@NonNull @NonNull String name, @NonNull @NonNull String environmentType)
      Constructs a new service environment instance.
      Parameters:
      name - the name of the environment.
      environmentType - the environment type which is associated with this environment.
      Throws:
      NullPointerException - if the given name or environment type is null.
  • Method Details

    • builder

      @NonNull public static @NonNull ServiceEnvironment.Builder builder()
      Constructs a new builder instance for a service environment.
      Returns:
      a service environment builder.
    • builder

      Constructs a new builder instance for a service environment, copying the properties of the given environment into the builder first.

      When calling build directly after constructing a builder using this method, it will result in an environment which is equal but not the same as the given one.

      Parameters:
      environment - the environment to copy the properties from.
      Returns:
      a new builder for a service environment holding the same properties as the given environment.
      Throws:
      NullPointerException - if the given environment is null.
    • name

      @NonNull public @NonNull String name()
      Get the unique name identifier of this object in the related scope.
      Specified by:
      name in interface Named
      Returns:
      the unique name identifier of this object in the related scope.
    • environmentType

      @NonNull public @NonNull String environmentType()
      Get the name of the environment type which is associated with this environment.
      Returns:
      the name of the associated environment type.
    • clone

      public ServiceEnvironment clone()
      Overrides:
      clone in class Object