com.neotys.neoload.model.repository.ImmutablePostMultipartRequest Maven / Gradle / Ivy
package com.neotys.neoload.model.repository;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import com.neotys.neoload.model.core.Element;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.CheckReturnValue;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.immutables.value.Generated;
/**
* Immutable implementation of {@link PostMultipartRequest}.
*
* Use the builder to create immutable instances:
* {@code ImmutablePostMultipartRequest.builder()}.
*/
@Generated(from = "PostMultipartRequest", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
@Deprecated
@Immutable
@CheckReturnValue
public final class ImmutablePostMultipartRequest
implements PostMultipartRequest {
private final String name;
private final @Nullable String description;
private final @Nullable String path;
private final @Nullable Server server;
private final Request.HttpMethod httpMethod;
private final ImmutableList parameters;
private final ImmutableList extractors;
private final ImmutableList validators;
private final ImmutableList headers;
private final @Nullable String contentType;
private final @Nullable RecordedFiles recordedFiles;
private final ImmutableList postParameters;
private final ImmutableList parts;
private ImmutablePostMultipartRequest(
String name,
@Nullable String description,
@Nullable String path,
@Nullable Server server,
Request.HttpMethod httpMethod,
ImmutableList parameters,
ImmutableList extractors,
ImmutableList validators,
ImmutableList headers,
@Nullable String contentType,
@Nullable RecordedFiles recordedFiles,
ImmutableList postParameters,
ImmutableList parts) {
this.name = name;
this.description = description;
this.path = path;
this.server = server;
this.httpMethod = httpMethod;
this.parameters = parameters;
this.extractors = extractors;
this.validators = validators;
this.headers = headers;
this.contentType = contentType;
this.recordedFiles = recordedFiles;
this.postParameters = postParameters;
this.parts = parts;
}
/**
* @return The value of the {@code name} attribute
*/
@Override
public String getName() {
return name;
}
/**
* @return The value of the {@code description} attribute
*/
@Override
public Optional getDescription() {
return Optional.ofNullable(description);
}
/**
* The request full path containing the URL parameters.
* @return
*/
@Override
public Optional getPath() {
return Optional.ofNullable(path);
}
/**
* @return The value of the {@code server} attribute
*/
@Override
public Optional getServer() {
return Optional.ofNullable(server);
}
/**
* @return The value of the {@code httpMethod} attribute
*/
@Override
public Request.HttpMethod getHttpMethod() {
return httpMethod;
}
/**
* @return The value of the {@code parameters} attribute
*/
@Override
public ImmutableList getParameters() {
return parameters;
}
/**
* @return The value of the {@code extractors} attribute
*/
@Override
public ImmutableList getExtractors() {
return extractors;
}
/**
* @return The value of the {@code validators} attribute
*/
@Override
public ImmutableList getValidators() {
return validators;
}
/**
* @return The value of the {@code headers} attribute
*/
@Override
public ImmutableList getHeaders() {
return headers;
}
/**
* @return The value of the {@code contentType} attribute
*/
@Override
public Optional getContentType() {
return Optional.ofNullable(contentType);
}
/**
* @return The value of the {@code recordedFiles} attribute
*/
@Override
public Optional getRecordedFiles() {
return Optional.ofNullable(recordedFiles);
}
/**
* @return The value of the {@code postParameters} attribute
*/
@Override
public ImmutableList getPostParameters() {
return postParameters;
}
/**
* @return The value of the {@code parts} attribute
*/
@Override
public ImmutableList getParts() {
return parts;
}
/**
* Copy the current immutable object by setting a value for the {@link PostMultipartRequest#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 ImmutablePostMultipartRequest withName(String value) {
String newValue = Objects.requireNonNull(value, "name");
if (this.name.equals(newValue)) return this;
return new ImmutablePostMultipartRequest(
newValue,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting a present value for the optional {@link PostMultipartRequest#getDescription() description} attribute.
* @param value The value for description
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withDescription(String value) {
String newValue = Objects.requireNonNull(value, "description");
if (Objects.equals(this.description, newValue)) return this;
return new ImmutablePostMultipartRequest(
this.name,
newValue,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting an optional value for the {@link PostMultipartRequest#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 ImmutablePostMultipartRequest withDescription(Optional optional) {
@Nullable String value = optional.orElse(null);
if (Objects.equals(this.description, value)) return this;
return new ImmutablePostMultipartRequest(
this.name,
value,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting a present value for the optional {@link PostMultipartRequest#getPath() path} attribute.
* @param value The value for path
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withPath(String value) {
String newValue = Objects.requireNonNull(value, "path");
if (Objects.equals(this.path, newValue)) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
newValue,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting an optional value for the {@link PostMultipartRequest#getPath() path} 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 path
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withPath(Optional optional) {
@Nullable String value = optional.orElse(null);
if (Objects.equals(this.path, value)) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
value,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting a present value for the optional {@link PostMultipartRequest#getServer() server} attribute.
* @param value The value for server
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withServer(Server value) {
Server newValue = Objects.requireNonNull(value, "server");
if (this.server == newValue) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
newValue,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting an optional value for the {@link PostMultipartRequest#getServer() server} 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 server
* @return A modified copy of {@code this} object
*/
@SuppressWarnings("unchecked") // safe covariant cast
public final ImmutablePostMultipartRequest withServer(Optional extends Server> optional) {
@Nullable Server value = optional.orElse(null);
if (this.server == value) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
value,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting a value for the {@link PostMultipartRequest#getHttpMethod() httpMethod} attribute.
* A value equality check is used to prevent copying of the same value by returning {@code this}.
* @param value A new value for httpMethod
* @return A modified copy of the {@code this} object
*/
public final ImmutablePostMultipartRequest withHttpMethod(Request.HttpMethod value) {
Request.HttpMethod newValue = Objects.requireNonNull(value, "httpMethod");
if (this.httpMethod == newValue) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
newValue,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getParameters() parameters}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withParameters(Parameter... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
newValue,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getParameters() parameters}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of parameters elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withParameters(Iterable extends Parameter> elements) {
if (this.parameters == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
newValue,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getExtractors() extractors}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withExtractors(VariableExtractor... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
newValue,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#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 ImmutablePostMultipartRequest withExtractors(Iterable extends VariableExtractor> elements) {
if (this.extractors == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
newValue,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getValidators() validators}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withValidators(Validator... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
newValue,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getValidators() validators}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of validators elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withValidators(Iterable extends Validator> elements) {
if (this.validators == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
newValue,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getHeaders() headers}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withHeaders(Header... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
newValue,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#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 ImmutablePostMultipartRequest withHeaders(Iterable extends Header> elements) {
if (this.headers == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
newValue,
this.contentType,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting a present value for the optional {@link PostMultipartRequest#getContentType() contentType} attribute.
* @param value The value for contentType
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withContentType(String value) {
String newValue = Objects.requireNonNull(value, "contentType");
if (Objects.equals(this.contentType, newValue)) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
newValue,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting an optional value for the {@link PostMultipartRequest#getContentType() contentType} 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 contentType
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withContentType(Optional optional) {
@Nullable String value = optional.orElse(null);
if (Objects.equals(this.contentType, value)) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
value,
this.recordedFiles,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting a present value for the optional {@link PostMultipartRequest#getRecordedFiles() recordedFiles} attribute.
* @param value The value for recordedFiles
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withRecordedFiles(RecordedFiles value) {
RecordedFiles newValue = Objects.requireNonNull(value, "recordedFiles");
if (this.recordedFiles == newValue) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
newValue,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object by setting an optional value for the {@link PostMultipartRequest#getRecordedFiles() recordedFiles} 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 recordedFiles
* @return A modified copy of {@code this} object
*/
@SuppressWarnings("unchecked") // safe covariant cast
public final ImmutablePostMultipartRequest withRecordedFiles(Optional extends RecordedFiles> optional) {
@Nullable RecordedFiles value = optional.orElse(null);
if (this.recordedFiles == value) return this;
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
value,
this.postParameters,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getPostParameters() postParameters}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withPostParameters(Parameter... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
newValue,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getPostParameters() postParameters}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of postParameters elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withPostParameters(Iterable extends Parameter> elements) {
if (this.postParameters == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
newValue,
this.parts);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getParts() parts}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withParts(Part... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
newValue);
}
/**
* Copy the current immutable object with elements that replace the content of {@link PostMultipartRequest#getParts() parts}.
* A shallow reference equality check is used to prevent copying of the same value by returning {@code this}.
* @param elements An iterable of parts elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutablePostMultipartRequest withParts(Iterable extends Part> elements) {
if (this.parts == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutablePostMultipartRequest(
this.name,
this.description,
this.path,
this.server,
this.httpMethod,
this.parameters,
this.extractors,
this.validators,
this.headers,
this.contentType,
this.recordedFiles,
this.postParameters,
newValue);
}
/**
* This instance is equal to all instances of {@code ImmutablePostMultipartRequest} 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 ImmutablePostMultipartRequest
&& equalTo(0, (ImmutablePostMultipartRequest) another);
}
private boolean equalTo(int synthetic, ImmutablePostMultipartRequest another) {
return name.equals(another.name)
&& Objects.equals(description, another.description)
&& Objects.equals(path, another.path)
&& Objects.equals(server, another.server)
&& httpMethod.equals(another.httpMethod)
&& parameters.equals(another.parameters)
&& extractors.equals(another.extractors)
&& validators.equals(another.validators)
&& headers.equals(another.headers)
&& Objects.equals(contentType, another.contentType)
&& Objects.equals(recordedFiles, another.recordedFiles)
&& postParameters.equals(another.postParameters)
&& parts.equals(another.parts);
}
/**
* Computes a hash code from attributes: {@code name}, {@code description}, {@code path}, {@code server}, {@code httpMethod}, {@code parameters}, {@code extractors}, {@code validators}, {@code headers}, {@code contentType}, {@code recordedFiles}, {@code postParameters}, {@code parts}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + name.hashCode();
h += (h << 5) + Objects.hashCode(description);
h += (h << 5) + Objects.hashCode(path);
h += (h << 5) + Objects.hashCode(server);
h += (h << 5) + httpMethod.hashCode();
h += (h << 5) + parameters.hashCode();
h += (h << 5) + extractors.hashCode();
h += (h << 5) + validators.hashCode();
h += (h << 5) + headers.hashCode();
h += (h << 5) + Objects.hashCode(contentType);
h += (h << 5) + Objects.hashCode(recordedFiles);
h += (h << 5) + postParameters.hashCode();
h += (h << 5) + parts.hashCode();
return h;
}
/**
* Prints the immutable value {@code PostMultipartRequest} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("PostMultipartRequest")
.omitNullValues()
.add("name", name)
.add("description", description)
.add("path", path)
.add("server", server)
.add("httpMethod", httpMethod)
.add("parameters", parameters)
.add("extractors", extractors)
.add("validators", validators)
.add("headers", headers)
.add("contentType", contentType)
.add("recordedFiles", recordedFiles)
.add("postParameters", postParameters)
.add("parts", parts)
.toString();
}
/**
* Creates an immutable copy of a {@link PostMultipartRequest} 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 PostMultipartRequest instance
*/
public static ImmutablePostMultipartRequest copyOf(PostMultipartRequest instance) {
if (instance instanceof ImmutablePostMultipartRequest) {
return (ImmutablePostMultipartRequest) instance;
}
return ImmutablePostMultipartRequest.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutablePostMultipartRequest ImmutablePostMultipartRequest}.
*
* ImmutablePostMultipartRequest.builder()
* .name(String) // required {@link PostMultipartRequest#getName() name}
* .description(String) // optional {@link PostMultipartRequest#getDescription() description}
* .path(String) // optional {@link PostMultipartRequest#getPath() path}
* .server(com.neotys.neoload.model.repository.Server) // optional {@link PostMultipartRequest#getServer() server}
* .httpMethod(com.neotys.neoload.model.repository.Request.HttpMethod) // required {@link PostMultipartRequest#getHttpMethod() httpMethod}
* .addParameters|addAllParameters(com.neotys.neoload.model.repository.Parameter) // {@link PostMultipartRequest#getParameters() parameters} elements
* .addExtractors|addAllExtractors(com.neotys.neoload.model.repository.VariableExtractor) // {@link PostMultipartRequest#getExtractors() extractors} elements
* .addValidators|addAllValidators(com.neotys.neoload.model.repository.Validator) // {@link PostMultipartRequest#getValidators() validators} elements
* .addHeaders|addAllHeaders(com.neotys.neoload.model.repository.Header) // {@link PostMultipartRequest#getHeaders() headers} elements
* .contentType(String) // optional {@link PostMultipartRequest#getContentType() contentType}
* .recordedFiles(com.neotys.neoload.model.repository.RecordedFiles) // optional {@link PostMultipartRequest#getRecordedFiles() recordedFiles}
* .addPostParameters|addAllPostParameters(com.neotys.neoload.model.repository.Parameter) // {@link PostMultipartRequest#getPostParameters() postParameters} elements
* .addParts|addAllParts(com.neotys.neoload.model.repository.Part) // {@link PostMultipartRequest#getParts() parts} elements
* .build();
*
* @return A new ImmutablePostMultipartRequest builder
*/
public static ImmutablePostMultipartRequest.Builder builder() {
return new ImmutablePostMultipartRequest.Builder();
}
/**
* Builds instances of type {@link ImmutablePostMultipartRequest ImmutablePostMultipartRequest}.
* 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.
*/
@Generated(from = "PostMultipartRequest", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private static final long INIT_BIT_NAME = 0x1L;
private static final long INIT_BIT_HTTP_METHOD = 0x2L;
private long initBits = 0x3L;
private @Nullable String name;
private @Nullable String description;
private @Nullable String path;
private @Nullable Server server;
private @Nullable Request.HttpMethod httpMethod;
private ImmutableList.Builder parameters = ImmutableList.builder();
private ImmutableList.Builder extractors = ImmutableList.builder();
private ImmutableList.Builder validators = ImmutableList.builder();
private ImmutableList.Builder headers = ImmutableList.builder();
private @Nullable String contentType;
private @Nullable RecordedFiles recordedFiles;
private ImmutableList.Builder postParameters = ImmutableList.builder();
private ImmutableList.Builder parts = ImmutableList.builder();
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.repository.PostRequest} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder from(PostRequest instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.repository.Request} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder from(Request instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.repository.PageElement} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder from(PageElement instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.core.Element} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder from(Element instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
/**
* Fill a builder with attribute values from the provided {@code com.neotys.neoload.model.repository.PostMultipartRequest} instance.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder from(PostMultipartRequest instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
private void from(Object object) {
@Var long bits = 0;
if (object instanceof PostRequest) {
PostRequest instance = (PostRequest) object;
if ((bits & 0x1L) == 0) {
Optional serverOptional = instance.getServer();
if (serverOptional.isPresent()) {
server(serverOptional);
}
bits |= 0x1L;
}
if ((bits & 0x2L) == 0) {
addAllHeaders(instance.getHeaders());
bits |= 0x2L;
}
if ((bits & 0x100L) == 0) {
Optional pathOptional = instance.getPath();
if (pathOptional.isPresent()) {
path(pathOptional);
}
bits |= 0x100L;
}
if ((bits & 0x4L) == 0) {
addAllExtractors(instance.getExtractors());
bits |= 0x4L;
}
if ((bits & 0x8L) == 0) {
addAllPostParameters(instance.getPostParameters());
bits |= 0x8L;
}
if ((bits & 0x10L) == 0) {
addAllValidators(instance.getValidators());
bits |= 0x10L;
}
if ((bits & 0x200L) == 0) {
name(instance.getName());
bits |= 0x200L;
}
if ((bits & 0x20L) == 0) {
Optional descriptionOptional = instance.getDescription();
if (descriptionOptional.isPresent()) {
description(descriptionOptional);
}
bits |= 0x20L;
}
if ((bits & 0x40L) == 0) {
Optional recordedFilesOptional = instance.getRecordedFiles();
if (recordedFilesOptional.isPresent()) {
recordedFiles(recordedFilesOptional);
}
bits |= 0x40L;
}
if ((bits & 0x80L) == 0) {
httpMethod(instance.getHttpMethod());
bits |= 0x80L;
}
if ((bits & 0x400L) == 0) {
addAllParameters(instance.getParameters());
bits |= 0x400L;
}
if ((bits & 0x800L) == 0) {
Optional contentTypeOptional = instance.getContentType();
if (contentTypeOptional.isPresent()) {
contentType(contentTypeOptional);
}
bits |= 0x800L;
}
}
if (object instanceof Request) {
Request instance = (Request) object;
if ((bits & 0x1L) == 0) {
Optional serverOptional = instance.getServer();
if (serverOptional.isPresent()) {
server(serverOptional);
}
bits |= 0x1L;
}
if ((bits & 0x2L) == 0) {
addAllHeaders(instance.getHeaders());
bits |= 0x2L;
}
if ((bits & 0x100L) == 0) {
Optional pathOptional = instance.getPath();
if (pathOptional.isPresent()) {
path(pathOptional);
}
bits |= 0x100L;
}
if ((bits & 0x4L) == 0) {
addAllExtractors(instance.getExtractors());
bits |= 0x4L;
}
if ((bits & 0x10L) == 0) {
addAllValidators(instance.getValidators());
bits |= 0x10L;
}
if ((bits & 0x200L) == 0) {
name(instance.getName());
bits |= 0x200L;
}
if ((bits & 0x20L) == 0) {
Optional descriptionOptional = instance.getDescription();
if (descriptionOptional.isPresent()) {
description(descriptionOptional);
}
bits |= 0x20L;
}
if ((bits & 0x40L) == 0) {
Optional recordedFilesOptional = instance.getRecordedFiles();
if (recordedFilesOptional.isPresent()) {
recordedFiles(recordedFilesOptional);
}
bits |= 0x40L;
}
if ((bits & 0x80L) == 0) {
httpMethod(instance.getHttpMethod());
bits |= 0x80L;
}
if ((bits & 0x400L) == 0) {
addAllParameters(instance.getParameters());
bits |= 0x400L;
}
if ((bits & 0x800L) == 0) {
Optional contentTypeOptional = instance.getContentType();
if (contentTypeOptional.isPresent()) {
contentType(contentTypeOptional);
}
bits |= 0x800L;
}
}
if (object instanceof PageElement) {
PageElement instance = (PageElement) object;
if ((bits & 0x200L) == 0) {
name(instance.getName());
bits |= 0x200L;
}
if ((bits & 0x20L) == 0) {
Optional descriptionOptional = instance.getDescription();
if (descriptionOptional.isPresent()) {
description(descriptionOptional);
}
bits |= 0x20L;
}
}
if (object instanceof Element) {
Element instance = (Element) object;
if ((bits & 0x200L) == 0) {
name(instance.getName());
bits |= 0x200L;
}
if ((bits & 0x20L) == 0) {
Optional descriptionOptional = instance.getDescription();
if (descriptionOptional.isPresent()) {
description(descriptionOptional);
}
bits |= 0x20L;
}
}
if (object instanceof PostMultipartRequest) {
PostMultipartRequest instance = (PostMultipartRequest) object;
if ((bits & 0x1L) == 0) {
Optional serverOptional = instance.getServer();
if (serverOptional.isPresent()) {
server(serverOptional);
}
bits |= 0x1L;
}
if ((bits & 0x2L) == 0) {
addAllHeaders(instance.getHeaders());
bits |= 0x2L;
}
if ((bits & 0x4L) == 0) {
addAllExtractors(instance.getExtractors());
bits |= 0x4L;
}
if ((bits & 0x8L) == 0) {
addAllPostParameters(instance.getPostParameters());
bits |= 0x8L;
}
if ((bits & 0x10L) == 0) {
addAllValidators(instance.getValidators());
bits |= 0x10L;
}
if ((bits & 0x20L) == 0) {
Optional descriptionOptional = instance.getDescription();
if (descriptionOptional.isPresent()) {
description(descriptionOptional);
}
bits |= 0x20L;
}
if ((bits & 0x40L) == 0) {
Optional recordedFilesOptional = instance.getRecordedFiles();
if (recordedFilesOptional.isPresent()) {
recordedFiles(recordedFilesOptional);
}
bits |= 0x40L;
}
if ((bits & 0x80L) == 0) {
httpMethod(instance.getHttpMethod());
bits |= 0x80L;
}
if ((bits & 0x100L) == 0) {
Optional pathOptional = instance.getPath();
if (pathOptional.isPresent()) {
path(pathOptional);
}
bits |= 0x100L;
}
if ((bits & 0x200L) == 0) {
name(instance.getName());
bits |= 0x200L;
}
addAllParts(instance.getParts());
if ((bits & 0x400L) == 0) {
addAllParameters(instance.getParameters());
bits |= 0x400L;
}
if ((bits & 0x800L) == 0) {
Optional contentTypeOptional = instance.getContentType();
if (contentTypeOptional.isPresent()) {
contentType(contentTypeOptional);
}
bits |= 0x800L;
}
}
}
/**
* Initializes the value for the {@link PostMultipartRequest#getName() name} attribute.
* @param name The value for name
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder name(String name) {
this.name = Objects.requireNonNull(name, "name");
initBits &= ~INIT_BIT_NAME;
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getDescription() description} to description.
* @param description The value for description
* @return {@code this} builder for chained invocation
*/
@CanIgnoreReturnValue
public final Builder description(String description) {
this.description = Objects.requireNonNull(description, "description");
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getDescription() description} to description.
* @param description The value for description
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder description(Optional description) {
this.description = description.orElse(null);
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getPath() path} to path.
* @param path The value for path
* @return {@code this} builder for chained invocation
*/
@CanIgnoreReturnValue
public final Builder path(String path) {
this.path = Objects.requireNonNull(path, "path");
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getPath() path} to path.
* @param path The value for path
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder path(Optional path) {
this.path = path.orElse(null);
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getServer() server} to server.
* @param server The value for server
* @return {@code this} builder for chained invocation
*/
@CanIgnoreReturnValue
public final Builder server(Server server) {
this.server = Objects.requireNonNull(server, "server");
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getServer() server} to server.
* @param server The value for server
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder server(Optional extends Server> server) {
this.server = server.orElse(null);
return this;
}
/**
* Initializes the value for the {@link PostMultipartRequest#getHttpMethod() httpMethod} attribute.
* @param httpMethod The value for httpMethod
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder httpMethod(Request.HttpMethod httpMethod) {
this.httpMethod = Objects.requireNonNull(httpMethod, "httpMethod");
initBits &= ~INIT_BIT_HTTP_METHOD;
return this;
}
/**
* Adds one element to {@link PostMultipartRequest#getParameters() parameters} list.
* @param element A parameters element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addParameters(Parameter element) {
this.parameters.add(element);
return this;
}
/**
* Adds elements to {@link PostMultipartRequest#getParameters() parameters} list.
* @param elements An array of parameters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addParameters(Parameter... elements) {
this.parameters.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link PostMultipartRequest#getParameters() parameters} list.
* @param elements An iterable of parameters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder parameters(Iterable extends Parameter> elements) {
this.parameters = ImmutableList.builder();
return addAllParameters(elements);
}
/**
* Adds elements to {@link PostMultipartRequest#getParameters() parameters} list.
* @param elements An iterable of parameters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllParameters(Iterable extends Parameter> elements) {
this.parameters.addAll(elements);
return this;
}
/**
* Adds one element to {@link PostMultipartRequest#getExtractors() extractors} list.
* @param element A extractors element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addExtractors(VariableExtractor element) {
this.extractors.add(element);
return this;
}
/**
* Adds elements to {@link PostMultipartRequest#getExtractors() extractors} list.
* @param elements An array of extractors elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addExtractors(VariableExtractor... elements) {
this.extractors.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link PostMultipartRequest#getExtractors() extractors} list.
* @param elements An iterable of extractors elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder extractors(Iterable extends VariableExtractor> elements) {
this.extractors = ImmutableList.builder();
return addAllExtractors(elements);
}
/**
* Adds elements to {@link PostMultipartRequest#getExtractors() extractors} list.
* @param elements An iterable of extractors elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllExtractors(Iterable extends VariableExtractor> elements) {
this.extractors.addAll(elements);
return this;
}
/**
* Adds one element to {@link PostMultipartRequest#getValidators() validators} list.
* @param element A validators element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addValidators(Validator element) {
this.validators.add(element);
return this;
}
/**
* Adds elements to {@link PostMultipartRequest#getValidators() validators} list.
* @param elements An array of validators elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addValidators(Validator... elements) {
this.validators.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link PostMultipartRequest#getValidators() validators} list.
* @param elements An iterable of validators elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder validators(Iterable extends Validator> elements) {
this.validators = ImmutableList.builder();
return addAllValidators(elements);
}
/**
* Adds elements to {@link PostMultipartRequest#getValidators() validators} list.
* @param elements An iterable of validators elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllValidators(Iterable extends Validator> elements) {
this.validators.addAll(elements);
return this;
}
/**
* Adds one element to {@link PostMultipartRequest#getHeaders() headers} list.
* @param element A headers element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addHeaders(Header element) {
this.headers.add(element);
return this;
}
/**
* Adds elements to {@link PostMultipartRequest#getHeaders() headers} list.
* @param elements An array of headers elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addHeaders(Header... elements) {
this.headers.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link PostMultipartRequest#getHeaders() headers} list.
* @param elements An iterable of headers elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder headers(Iterable extends Header> elements) {
this.headers = ImmutableList.builder();
return addAllHeaders(elements);
}
/**
* Adds elements to {@link PostMultipartRequest#getHeaders() headers} list.
* @param elements An iterable of headers elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllHeaders(Iterable extends Header> elements) {
this.headers.addAll(elements);
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getContentType() contentType} to contentType.
* @param contentType The value for contentType
* @return {@code this} builder for chained invocation
*/
@CanIgnoreReturnValue
public final Builder contentType(String contentType) {
this.contentType = Objects.requireNonNull(contentType, "contentType");
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getContentType() contentType} to contentType.
* @param contentType The value for contentType
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder contentType(Optional contentType) {
this.contentType = contentType.orElse(null);
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getRecordedFiles() recordedFiles} to recordedFiles.
* @param recordedFiles The value for recordedFiles
* @return {@code this} builder for chained invocation
*/
@CanIgnoreReturnValue
public final Builder recordedFiles(RecordedFiles recordedFiles) {
this.recordedFiles = Objects.requireNonNull(recordedFiles, "recordedFiles");
return this;
}
/**
* Initializes the optional value {@link PostMultipartRequest#getRecordedFiles() recordedFiles} to recordedFiles.
* @param recordedFiles The value for recordedFiles
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder recordedFiles(Optional extends RecordedFiles> recordedFiles) {
this.recordedFiles = recordedFiles.orElse(null);
return this;
}
/**
* Adds one element to {@link PostMultipartRequest#getPostParameters() postParameters} list.
* @param element A postParameters element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addPostParameters(Parameter element) {
this.postParameters.add(element);
return this;
}
/**
* Adds elements to {@link PostMultipartRequest#getPostParameters() postParameters} list.
* @param elements An array of postParameters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addPostParameters(Parameter... elements) {
this.postParameters.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link PostMultipartRequest#getPostParameters() postParameters} list.
* @param elements An iterable of postParameters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder postParameters(Iterable extends Parameter> elements) {
this.postParameters = ImmutableList.builder();
return addAllPostParameters(elements);
}
/**
* Adds elements to {@link PostMultipartRequest#getPostParameters() postParameters} list.
* @param elements An iterable of postParameters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllPostParameters(Iterable extends Parameter> elements) {
this.postParameters.addAll(elements);
return this;
}
/**
* Adds one element to {@link PostMultipartRequest#getParts() parts} list.
* @param element A parts element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addParts(Part element) {
this.parts.add(element);
return this;
}
/**
* Adds elements to {@link PostMultipartRequest#getParts() parts} list.
* @param elements An array of parts elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addParts(Part... elements) {
this.parts.add(elements);
return this;
}
/**
* Sets or replaces all elements for {@link PostMultipartRequest#getParts() parts} list.
* @param elements An iterable of parts elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder parts(Iterable extends Part> elements) {
this.parts = ImmutableList.builder();
return addAllParts(elements);
}
/**
* Adds elements to {@link PostMultipartRequest#getParts() parts} list.
* @param elements An iterable of parts elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllParts(Iterable extends Part> elements) {
this.parts.addAll(elements);
return this;
}
/**
* Builds a new {@link ImmutablePostMultipartRequest ImmutablePostMultipartRequest}.
* @return An immutable instance of PostMultipartRequest
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutablePostMultipartRequest build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutablePostMultipartRequest(
name,
description,
path,
server,
httpMethod,
parameters.build(),
extractors.build(),
validators.build(),
headers.build(),
contentType,
recordedFiles,
postParameters.build(),
parts.build());
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_NAME) != 0) attributes.add("name");
if ((initBits & INIT_BIT_HTTP_METHOD) != 0) attributes.add("httpMethod");
return "Cannot build PostMultipartRequest, some of required attributes are not set " + attributes;
}
}
}