com.arakelian.elastic.model.ImmutableRefresh 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.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
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 Refresh}.
*
* Use the builder to create immutable instances:
* {@code ImmutableRefresh.builder()}.
*/
@Generated(from = "Refresh", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableRefresh implements Refresh {
private final @Nullable Shards shards;
private ImmutableRefresh(ImmutableRefresh.Builder builder) {
this.shards = builder.shards;
}
/**
* @return The value of the {@code shards} attribute
*/
@JsonProperty("_shards")
@Override
public @Nullable Shards getShards() {
return shards;
}
/**
* This instance is equal to all instances of {@code ImmutableRefresh} 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 ImmutableRefresh
&& equalTo((ImmutableRefresh) another);
}
private boolean equalTo(ImmutableRefresh another) {
return Objects.equals(shards, another.shards);
}
/**
* Computes a hash code from attributes: {@code shards}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + Objects.hashCode(shards);
return h;
}
/**
* Prints the immutable value {@code Refresh} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("Refresh")
.omitNullValues()
.add("shards", shards)
.toString();
}
/**
* Creates a builder for {@link ImmutableRefresh ImmutableRefresh}.
*
* ImmutableRefresh.builder()
* .shards(com.arakelian.elastic.model.Shards | null) // nullable {@link Refresh#getShards() shards}
* .build();
*
* @return A new ImmutableRefresh builder
*/
public static ImmutableRefresh.Builder builder() {
return new ImmutableRefresh.Builder();
}
/**
* Builds instances of type {@link ImmutableRefresh ImmutableRefresh}.
* 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 = "Refresh", generator = "Immutables")
@NotThreadSafe
public static final class Builder {
private @javax.annotation.Nullable Shards shards;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code Refresh} instance.
* Regular attribute values will be replaced with those from the given instance.
* Absent optional values will not replace present values.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder from(Refresh instance) {
Objects.requireNonNull(instance, "instance");
Shards shardsValue = instance.getShards();
if (shardsValue != null) {
shards(shardsValue);
}
return this;
}
/**
* Initializes the value for the {@link Refresh#getShards() shards} attribute.
* @param shards The value for shards (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("_shards")
public final Builder shards(@Nullable Shards shards) {
this.shards = shards;
return this;
}
/**
* Builds a new {@link ImmutableRefresh ImmutableRefresh}.
* @return An immutable instance of Refresh
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableRefresh build() {
return new ImmutableRefresh(this);
}
}
}