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

com.neotys.neoload.model.scenario.ImmutablePeaksLoadPolicy Maven / Gradle / Ivy

package com.neotys.neoload.model.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.errorprone.annotations.CanIgnoreReturnValue;
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 PeaksLoadPolicy}.
 * 

* Use the builder to create immutable instances: * {@code new PeaksLoadPolicy.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "PeaksLoadPolicy"}) @Deprecated @Immutable @CheckReturnValue public final class ImmutablePeaksLoadPolicy implements PeaksLoadPolicy { private final com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy minimum; private final com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy maximum; private final PeaksLoadPolicy.Peak start; private final Integer rampup; private final com.neotys.neoload.model.scenario.@Valid Duration duration; private final com.neotys.neoload.model.scenario.@Valid StartAfter startAfter; private final com.neotys.neoload.model.scenario.@Valid StopAfter stopAfter; private ImmutablePeaksLoadPolicy( com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy minimum, com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy maximum, PeaksLoadPolicy.Peak start, Integer rampup, com.neotys.neoload.model.scenario.@Valid Duration duration, com.neotys.neoload.model.scenario.@Valid StartAfter startAfter, com.neotys.neoload.model.scenario.@Valid StopAfter stopAfter) { this.minimum = minimum; this.maximum = maximum; this.start = start; this.rampup = rampup; this.duration = duration; this.startAfter = startAfter; this.stopAfter = stopAfter; } /** * @return The value of the {@code minimum} attribute */ @JsonProperty("minimum") @Override public com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy getMinimum() { return minimum; } /** * @return The value of the {@code maximum} attribute */ @JsonProperty("maximum") @Override public com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy getMaximum() { return maximum; } /** * @return The value of the {@code start} attribute */ @JsonProperty("start") @Override public PeaksLoadPolicy.Peak getStart() { return start; } /** * @return The value of the {@code rampup} attribute */ @JsonProperty("step_rampup") @Override public Integer getRampup() { return rampup; } /** * @return The value of the {@code duration} attribute */ @JsonProperty("duration") @Override public com.neotys.neoload.model.scenario.@Valid Duration getDuration() { return duration; } /** * @return The value of the {@code startAfter} attribute */ @JsonProperty("start_after") @Override public com.neotys.neoload.model.scenario.@Valid StartAfter getStartAfter() { return startAfter; } /** * @return The value of the {@code stopAfter} attribute */ @JsonProperty("stop_after") @Override public com.neotys.neoload.model.scenario.@Valid StopAfter getStopAfter() { return stopAfter; } /** * Copy the current immutable object by setting a value for the {@link PeaksLoadPolicy#getMinimum() minimum} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for minimum (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutablePeaksLoadPolicy withMinimum(com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy value) { if (this.minimum == value) return this; return new ImmutablePeaksLoadPolicy(value, this.maximum, this.start, this.rampup, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link PeaksLoadPolicy#getMaximum() maximum} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for maximum (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutablePeaksLoadPolicy withMaximum(com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy value) { if (this.maximum == value) return this; return new ImmutablePeaksLoadPolicy(this.minimum, value, this.start, this.rampup, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link PeaksLoadPolicy#getStart() start} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for start (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutablePeaksLoadPolicy withStart(PeaksLoadPolicy.Peak value) { if (this.start == value) return this; return new ImmutablePeaksLoadPolicy(this.minimum, this.maximum, value, this.rampup, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link PeaksLoadPolicy#getRampup() rampup} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for rampup (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutablePeaksLoadPolicy withRampup(Integer value) { if (Objects.equals(this.rampup, value)) return this; return new ImmutablePeaksLoadPolicy(this.minimum, this.maximum, this.start, value, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link PeaksLoadPolicy#getDuration() duration} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for duration (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutablePeaksLoadPolicy withDuration(com.neotys.neoload.model.scenario.@Valid Duration value) { if (this.duration == value) return this; return new ImmutablePeaksLoadPolicy(this.minimum, this.maximum, this.start, this.rampup, value, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link PeaksLoadPolicy#getStartAfter() startAfter} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for startAfter (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutablePeaksLoadPolicy withStartAfter(com.neotys.neoload.model.scenario.@Valid StartAfter value) { if (this.startAfter == value) return this; return new ImmutablePeaksLoadPolicy(this.minimum, this.maximum, this.start, this.rampup, this.duration, value, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link PeaksLoadPolicy#getStopAfter() stopAfter} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for stopAfter (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutablePeaksLoadPolicy withStopAfter(com.neotys.neoload.model.scenario.@Valid StopAfter value) { if (this.stopAfter == value) return this; return new ImmutablePeaksLoadPolicy(this.minimum, this.maximum, this.start, this.rampup, this.duration, this.startAfter, value); } /** * This instance is equal to all instances of {@code ImmutablePeaksLoadPolicy} 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 ImmutablePeaksLoadPolicy && equalTo((ImmutablePeaksLoadPolicy) another); } private boolean equalTo(ImmutablePeaksLoadPolicy another) { return Objects.equals(minimum, another.minimum) && Objects.equals(maximum, another.maximum) && Objects.equals(start, another.start) && Objects.equals(rampup, another.rampup) && Objects.equals(duration, another.duration) && Objects.equals(startAfter, another.startAfter) && Objects.equals(stopAfter, another.stopAfter); } /** * Computes a hash code from attributes: {@code minimum}, {@code maximum}, {@code start}, {@code rampup}, {@code duration}, {@code startAfter}, {@code stopAfter}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Objects.hashCode(minimum); h += (h << 5) + Objects.hashCode(maximum); h += (h << 5) + Objects.hashCode(start); h += (h << 5) + Objects.hashCode(rampup); h += (h << 5) + Objects.hashCode(duration); h += (h << 5) + Objects.hashCode(startAfter); h += (h << 5) + Objects.hashCode(stopAfter); return h; } /** * Prints the immutable value {@code PeaksLoadPolicy} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("PeaksLoadPolicy") .omitNullValues() .add("minimum", minimum) .add("maximum", maximum) .add("start", start) .add("rampup", rampup) .add("duration", duration) .add("startAfter", startAfter) .add("stopAfter", stopAfter) .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 PeaksLoadPolicy { @Nullable com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy minimum; @Nullable com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy maximum; @Nullable PeaksLoadPolicy.Peak start; @Nullable Integer rampup; @Nullable com.neotys.neoload.model.scenario.@Valid Duration duration; @Nullable com.neotys.neoload.model.scenario.@Valid StartAfter startAfter; @Nullable com.neotys.neoload.model.scenario.@Valid StopAfter stopAfter; @JsonProperty("minimum") public void setMinimum(com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy minimum) { this.minimum = minimum; } @JsonProperty("maximum") public void setMaximum(com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy maximum) { this.maximum = maximum; } @JsonProperty("start") public void setStart(PeaksLoadPolicy.Peak start) { this.start = start; } @JsonProperty("step_rampup") public void setRampup(Integer rampup) { this.rampup = rampup; } @JsonProperty("duration") public void setDuration(com.neotys.neoload.model.scenario.@Valid Duration duration) { this.duration = duration; } @JsonProperty("start_after") public void setStartAfter(com.neotys.neoload.model.scenario.@Valid StartAfter startAfter) { this.startAfter = startAfter; } @JsonProperty("stop_after") public void setStopAfter(com.neotys.neoload.model.scenario.@Valid StopAfter stopAfter) { this.stopAfter = stopAfter; } @Override public com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy getMinimum() { throw new UnsupportedOperationException(); } @Override public com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy getMaximum() { throw new UnsupportedOperationException(); } @Override public PeaksLoadPolicy.Peak getStart() { throw new UnsupportedOperationException(); } @Override public Integer getRampup() { throw new UnsupportedOperationException(); } @Override public com.neotys.neoload.model.scenario.@Valid Duration getDuration() { throw new UnsupportedOperationException(); } @Override public com.neotys.neoload.model.scenario.@Valid StartAfter getStartAfter() { throw new UnsupportedOperationException(); } @Override public com.neotys.neoload.model.scenario.@Valid StopAfter getStopAfter() { 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 ImmutablePeaksLoadPolicy fromJson(Json json) { PeaksLoadPolicy.Builder builder = new PeaksLoadPolicy.Builder(); if (json.minimum != null) { builder.minimum(json.minimum); } if (json.maximum != null) { builder.maximum(json.maximum); } if (json.start != null) { builder.start(json.start); } if (json.rampup != null) { builder.rampup(json.rampup); } if (json.duration != null) { builder.duration(json.duration); } if (json.startAfter != null) { builder.startAfter(json.startAfter); } if (json.stopAfter != null) { builder.stopAfter(json.stopAfter); } return (ImmutablePeaksLoadPolicy) builder.build(); } /** * Creates an immutable copy of a {@link PeaksLoadPolicy} 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 PeaksLoadPolicy instance */ public static ImmutablePeaksLoadPolicy copyOf(PeaksLoadPolicy instance) { if (instance instanceof ImmutablePeaksLoadPolicy) { return (ImmutablePeaksLoadPolicy) instance; } return new PeaksLoadPolicy.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutablePeaksLoadPolicy ImmutablePeaksLoadPolicy}. * 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 com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy minimum; private @Nullable com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy maximum; private @Nullable PeaksLoadPolicy.Peak start; private @Nullable Integer rampup; private @Nullable com.neotys.neoload.model.scenario.@Valid Duration duration; private @Nullable com.neotys.neoload.model.scenario.@Valid StartAfter startAfter; private @Nullable com.neotys.neoload.model.scenario.@Valid StopAfter stopAfter; /** * Creates a builder for {@link ImmutablePeaksLoadPolicy ImmutablePeaksLoadPolicy} instances. */ public Builder() { if (!(this instanceof PeaksLoadPolicy.Builder)) { throw new UnsupportedOperationException("Use: new PeaksLoadPolicy.Builder()"); } } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.scenario.StartStopPolicy} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final PeaksLoadPolicy.Builder from(StartStopPolicy instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (PeaksLoadPolicy.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.scenario.DurationPolicy} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final PeaksLoadPolicy.Builder from(DurationPolicy instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (PeaksLoadPolicy.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.scenario.PeaksLoadPolicy} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final PeaksLoadPolicy.Builder from(PeaksLoadPolicy instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (PeaksLoadPolicy.Builder) this; } private void from(Object object) { long bits = 0; if (object instanceof StartStopPolicy) { StartStopPolicy instance = (StartStopPolicy) object; com.neotys.neoload.model.scenario.@Valid StartAfter startAfterValue = instance.getStartAfter(); if (startAfterValue != null) { startAfter(startAfterValue); } com.neotys.neoload.model.scenario.@Valid StopAfter stopAfterValue = instance.getStopAfter(); if (stopAfterValue != null) { stopAfter(stopAfterValue); } if ((bits & 0x1L) == 0) { Integer rampupValue = instance.getRampup(); if (rampupValue != null) { rampup(rampupValue); } bits |= 0x1L; } } if (object instanceof DurationPolicy) { DurationPolicy instance = (DurationPolicy) object; com.neotys.neoload.model.scenario.@Valid Duration durationValue = instance.getDuration(); if (durationValue != null) { duration(durationValue); } } if (object instanceof PeaksLoadPolicy) { PeaksLoadPolicy instance = (PeaksLoadPolicy) object; PeaksLoadPolicy.Peak startValue = instance.getStart(); if (startValue != null) { start(startValue); } com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy maximumValue = instance.getMaximum(); if (maximumValue != null) { maximum(maximumValue); } com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy minimumValue = instance.getMinimum(); if (minimumValue != null) { minimum(minimumValue); } if ((bits & 0x1L) == 0) { Integer rampupValue = instance.getRampup(); if (rampupValue != null) { rampup(rampupValue); } bits |= 0x1L; } } } /** * Initializes the value for the {@link PeaksLoadPolicy#getMinimum() minimum} attribute. * @param minimum The value for minimum (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("minimum") public final PeaksLoadPolicy.Builder minimum(com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy minimum) { this.minimum = minimum; return (PeaksLoadPolicy.Builder) this; } /** * Initializes the value for the {@link PeaksLoadPolicy#getMaximum() maximum} attribute. * @param maximum The value for maximum (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("maximum") public final PeaksLoadPolicy.Builder maximum(com.neotys.neoload.model.scenario.@Valid PeakLoadPolicy maximum) { this.maximum = maximum; return (PeaksLoadPolicy.Builder) this; } /** * Initializes the value for the {@link PeaksLoadPolicy#getStart() start} attribute. * @param start The value for start (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("start") public final PeaksLoadPolicy.Builder start(PeaksLoadPolicy.Peak start) { this.start = start; return (PeaksLoadPolicy.Builder) this; } /** * Initializes the value for the {@link PeaksLoadPolicy#getRampup() rampup} attribute. * @param rampup The value for rampup (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("step_rampup") public final PeaksLoadPolicy.Builder rampup(Integer rampup) { this.rampup = rampup; return (PeaksLoadPolicy.Builder) this; } /** * Initializes the value for the {@link PeaksLoadPolicy#getDuration() duration} attribute. * @param duration The value for duration (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("duration") public final PeaksLoadPolicy.Builder duration(com.neotys.neoload.model.scenario.@Valid Duration duration) { this.duration = duration; return (PeaksLoadPolicy.Builder) this; } /** * Initializes the value for the {@link PeaksLoadPolicy#getStartAfter() startAfter} attribute. * @param startAfter The value for startAfter (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("start_after") public final PeaksLoadPolicy.Builder startAfter(com.neotys.neoload.model.scenario.@Valid StartAfter startAfter) { this.startAfter = startAfter; return (PeaksLoadPolicy.Builder) this; } /** * Initializes the value for the {@link PeaksLoadPolicy#getStopAfter() stopAfter} attribute. * @param stopAfter The value for stopAfter (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("stop_after") public final PeaksLoadPolicy.Builder stopAfter(com.neotys.neoload.model.scenario.@Valid StopAfter stopAfter) { this.stopAfter = stopAfter; return (PeaksLoadPolicy.Builder) this; } /** * Builds a new {@link ImmutablePeaksLoadPolicy ImmutablePeaksLoadPolicy}. * @return An immutable instance of PeaksLoadPolicy * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutablePeaksLoadPolicy build() { return new ImmutablePeaksLoadPolicy(minimum, maximum, start, rampup, duration, startAfter, stopAfter); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy