All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.neotys.neoload.model.v3.project.ImmutableProject Maven / Gradle / Ivy

package com.neotys.neoload.model.v3.project;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.neotys.neoload.model.v3.project.population.Population;
import com.neotys.neoload.model.v3.project.scenario.Scenario;
import com.neotys.neoload.model.v3.project.server.Server;
import com.neotys.neoload.model.v3.project.sla.SlaProfile;
import com.neotys.neoload.model.v3.project.userpath.UserPath;
import com.neotys.neoload.model.v3.project.variable.Variable;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.CheckReturnValue;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import javax.validation.Valid;

/**
 * Immutable implementation of {@link Project}.
 * 

* Use the builder to create immutable instances: * {@code new Project.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "Project"}) @Immutable @CheckReturnValue public final class ImmutableProject implements Project { private final @Nullable String name; private final ImmutableList slaProfiles; private final ImmutableList variables; private final ImmutableList servers; private final ImmutableList userPaths; private final ImmutableList populations; private final ImmutableList scenarios; private final ImmutableMap projectSettings; private final ImmutableList dependencies; private ImmutableProject( @Nullable String name, ImmutableList slaProfiles, ImmutableList variables, ImmutableList servers, ImmutableList userPaths, ImmutableList populations, ImmutableList scenarios, ImmutableMap projectSettings, ImmutableList dependencies) { this.name = name; this.slaProfiles = slaProfiles; this.variables = variables; this.servers = servers; this.userPaths = userPaths; this.populations = populations; this.scenarios = scenarios; this.projectSettings = projectSettings; this.dependencies = dependencies; } /** * @return The value of the {@code name} attribute */ @JsonProperty("name") @Override public Optional getName() { return Optional.ofNullable(name); } /** * @return The value of the {@code slaProfiles} attribute */ @JsonProperty("sla_profiles") @Override public ImmutableList getSlaProfiles() { return slaProfiles; } /** * @return The value of the {@code variables} attribute */ @JsonProperty("variables") @Override public ImmutableList getVariables() { return variables; } /** * @return The value of the {@code servers} attribute */ @JsonProperty("servers") @Override public ImmutableList getServers() { return servers; } /** * @return The value of the {@code userPaths} attribute */ @JsonProperty("user_paths") @Override public ImmutableList getUserPaths() { return userPaths; } /** * @return The value of the {@code populations} attribute */ @JsonProperty("populations") @Override public ImmutableList getPopulations() { return populations; } /** * @return The value of the {@code scenarios} attribute */ @JsonProperty("scenarios") @Override public ImmutableList getScenarios() { return scenarios; } /** * @return The value of the {@code projectSettings} attribute */ @JsonProperty("project_settings") @Override public ImmutableMap getProjectSettings() { return projectSettings; } /** * @return The value of the {@code dependencies} attribute */ @JsonProperty("dependencies") @JsonIgnore @Override public ImmutableList getDependencies() { return dependencies; } /** * Copy the current immutable object by setting a present value for the optional {@link Project#getName() name} attribute. * @param value The value for name * @return A modified copy of {@code this} object */ public final ImmutableProject withName(String value) { @Nullable String newValue = Objects.requireNonNull(value, "name"); if (Objects.equals(this.name, newValue)) return this; return new ImmutableProject( newValue, this.slaProfiles, this.variables, this.servers, this.userPaths, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object by setting an optional value for the {@link Project#getName() name} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for name * @return A modified copy of {@code this} object */ public final ImmutableProject withName(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.name, value)) return this; return new ImmutableProject( value, this.slaProfiles, this.variables, this.servers, this.userPaths, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getSlaProfiles() slaProfiles}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withSlaProfiles(SlaProfile... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, newValue, this.variables, this.servers, this.userPaths, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getSlaProfiles() slaProfiles}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of slaProfiles elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withSlaProfiles(Iterable elements) { if (this.slaProfiles == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, newValue, this.variables, this.servers, this.userPaths, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getVariables() variables}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withVariables(Variable... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, newValue, this.servers, this.userPaths, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getVariables() variables}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of variables elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withVariables(Iterable elements) { if (this.variables == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, newValue, this.servers, this.userPaths, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getServers() servers}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withServers(Server... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, newValue, this.userPaths, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getServers() servers}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of servers elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withServers(Iterable elements) { if (this.servers == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, newValue, this.userPaths, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getUserPaths() userPaths}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withUserPaths(UserPath... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, newValue, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getUserPaths() userPaths}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of userPaths elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withUserPaths(Iterable elements) { if (this.userPaths == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, newValue, this.populations, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getPopulations() populations}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withPopulations(Population... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, this.userPaths, newValue, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getPopulations() populations}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of populations elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withPopulations(Iterable elements) { if (this.populations == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, this.userPaths, newValue, this.scenarios, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getScenarios() scenarios}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withScenarios(Scenario... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, this.userPaths, this.populations, newValue, this.projectSettings, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getScenarios() scenarios}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of scenarios elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withScenarios(Iterable elements) { if (this.scenarios == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, this.userPaths, this.populations, newValue, this.projectSettings, this.dependencies); } /** * Copy the current immutable object by replacing the {@link Project#getProjectSettings() projectSettings} map with the specified map. * Nulls are not permitted as keys or values. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param entries The entries to be added to the projectSettings map * @return A modified copy of {@code this} object */ public final ImmutableProject withProjectSettings(java.util.Map entries) { if (this.projectSettings == entries) return this; ImmutableMap newValue = ImmutableMap.copyOf(entries); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, this.userPaths, this.populations, this.scenarios, newValue, this.dependencies); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getDependencies() dependencies}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withDependencies(Dependency... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, this.userPaths, this.populations, this.scenarios, this.projectSettings, newValue); } /** * Copy the current immutable object with elements that replace the content of {@link Project#getDependencies() dependencies}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of dependencies elements to set * @return A modified copy of {@code this} object */ public final ImmutableProject withDependencies(Iterable elements) { if (this.dependencies == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableProject( this.name, this.slaProfiles, this.variables, this.servers, this.userPaths, this.populations, this.scenarios, this.projectSettings, newValue); } /** * This instance is equal to all instances of {@code ImmutableProject} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof ImmutableProject && equalTo((ImmutableProject) another); } private boolean equalTo(ImmutableProject another) { return Objects.equals(name, another.name) && slaProfiles.equals(another.slaProfiles) && variables.equals(another.variables) && servers.equals(another.servers) && userPaths.equals(another.userPaths) && populations.equals(another.populations) && scenarios.equals(another.scenarios) && projectSettings.equals(another.projectSettings) && dependencies.equals(another.dependencies); } /** * Computes a hash code from attributes: {@code name}, {@code slaProfiles}, {@code variables}, {@code servers}, {@code userPaths}, {@code populations}, {@code scenarios}, {@code projectSettings}, {@code dependencies}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(name); h += (h << 5) + slaProfiles.hashCode(); h += (h << 5) + variables.hashCode(); h += (h << 5) + servers.hashCode(); h += (h << 5) + userPaths.hashCode(); h += (h << 5) + populations.hashCode(); h += (h << 5) + scenarios.hashCode(); h += (h << 5) + projectSettings.hashCode(); h += (h << 5) + dependencies.hashCode(); return h; } /** * Prints the immutable value {@code Project} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("Project") .omitNullValues() .add("name", name) .add("slaProfiles", slaProfiles) .add("variables", variables) .add("servers", servers) .add("userPaths", userPaths) .add("populations", populations) .add("scenarios", scenarios) .add("projectSettings", projectSettings) .add("dependencies", dependencies) .toString(); } /** * Utility type used to correctly read immutable object from JSON representation. * @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure */ @Deprecated @JsonDeserialize @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements Project { Optional name = Optional.empty(); java.util.@Valid List slaProfiles = ImmutableList.of(); java.util.@Valid List variables = ImmutableList.of(); java.util.@Valid List servers = ImmutableList.of(); java.util.@Valid List userPaths = ImmutableList.of(); java.util.@Valid List populations = ImmutableList.of(); java.util.@Valid List scenarios = ImmutableList.of(); @Nullable java.util.@Valid Map projectSettings; java.util.List dependencies = ImmutableList.of(); @JsonProperty("name") public void setName(Optional name) { this.name = name; } @JsonProperty("sla_profiles") public void setSlaProfiles(java.util.@Valid List slaProfiles) { this.slaProfiles = slaProfiles; } @JsonProperty("variables") public void setVariables(java.util.@Valid List variables) { this.variables = variables; } @JsonProperty("servers") public void setServers(java.util.@Valid List servers) { this.servers = servers; } @JsonProperty("user_paths") public void setUserPaths(java.util.@Valid List userPaths) { this.userPaths = userPaths; } @JsonProperty("populations") public void setPopulations(java.util.@Valid List populations) { this.populations = populations; } @JsonProperty("scenarios") public void setScenarios(java.util.@Valid List scenarios) { this.scenarios = scenarios; } @JsonProperty("project_settings") public void setProjectSettings(java.util.@Valid Map projectSettings) { this.projectSettings = projectSettings; } @JsonProperty("dependencies") @JsonIgnore public void setDependencies(java.util.List dependencies) { this.dependencies = dependencies; } @Override public Optional getName() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getSlaProfiles() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getVariables() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getServers() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getUserPaths() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getPopulations() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getScenarios() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid Map getProjectSettings() { throw new UnsupportedOperationException(); } @Override public java.util.List getDependencies() { throw new UnsupportedOperationException(); } } /** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure */ @Deprecated @JsonCreator(mode = JsonCreator.Mode.DELEGATING) static ImmutableProject fromJson(Json json) { Project.Builder builder = new Project.Builder(); if (json.name != null) { builder.name(json.name); } if (json.slaProfiles != null) { builder.addAllSlaProfiles(json.slaProfiles); } if (json.variables != null) { builder.addAllVariables(json.variables); } if (json.servers != null) { builder.addAllServers(json.servers); } if (json.userPaths != null) { builder.addAllUserPaths(json.userPaths); } if (json.populations != null) { builder.addAllPopulations(json.populations); } if (json.scenarios != null) { builder.addAllScenarios(json.scenarios); } if (json.projectSettings != null) { builder.putAllProjectSettings(json.projectSettings); } if (json.dependencies != null) { builder.addAllDependencies(json.dependencies); } return (ImmutableProject) builder.build(); } /** * Creates an immutable copy of a {@link Project} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable Project instance */ public static ImmutableProject copyOf(Project instance) { if (instance instanceof ImmutableProject) { return (ImmutableProject) instance; } return new Project.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableProject ImmutableProject}. * Initialize attributes and then invoke the {@link #build()} method to create an * immutable instance. *

{@code Builder} is not thread-safe and generally should not be stored in a field or collection, * but instead used immediately to create instances. */ @NotThreadSafe public static class Builder { private @Nullable String name; private ImmutableList.Builder slaProfiles = ImmutableList.builder(); private ImmutableList.Builder variables = ImmutableList.builder(); private ImmutableList.Builder servers = ImmutableList.builder(); private ImmutableList.Builder userPaths = ImmutableList.builder(); private ImmutableList.Builder populations = ImmutableList.builder(); private ImmutableList.Builder scenarios = ImmutableList.builder(); private ImmutableMap.Builder projectSettings = ImmutableMap.builder(); private ImmutableList.Builder dependencies = ImmutableList.builder(); /** * Creates a builder for {@link ImmutableProject ImmutableProject} instances. */ public Builder() { if (!(this instanceof Project.Builder)) { throw new UnsupportedOperationException("Use: new Project.Builder()"); } } /** * Fill a builder with attribute values from the provided {@code Project} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder from(Project instance) { Objects.requireNonNull(instance, "instance"); Optional nameOptional = instance.getName(); if (nameOptional.isPresent()) { name(nameOptional); } addAllSlaProfiles(instance.getSlaProfiles()); addAllVariables(instance.getVariables()); addAllServers(instance.getServers()); addAllUserPaths(instance.getUserPaths()); addAllPopulations(instance.getPopulations()); addAllScenarios(instance.getScenarios()); putAllProjectSettings(instance.getProjectSettings()); addAllDependencies(instance.getDependencies()); return (Project.Builder) this; } /** * Initializes the optional value {@link Project#getName() name} to name. * @param name The value for name * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Project.Builder name(String name) { this.name = Objects.requireNonNull(name, "name"); return (Project.Builder) this; } /** * Initializes the optional value {@link Project#getName() name} to name. * @param name The value for name * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("name") public final Project.Builder name(Optional name) { this.name = name.orElse(null); return (Project.Builder) this; } /** * Adds one element to {@link Project#getSlaProfiles() slaProfiles} list. * @param element A slaProfiles element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addSlaProfiles(SlaProfile element) { this.slaProfiles.add(element); return (Project.Builder) this; } /** * Adds elements to {@link Project#getSlaProfiles() slaProfiles} list. * @param elements An array of slaProfiles elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addSlaProfiles(SlaProfile... elements) { this.slaProfiles.add(elements); return (Project.Builder) this; } /** * Sets or replaces all elements for {@link Project#getSlaProfiles() slaProfiles} list. * @param elements An iterable of slaProfiles elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("sla_profiles") public final Project.Builder slaProfiles(Iterable elements) { this.slaProfiles = ImmutableList.builder(); return addAllSlaProfiles(elements); } /** * Adds elements to {@link Project#getSlaProfiles() slaProfiles} list. * @param elements An iterable of slaProfiles elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addAllSlaProfiles(Iterable elements) { this.slaProfiles.addAll(elements); return (Project.Builder) this; } /** * Adds one element to {@link Project#getVariables() variables} list. * @param element A variables element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addVariables(Variable element) { this.variables.add(element); return (Project.Builder) this; } /** * Adds elements to {@link Project#getVariables() variables} list. * @param elements An array of variables elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addVariables(Variable... elements) { this.variables.add(elements); return (Project.Builder) this; } /** * Sets or replaces all elements for {@link Project#getVariables() variables} list. * @param elements An iterable of variables elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("variables") public final Project.Builder variables(Iterable elements) { this.variables = ImmutableList.builder(); return addAllVariables(elements); } /** * Adds elements to {@link Project#getVariables() variables} list. * @param elements An iterable of variables elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addAllVariables(Iterable elements) { this.variables.addAll(elements); return (Project.Builder) this; } /** * Adds one element to {@link Project#getServers() servers} list. * @param element A servers element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addServers(Server element) { this.servers.add(element); return (Project.Builder) this; } /** * Adds elements to {@link Project#getServers() servers} list. * @param elements An array of servers elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addServers(Server... elements) { this.servers.add(elements); return (Project.Builder) this; } /** * Sets or replaces all elements for {@link Project#getServers() servers} list. * @param elements An iterable of servers elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("servers") public final Project.Builder servers(Iterable elements) { this.servers = ImmutableList.builder(); return addAllServers(elements); } /** * Adds elements to {@link Project#getServers() servers} list. * @param elements An iterable of servers elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addAllServers(Iterable elements) { this.servers.addAll(elements); return (Project.Builder) this; } /** * Adds one element to {@link Project#getUserPaths() userPaths} list. * @param element A userPaths element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addUserPaths(UserPath element) { this.userPaths.add(element); return (Project.Builder) this; } /** * Adds elements to {@link Project#getUserPaths() userPaths} list. * @param elements An array of userPaths elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addUserPaths(UserPath... elements) { this.userPaths.add(elements); return (Project.Builder) this; } /** * Sets or replaces all elements for {@link Project#getUserPaths() userPaths} list. * @param elements An iterable of userPaths elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("user_paths") public final Project.Builder userPaths(Iterable elements) { this.userPaths = ImmutableList.builder(); return addAllUserPaths(elements); } /** * Adds elements to {@link Project#getUserPaths() userPaths} list. * @param elements An iterable of userPaths elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addAllUserPaths(Iterable elements) { this.userPaths.addAll(elements); return (Project.Builder) this; } /** * Adds one element to {@link Project#getPopulations() populations} list. * @param element A populations element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addPopulations(Population element) { this.populations.add(element); return (Project.Builder) this; } /** * Adds elements to {@link Project#getPopulations() populations} list. * @param elements An array of populations elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addPopulations(Population... elements) { this.populations.add(elements); return (Project.Builder) this; } /** * Sets or replaces all elements for {@link Project#getPopulations() populations} list. * @param elements An iterable of populations elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("populations") public final Project.Builder populations(Iterable elements) { this.populations = ImmutableList.builder(); return addAllPopulations(elements); } /** * Adds elements to {@link Project#getPopulations() populations} list. * @param elements An iterable of populations elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addAllPopulations(Iterable elements) { this.populations.addAll(elements); return (Project.Builder) this; } /** * Adds one element to {@link Project#getScenarios() scenarios} list. * @param element A scenarios element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addScenarios(Scenario element) { this.scenarios.add(element); return (Project.Builder) this; } /** * Adds elements to {@link Project#getScenarios() scenarios} list. * @param elements An array of scenarios elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addScenarios(Scenario... elements) { this.scenarios.add(elements); return (Project.Builder) this; } /** * Sets or replaces all elements for {@link Project#getScenarios() scenarios} list. * @param elements An iterable of scenarios elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("scenarios") public final Project.Builder scenarios(Iterable elements) { this.scenarios = ImmutableList.builder(); return addAllScenarios(elements); } /** * Adds elements to {@link Project#getScenarios() scenarios} list. * @param elements An iterable of scenarios elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addAllScenarios(Iterable elements) { this.scenarios.addAll(elements); return (Project.Builder) this; } /** * Put one entry to the {@link Project#getProjectSettings() projectSettings} map. * @param key The key in the projectSettings map * @param value The associated value in the projectSettings map * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder putProjectSettings(String key, String value) { this.projectSettings.put(key, value); return (Project.Builder) this; } /** * Put one entry to the {@link Project#getProjectSettings() projectSettings} map. Nulls are not permitted * @param entry The key and value entry * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder putProjectSettings(java.util.Map.Entry entry) { this.projectSettings.put(entry); return (Project.Builder) this; } /** * Sets or replaces all mappings from the specified map as entries for the {@link Project#getProjectSettings() projectSettings} map. Nulls are not permitted * @param projectSettings The entries that will be added to the projectSettings map * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("project_settings") public final Project.Builder projectSettings(java.util.Map projectSettings) { this.projectSettings = ImmutableMap.builder(); return putAllProjectSettings(projectSettings); } /** * Put all mappings from the specified map as entries to {@link Project#getProjectSettings() projectSettings} map. Nulls are not permitted * @param projectSettings The entries that will be added to the projectSettings map * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder putAllProjectSettings(java.util.Map projectSettings) { this.projectSettings.putAll(projectSettings); return (Project.Builder) this; } /** * Adds one element to {@link Project#getDependencies() dependencies} list. * @param element A dependencies element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addDependencies(Dependency element) { this.dependencies.add(element); return (Project.Builder) this; } /** * Adds elements to {@link Project#getDependencies() dependencies} list. * @param elements An array of dependencies elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addDependencies(Dependency... elements) { this.dependencies.add(elements); return (Project.Builder) this; } /** * Sets or replaces all elements for {@link Project#getDependencies() dependencies} list. * @param elements An iterable of dependencies elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("dependencies") @JsonIgnore public final Project.Builder dependencies(Iterable elements) { this.dependencies = ImmutableList.builder(); return addAllDependencies(elements); } /** * Adds elements to {@link Project#getDependencies() dependencies} list. * @param elements An iterable of dependencies elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Project.Builder addAllDependencies(Iterable elements) { this.dependencies.addAll(elements); return (Project.Builder) this; } /** * Builds a new {@link ImmutableProject ImmutableProject}. * @return An immutable instance of Project * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableProject build() { return new ImmutableProject( name, slaProfiles.build(), variables.build(), servers.build(), userPaths.build(), populations.build(), scenarios.build(), projectSettings.build(), dependencies.build()); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy