com.neotys.neoload.model.repository.ImmutableGetPlainRequest 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 GetPlainRequest}.
*
* Use the builder to create immutable instances:
* {@code ImmutableGetPlainRequest.builder()}.
*/
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@Generated({"Immutables.generator", "GetPlainRequest"})
@Deprecated
@Immutable
@CheckReturnValue
public final class ImmutableGetPlainRequest implements GetPlainRequest {
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 ImmutableGetPlainRequest(
@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.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;
}
/**
* 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 by setting a present value for the optional {@link GetPlainRequest#getPath() path} attribute.
* @param value The value for path
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withPath(String value) {
@Nullable String newValue = Objects.requireNonNull(value, "path");
if (Objects.equals(this.path, newValue)) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withPath(Optional optional) {
@Nullable String value = optional.orElse(null);
if (Objects.equals(this.path, value)) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#getServer() server} attribute.
* @param value The value for server
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withServer(Server value) {
@Nullable Server newValue = Objects.requireNonNull(value, "server");
if (this.server == newValue) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withServer(Optional extends Server> optional) {
@Nullable Server value = optional.orElse(null);
if (this.server == value) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withHttpMethod(Request.HttpMethod value) {
if (this.httpMethod == value) return this;
Request.HttpMethod newValue = Objects.requireNonNull(value, "httpMethod");
return new ImmutableGetPlainRequest(
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 GetPlainRequest#getParameters() parameters}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withParameters(Parameter... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withParameters(Iterable extends Parameter> elements) {
if (this.parameters == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableGetPlainRequest(
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 GetPlainRequest#getExtractors() extractors}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withExtractors(VariableExtractor... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withExtractors(Iterable extends VariableExtractor> elements) {
if (this.extractors == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableGetPlainRequest(
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 GetPlainRequest#getValidators() validators}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withValidators(Validator... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withValidators(Iterable extends Validator> elements) {
if (this.validators == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableGetPlainRequest(
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 GetPlainRequest#getHeaders() headers}.
* @param elements The elements to set
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withHeaders(Header... elements) {
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withHeaders(Iterable extends Header> elements) {
if (this.headers == elements) return this;
ImmutableList newValue = ImmutableList.copyOf(elements);
return new ImmutableGetPlainRequest(
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 GetPlainRequest#getContentType() contentType} attribute.
* @param value The value for contentType
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withContentType(String value) {
@Nullable String newValue = Objects.requireNonNull(value, "contentType");
if (Objects.equals(this.contentType, newValue)) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withContentType(Optional optional) {
@Nullable String value = optional.orElse(null);
if (Objects.equals(this.contentType, value)) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#getRecordedFiles() recordedFiles} attribute.
* @param value The value for recordedFiles
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withRecordedFiles(RecordedFiles value) {
@Nullable RecordedFiles newValue = Objects.requireNonNull(value, "recordedFiles");
if (this.recordedFiles == newValue) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withRecordedFiles(Optional extends RecordedFiles> optional) {
@Nullable RecordedFiles value = optional.orElse(null);
if (this.recordedFiles == value) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withName(String value) {
if (this.name.equals(value)) return this;
String newValue = Objects.requireNonNull(value, "name");
return new ImmutableGetPlainRequest(
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 GetPlainRequest#getDescription() description} attribute.
* @param value The value for description
* @return A modified copy of {@code this} object
*/
public final ImmutableGetPlainRequest withDescription(String value) {
@Nullable String newValue = Objects.requireNonNull(value, "description");
if (Objects.equals(this.description, newValue)) return this;
return new ImmutableGetPlainRequest(
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 GetPlainRequest#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 ImmutableGetPlainRequest withDescription(Optional optional) {
@Nullable String value = optional.orElse(null);
if (Objects.equals(this.description, value)) return this;
return new ImmutableGetPlainRequest(
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 ImmutableGetPlainRequest} 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 ImmutableGetPlainRequest
&& equalTo((ImmutableGetPlainRequest) another);
}
private boolean equalTo(ImmutableGetPlainRequest another) {
return 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 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) + 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 GetPlainRequest} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("GetPlainRequest")
.omitNullValues()
.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 GetPlainRequest} 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 GetPlainRequest instance
*/
public static ImmutableGetPlainRequest copyOf(GetPlainRequest instance) {
if (instance instanceof ImmutableGetPlainRequest) {
return (ImmutableGetPlainRequest) instance;
}
return ImmutableGetPlainRequest.builder()
.from(instance)
.build();
}
/**
* Creates a builder for {@link ImmutableGetPlainRequest ImmutableGetPlainRequest}.
* @return A new ImmutableGetPlainRequest builder
*/
public static ImmutableGetPlainRequest.Builder builder() {
return new ImmutableGetPlainRequest.Builder();
}
/**
* Builds instances of type {@link ImmutableGetPlainRequest ImmutableGetPlainRequest}.
* 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 @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.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.GetPlainRequest} 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(GetPlainRequest instance) {
Objects.requireNonNull(instance, "instance");
from((Object) instance);
return this;
}
private void from(Object object) {
if (object instanceof Request) {
Request instance = (Request) object;
Optional pathOptional = instance.getPath();
if (pathOptional.isPresent()) {
path(pathOptional);
}
Optional serverOptional = instance.getServer();
if (serverOptional.isPresent()) {
server(serverOptional);
}
addAllHeaders(instance.getHeaders());
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);
}
}
}
/**
* Initializes the optional value {@link GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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;
}
/**
* Initializes the value for the {@link GetPlainRequest#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 GetPlainRequest#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 GetPlainRequest#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 ImmutableGetPlainRequest ImmutableGetPlainRequest}.
* @return An immutable instance of GetPlainRequest
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableGetPlainRequest build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableGetPlainRequest(
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 GetPlainRequest, some of required attributes are not set " + attributes;
}
}
}