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

com.neotys.neoload.model.v3.project.scenario.ImmutableScenario Maven / Gradle / Ivy

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

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
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.primitives.Booleans;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.neotys.neoload.model.v3.project.Element;
import com.neotys.neoload.model.v3.project.SlaElement;
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 Scenario}.
 * 

* Use the builder to create immutable instances: * {@code new Scenario.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "Scenario"}) @Immutable @CheckReturnValue public final class ImmutableScenario implements Scenario { private final ImmutableList populations; private final @Nullable Apm apm; private final ImmutableList excludedUrls; private final ImmutableList rendezvousPolicies; private final boolean isStoredVariables; private final @Nullable MonitoringParameters monitoringParameters; private final String name; private final @Nullable String description; private final @Nullable String slaProfile; private ImmutableScenario(ImmutableScenario.Builder builder) { this.populations = builder.populations.build(); this.apm = builder.apm; this.excludedUrls = builder.excludedUrls.build(); this.rendezvousPolicies = builder.rendezvousPolicies.build(); this.monitoringParameters = builder.monitoringParameters; this.name = builder.name; this.description = builder.description; this.slaProfile = builder.slaProfile; this.isStoredVariables = builder.isStoredVariablesIsSet() ? builder.isStoredVariables : Scenario.super.isStoredVariables(); } private ImmutableScenario( ImmutableList populations, @Nullable Apm apm, ImmutableList excludedUrls, ImmutableList rendezvousPolicies, boolean isStoredVariables, @Nullable MonitoringParameters monitoringParameters, String name, @Nullable String description, @Nullable String slaProfile) { this.populations = populations; this.apm = apm; this.excludedUrls = excludedUrls; this.rendezvousPolicies = rendezvousPolicies; this.isStoredVariables = isStoredVariables; this.monitoringParameters = monitoringParameters; this.name = name; this.description = description; this.slaProfile = slaProfile; } /** * @return The value of the {@code populations} attribute */ @JsonProperty("populations") @Override public ImmutableList getPopulations() { return populations; } /** * @return The value of the {@code apm} attribute */ @JsonProperty("apm_configuration") @Override public java.util.@Valid Optional getApm() { return java.util.Optional.ofNullable(apm); } /** * @return The value of the {@code excludedUrls} attribute */ @JsonProperty("excluded_urls") @Override public ImmutableList getExcludedUrls() { return excludedUrls; } /** * @return The value of the {@code rendezvousPolicies} attribute */ @JsonProperty("rendezvous_policies") @Override public ImmutableList getRendezvousPolicies() { return rendezvousPolicies; } /** * @return The value of the {@code isStoredVariables} attribute */ @JsonProperty("store_variables_for_raw_data") @Override public boolean isStoredVariables() { return isStoredVariables; } /** * @return The value of the {@code monitoringParameters} attribute */ @JsonProperty("monitoring") @Override public java.util.Optional getMonitoringParameters() { return java.util.Optional.ofNullable(monitoringParameters); } /** * @return The value of the {@code name} attribute */ @JsonProperty("name") @Override public String getName() { return name; } /** * @return The value of the {@code description} attribute */ @JsonProperty("description") @Override public java.util.Optional getDescription() { return java.util.Optional.ofNullable(description); } /** * @return The value of the {@code slaProfile} attribute */ @JsonProperty("sla_profile") @Override public java.util.Optional getSlaProfile() { return java.util.Optional.ofNullable(slaProfile); } /** * Copy the current immutable object with elements that replace the content of {@link Scenario#getPopulations() populations}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableScenario withPopulations(PopulationPolicy... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableScenario( newValue, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object with elements that replace the content of {@link Scenario#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 ImmutableScenario withPopulations(Iterable elements) { if (this.populations == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableScenario( newValue, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object by setting a present value for the optional {@link Scenario#getApm() apm} attribute. * @param value The value for apm * @return A modified copy of {@code this} object */ public final ImmutableScenario withApm(Apm value) { @Nullable Apm newValue = Objects.requireNonNull(value, "apm"); if (this.apm == newValue) return this; return new ImmutableScenario( this.populations, newValue, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object by setting an optional value for the {@link Scenario#getApm() apm} attribute. * A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning {@code this}. * @param optional A value for apm * @return A modified copy of {@code this} object */ public final ImmutableScenario withApm(java.util.Optional optional) { @Nullable Apm value = optional.orElse(null); if (this.apm == value) return this; return new ImmutableScenario( this.populations, value, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object with elements that replace the content of {@link Scenario#getExcludedUrls() excludedUrls}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableScenario withExcludedUrls(String... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableScenario( this.populations, this.apm, newValue, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object with elements that replace the content of {@link Scenario#getExcludedUrls() excludedUrls}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of excludedUrls elements to set * @return A modified copy of {@code this} object */ public final ImmutableScenario withExcludedUrls(Iterable elements) { if (this.excludedUrls == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableScenario( this.populations, this.apm, newValue, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object with elements that replace the content of {@link Scenario#getRendezvousPolicies() rendezvousPolicies}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableScenario withRendezvousPolicies(RendezvousPolicy... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, newValue, this.isStoredVariables, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object with elements that replace the content of {@link Scenario#getRendezvousPolicies() rendezvousPolicies}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of rendezvousPolicies elements to set * @return A modified copy of {@code this} object */ public final ImmutableScenario withRendezvousPolicies(Iterable elements) { if (this.rendezvousPolicies == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, newValue, this.isStoredVariables, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object by setting a value for the {@link Scenario#isStoredVariables() isStoredVariables} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for isStoredVariables * @return A modified copy of the {@code this} object */ public final ImmutableScenario withIsStoredVariables(boolean value) { if (this.isStoredVariables == value) return this; return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, this.rendezvousPolicies, value, this.monitoringParameters, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object by setting a present value for the optional {@link Scenario#getMonitoringParameters() monitoringParameters} attribute. * @param value The value for monitoringParameters * @return A modified copy of {@code this} object */ public final ImmutableScenario withMonitoringParameters(MonitoringParameters value) { @Nullable MonitoringParameters newValue = Objects.requireNonNull(value, "monitoringParameters"); if (this.monitoringParameters == newValue) return this; return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, newValue, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object by setting an optional value for the {@link Scenario#getMonitoringParameters() monitoringParameters} attribute. * A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning {@code this}. * @param optional A value for monitoringParameters * @return A modified copy of {@code this} object */ public final ImmutableScenario withMonitoringParameters(java.util.Optional optional) { @Nullable MonitoringParameters value = optional.orElse(null); if (this.monitoringParameters == value) return this; return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, value, this.name, this.description, this.slaProfile); } /** * Copy the current immutable object by setting a value for the {@link Scenario#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 (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableScenario withName(String value) { if (Objects.equals(this.name, value)) return this; return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, value, this.description, this.slaProfile); } /** * Copy the current immutable object by setting a present value for the optional {@link Scenario#getDescription() description} attribute. * @param value The value for description * @return A modified copy of {@code this} object */ public final ImmutableScenario withDescription(String value) { @Nullable String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, newValue, this.slaProfile); } /** * Copy the current immutable object by setting an optional value for the {@link Scenario#getDescription() description} 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 description * @return A modified copy of {@code this} object */ public final ImmutableScenario withDescription(java.util.Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.description, value)) return this; return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, value, this.slaProfile); } /** * Copy the current immutable object by setting a present value for the optional {@link Scenario#getSlaProfile() slaProfile} attribute. * @param value The value for slaProfile * @return A modified copy of {@code this} object */ public final ImmutableScenario withSlaProfile(String value) { @Nullable String newValue = Objects.requireNonNull(value, "slaProfile"); if (Objects.equals(this.slaProfile, newValue)) return this; return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, this.description, newValue); } /** * Copy the current immutable object by setting an optional value for the {@link Scenario#getSlaProfile() slaProfile} 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 slaProfile * @return A modified copy of {@code this} object */ public final ImmutableScenario withSlaProfile(java.util.Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.slaProfile, value)) return this; return new ImmutableScenario( this.populations, this.apm, this.excludedUrls, this.rendezvousPolicies, this.isStoredVariables, this.monitoringParameters, this.name, this.description, value); } /** * This instance is equal to all instances of {@code ImmutableScenario} 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 ImmutableScenario && equalTo((ImmutableScenario) another); } private boolean equalTo(ImmutableScenario another) { return populations.equals(another.populations) && Objects.equals(apm, another.apm) && excludedUrls.equals(another.excludedUrls) && rendezvousPolicies.equals(another.rendezvousPolicies) && isStoredVariables == another.isStoredVariables && Objects.equals(monitoringParameters, another.monitoringParameters) && Objects.equals(name, another.name) && Objects.equals(description, another.description) && Objects.equals(slaProfile, another.slaProfile); } /** * Computes a hash code from attributes: {@code populations}, {@code apm}, {@code excludedUrls}, {@code rendezvousPolicies}, {@code isStoredVariables}, {@code monitoringParameters}, {@code name}, {@code description}, {@code slaProfile}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + populations.hashCode(); h += (h << 5) + Objects.hashCode(apm); h += (h << 5) + excludedUrls.hashCode(); h += (h << 5) + rendezvousPolicies.hashCode(); h += (h << 5) + Booleans.hashCode(isStoredVariables); h += (h << 5) + Objects.hashCode(monitoringParameters); h += (h << 5) + Objects.hashCode(name); h += (h << 5) + Objects.hashCode(description); h += (h << 5) + Objects.hashCode(slaProfile); return h; } /** * Prints the immutable value {@code Scenario} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("Scenario") .omitNullValues() .add("populations", populations) .add("apm", apm) .add("excludedUrls", excludedUrls) .add("rendezvousPolicies", rendezvousPolicies) .add("isStoredVariables", isStoredVariables) .add("monitoringParameters", monitoringParameters) .add("name", name) .add("description", description) .add("slaProfile", slaProfile) .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 Scenario { java.util.@Valid List populations = ImmutableList.of(); java.util.@Valid Optional apm = java.util.Optional.empty(); java.util.@Valid List excludedUrls = ImmutableList.of(); java.util.@Valid List rendezvousPolicies = ImmutableList.of(); boolean isStoredVariables; boolean isStoredVariablesIsSet; java.util.Optional monitoringParameters = java.util.Optional.empty(); @Nullable String name; java.util.Optional description = java.util.Optional.empty(); java.util.Optional slaProfile = java.util.Optional.empty(); @JsonProperty("populations") public void setPopulations(java.util.@Valid List populations) { this.populations = populations; } @JsonProperty("apm_configuration") public void setApm(java.util.@Valid Optional apm) { this.apm = apm; } @JsonProperty("excluded_urls") public void setExcludedUrls(java.util.@Valid List excludedUrls) { this.excludedUrls = excludedUrls; } @JsonProperty("rendezvous_policies") public void setRendezvousPolicies(java.util.@Valid List rendezvousPolicies) { this.rendezvousPolicies = rendezvousPolicies; } @JsonProperty("store_variables_for_raw_data") public void setIsStoredVariables(boolean isStoredVariables) { this.isStoredVariables = isStoredVariables; this.isStoredVariablesIsSet = true; } @JsonProperty("monitoring") public void setMonitoringParameters(java.util.Optional monitoringParameters) { this.monitoringParameters = monitoringParameters; } @JsonProperty("name") public void setName(String name) { this.name = name; } @JsonProperty("description") public void setDescription(java.util.Optional description) { this.description = description; } @JsonProperty("sla_profile") public void setSlaProfile(java.util.Optional slaProfile) { this.slaProfile = slaProfile; } @Override public Element withName(String of) { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getPopulations() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid Optional getApm() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getExcludedUrls() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getRendezvousPolicies() { throw new UnsupportedOperationException(); } @Override public boolean isStoredVariables() { throw new UnsupportedOperationException(); } @Override public java.util.Optional getMonitoringParameters() { throw new UnsupportedOperationException(); } @Override public String getName() { throw new UnsupportedOperationException(); } @Override public java.util.Optional getDescription() { throw new UnsupportedOperationException(); } @Override public java.util.Optional getSlaProfile() { 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 ImmutableScenario fromJson(Json json) { Scenario.Builder builder = new Scenario.Builder(); if (json.populations != null) { builder.addAllPopulations(json.populations); } if (json.apm != null) { builder.apm(json.apm); } if (json.excludedUrls != null) { builder.addAllExcludedUrls(json.excludedUrls); } if (json.rendezvousPolicies != null) { builder.addAllRendezvousPolicies(json.rendezvousPolicies); } if (json.isStoredVariablesIsSet) { builder.isStoredVariables(json.isStoredVariables); } if (json.monitoringParameters != null) { builder.monitoringParameters(json.monitoringParameters); } if (json.name != null) { builder.name(json.name); } if (json.description != null) { builder.description(json.description); } if (json.slaProfile != null) { builder.slaProfile(json.slaProfile); } return (ImmutableScenario) builder.build(); } /** * Creates an immutable copy of a {@link Scenario} 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 Scenario instance */ public static ImmutableScenario copyOf(Scenario instance) { if (instance instanceof ImmutableScenario) { return (ImmutableScenario) instance; } return new Scenario.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableScenario ImmutableScenario}. * 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 static final long OPT_BIT_IS_STORED_VARIABLES = 0x1L; private long optBits; private ImmutableList.Builder populations = ImmutableList.builder(); private @Nullable Apm apm; private ImmutableList.Builder excludedUrls = ImmutableList.builder(); private ImmutableList.Builder rendezvousPolicies = ImmutableList.builder(); private boolean isStoredVariables; private @Nullable MonitoringParameters monitoringParameters; private @Nullable String name; private @Nullable String description; private @Nullable String slaProfile; /** * Creates a builder for {@link ImmutableScenario ImmutableScenario} instances. */ public Builder() { if (!(this instanceof Scenario.Builder)) { throw new UnsupportedOperationException("Use: new Scenario.Builder()"); } } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.Element} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder from(Element instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (Scenario.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.SlaElement} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder from(SlaElement instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (Scenario.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.scenario.Scenario} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder from(Scenario instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (Scenario.Builder) this; } private void from(Object object) { if (object instanceof Element) { Element instance = (Element) object; String nameValue = instance.getName(); if (nameValue != null) { name(nameValue); } java.util.Optional descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } } if (object instanceof SlaElement) { SlaElement instance = (SlaElement) object; java.util.Optional slaProfileOptional = instance.getSlaProfile(); if (slaProfileOptional.isPresent()) { slaProfile(slaProfileOptional); } } if (object instanceof Scenario) { Scenario instance = (Scenario) object; addAllRendezvousPolicies(instance.getRendezvousPolicies()); java.util.Optional monitoringParametersOptional = instance.getMonitoringParameters(); if (monitoringParametersOptional.isPresent()) { monitoringParameters(monitoringParametersOptional); } isStoredVariables(instance.isStoredVariables()); addAllExcludedUrls(instance.getExcludedUrls()); addAllPopulations(instance.getPopulations()); java.util.@Valid Optional apmOptional = instance.getApm(); if (apmOptional.isPresent()) { apm(apmOptional); } } } /** * Adds one element to {@link Scenario#getPopulations() populations} list. * @param element A populations element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addPopulations(PopulationPolicy element) { this.populations.add(element); return (Scenario.Builder) this; } /** * Adds elements to {@link Scenario#getPopulations() populations} list. * @param elements An array of populations elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addPopulations(PopulationPolicy... elements) { this.populations.add(elements); return (Scenario.Builder) this; } /** * Sets or replaces all elements for {@link Scenario#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 Scenario.Builder populations(Iterable elements) { this.populations = ImmutableList.builder(); return addAllPopulations(elements); } /** * Adds elements to {@link Scenario#getPopulations() populations} list. * @param elements An iterable of populations elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addAllPopulations(Iterable elements) { this.populations.addAll(elements); return (Scenario.Builder) this; } /** * Initializes the optional value {@link Scenario#getApm() apm} to apm. * @param apm The value for apm * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder apm(Apm apm) { this.apm = Objects.requireNonNull(apm, "apm"); return (Scenario.Builder) this; } /** * Initializes the optional value {@link Scenario#getApm() apm} to apm. * @param apm The value for apm * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("apm_configuration") public final Scenario.Builder apm(java.util.Optional apm) { this.apm = apm.orElse(null); return (Scenario.Builder) this; } /** * Adds one element to {@link Scenario#getExcludedUrls() excludedUrls} list. * @param element A excludedUrls element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addExcludedUrls(String element) { this.excludedUrls.add(element); return (Scenario.Builder) this; } /** * Adds elements to {@link Scenario#getExcludedUrls() excludedUrls} list. * @param elements An array of excludedUrls elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addExcludedUrls(String... elements) { this.excludedUrls.add(elements); return (Scenario.Builder) this; } /** * Sets or replaces all elements for {@link Scenario#getExcludedUrls() excludedUrls} list. * @param elements An iterable of excludedUrls elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("excluded_urls") public final Scenario.Builder excludedUrls(Iterable elements) { this.excludedUrls = ImmutableList.builder(); return addAllExcludedUrls(elements); } /** * Adds elements to {@link Scenario#getExcludedUrls() excludedUrls} list. * @param elements An iterable of excludedUrls elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addAllExcludedUrls(Iterable elements) { this.excludedUrls.addAll(elements); return (Scenario.Builder) this; } /** * Adds one element to {@link Scenario#getRendezvousPolicies() rendezvousPolicies} list. * @param element A rendezvousPolicies element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addRendezvousPolicies(RendezvousPolicy element) { this.rendezvousPolicies.add(element); return (Scenario.Builder) this; } /** * Adds elements to {@link Scenario#getRendezvousPolicies() rendezvousPolicies} list. * @param elements An array of rendezvousPolicies elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addRendezvousPolicies(RendezvousPolicy... elements) { this.rendezvousPolicies.add(elements); return (Scenario.Builder) this; } /** * Sets or replaces all elements for {@link Scenario#getRendezvousPolicies() rendezvousPolicies} list. * @param elements An iterable of rendezvousPolicies elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("rendezvous_policies") public final Scenario.Builder rendezvousPolicies(Iterable elements) { this.rendezvousPolicies = ImmutableList.builder(); return addAllRendezvousPolicies(elements); } /** * Adds elements to {@link Scenario#getRendezvousPolicies() rendezvousPolicies} list. * @param elements An iterable of rendezvousPolicies elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder addAllRendezvousPolicies(Iterable elements) { this.rendezvousPolicies.addAll(elements); return (Scenario.Builder) this; } /** * Initializes the value for the {@link Scenario#isStoredVariables() isStoredVariables} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link Scenario#isStoredVariables() isStoredVariables}. * @param isStoredVariables The value for isStoredVariables * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("store_variables_for_raw_data") public final Scenario.Builder isStoredVariables(boolean isStoredVariables) { this.isStoredVariables = isStoredVariables; optBits |= OPT_BIT_IS_STORED_VARIABLES; return (Scenario.Builder) this; } /** * Initializes the optional value {@link Scenario#getMonitoringParameters() monitoringParameters} to monitoringParameters. * @param monitoringParameters The value for monitoringParameters * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder monitoringParameters(MonitoringParameters monitoringParameters) { this.monitoringParameters = Objects.requireNonNull(monitoringParameters, "monitoringParameters"); return (Scenario.Builder) this; } /** * Initializes the optional value {@link Scenario#getMonitoringParameters() monitoringParameters} to monitoringParameters. * @param monitoringParameters The value for monitoringParameters * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("monitoring") public final Scenario.Builder monitoringParameters(java.util.Optional monitoringParameters) { this.monitoringParameters = monitoringParameters.orElse(null); return (Scenario.Builder) this; } /** * Initializes the value for the {@link Scenario#getName() name} attribute. * @param name The value for name (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("name") public final Scenario.Builder name(String name) { this.name = name; return (Scenario.Builder) this; } /** * Initializes the optional value {@link Scenario#getDescription() description} to description. * @param description The value for description * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder description(String description) { this.description = Objects.requireNonNull(description, "description"); return (Scenario.Builder) this; } /** * Initializes the optional value {@link Scenario#getDescription() description} to description. * @param description The value for description * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("description") public final Scenario.Builder description(java.util.Optional description) { this.description = description.orElse(null); return (Scenario.Builder) this; } /** * Initializes the optional value {@link Scenario#getSlaProfile() slaProfile} to slaProfile. * @param slaProfile The value for slaProfile * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Scenario.Builder slaProfile(String slaProfile) { this.slaProfile = Objects.requireNonNull(slaProfile, "slaProfile"); return (Scenario.Builder) this; } /** * Initializes the optional value {@link Scenario#getSlaProfile() slaProfile} to slaProfile. * @param slaProfile The value for slaProfile * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("sla_profile") public final Scenario.Builder slaProfile(java.util.Optional slaProfile) { this.slaProfile = slaProfile.orElse(null); return (Scenario.Builder) this; } /** * Builds a new {@link ImmutableScenario ImmutableScenario}. * @return An immutable instance of Scenario * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableScenario build() { return new ImmutableScenario(this); } private boolean isStoredVariablesIsSet() { return (optBits & OPT_BIT_IS_STORED_VARIABLES) != 0; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy