Class GroupConfiguration.Builder
java.lang.Object
eu.cloudnetservice.driver.service.ServiceConfigurationBase.Builder<GroupConfiguration, GroupConfiguration.Builder>
eu.cloudnetservice.driver.service.GroupConfiguration.Builder
- All Implemented Interfaces:
DefaultedDocPropertyHolder, DefaultedDocPropertyHolder.Mutable<GroupConfiguration.Builder>, DefaultedDocPropertyHolder.Mutable.WithDirectModifier<GroupConfiguration.Builder>, DocPropertyHolder, DocPropertyHolder.Mutable<GroupConfiguration.Builder>
- Enclosing class:
GroupConfiguration
public static class GroupConfiguration.Builder
extends ServiceConfigurationBase.Builder<GroupConfiguration, GroupConfiguration.Builder>
Represents a builder for a group configuration.
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface DefaultedDocPropertyHolder
DefaultedDocPropertyHolder.Mutable<S>Nested classes/interfaces inherited from interface DefaultedDocPropertyHolder.Mutable
DefaultedDocPropertyHolder.Mutable.WithDirectModifier<S>Nested classes/interfaces inherited from interface DocPropertyHolder
DocPropertyHolder.Mutable<S> -
Field Summary
FieldsFields inherited from class ServiceConfigurationBase.Builder
deployments, environmentVariables, includes, jvmOptions, processParameters, properties, templates -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an instance of the service configuration type this builder is targeting.modifyTargetEnvironments(@NonNull Consumer<Collection<String>> modifier) Modifies the target environments of this group configuration.Sets the name of the newly created group configuration.protected @NonNull GroupConfiguration.Builderself()Get the current instance of the builder, this removes the need for unchecked generics which are annoying.targetEnvironments(@NonNull Collection<String> targetEnvironments) Sets the target environments of the group configuration.Methods inherited from class ServiceConfigurationBase.Builder
deployments, environmentVariables, inclusions, jvmOptions, modifyDeployments, modifyEnvironmentVariables, modifyInclusions, modifyJvmOptions, modifyProcessParameters, modifyTemplates, processParameters, properties, propertyHolder, templatesMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DefaultedDocPropertyHolder
propertyAbsent, propertyPresent, readProperty, readPropertyOrDefault, readPropertyOrGet, readPropertyOrThrow, readPropertyOrThrowMethods inherited from interface DefaultedDocPropertyHolder.Mutable
removeProperty, writeProperty, writePropertyIfAbsent, writePropertyIfAbsent, writePropertyIfPresent, writePropertyIfPresentMethods inherited from interface DefaultedDocPropertyHolder.Mutable.WithDirectModifier
modifyAndSetProperties, modifyProperties
-
Field Details
-
name
-
targetEnvironments
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
name
Sets the name of the newly created group configuration. This property is required in order to build a configuration.- Parameters:
name- the name of the new group.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given name is null.
-
targetEnvironments
@NonNull public @NonNull GroupConfiguration.Builder targetEnvironments(@NonNull @NonNull Collection<String> targetEnvironments) Sets the target environments of the group configuration. This configuration will automatically be applied to all given environments, even if the base task of a service does not implement them.This method overwrites all previously set environments. Furthermore, changes to the given collection after the method call will not get reflected into this builder.
- Parameters:
targetEnvironments- the environments to always apply the group configuration to.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given environment collection is null.
-
modifyTargetEnvironments
@NonNull public @NonNull GroupConfiguration.Builder modifyTargetEnvironments(@NonNull @NonNull Consumer<Collection<String>> modifier) Modifies the target environments of this group configuration. The group configuration will always be applied to all services having the given environment, even if the base task of them does not implement the group.- Parameters:
modifier- the modifier to be applied to the already added target environments of this builder.- Returns:
- the same instance as used to call the method, for chaining.
- Throws:
NullPointerException- if the given environment is null.
-
self
Get the current instance of the builder, this removes the need for unchecked generics which are annoying.- Specified by:
selfin classServiceConfigurationBase.Builder<GroupConfiguration, GroupConfiguration.Builder>- Returns:
- the current instance of this builder.
-
build
Builds an instance of the service configuration type this builder is targeting.- Specified by:
buildin classServiceConfigurationBase.Builder<GroupConfiguration, GroupConfiguration.Builder>- Returns:
- the build service configuration.
- Throws:
NullPointerException- if this builder has no name given.
-