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

com.neotys.neoload.model.scenario.ImmutableRampupLoadPolicy 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 RampupLoadPolicy}.
 * 

* Use the builder to create immutable instances: * {@code new RampupLoadPolicy.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "RampupLoadPolicy"}) @Deprecated @Immutable @CheckReturnValue public final class ImmutableRampupLoadPolicy implements RampupLoadPolicy { private final int minUsers; private final Integer maxUsers; private final int incrementUsers; private final com.neotys.neoload.model.scenario.@Valid Duration incrementEvery; 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 ImmutableRampupLoadPolicy( int minUsers, Integer maxUsers, int incrementUsers, com.neotys.neoload.model.scenario.@Valid Duration incrementEvery, 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.minUsers = minUsers; this.maxUsers = maxUsers; this.incrementUsers = incrementUsers; this.incrementEvery = incrementEvery; this.rampup = rampup; this.duration = duration; this.startAfter = startAfter; this.stopAfter = stopAfter; } /** * @return The value of the {@code minUsers} attribute */ @JsonProperty("min_users") @Override public int getMinUsers() { return minUsers; } /** * @return The value of the {@code maxUsers} attribute */ @JsonProperty("max_users") @Override public Integer getMaxUsers() { return maxUsers; } /** * @return The value of the {@code incrementUsers} attribute */ @JsonProperty("increment_users") @Override public int getIncrementUsers() { return incrementUsers; } /** * @return The value of the {@code incrementEvery} attribute */ @JsonProperty("increment_every") @Override public com.neotys.neoload.model.scenario.@Valid Duration getIncrementEvery() { return incrementEvery; } /** * @return The value of the {@code rampup} attribute */ @JsonProperty("increment_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 RampupLoadPolicy#getMinUsers() minUsers} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for minUsers * @return A modified copy of the {@code this} object */ public final ImmutableRampupLoadPolicy withMinUsers(int value) { if (this.minUsers == value) return this; return new ImmutableRampupLoadPolicy( value, this.maxUsers, this.incrementUsers, this.incrementEvery, this.rampup, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link RampupLoadPolicy#getMaxUsers() maxUsers} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for maxUsers (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableRampupLoadPolicy withMaxUsers(Integer value) { if (Objects.equals(this.maxUsers, value)) return this; return new ImmutableRampupLoadPolicy( this.minUsers, value, this.incrementUsers, this.incrementEvery, this.rampup, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link RampupLoadPolicy#getIncrementUsers() incrementUsers} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for incrementUsers * @return A modified copy of the {@code this} object */ public final ImmutableRampupLoadPolicy withIncrementUsers(int value) { if (this.incrementUsers == value) return this; return new ImmutableRampupLoadPolicy( this.minUsers, this.maxUsers, value, this.incrementEvery, this.rampup, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link RampupLoadPolicy#getIncrementEvery() incrementEvery} 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 incrementEvery (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableRampupLoadPolicy withIncrementEvery(com.neotys.neoload.model.scenario.@Valid Duration value) { if (this.incrementEvery == value) return this; return new ImmutableRampupLoadPolicy( this.minUsers, this.maxUsers, this.incrementUsers, value, this.rampup, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link RampupLoadPolicy#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 ImmutableRampupLoadPolicy withRampup(Integer value) { if (Objects.equals(this.rampup, value)) return this; return new ImmutableRampupLoadPolicy( this.minUsers, this.maxUsers, this.incrementUsers, this.incrementEvery, value, this.duration, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link RampupLoadPolicy#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 ImmutableRampupLoadPolicy withDuration(com.neotys.neoload.model.scenario.@Valid Duration value) { if (this.duration == value) return this; return new ImmutableRampupLoadPolicy( this.minUsers, this.maxUsers, this.incrementUsers, this.incrementEvery, this.rampup, value, this.startAfter, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link RampupLoadPolicy#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 ImmutableRampupLoadPolicy withStartAfter(com.neotys.neoload.model.scenario.@Valid StartAfter value) { if (this.startAfter == value) return this; return new ImmutableRampupLoadPolicy( this.minUsers, this.maxUsers, this.incrementUsers, this.incrementEvery, this.rampup, this.duration, value, this.stopAfter); } /** * Copy the current immutable object by setting a value for the {@link RampupLoadPolicy#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 ImmutableRampupLoadPolicy withStopAfter(com.neotys.neoload.model.scenario.@Valid StopAfter value) { if (this.stopAfter == value) return this; return new ImmutableRampupLoadPolicy( this.minUsers, this.maxUsers, this.incrementUsers, this.incrementEvery, this.rampup, this.duration, this.startAfter, value); } /** * This instance is equal to all instances of {@code ImmutableRampupLoadPolicy} 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 ImmutableRampupLoadPolicy && equalTo((ImmutableRampupLoadPolicy) another); } private boolean equalTo(ImmutableRampupLoadPolicy another) { return minUsers == another.minUsers && Objects.equals(maxUsers, another.maxUsers) && incrementUsers == another.incrementUsers && Objects.equals(incrementEvery, another.incrementEvery) && 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 minUsers}, {@code maxUsers}, {@code incrementUsers}, {@code incrementEvery}, {@code rampup}, {@code duration}, {@code startAfter}, {@code stopAfter}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + minUsers; h += (h << 5) + Objects.hashCode(maxUsers); h += (h << 5) + incrementUsers; h += (h << 5) + Objects.hashCode(incrementEvery); 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 RampupLoadPolicy} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("RampupLoadPolicy") .omitNullValues() .add("minUsers", minUsers) .add("maxUsers", maxUsers) .add("incrementUsers", incrementUsers) .add("incrementEvery", incrementEvery) .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 RampupLoadPolicy { int minUsers; boolean minUsersIsSet; @Nullable Integer maxUsers; int incrementUsers; boolean incrementUsersIsSet; @Nullable com.neotys.neoload.model.scenario.@Valid Duration incrementEvery; @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("min_users") public void setMinUsers(int minUsers) { this.minUsers = minUsers; this.minUsersIsSet = true; } @JsonProperty("max_users") public void setMaxUsers(Integer maxUsers) { this.maxUsers = maxUsers; } @JsonProperty("increment_users") public void setIncrementUsers(int incrementUsers) { this.incrementUsers = incrementUsers; this.incrementUsersIsSet = true; } @JsonProperty("increment_every") public void setIncrementEvery(com.neotys.neoload.model.scenario.@Valid Duration incrementEvery) { this.incrementEvery = incrementEvery; } @JsonProperty("increment_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 int getMinUsers() { throw new UnsupportedOperationException(); } @Override public Integer getMaxUsers() { throw new UnsupportedOperationException(); } @Override public int getIncrementUsers() { throw new UnsupportedOperationException(); } @Override public com.neotys.neoload.model.scenario.@Valid Duration getIncrementEvery() { 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 ImmutableRampupLoadPolicy fromJson(Json json) { RampupLoadPolicy.Builder builder = new RampupLoadPolicy.Builder(); if (json.minUsersIsSet) { builder.minUsers(json.minUsers); } if (json.maxUsers != null) { builder.maxUsers(json.maxUsers); } if (json.incrementUsersIsSet) { builder.incrementUsers(json.incrementUsers); } if (json.incrementEvery != null) { builder.incrementEvery(json.incrementEvery); } 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 (ImmutableRampupLoadPolicy) builder.build(); } /** * Creates an immutable copy of a {@link RampupLoadPolicy} 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 RampupLoadPolicy instance */ public static ImmutableRampupLoadPolicy copyOf(RampupLoadPolicy instance) { if (instance instanceof ImmutableRampupLoadPolicy) { return (ImmutableRampupLoadPolicy) instance; } return new RampupLoadPolicy.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableRampupLoadPolicy ImmutableRampupLoadPolicy}. * 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 int minUsers; private @Nullable Integer maxUsers; private int incrementUsers; private @Nullable com.neotys.neoload.model.scenario.@Valid Duration incrementEvery; 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 ImmutableRampupLoadPolicy ImmutableRampupLoadPolicy} instances. */ public Builder() { if (!(this instanceof RampupLoadPolicy.Builder)) { throw new UnsupportedOperationException("Use: new RampupLoadPolicy.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 RampupLoadPolicy.Builder from(StartStopPolicy instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (RampupLoadPolicy.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 RampupLoadPolicy.Builder from(DurationPolicy instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (RampupLoadPolicy.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.scenario.RampupLoadPolicy} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final RampupLoadPolicy.Builder from(RampupLoadPolicy instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (RampupLoadPolicy.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 RampupLoadPolicy) { RampupLoadPolicy instance = (RampupLoadPolicy) object; minUsers(instance.getMinUsers()); Integer maxUsersValue = instance.getMaxUsers(); if (maxUsersValue != null) { maxUsers(maxUsersValue); } com.neotys.neoload.model.scenario.@Valid Duration incrementEveryValue = instance.getIncrementEvery(); if (incrementEveryValue != null) { incrementEvery(incrementEveryValue); } incrementUsers(instance.getIncrementUsers()); if ((bits & 0x1L) == 0) { Integer rampupValue = instance.getRampup(); if (rampupValue != null) { rampup(rampupValue); } bits |= 0x1L; } } } /** * Initializes the value for the {@link RampupLoadPolicy#getMinUsers() minUsers} attribute. * @param minUsers The value for minUsers * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("min_users") public final RampupLoadPolicy.Builder minUsers(int minUsers) { this.minUsers = minUsers; return (RampupLoadPolicy.Builder) this; } /** * Initializes the value for the {@link RampupLoadPolicy#getMaxUsers() maxUsers} attribute. * @param maxUsers The value for maxUsers (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("max_users") public final RampupLoadPolicy.Builder maxUsers(Integer maxUsers) { this.maxUsers = maxUsers; return (RampupLoadPolicy.Builder) this; } /** * Initializes the value for the {@link RampupLoadPolicy#getIncrementUsers() incrementUsers} attribute. * @param incrementUsers The value for incrementUsers * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("increment_users") public final RampupLoadPolicy.Builder incrementUsers(int incrementUsers) { this.incrementUsers = incrementUsers; return (RampupLoadPolicy.Builder) this; } /** * Initializes the value for the {@link RampupLoadPolicy#getIncrementEvery() incrementEvery} attribute. * @param incrementEvery The value for incrementEvery (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("increment_every") public final RampupLoadPolicy.Builder incrementEvery(com.neotys.neoload.model.scenario.@Valid Duration incrementEvery) { this.incrementEvery = incrementEvery; return (RampupLoadPolicy.Builder) this; } /** * Initializes the value for the {@link RampupLoadPolicy#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("increment_rampup") public final RampupLoadPolicy.Builder rampup(Integer rampup) { this.rampup = rampup; return (RampupLoadPolicy.Builder) this; } /** * Initializes the value for the {@link RampupLoadPolicy#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 RampupLoadPolicy.Builder duration(com.neotys.neoload.model.scenario.@Valid Duration duration) { this.duration = duration; return (RampupLoadPolicy.Builder) this; } /** * Initializes the value for the {@link RampupLoadPolicy#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 RampupLoadPolicy.Builder startAfter(com.neotys.neoload.model.scenario.@Valid StartAfter startAfter) { this.startAfter = startAfter; return (RampupLoadPolicy.Builder) this; } /** * Initializes the value for the {@link RampupLoadPolicy#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 RampupLoadPolicy.Builder stopAfter(com.neotys.neoload.model.scenario.@Valid StopAfter stopAfter) { this.stopAfter = stopAfter; return (RampupLoadPolicy.Builder) this; } /** * Builds a new {@link ImmutableRampupLoadPolicy ImmutableRampupLoadPolicy}. * @return An immutable instance of RampupLoadPolicy * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableRampupLoadPolicy build() { return new ImmutableRampupLoadPolicy(minUsers, maxUsers, incrementUsers, incrementEvery, rampup, duration, startAfter, stopAfter); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy