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

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.common.collect.Lists;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.neotys.neoload.model.core.Element;
import java.util.List;
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;

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

* Use the builder to create immutable instances: * {@code ImmutablePostMultipartRequest.builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "PostMultipartRequest"}) @Deprecated @Immutable @CheckReturnValue public final class ImmutablePostMultipartRequest implements PostMultipartRequest { private final ImmutableList parts; private final ImmutableList postParameters; 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 String name; private final @Nullable String description; private ImmutablePostMultipartRequest( ImmutableList parts, ImmutableList postParameters, @Nullable String path, @Nullable Server server, Request.HttpMethod httpMethod, ImmutableList parameters, ImmutableList extractors, ImmutableList validators, ImmutableList
headers, @Nullable String contentType, @Nullable RecordedFiles recordedFiles, String name, @Nullable String description) { this.parts = parts; this.postParameters = postParameters; 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.name = name; this.description = description; } /** * @return The value of the {@code parts} attribute */ @Override public ImmutableList getParts() { return parts; } /** * @return The value of the {@code postParameters} attribute */ @Override public ImmutableList getPostParameters() { return postParameters; } /** * 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 name} attribute */ @Override public String getName() { return name; } /** * @return The value of the {@code description} attribute */ @Override public Optional getDescription() { return Optional.ofNullable(description); } /** * 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( newValue, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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 elements) { if (this.parts == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutablePostMultipartRequest( newValue, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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.parts, newValue, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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 elements) { if (this.postParameters == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutablePostMultipartRequest( this.parts, newValue, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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) { @Nullable String newValue = Objects.requireNonNull(value, "path"); if (Objects.equals(this.path, newValue)) return this; return new ImmutablePostMultipartRequest( this.parts, this.postParameters, newValue, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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.parts, this.postParameters, value, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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) { @Nullable Server newValue = Objects.requireNonNull(value, "server"); if (this.server == newValue) return this; return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, newValue, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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 */ public final ImmutablePostMultipartRequest withServer(Optional optional) { @Nullable Server value = optional.orElse(null); if (this.server == value) return this; return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, value, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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) { if (this.httpMethod == value) return this; Request.HttpMethod newValue = Objects.requireNonNull(value, "httpMethod"); return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, newValue, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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.parts, this.postParameters, this.path, this.server, this.httpMethod, newValue, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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 elements) { if (this.parameters == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, newValue, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, newValue, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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 elements) { if (this.extractors == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, newValue, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, newValue, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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 elements) { if (this.validators == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, newValue, this.headers, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, newValue, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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 elements) { if (this.headers == elements) return this; ImmutableList
newValue = ImmutableList.copyOf(elements); return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, newValue, this.contentType, this.recordedFiles, this.name, this.description); } /** * 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) { @Nullable String newValue = Objects.requireNonNull(value, "contentType"); if (Objects.equals(this.contentType, newValue)) return this; return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, newValue, this.recordedFiles, this.name, this.description); } /** * 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.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, value, this.recordedFiles, this.name, this.description); } /** * 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) { @Nullable RecordedFiles newValue = Objects.requireNonNull(value, "recordedFiles"); if (this.recordedFiles == newValue) return this; return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, newValue, this.name, this.description); } /** * 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 */ public final ImmutablePostMultipartRequest withRecordedFiles(Optional optional) { @Nullable RecordedFiles value = optional.orElse(null); if (this.recordedFiles == value) return this; return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, value, this.name, this.description); } /** * 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) { if (this.name.equals(value)) return this; String newValue = Objects.requireNonNull(value, "name"); return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, newValue, this.description); } /** * 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) { @Nullable String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return new ImmutablePostMultipartRequest( this.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, newValue); } /** * 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.parts, this.postParameters, this.path, this.server, this.httpMethod, this.parameters, this.extractors, this.validators, this.headers, this.contentType, this.recordedFiles, this.name, value); } /** * 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((ImmutablePostMultipartRequest) another); } private boolean equalTo(ImmutablePostMultipartRequest another) { return parts.equals(another.parts) && postParameters.equals(another.postParameters) && 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) && name.equals(another.name) && Objects.equals(description, another.description); } /** * Computes a hash code from attributes: {@code parts}, {@code postParameters}, {@code path}, {@code server}, {@code httpMethod}, {@code parameters}, {@code extractors}, {@code validators}, {@code headers}, {@code contentType}, {@code recordedFiles}, {@code name}, {@code description}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + parts.hashCode(); h += (h << 5) + postParameters.hashCode(); 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) + name.hashCode(); h += (h << 5) + Objects.hashCode(description); 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("parts", parts) .add("postParameters", postParameters) .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("name", name) .add("description", description) .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}. * @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. */ @NotThreadSafe public static final class Builder { private static final long INIT_BIT_HTTP_METHOD = 0x1L; private static final long INIT_BIT_NAME = 0x2L; private long initBits = 0x3L; private ImmutableList.Builder parts = ImmutableList.builder(); private ImmutableList.Builder postParameters = ImmutableList.builder(); 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 @Nullable String name; private @Nullable String description; 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.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) { if (object instanceof PostRequest) { PostRequest instance = (PostRequest) object; addAllPostParameters(instance.getPostParameters()); } if (object instanceof Request) { Request instance = (Request) object; Optional serverOptional = instance.getServer(); if (serverOptional.isPresent()) { server(serverOptional); } addAllHeaders(instance.getHeaders()); Optional pathOptional = instance.getPath(); if (pathOptional.isPresent()) { path(pathOptional); } addAllExtractors(instance.getExtractors()); addAllValidators(instance.getValidators()); Optional recordedFilesOptional = instance.getRecordedFiles(); if (recordedFilesOptional.isPresent()) { recordedFiles(recordedFilesOptional); } httpMethod(instance.getHttpMethod()); addAllParameters(instance.getParameters()); Optional contentTypeOptional = instance.getContentType(); if (contentTypeOptional.isPresent()) { contentType(contentTypeOptional); } } if (object instanceof Element) { Element instance = (Element) object; name(instance.getName()); Optional descriptionOptional = instance.getDescription(); if (descriptionOptional.isPresent()) { description(descriptionOptional); } } if (object instanceof PostMultipartRequest) { PostMultipartRequest instance = (PostMultipartRequest) object; addAllParts(instance.getParts()); } } /** * 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 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 elements) { this.parts.addAll(elements); 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 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 elements) { this.postParameters.addAll(elements); 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 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 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 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 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 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 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 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 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 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 recordedFiles) { this.recordedFiles = recordedFiles.orElse(null); return this; } /** * 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; } /** * 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( parts.build(), postParameters.build(), path, server, httpMethod, parameters.build(), extractors.build(), validators.build(), headers.build(), contentType, recordedFiles, name, description); } private String formatRequiredAttributesMessage() { List attributes = Lists.newArrayList(); if ((initBits & INIT_BIT_HTTP_METHOD) != 0) attributes.add("httpMethod"); if ((initBits & INIT_BIT_NAME) != 0) attributes.add("name"); return "Cannot build PostMultipartRequest, some of required attributes are not set " + attributes; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy