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

com.neotys.neoload.model.v3.project.userpath.ImmutableRequest Maven / Gradle / Ivy

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

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.collect.Lists;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.neotys.neoload.model.v3.project.Element;
import com.neotys.neoload.model.v3.project.SlaElement;
import com.neotys.neoload.model.v3.project.userpath.assertion.ContentAssertion;
import com.neotys.neoload.model.v3.project.userpath.assertion.ContentAssertionElement;
import com.neotys.neoload.model.v3.validation.groups.NeoLoad;
import java.util.ArrayList;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.CheckReturnValue;
import javax.annotation.Generated;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import javax.validation.Valid;
import javax.validation.constraints.Pattern;

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

* Use the builder to create immutable instances: * {@code new Request.Builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "Request"}) @Immutable @CheckReturnValue public final class ImmutableRequest implements Request { private final String name; private final java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String url; private final @Nullable String server; private final String method; private final ImmutableList

headers; private final @Nullable String body; private final @Nullable byte[] bodyBinary; private final @Nullable java.util.List parts; private final ImmutableList extractors; private final java.lang.@Valid Boolean followRedirects; private final @Nullable String description; private final @Nullable String slaProfile; private final ImmutableList contentAssertions; private ImmutableRequest(ImmutableRequest.Builder builder) { this.url = builder.url; this.server = builder.server; this.headers = builder.headers.build(); this.body = builder.body; this.bodyBinary = builder.bodyBinary; this.parts = builder.parts; this.extractors = builder.extractors.build(); this.description = builder.description; this.slaProfile = builder.slaProfile; this.contentAssertions = builder.contentAssertions.build(); if (builder.name != null) { initShim.name(builder.name); } if (builder.method != null) { initShim.method(builder.method); } if (builder.followRedirects != null) { initShim.followRedirects(builder.followRedirects); } this.name = initShim.getName(); this.method = initShim.getMethod(); this.followRedirects = initShim.getFollowRedirects(); this.initShim = null; } private ImmutableRequest( String name, java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String url, @Nullable String server, String method, ImmutableList
headers, @Nullable String body, @Nullable byte[] bodyBinary, @Nullable java.util.List parts, ImmutableList extractors, java.lang.@Valid Boolean followRedirects, @Nullable String description, @Nullable String slaProfile, ImmutableList contentAssertions) { this.name = name; this.url = url; this.server = server; this.method = method; this.headers = headers; this.body = body; this.bodyBinary = bodyBinary; this.parts = parts; this.extractors = extractors; this.followRedirects = followRedirects; this.description = description; this.slaProfile = slaProfile; this.contentAssertions = contentAssertions; this.initShim = null; } private static final int STAGE_INITIALIZING = -1; private static final int STAGE_UNINITIALIZED = 0; private static final int STAGE_INITIALIZED = 1; private transient volatile InitShim initShim = new InitShim(); private final class InitShim { private String name; private int nameBuildStage; String getName() { if (nameBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (nameBuildStage == STAGE_UNINITIALIZED) { nameBuildStage = STAGE_INITIALIZING; this.name = Objects.requireNonNull(getNameInitialize(), "name"); nameBuildStage = STAGE_INITIALIZED; } return this.name; } void name(String name) { this.name = name; nameBuildStage = STAGE_INITIALIZED; } private String method; private int methodBuildStage; String getMethod() { if (methodBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (methodBuildStage == STAGE_UNINITIALIZED) { methodBuildStage = STAGE_INITIALIZING; this.method = Objects.requireNonNull(getMethodInitialize(), "method"); methodBuildStage = STAGE_INITIALIZED; } return this.method; } void method(String method) { this.method = method; methodBuildStage = STAGE_INITIALIZED; } private java.lang.@Valid Boolean followRedirects; private int followRedirectsBuildStage; java.lang.@Valid Boolean getFollowRedirects() { if (followRedirectsBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (followRedirectsBuildStage == STAGE_UNINITIALIZED) { followRedirectsBuildStage = STAGE_INITIALIZING; this.followRedirects = Objects.requireNonNull(getFollowRedirectsInitialize(), "followRedirects"); followRedirectsBuildStage = STAGE_INITIALIZED; } return this.followRedirects; } void followRedirects(java.lang.@Valid Boolean followRedirects) { this.followRedirects = followRedirects; followRedirectsBuildStage = STAGE_INITIALIZED; } private String formatInitCycleMessage() { ArrayList attributes = Lists.newArrayList(); if (nameBuildStage == STAGE_INITIALIZING) attributes.add("name"); if (methodBuildStage == STAGE_INITIALIZING) attributes.add("method"); if (followRedirectsBuildStage == STAGE_INITIALIZING) attributes.add("followRedirects"); return "Cannot build Request, attribute initializers form cycle" + attributes; } } private String getNameInitialize() { return Request.super.getName(); } private String getMethodInitialize() { return Request.super.getMethod(); } private java.lang.@Valid Boolean getFollowRedirectsInitialize() { return Request.super.getFollowRedirects(); } /** * @return The value of the {@code name} attribute */ @JsonProperty("name") @Override public String getName() { InitShim shim = this.initShim; return shim != null ? shim.getName() : this.name; } /** * @return The value of the {@code url} attribute */ @JsonProperty("url") @Override public java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String getUrl() { return url; } /** * @return The value of the {@code server} attribute */ @JsonProperty("server") @Override public Optional getServer() { return Optional.ofNullable(server); } /** * @return The value of the {@code method} attribute */ @JsonProperty("method") @Override public String getMethod() { InitShim shim = this.initShim; return shim != null ? shim.getMethod() : this.method; } /** * @return The value of the {@code headers} attribute */ @JsonProperty("headers") @Override public ImmutableList
getHeaders() { return headers; } /** * @return The value of the {@code body} attribute */ @JsonProperty("body") @Override public Optional getBody() { return Optional.ofNullable(body); } /** * @return The value of the {@code bodyBinary} attribute */ @JsonProperty("bodybinary") @Override public Optional getBodyBinary() { return Optional.ofNullable(bodyBinary); } /** * @return The value of the {@code parts} attribute */ @JsonProperty("parts") @Override public Optional> getParts() { return Optional.ofNullable(parts); } /** * @return The value of the {@code extractors} attribute */ @JsonProperty("extractors") @Override public ImmutableList getExtractors() { return extractors; } /** * @return The value of the {@code followRedirects} attribute */ @JsonProperty("followRedirects") @Override public java.lang.@Valid Boolean getFollowRedirects() { InitShim shim = this.initShim; return shim != null ? shim.getFollowRedirects() : this.followRedirects; } /** * @return The value of the {@code description} attribute */ @JsonProperty("description") @Override public Optional getDescription() { return Optional.ofNullable(description); } /** * @return The value of the {@code slaProfile} attribute */ @JsonProperty("sla_profile") @Override public Optional getSlaProfile() { return Optional.ofNullable(slaProfile); } /** * @return The value of the {@code contentAssertions} attribute */ @JsonProperty("assert_content") @Override public ImmutableList getContentAssertions() { return contentAssertions; } /** * Copy the current immutable object by setting a value for the {@link Request#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 ImmutableRequest withName(String value) { if (this.name.equals(value)) return this; String newValue = Objects.requireNonNull(value, "name"); return new ImmutableRequest( newValue, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a value for the {@link Request#getUrl() url} 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 url (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableRequest withUrl(java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String value) { if (this.url == value) return this; return new ImmutableRequest( this.name, value, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a present value for the optional {@link Request#getServer() server} attribute. * @param value The value for server * @return A modified copy of {@code this} object */ public final ImmutableRequest withServer(String value) { @Nullable String newValue = Objects.requireNonNull(value, "server"); if (Objects.equals(this.server, newValue)) return this; return new ImmutableRequest( this.name, this.url, newValue, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting an optional value for the {@link Request#getServer() server} 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 server * @return A modified copy of {@code this} object */ public final ImmutableRequest withServer(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.server, value)) return this; return new ImmutableRequest( this.name, this.url, value, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a value for the {@link Request#getMethod() method} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for method * @return A modified copy of the {@code this} object */ public final ImmutableRequest withMethod(String value) { if (this.method.equals(value)) return this; String newValue = Objects.requireNonNull(value, "method"); return new ImmutableRequest( this.name, this.url, this.server, newValue, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object with elements that replace the content of {@link Request#getHeaders() headers}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableRequest withHeaders(Header... elements) { ImmutableList
newValue = ImmutableList.copyOf(elements); return new ImmutableRequest( this.name, this.url, this.server, this.method, newValue, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object with elements that replace the content of {@link Request#getHeaders() headers}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of headers elements to set * @return A modified copy of {@code this} object */ public final ImmutableRequest withHeaders(Iterable elements) { if (this.headers == elements) return this; ImmutableList
newValue = ImmutableList.copyOf(elements); return new ImmutableRequest( this.name, this.url, this.server, this.method, newValue, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a present value for the optional {@link Request#getBody() body} attribute. * @param value The value for body * @return A modified copy of {@code this} object */ public final ImmutableRequest withBody(String value) { @Nullable String newValue = Objects.requireNonNull(value, "body"); if (Objects.equals(this.body, newValue)) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, newValue, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting an optional value for the {@link Request#getBody() body} 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 body * @return A modified copy of {@code this} object */ public final ImmutableRequest withBody(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.body, value)) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, value, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a present value for the optional {@link Request#getBodyBinary() bodyBinary} attribute. * @param value The value for bodyBinary * @return A modified copy of {@code this} object */ public final ImmutableRequest withBodyBinary(byte[] value) { @Nullable byte[] newValue = Objects.requireNonNull(value, "bodyBinary"); if (this.bodyBinary == newValue) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, newValue, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting an optional value for the {@link Request#getBodyBinary() bodyBinary} 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 bodyBinary * @return A modified copy of {@code this} object */ public final ImmutableRequest withBodyBinary(Optional optional) { @Nullable byte[] value = optional.orElse(null); if (this.bodyBinary == value) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, value, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a present value for the optional {@link Request#getParts() parts} attribute. * @param value The value for parts * @return A modified copy of {@code this} object */ public final ImmutableRequest withParts(java.util.List value) { @Nullable java.util.List newValue = Objects.requireNonNull(value, "parts"); if (this.parts == newValue) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, newValue, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting an optional value for the {@link Request#getParts() parts} 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 parts * @return A modified copy of {@code this} object */ public final ImmutableRequest withParts(Optional> optional) { @Nullable java.util.List value = optional.orElse(null); if (this.parts == value) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, value, this.extractors, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object with elements that replace the content of {@link Request#getExtractors() extractors}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableRequest withExtractors(VariableExtractor... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, newValue, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object with elements that replace the content of {@link Request#getExtractors() extractors}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of extractors elements to set * @return A modified copy of {@code this} object */ public final ImmutableRequest withExtractors(Iterable elements) { if (this.extractors == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, newValue, this.followRedirects, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a value for the {@link Request#getFollowRedirects() followRedirects} 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 followRedirects * @return A modified copy of the {@code this} object */ public final ImmutableRequest withFollowRedirects(java.lang.@Valid Boolean value) { if (this.followRedirects == value) return this; java.lang.@Valid Boolean newValue = Objects.requireNonNull(value, "followRedirects"); return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, newValue, this.description, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a present value for the optional {@link Request#getDescription() description} attribute. * @param value The value for description * @return A modified copy of {@code this} object */ public final ImmutableRequest withDescription(String value) { @Nullable String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, newValue, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting an optional value for the {@link Request#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 ImmutableRequest withDescription(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.description, value)) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, value, this.slaProfile, this.contentAssertions); } /** * Copy the current immutable object by setting a present value for the optional {@link Request#getSlaProfile() slaProfile} attribute. * @param value The value for slaProfile * @return A modified copy of {@code this} object */ public final ImmutableRequest withSlaProfile(String value) { @Nullable String newValue = Objects.requireNonNull(value, "slaProfile"); if (Objects.equals(this.slaProfile, newValue)) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, newValue, this.contentAssertions); } /** * Copy the current immutable object by setting an optional value for the {@link Request#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 ImmutableRequest withSlaProfile(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.slaProfile, value)) return this; return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, value, this.contentAssertions); } /** * Copy the current immutable object with elements that replace the content of {@link Request#getContentAssertions() contentAssertions}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableRequest withContentAssertions(ContentAssertion... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, newValue); } /** * Copy the current immutable object with elements that replace the content of {@link Request#getContentAssertions() contentAssertions}. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param elements An iterable of contentAssertions elements to set * @return A modified copy of {@code this} object */ public final ImmutableRequest withContentAssertions(Iterable elements) { if (this.contentAssertions == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableRequest( this.name, this.url, this.server, this.method, this.headers, this.body, this.bodyBinary, this.parts, this.extractors, this.followRedirects, this.description, this.slaProfile, newValue); } /** * This instance is equal to all instances of {@code ImmutableRequest} 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 ImmutableRequest && equalTo((ImmutableRequest) another); } private boolean equalTo(ImmutableRequest another) { return name.equals(another.name) && Objects.equals(url, another.url) && Objects.equals(server, another.server) && method.equals(another.method) && headers.equals(another.headers) && Objects.equals(body, another.body) && Objects.equals(bodyBinary, another.bodyBinary) && Objects.equals(parts, another.parts) && extractors.equals(another.extractors) && followRedirects.equals(another.followRedirects) && Objects.equals(description, another.description) && Objects.equals(slaProfile, another.slaProfile) && contentAssertions.equals(another.contentAssertions); } /** * Computes a hash code from attributes: {@code name}, {@code url}, {@code server}, {@code method}, {@code headers}, {@code body}, {@code bodyBinary}, {@code parts}, {@code extractors}, {@code followRedirects}, {@code description}, {@code slaProfile}, {@code contentAssertions}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + name.hashCode(); h += (h << 5) + Objects.hashCode(url); h += (h << 5) + Objects.hashCode(server); h += (h << 5) + method.hashCode(); h += (h << 5) + headers.hashCode(); h += (h << 5) + Objects.hashCode(body); h += (h << 5) + Objects.hashCode(bodyBinary); h += (h << 5) + Objects.hashCode(parts); h += (h << 5) + extractors.hashCode(); h += (h << 5) + followRedirects.hashCode(); h += (h << 5) + Objects.hashCode(description); h += (h << 5) + Objects.hashCode(slaProfile); h += (h << 5) + contentAssertions.hashCode(); return h; } /** * Prints the immutable value {@code Request} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("Request") .omitNullValues() .add("name", name) .add("url", url) .add("server", server) .add("method", method) .add("headers", headers) .add("body", body) .add("bodyBinary", bodyBinary) .add("parts", parts) .add("extractors", extractors) .add("followRedirects", followRedirects) .add("description", description) .add("slaProfile", slaProfile) .add("contentAssertions", contentAssertions) .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 Request { @Nullable String name; @Nullable java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String url; Optional server = Optional.empty(); @Nullable String method; java.util.@Valid List
headers = ImmutableList.of(); Optional body = Optional.empty(); Optional bodyBinary = Optional.empty(); Optional> parts = Optional.empty(); java.util.@Valid List extractors = ImmutableList.of(); @Nullable java.lang.@Valid Boolean followRedirects; Optional description = Optional.empty(); Optional slaProfile = Optional.empty(); java.util.@Valid List contentAssertions = ImmutableList.of(); @JsonProperty("name") public void setName(String name) { this.name = name; } @JsonProperty("url") public void setUrl(java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String url) { this.url = url; } @JsonProperty("server") public void setServer(Optional server) { this.server = server; } @JsonProperty("method") public void setMethod(String method) { this.method = method; } @JsonProperty("headers") public void setHeaders(java.util.@Valid List
headers) { this.headers = headers; } @JsonProperty("body") public void setBody(Optional body) { this.body = body; } @JsonProperty("bodybinary") public void setBodyBinary(Optional bodyBinary) { this.bodyBinary = bodyBinary; } @JsonProperty("parts") public void setParts(Optional> parts) { this.parts = parts; } @JsonProperty("extractors") public void setExtractors(java.util.@Valid List extractors) { this.extractors = extractors; } @JsonProperty("followRedirects") public void setFollowRedirects(java.lang.@Valid Boolean followRedirects) { this.followRedirects = followRedirects; } @JsonProperty("description") public void setDescription(Optional description) { this.description = description; } @JsonProperty("sla_profile") public void setSlaProfile(Optional slaProfile) { this.slaProfile = slaProfile; } @JsonProperty("assert_content") public void setContentAssertions(java.util.@Valid List contentAssertions) { this.contentAssertions = contentAssertions; } @Override public Element withName(String of) { throw new UnsupportedOperationException(); } @Override public String getName() { throw new UnsupportedOperationException(); } @Override public java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String getUrl() { throw new UnsupportedOperationException(); } @Override public Optional getServer() { throw new UnsupportedOperationException(); } @Override public String getMethod() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List
getHeaders() { throw new UnsupportedOperationException(); } @Override public Optional getBody() { throw new UnsupportedOperationException(); } @Override public Optional getBodyBinary() { throw new UnsupportedOperationException(); } @Override public Optional> getParts() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getExtractors() { throw new UnsupportedOperationException(); } @Override public java.lang.@Valid Boolean getFollowRedirects() { throw new UnsupportedOperationException(); } @Override public Optional getDescription() { throw new UnsupportedOperationException(); } @Override public Optional getSlaProfile() { throw new UnsupportedOperationException(); } @Override public java.util.@Valid List getContentAssertions() { 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 ImmutableRequest fromJson(Json json) { Request.Builder builder = new Request.Builder(); if (json.name != null) { builder.name(json.name); } if (json.url != null) { builder.url(json.url); } if (json.server != null) { builder.server(json.server); } if (json.method != null) { builder.method(json.method); } if (json.headers != null) { builder.addAllHeaders(json.headers); } if (json.body != null) { builder.body(json.body); } if (json.bodyBinary != null) { builder.bodyBinary(json.bodyBinary); } if (json.parts != null) { builder.parts(json.parts); } if (json.extractors != null) { builder.addAllExtractors(json.extractors); } if (json.followRedirects != null) { builder.followRedirects(json.followRedirects); } if (json.description != null) { builder.description(json.description); } if (json.slaProfile != null) { builder.slaProfile(json.slaProfile); } if (json.contentAssertions != null) { builder.addAllContentAssertions(json.contentAssertions); } return (ImmutableRequest) builder.build(); } /** * Creates an immutable copy of a {@link Request} 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 Request instance */ public static ImmutableRequest copyOf(Request instance) { if (instance instanceof ImmutableRequest) { return (ImmutableRequest) instance; } return new Request.Builder() .from(instance) .build(); } /** * Builds instances of type {@link ImmutableRequest ImmutableRequest}. * 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 @Nullable java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String url; private @Nullable String server; private @Nullable String method; private ImmutableList.Builder

headers = ImmutableList.builder(); private @Nullable String body; private @Nullable byte[] bodyBinary; private @Nullable java.util.List parts; private ImmutableList.Builder extractors = ImmutableList.builder(); private @Nullable java.lang.@Valid Boolean followRedirects; private @Nullable String description; private @Nullable String slaProfile; private ImmutableList.Builder contentAssertions = ImmutableList.builder(); /** * Creates a builder for {@link ImmutableRequest ImmutableRequest} instances. */ public Builder() { if (!(this instanceof Request.Builder)) { throw new UnsupportedOperationException("Use: new Request.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 Request.Builder from(Element instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (Request.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 Request.Builder from(SlaElement instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (Request.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.userpath.assertion.ContentAssertionElement} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder from(ContentAssertionElement instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (Request.Builder) this; } /** * Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.v3.project.userpath.Request} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder from(Request instance) { Objects.requireNonNull(instance, "instance"); from((Object) instance); return (Request.Builder) this; } private void from(Object object) { long bits = 0; if (object instanceof Element) { Element instance = (Element) object; if ((bits & 0x1L) == 0) { name(instance.getName()); bits |= 0x1L; } Optional descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } } if (object instanceof SlaElement) { SlaElement instance = (SlaElement) object; Optional slaProfileOptional = instance.getSlaProfile(); if (slaProfileOptional.isPresent()) { slaProfile(slaProfileOptional); } } if (object instanceof ContentAssertionElement) { ContentAssertionElement instance = (ContentAssertionElement) object; addAllContentAssertions(instance.getContentAssertions()); } if (object instanceof Request) { Request instance = (Request) object; Optional serverOptional = instance.getServer(); if (serverOptional.isPresent()) { server(serverOptional); } addAllHeaders(instance.getHeaders()); method(instance.getMethod()); addAllExtractors(instance.getExtractors()); followRedirects(instance.getFollowRedirects()); Optional bodyBinaryOptional = instance.getBodyBinary(); if (bodyBinaryOptional.isPresent()) { bodyBinary(bodyBinaryOptional); } if ((bits & 0x1L) == 0) { name(instance.getName()); bits |= 0x1L; } Optional> partsOptional = instance.getParts(); if (partsOptional.isPresent()) { parts(partsOptional); } Optional bodyOptional = instance.getBody(); if (bodyOptional.isPresent()) { body(bodyOptional); } java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String urlValue = instance.getUrl(); if (urlValue != null) { url(urlValue); } } } /** * Initializes the value for the {@link Request#getName() name} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link Request#getName() name}. * @param name The value for name * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("name") public final Request.Builder name(String name) { this.name = Objects.requireNonNull(name, "name"); return (Request.Builder) this; } /** * Initializes the value for the {@link Request#getUrl() url} attribute. * @param url The value for url (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("url") public final Request.Builder url(java.lang.@Pattern(regexp = "^((http[s]?):\\/\\/(([^:/\\[\\]]+)|(\\[[^/]+\\])):?((\\d+)|(\\$\\{.+\\}))?)?($|\\/.*$)", groups = {NeoLoad.class}) String url) { this.url = url; return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getServer() server} to server. * @param server The value for server * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Request.Builder server(String server) { this.server = Objects.requireNonNull(server, "server"); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getServer() server} to server. * @param server The value for server * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("server") public final Request.Builder server(Optional server) { this.server = server.orElse(null); return (Request.Builder) this; } /** * Initializes the value for the {@link Request#getMethod() method} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link Request#getMethod() method}. * @param method The value for method * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("method") public final Request.Builder method(String method) { this.method = Objects.requireNonNull(method, "method"); return (Request.Builder) this; } /** * Adds one element to {@link Request#getHeaders() headers} list. * @param element A headers element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addHeaders(Header element) { this.headers.add(element); return (Request.Builder) this; } /** * Adds elements to {@link Request#getHeaders() headers} list. * @param elements An array of headers elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addHeaders(Header... elements) { this.headers.add(elements); return (Request.Builder) this; } /** * Sets or replaces all elements for {@link Request#getHeaders() headers} list. * @param elements An iterable of headers elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("headers") public final Request.Builder headers(Iterable elements) { this.headers = ImmutableList.builder(); return addAllHeaders(elements); } /** * Adds elements to {@link Request#getHeaders() headers} list. * @param elements An iterable of headers elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addAllHeaders(Iterable elements) { this.headers.addAll(elements); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getBody() body} to body. * @param body The value for body * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Request.Builder body(String body) { this.body = Objects.requireNonNull(body, "body"); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getBody() body} to body. * @param body The value for body * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("body") public final Request.Builder body(Optional body) { this.body = body.orElse(null); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getBodyBinary() bodyBinary} to bodyBinary. * @param bodyBinary The value for bodyBinary * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Request.Builder bodyBinary(byte[] bodyBinary) { this.bodyBinary = Objects.requireNonNull(bodyBinary, "bodyBinary"); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getBodyBinary() bodyBinary} to bodyBinary. * @param bodyBinary The value for bodyBinary * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("bodybinary") public final Request.Builder bodyBinary(Optional bodyBinary) { this.bodyBinary = bodyBinary.orElse(null); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getParts() parts} to parts. * @param parts The value for parts * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Request.Builder parts(java.util.List parts) { this.parts = Objects.requireNonNull(parts, "parts"); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getParts() parts} to parts. * @param parts The value for parts * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("parts") public final Request.Builder parts(Optional> parts) { this.parts = parts.orElse(null); return (Request.Builder) this; } /** * Adds one element to {@link Request#getExtractors() extractors} list. * @param element A extractors element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addExtractors(VariableExtractor element) { this.extractors.add(element); return (Request.Builder) this; } /** * Adds elements to {@link Request#getExtractors() extractors} list. * @param elements An array of extractors elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addExtractors(VariableExtractor... elements) { this.extractors.add(elements); return (Request.Builder) this; } /** * Sets or replaces all elements for {@link Request#getExtractors() extractors} list. * @param elements An iterable of extractors elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("extractors") public final Request.Builder extractors(Iterable elements) { this.extractors = ImmutableList.builder(); return addAllExtractors(elements); } /** * Adds elements to {@link Request#getExtractors() extractors} list. * @param elements An iterable of extractors elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addAllExtractors(Iterable elements) { this.extractors.addAll(elements); return (Request.Builder) this; } /** * Initializes the value for the {@link Request#getFollowRedirects() followRedirects} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link Request#getFollowRedirects() followRedirects}. * @param followRedirects The value for followRedirects * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("followRedirects") public final Request.Builder followRedirects(java.lang.@Valid Boolean followRedirects) { this.followRedirects = Objects.requireNonNull(followRedirects, "followRedirects"); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getDescription() description} to description. * @param description The value for description * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Request.Builder description(String description) { this.description = Objects.requireNonNull(description, "description"); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#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 Request.Builder description(Optional description) { this.description = description.orElse(null); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#getSlaProfile() slaProfile} to slaProfile. * @param slaProfile The value for slaProfile * @return {@code this} builder for chained invocation */ @CanIgnoreReturnValue public final Request.Builder slaProfile(String slaProfile) { this.slaProfile = Objects.requireNonNull(slaProfile, "slaProfile"); return (Request.Builder) this; } /** * Initializes the optional value {@link Request#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 Request.Builder slaProfile(Optional slaProfile) { this.slaProfile = slaProfile.orElse(null); return (Request.Builder) this; } /** * Adds one element to {@link Request#getContentAssertions() contentAssertions} list. * @param element A contentAssertions element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addContentAssertions(ContentAssertion element) { this.contentAssertions.add(element); return (Request.Builder) this; } /** * Adds elements to {@link Request#getContentAssertions() contentAssertions} list. * @param elements An array of contentAssertions elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addContentAssertions(ContentAssertion... elements) { this.contentAssertions.add(elements); return (Request.Builder) this; } /** * Sets or replaces all elements for {@link Request#getContentAssertions() contentAssertions} list. * @param elements An iterable of contentAssertions elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("assert_content") public final Request.Builder contentAssertions(Iterable elements) { this.contentAssertions = ImmutableList.builder(); return addAllContentAssertions(elements); } /** * Adds elements to {@link Request#getContentAssertions() contentAssertions} list. * @param elements An iterable of contentAssertions elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Request.Builder addAllContentAssertions(Iterable elements) { this.contentAssertions.addAll(elements); return (Request.Builder) this; } /** * Builds a new {@link ImmutableRequest ImmutableRequest}. * @return An immutable instance of Request * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableRequest build() { return new ImmutableRequest(this); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy