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

com.arakelian.elastic.model.ImmutableMget Maven / Gradle / Ivy

package com.arakelian.elastic.model;

import com.arakelian.core.feature.Nullable;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import java.util.List;
import java.util.Objects;
import javax.annotation.CheckReturnValue;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.immutables.value.Generated;

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

* Use the builder to create immutable instances: * {@code ImmutableMget.builder()}. */ @Generated(from = "Mget", generator = "Immutables") @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @javax.annotation.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableMget implements Mget { private final @Nullable ImmutableList docs; private ImmutableMget(ImmutableMget.Builder builder) { this.docs = builder.docs == null ? null : builder.docs.build(); } /** * @return The value of the {@code docs} attribute */ @JsonProperty("docs") @Override public @Nullable ImmutableList getDocs() { return docs; } /** * This instance is equal to all instances of {@code ImmutableMget} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@javax.annotation.Nullable Object another) { if (this == another) return true; return another instanceof ImmutableMget && equalTo((ImmutableMget) another); } private boolean equalTo(ImmutableMget another) { return Objects.equals(docs, another.docs); } /** * Computes a hash code from attributes: {@code docs}. * @return hashCode value */ @Override public int hashCode() { @Var int h = 5381; h += (h << 5) + Objects.hashCode(docs); return h; } /** * Prints the immutable value {@code Mget} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("Mget") .omitNullValues() .add("docs", docs) .toString(); } /** * Creates a builder for {@link ImmutableMget ImmutableMget}. * @return A new ImmutableMget builder */ public static ImmutableMget.Builder builder() { return new ImmutableMget.Builder(); } /** * Builds instances of type {@link ImmutableMget ImmutableMget}. * Initialize attributes and then invoke the {@link #build()} method to create an * immutable instance. *

{@code Builder} is not thread-safe and generally should not be stored in a field or collection, * but instead used immediately to create instances. */ @Generated(from = "Mget", generator = "Immutables") @NotThreadSafe public static final class Builder { private ImmutableList.Builder docs = null; private Builder() { } /** * Fill a builder with attribute values from the provided {@code Mget} instance. * Regular attribute values will be replaced with those from the given instance. * Absent optional values will not replace present values. * Collection elements and entries will be added, not replaced. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder from(Mget instance) { Objects.requireNonNull(instance, "instance"); List docsValue = instance.getDocs(); if (docsValue != null) { addAllDocs(docsValue); } return this; } /** * Adds one element to {@link Mget#getDocs() docs} list. * @param element A docs element * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addDoc(Mget.MgetDocument element) { if (this.docs == null) { this.docs = ImmutableList.builder(); } this.docs.add(element); return this; } /** * Adds elements to {@link Mget#getDocs() docs} list. * @param elements An array of docs elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addDocs(Mget.MgetDocument... elements) { if (this.docs == null) { this.docs = ImmutableList.builder(); } this.docs.add(elements); return this; } /** * Sets or replaces all elements for {@link Mget#getDocs() docs} list. * @param elements An iterable of docs elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue @JsonProperty("docs") public final Builder docs(@Nullable Iterable elements) { if (elements == null) { this.docs = null; return this; } this.docs = ImmutableList.builder(); return addAllDocs(elements); } /** * Adds elements to {@link Mget#getDocs() docs} list. * @param elements An iterable of docs elements * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder addAllDocs(Iterable elements) { Objects.requireNonNull(elements, "docs element"); if (this.docs == null) { this.docs = ImmutableList.builder(); } this.docs.addAll(elements); return this; } /** * Builds a new {@link ImmutableMget ImmutableMget}. * @return An immutable instance of Mget * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableMget build() { return new ImmutableMget(this); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy