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

com.neotys.neoload.model.repository.ImmutableGetFollowLinkRequest 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 GetFollowLinkRequest}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableGetFollowLinkRequest.builder()}. */ @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @Generated({"Immutables.generator", "GetFollowLinkRequest"}) @Deprecated @Immutable @CheckReturnValue public final class ImmutableGetFollowLinkRequest implements GetFollowLinkRequest { private final String text; private final Request referer; 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 ImmutableGetFollowLinkRequest( String text, Request referer, @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.text = text; this.referer = referer; 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 text} attribute */ @Override public String getText() { return text; } /** * @return The value of the {@code referer} attribute */ @Override public Request getReferer() { return referer; } /** * 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 value for the {@link GetFollowLinkRequest#getText() text} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for text * @return A modified copy of the {@code this} object */ public final ImmutableGetFollowLinkRequest withText(String value) { if (this.text.equals(value)) return this; String newValue = Objects.requireNonNull(value, "text"); return new ImmutableGetFollowLinkRequest( newValue, this.referer, 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 value for the {@link GetFollowLinkRequest#getReferer() referer} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for referer * @return A modified copy of the {@code this} object */ public final ImmutableGetFollowLinkRequest withReferer(Request value) { if (this.referer == value) return this; Request newValue = Objects.requireNonNull(value, "referer"); return new ImmutableGetFollowLinkRequest( this.text, 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 GetFollowLinkRequest#getPath() path} attribute. * @param value The value for path * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withPath(String value) { @Nullable String newValue = Objects.requireNonNull(value, "path"); if (Objects.equals(this.path, newValue)) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withPath(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.path, value)) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#getServer() server} attribute. * @param value The value for server * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withServer(Server value) { @Nullable Server newValue = Objects.requireNonNull(value, "server"); if (this.server == newValue) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withServer(Optional optional) { @Nullable Server value = optional.orElse(null); if (this.server == value) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withHttpMethod(Request.HttpMethod value) { if (this.httpMethod == value) return this; Request.HttpMethod newValue = Objects.requireNonNull(value, "httpMethod"); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#getParameters() parameters}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withParameters(Parameter... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withParameters(Iterable elements) { if (this.parameters == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#getExtractors() extractors}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withExtractors(VariableExtractor... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withExtractors(Iterable elements) { if (this.extractors == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#getValidators() validators}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withValidators(Validator... elements) { ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withValidators(Iterable elements) { if (this.validators == elements) return this; ImmutableList newValue = ImmutableList.copyOf(elements); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#getHeaders() headers}. * @param elements The elements to set * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withHeaders(Header... elements) { ImmutableList
newValue = ImmutableList.copyOf(elements); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withHeaders(Iterable elements) { if (this.headers == elements) return this; ImmutableList
newValue = ImmutableList.copyOf(elements); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#getContentType() contentType} attribute. * @param value The value for contentType * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withContentType(String value) { @Nullable String newValue = Objects.requireNonNull(value, "contentType"); if (Objects.equals(this.contentType, newValue)) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withContentType(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.contentType, value)) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#getRecordedFiles() recordedFiles} attribute. * @param value The value for recordedFiles * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withRecordedFiles(RecordedFiles value) { @Nullable RecordedFiles newValue = Objects.requireNonNull(value, "recordedFiles"); if (this.recordedFiles == newValue) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withRecordedFiles(Optional optional) { @Nullable RecordedFiles value = optional.orElse(null); if (this.recordedFiles == value) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withName(String value) { if (this.name.equals(value)) return this; String newValue = Objects.requireNonNull(value, "name"); return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#getDescription() description} attribute. * @param value The value for description * @return A modified copy of {@code this} object */ public final ImmutableGetFollowLinkRequest withDescription(String value) { @Nullable String newValue = Objects.requireNonNull(value, "description"); if (Objects.equals(this.description, newValue)) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest withDescription(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.description, value)) return this; return new ImmutableGetFollowLinkRequest( this.text, this.referer, 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 ImmutableGetFollowLinkRequest} 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 ImmutableGetFollowLinkRequest && equalTo((ImmutableGetFollowLinkRequest) another); } private boolean equalTo(ImmutableGetFollowLinkRequest another) { return text.equals(another.text) && referer.equals(another.referer) && 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 text}, {@code referer}, {@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) + text.hashCode(); h += (h << 5) + referer.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 GetFollowLinkRequest} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("GetFollowLinkRequest") .omitNullValues() .add("text", text) .add("referer", referer) .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 GetFollowLinkRequest} 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 GetFollowLinkRequest instance */ public static ImmutableGetFollowLinkRequest copyOf(GetFollowLinkRequest instance) { if (instance instanceof ImmutableGetFollowLinkRequest) { return (ImmutableGetFollowLinkRequest) instance; } return ImmutableGetFollowLinkRequest.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableGetFollowLinkRequest ImmutableGetFollowLinkRequest}. * @return A new ImmutableGetFollowLinkRequest builder */ public static ImmutableGetFollowLinkRequest.Builder builder() { return new ImmutableGetFollowLinkRequest.Builder(); } /** * Builds instances of type {@link ImmutableGetFollowLinkRequest ImmutableGetFollowLinkRequest}. * 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_TEXT = 0x1L; private static final long INIT_BIT_REFERER = 0x2L; private static final long INIT_BIT_HTTP_METHOD = 0x4L; private static final long INIT_BIT_NAME = 0x8L; private long initBits = 0xfL; private @Nullable String text; private @Nullable Request referer; 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.GetFollowLinkRequest} 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(GetFollowLinkRequest 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; } private void from(Object object) { if (object instanceof GetFollowLinkRequest) { GetFollowLinkRequest instance = (GetFollowLinkRequest) object; referer(instance.getReferer()); text(instance.getText()); } 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); } } } /** * Initializes the value for the {@link GetFollowLinkRequest#getText() text} attribute. * @param text The value for text * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder text(String text) { this.text = Objects.requireNonNull(text, "text"); initBits &= ~INIT_BIT_TEXT; return this; } /** * Initializes the value for the {@link GetFollowLinkRequest#getReferer() referer} attribute. * @param referer The value for referer * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder referer(Request referer) { this.referer = Objects.requireNonNull(referer, "referer"); initBits &= ~INIT_BIT_REFERER; return this; } /** * Initializes the optional value {@link GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 GetFollowLinkRequest#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 ImmutableGetFollowLinkRequest ImmutableGetFollowLinkRequest}. * @return An immutable instance of GetFollowLinkRequest * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableGetFollowLinkRequest build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableGetFollowLinkRequest( text, referer, 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_TEXT) != 0) attributes.add("text"); if ((initBits & INIT_BIT_REFERER) != 0) attributes.add("referer"); if ((initBits & INIT_BIT_HTTP_METHOD) != 0) attributes.add("httpMethod"); if ((initBits & INIT_BIT_NAME) != 0) attributes.add("name"); return "Cannot build GetFollowLinkRequest, some of required attributes are not set " + attributes; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy