com.neotys.neoload.model.ImmutableProject Maven / Gradle / Ivy
package com.neotys.neoload.model;
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.repository.Container;
import com.neotys.neoload.model.repository.Population;
import com.neotys.neoload.model.repository.Server;
import com.neotys.neoload.model.repository.UserPath;
import com.neotys.neoload.model.repository.Variable;
import com.neotys.neoload.model.scenario.Scenario;
import java.util.Map;
import java.util.Objects;
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"})
@Deprecated
@Immutable
@CheckReturnValue
public final class ImmutableProject implements Project {
private final String name;
private final ImmutableList sharedElements;
private final ImmutableList userPaths;
private final ImmutableList servers;
private final ImmutableList variables;
private final ImmutableList populations;
private final ImmutableList scenarios;
private final ImmutableMap projectSettings;
private ImmutableProject(ImmutableProject.Builder builder) {
this.sharedElements = builder.sharedElements.build();
this.userPaths = builder.userPaths.build();
this.servers = builder.servers.build();
this.variables = builder.variables.build();
this.populations = builder.populations.build();
this.scenarios = builder.scenarios.build();
this.projectSettings = builder.projectSettings.build();
this.name = builder.name != null
? builder.name
: Objects.requireNonNull(Project.super.getName(), "name");
}
private ImmutableProject(
String name,
ImmutableList sharedElements,
ImmutableList userPaths,
ImmutableList servers,
ImmutableList variables,
ImmutableList populations,
ImmutableList scenarios,
ImmutableMap projectSettings) {
this.name = name;
this.sharedElements = sharedElements;
this.userPaths = userPaths;
this.servers = servers;
this.variables = variables;
this.populations = populations;
this.scenarios = scenarios;
this.projectSettings = projectSettings;
}
/**
* @return The value of the {@code name} attribute
*/
@JsonProperty("name")
@Override
public String getName() {
return name;
}
/**
* @return The value of the {@code sharedElements} attribute
*/
@JsonProperty("sharedElements")
@JsonIgnore
@Override
public ImmutableList getSharedElements() {
return sharedElements;
}
/**
* @return The value of the {@code userPaths} attribute
*/
@JsonProperty("userPaths")
@JsonIgnore
@Override
public ImmutableList getUserPaths() {
return userPaths;
}
/**
* @return The value of the {@code servers} attribute
*/
@JsonProperty("servers")
@JsonIgnore
@Override
public ImmutableList getServers() {
return servers;
}
/**
* @return The value of the {@code variables} attribute
*/
@JsonProperty("variables")
@JsonIgnore
@Override
public ImmutableList getVariables() {
return variables;
}
/**
* @return The value of the {@code populations} attribute
*/
@JsonProperty("populations")
@JsonIgnore
@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("projectSettings")
@JsonIgnore
@Override
public ImmutableMap getProjectSettings() {
return projectSettings;
}
/**
* Copy the current immutable object by setting a value for the {@link Project#getName() name} attribute.
* An equals check used to prevent copying of the same value by returning {@code this}.
* @param value A new value for name
* @return A modified copy of the {@code this} object
*/
public final ImmutableProject withName(String value) {
if (this.name.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "name");
return new ImmutableProject(
newValue,
this.sharedElements,
this.userPaths,
this.servers,
this.variables,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* Copy the current immutable object with elements that replace the content of {@link Project#getSharedElements() sharedElements}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableProject withSharedElements(Container... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableProject(
this.name,
newValue,
this.userPaths,
this.servers,
this.variables,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* Copy the current immutable object with elements that replace the content of {@link Project#getSharedElements() sharedElements}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of sharedElements elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableProject withSharedElements(Iterable extends Container> elements) {
if (this.sharedElements == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableProject(
this.name,
newValue,
this.userPaths,
this.servers,
this.variables,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* 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.sharedElements,
newValue,
this.servers,
this.variables,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* 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 extends UserPath> elements) {
if (this.userPaths == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableProject(
this.name,
this.sharedElements,
newValue,
this.servers,
this.variables,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* 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.sharedElements,
this.userPaths,
newValue,
this.variables,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* 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 extends Server> elements) {
if (this.servers == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableProject(
this.name,
this.sharedElements,
this.userPaths,
newValue,
this.variables,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* 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.sharedElements,
this.userPaths,
this.servers,
newValue,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* 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 extends Variable> elements) {
if (this.variables == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableProject(
this.name,
this.sharedElements,
this.userPaths,
this.servers,
newValue,
this.populations,
this.scenarios,
this.projectSettings);
}
/**
* 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.sharedElements,
this.userPaths,
this.servers,
this.variables,
newValue,
this.scenarios,
this.projectSettings);
}
/**
* 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 extends Population> elements) {
if (this.populations == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableProject(
this.name,
this.sharedElements,
this.userPaths,
this.servers,
this.variables,
newValue,
this.scenarios,
this.projectSettings);
}
/**
* 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.sharedElements,
this.userPaths,
this.servers,
this.variables,
this.populations,
newValue,
this.projectSettings);
}
/**
* 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 extends Scenario> elements) {
if (this.scenarios == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableProject(
this.name,
this.sharedElements,
this.userPaths,
this.servers,
this.variables,
this.populations,
newValue,
this.projectSettings);
}
/**
* 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(Map entries) {
if (this.projectSettings == entries) return this;
ImmutableMap newValue = ImmutableMap.copyOf(entries);
return new ImmutableProject(
this.name,
this.sharedElements,
this.userPaths,
this.servers,
this.variables,
this.populations,
this.scenarios,
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 name.equals(another.name)
&& sharedElements.equals(another.sharedElements)
&& userPaths.equals(another.userPaths)
&& servers.equals(another.servers)
&& variables.equals(another.variables)
&& populations.equals(another.populations)
&& scenarios.equals(another.scenarios)
&& projectSettings.equals(another.projectSettings);
}
/**
* Computes a hash code from attributes: {@code name}, {@code sharedElements}, {@code userPaths}, {@code servers}, {@code variables}, {@code populations}, {@code scenarios}, {@code projectSettings}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + name.hashCode();
h += (h << 5) + sharedElements.hashCode();
h += (h << 5) + userPaths.hashCode();
h += (h << 5) + servers.hashCode();
h += (h << 5) + variables.hashCode();
h += (h << 5) + populations.hashCode();
h += (h << 5) + scenarios.hashCode();
h += (h << 5) + projectSettings.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("sharedElements", sharedElements)
.add("userPaths", userPaths)
.add("servers", servers)
.add("variables", variables)
.add("populations", populations)
.add("scenarios", scenarios)
.add("projectSettings", projectSettings)
.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 {
@Nullable String name;
java.util.List sharedElements = ImmutableList.of();
java.util.List userPaths = ImmutableList.of();
java.util.List servers = ImmutableList.of();
java.util.List variables = ImmutableList.of();
java.util.List populations = ImmutableList.of();
java.util.@Valid List scenarios = ImmutableList.of();
@Nullable Map projectSettings;
@JsonProperty("name")
public void setName(String name) {
this.name = name;
}
@JsonProperty("sharedElements")
@JsonIgnore
public void setSharedElements(java.util.List sharedElements) {
this.sharedElements = sharedElements;
}
@JsonProperty("userPaths")
@JsonIgnore
public void setUserPaths(java.util.List userPaths) {
this.userPaths = userPaths;
}
@JsonProperty("servers")
@JsonIgnore
public void setServers(java.util.List servers) {
this.servers = servers;
}
@JsonProperty("variables")
@JsonIgnore
public void setVariables(java.util.List variables) {
this.variables = variables;
}
@JsonProperty("populations")
@JsonIgnore
public void setPopulations(java.util.List populations) {
this.populations = populations;
}
@JsonProperty("scenarios")
public void setScenarios(java.util.@Valid List scenarios) {
this.scenarios = scenarios;
}
@JsonProperty("projectSettings")
@JsonIgnore
public void setProjectSettings(Map projectSettings) {
this.projectSettings = projectSettings;
}
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public java.util.List getSharedElements() { throw new UnsupportedOperationException(); }
@Override
public java.util.List getUserPaths() { throw new UnsupportedOperationException(); }
@Override
public java.util.List getServers() { throw new UnsupportedOperationException(); }
@Override
public java.util.List getVariables() { throw new UnsupportedOperationException(); }
@Override
public java.util.List getPopulations() { throw new UnsupportedOperationException(); }
@Override
public java.util.@Valid List getScenarios() { throw new UnsupportedOperationException(); }
@Override
public Map getProjectSettings() { 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.sharedElements != null) {
builder.addAllSharedElements(json.sharedElements);
}
if (json.userPaths != null) {
builder.addAllUserPaths(json.userPaths);
}
if (json.servers != null) {
builder.addAllServers(json.servers);
}
if (json.variables != null) {
builder.addAllVariables(json.variables);
}
if (json.populations != null) {
builder.addAllPopulations(json.populations);
}
if (json.scenarios != null) {
builder.addAllScenarios(json.scenarios);
}
if (json.projectSettings != null) {
builder.putAllProjectSettings(json.projectSettings);
}
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 sharedElements = ImmutableList.builder();
private ImmutableList.Builder userPaths = ImmutableList.builder();
private ImmutableList.Builder servers = ImmutableList.builder();
private ImmutableList.Builder variables = ImmutableList.builder();
private ImmutableList.Builder populations = ImmutableList.builder();
private ImmutableList.Builder scenarios = ImmutableList.builder();
private ImmutableMap.Builder projectSettings = ImmutableMap.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");
name(instance.getName());
addAllSharedElements(instance.getSharedElements());
addAllUserPaths(instance.getUserPaths());
addAllServers(instance.getServers());
addAllVariables(instance.getVariables());
addAllPopulations(instance.getPopulations());
addAllScenarios(instance.getScenarios());
putAllProjectSettings(instance.getProjectSettings());
return (Project.Builder) this;
}
/**
* Initializes the value for the {@link Project#getName() name} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link Project#getName() 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(String name) {
this.name = Objects.requireNonNull(name, "name");
return (Project.Builder) this;
}
/**
* Adds one element to {@link Project#getSharedElements() sharedElements} list.
* @param element A sharedElements element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Project.Builder addSharedElements(Container element) {
this.sharedElements.add(element);
return (Project.Builder) this;
}
/**
* Adds elements to {@link Project#getSharedElements() sharedElements} list.
* @param elements An array of sharedElements elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Project.Builder addSharedElements(Container... elements) {
this.sharedElements.add(elements);
return (Project.Builder) this;
}
/**
* Sets or replaces all elements for {@link Project#getSharedElements() sharedElements} list.
* @param elements An iterable of sharedElements elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("sharedElements")
@JsonIgnore
public final Project.Builder sharedElements(Iterable extends Container> elements) {
this.sharedElements = ImmutableList.builder();
return addAllSharedElements(elements);
}
/**
* Adds elements to {@link Project#getSharedElements() sharedElements} list.
* @param elements An iterable of sharedElements elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Project.Builder addAllSharedElements(Iterable extends Container> elements) {
this.sharedElements.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("userPaths")
@JsonIgnore
public final Project.Builder userPaths(Iterable extends UserPath> 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 extends UserPath> elements) {
this.userPaths.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")
@JsonIgnore
public final Project.Builder servers(Iterable extends Server> 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 extends Server> elements) {
this.servers.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")
@JsonIgnore
public final Project.Builder variables(Iterable extends Variable> 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 extends Variable> elements) {
this.variables.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")
@JsonIgnore
public final Project.Builder populations(Iterable extends Population> 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 extends Population> 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 extends Scenario> 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 extends Scenario> 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(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("projectSettings")
@JsonIgnore
public final Project.Builder projectSettings(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(Map projectSettings) {
this.projectSettings.putAll(projectSettings);
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(this);
}
}
}