com.arakelian.elastic.model.ImmutableAnalysis Maven / Gradle / Ivy
package com.arakelian.elastic.model;
import com.arakelian.core.feature.Nullable;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
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 IndexSettings.Analysis}.
*
* Use the builder to create immutable instances:
* {@code ImmutableAnalysis.builder()}.
*/
@Generated(from = "IndexSettings.Analysis", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableAnalysis implements IndexSettings.Analysis {
private final @Nullable IndexSettings.AnalyzerSettings analyzer;
private final @Nullable IndexSettings.CharFilterSettings charFilter;
private final @Nullable IndexSettings.FilterSettings filter;
private final @Nullable IndexSettings.NormalizerSettings normalizer;
private final @Nullable IndexSettings.TokenizerSettings tokenizer;
private ImmutableAnalysis(ImmutableAnalysis.Builder builder) {
this.analyzer = builder.analyzer;
this.charFilter = builder.charFilter;
this.filter = builder.filter;
this.normalizer = builder.normalizer;
this.tokenizer = builder.tokenizer;
}
/**
* @return The value of the {@code analyzer} attribute
*/
@JsonProperty("analyzer")
@Override
public @Nullable IndexSettings.AnalyzerSettings getAnalyzer() {
return analyzer;
}
/**
* @return The value of the {@code charFilter} attribute
*/
@JsonProperty("char_filter")
@Override
public @Nullable IndexSettings.CharFilterSettings getCharFilter() {
return charFilter;
}
/**
* @return The value of the {@code filter} attribute
*/
@JsonProperty("filter")
@Override
public @Nullable IndexSettings.FilterSettings getFilter() {
return filter;
}
/**
* @return The value of the {@code normalizer} attribute
*/
@JsonProperty("normalizer")
@Override
public @Nullable IndexSettings.NormalizerSettings getNormalizer() {
return normalizer;
}
/**
* @return The value of the {@code tokenizer} attribute
*/
@JsonProperty("tokenizer")
@Override
public @Nullable IndexSettings.TokenizerSettings getTokenizer() {
return tokenizer;
}
/**
* This instance is equal to all instances of {@code ImmutableAnalysis} 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 ImmutableAnalysis
&& equalTo((ImmutableAnalysis) another);
}
private boolean equalTo(ImmutableAnalysis another) {
return Objects.equals(analyzer, another.analyzer)
&& Objects.equals(charFilter, another.charFilter)
&& Objects.equals(filter, another.filter)
&& Objects.equals(normalizer, another.normalizer)
&& Objects.equals(tokenizer, another.tokenizer);
}
/**
* Computes a hash code from attributes: {@code analyzer}, {@code charFilter}, {@code filter}, {@code normalizer}, {@code tokenizer}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + Objects.hashCode(analyzer);
h += (h << 5) + Objects.hashCode(charFilter);
h += (h << 5) + Objects.hashCode(filter);
h += (h << 5) + Objects.hashCode(normalizer);
h += (h << 5) + Objects.hashCode(tokenizer);
return h;
}
/**
* Prints the immutable value {@code Analysis} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("Analysis")
.omitNullValues()
.add("analyzer", analyzer)
.add("charFilter", charFilter)
.add("filter", filter)
.add("normalizer", normalizer)
.add("tokenizer", tokenizer)
.toString();
}
/**
* Creates a builder for {@link ImmutableAnalysis ImmutableAnalysis}.
* @return A new ImmutableAnalysis builder
*/
public static ImmutableAnalysis.Builder builder() {
return new ImmutableAnalysis.Builder();
}
/**
* Builds instances of type {@link ImmutableAnalysis ImmutableAnalysis}.
* 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 = "IndexSettings.Analysis", generator = "Immutables")
@NotThreadSafe
@JsonPropertyOrder({"analyzer", "normalizer", "filter", "char_filter", "tokenizer"})
public static final class Builder {
private @javax.annotation.Nullable IndexSettings.AnalyzerSettings analyzer;
private @javax.annotation.Nullable IndexSettings.CharFilterSettings charFilter;
private @javax.annotation.Nullable IndexSettings.FilterSettings filter;
private @javax.annotation.Nullable IndexSettings.NormalizerSettings normalizer;
private @javax.annotation.Nullable IndexSettings.TokenizerSettings tokenizer;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code Analysis} 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(IndexSettings.Analysis instance) {
Objects.requireNonNull(instance, "instance");
IndexSettings.AnalyzerSettings analyzerValue = instance.getAnalyzer();
if (analyzerValue != null) {
analyzer(analyzerValue);
}
IndexSettings.CharFilterSettings charFilterValue = instance.getCharFilter();
if (charFilterValue != null) {
charFilter(charFilterValue);
}
IndexSettings.FilterSettings filterValue = instance.getFilter();
if (filterValue != null) {
filter(filterValue);
}
IndexSettings.NormalizerSettings normalizerValue = instance.getNormalizer();
if (normalizerValue != null) {
normalizer(normalizerValue);
}
IndexSettings.TokenizerSettings tokenizerValue = instance.getTokenizer();
if (tokenizerValue != null) {
tokenizer(tokenizerValue);
}
return this;
}
/**
* Initializes the value for the {@link IndexSettings.Analysis#getAnalyzer() analyzer} attribute.
* @param analyzer The value for analyzer (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("analyzer")
public final Builder analyzer(@Nullable IndexSettings.AnalyzerSettings analyzer) {
this.analyzer = analyzer;
return this;
}
/**
* Initializes the value for the {@link IndexSettings.Analysis#getCharFilter() charFilter} attribute.
* @param charFilter The value for charFilter (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("char_filter")
public final Builder charFilter(@Nullable IndexSettings.CharFilterSettings charFilter) {
this.charFilter = charFilter;
return this;
}
/**
* Initializes the value for the {@link IndexSettings.Analysis#getFilter() filter} attribute.
* @param filter The value for filter (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("filter")
public final Builder filter(@Nullable IndexSettings.FilterSettings filter) {
this.filter = filter;
return this;
}
/**
* Initializes the value for the {@link IndexSettings.Analysis#getNormalizer() normalizer} attribute.
* @param normalizer The value for normalizer (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("normalizer")
public final Builder normalizer(@Nullable IndexSettings.NormalizerSettings normalizer) {
this.normalizer = normalizer;
return this;
}
/**
* Initializes the value for the {@link IndexSettings.Analysis#getTokenizer() tokenizer} attribute.
* @param tokenizer The value for tokenizer (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("tokenizer")
public final Builder tokenizer(@Nullable IndexSettings.TokenizerSettings tokenizer) {
this.tokenizer = tokenizer;
return this;
}
/**
* Builds a new {@link ImmutableAnalysis ImmutableAnalysis}.
* @return An immutable instance of Analysis
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableAnalysis build() {
return new ImmutableAnalysis(this);
}
}
}