com.arakelian.elastic.model.ImmutableField Maven / Gradle / Ivy
package com.arakelian.elastic.model;
import com.arakelian.core.feature.Nullable;
import com.arakelian.elastic.Views;
import com.arakelian.elastic.doc.filters.TokenFilter;
import com.arakelian.elastic.model.enums.Orientation;
import com.arakelian.elastic.model.enums.SpatialStrategy;
import com.arakelian.elastic.model.enums.Tree;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
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 Field}.
*
* Use the builder to create immutable instances:
* {@code ImmutableField.builder()}.
*/
@Generated(from = "Field", generator = "Immutables")
@SuppressWarnings({"all"})
@ParametersAreNonnullByDefault
@javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor")
@Immutable
@CheckReturnValue
public final class ImmutableField extends Field {
private final ImmutableList additionalTargets;
private final ImmutableSet aliases;
private final @Nullable String analyzer;
private final @Nullable Double boost;
private final @Nullable Boolean coerce;
private final ImmutableList copyTo;
private final @Nullable String description;
private final ImmutableSet excludePlugins;
private final ImmutableMap fields;
private final @Nullable String format;
private final @Nullable Integer ignoreAbove;
private final ImmutableSet includePlugins;
private final @Nullable Field.IndexOptions indexOptions;
private final String name;
private final @Nullable String normalizer;
private final @Nullable String nullValue;
private final @Nullable Orientation orientation;
private final @Nullable Integer positionIncrementGap;
private final @Nullable String precision;
private final @Nullable Integer scalingFactor;
private final @Nullable String searchAnalyzer;
private final @Nullable SpatialStrategy strategy;
private final @Nullable Field.TermVector termVector;
private final ImmutableList tokenFilters;
private final @Nullable Tree tree;
private final @Nullable String treeLevels;
private final @Nullable Field.Type type;
private final @Nullable Boolean docValues;
private final @Nullable Boolean eagerGlobalOrdinals;
private final @Nullable Boolean enabled;
private final @Nullable Boolean fielddata;
private final @Nullable Boolean ignoreGlobalTokenFilters;
private final @Nullable Boolean ignoreMalformed;
private final @Nullable Boolean ignoreZValue;
private final @Nullable Boolean includeInAll;
private final @Nullable Boolean index;
private final boolean metaField;
private final @Nullable Boolean norms;
private final @Nullable Boolean pointsOnly;
private final @Nullable Boolean sortTokens;
private final @Nullable Boolean store;
private ImmutableField(ImmutableField.Builder builder) {
this.boost = builder.boost;
this.coerce = builder.coerce;
this.description = builder.description;
this.format = builder.format;
this.indexOptions = builder.indexOptions;
this.name = builder.name;
this.normalizer = builder.normalizer;
this.nullValue = builder.nullValue;
this.orientation = builder.orientation;
this.positionIncrementGap = builder.positionIncrementGap;
this.precision = builder.precision;
this.searchAnalyzer = builder.searchAnalyzer;
this.strategy = builder.strategy;
this.termVector = builder.termVector;
this.tree = builder.tree;
this.treeLevels = builder.treeLevels;
this.eagerGlobalOrdinals = builder.eagerGlobalOrdinals;
this.enabled = builder.enabled;
this.fielddata = builder.fielddata;
this.ignoreGlobalTokenFilters = builder.ignoreGlobalTokenFilters;
this.ignoreMalformed = builder.ignoreMalformed;
this.ignoreZValue = builder.ignoreZValue;
this.norms = builder.norms;
this.pointsOnly = builder.pointsOnly;
this.sortTokens = builder.sortTokens;
if (builder.additionalTargetsIsSet()) {
initShim.additionalTargets(builder.additionalTargets.build());
}
if (builder.aliasesIsSet()) {
initShim.aliases(builder.aliases.build());
}
if (builder.analyzerIsSet()) {
initShim.analyzer(builder.analyzer);
}
if (builder.copyToIsSet()) {
initShim.copyTo(builder.copyTo.build());
}
if (builder.excludePluginsIsSet()) {
initShim.excludePlugins(builder.excludePlugins.build());
}
if (builder.fieldsIsSet()) {
initShim.fields(builder.fields.build());
}
if (builder.ignoreAboveIsSet()) {
initShim.ignoreAbove(builder.ignoreAbove);
}
if (builder.includePluginsIsSet()) {
initShim.includePlugins(builder.includePlugins.build());
}
if (builder.scalingFactorIsSet()) {
initShim.scalingFactor(builder.scalingFactor);
}
if (builder.tokenFiltersIsSet()) {
initShim.tokenFilters(builder.tokenFilters.build());
}
if (builder.typeIsSet()) {
initShim.type(builder.type);
}
if (builder.docValuesIsSet()) {
initShim.docValues(builder.docValues);
}
if (builder.includeInAllIsSet()) {
initShim.includeInAll(builder.includeInAll);
}
if (builder.indexIsSet()) {
initShim.index(builder.index);
}
if (builder.metaFieldIsSet()) {
initShim.metaField(builder.metaField);
}
if (builder.storeIsSet()) {
initShim.store(builder.store);
}
this.additionalTargets = initShim.getAdditionalTargets();
this.aliases = initShim.getAliases();
this.analyzer = initShim.getAnalyzer();
this.copyTo = initShim.getCopyTo();
this.excludePlugins = initShim.getExcludePlugins();
this.fields = initShim.getFields();
this.ignoreAbove = initShim.getIgnoreAbove();
this.includePlugins = initShim.getIncludePlugins();
this.scalingFactor = initShim.getScalingFactor();
this.tokenFilters = initShim.getTokenFilters();
this.type = initShim.getType();
this.docValues = initShim.isDocValues();
this.includeInAll = initShim.isIncludeInAll();
this.index = initShim.isIndex();
this.metaField = initShim.isMetaField();
this.store = initShim.isStore();
this.initShim = null;
}
private static final byte STAGE_INITIALIZING = -1;
private static final byte STAGE_UNINITIALIZED = 0;
private static final byte STAGE_INITIALIZED = 1;
@SuppressWarnings("Immutable")
private transient volatile InitShim initShim = new InitShim();
@Generated(from = "Field", generator = "Immutables")
private final class InitShim {
private byte additionalTargetsBuildStage = STAGE_UNINITIALIZED;
private ImmutableList additionalTargets;
ImmutableList getAdditionalTargets() {
if (additionalTargetsBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (additionalTargetsBuildStage == STAGE_UNINITIALIZED) {
additionalTargetsBuildStage = STAGE_INITIALIZING;
this.additionalTargets = ImmutableList.copyOf(ImmutableField.super.getAdditionalTargets());
additionalTargetsBuildStage = STAGE_INITIALIZED;
}
return this.additionalTargets;
}
void additionalTargets(ImmutableList additionalTargets) {
this.additionalTargets = additionalTargets;
additionalTargetsBuildStage = STAGE_INITIALIZED;
}
private byte aliasesBuildStage = STAGE_UNINITIALIZED;
private ImmutableSet aliases;
ImmutableSet getAliases() {
if (aliasesBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (aliasesBuildStage == STAGE_UNINITIALIZED) {
aliasesBuildStage = STAGE_INITIALIZING;
this.aliases = ImmutableSet.copyOf(ImmutableField.super.getAliases());
aliasesBuildStage = STAGE_INITIALIZED;
}
return this.aliases;
}
void aliases(ImmutableSet aliases) {
this.aliases = aliases;
aliasesBuildStage = STAGE_INITIALIZED;
}
private byte analyzerBuildStage = STAGE_UNINITIALIZED;
private String analyzer;
String getAnalyzer() {
if (analyzerBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (analyzerBuildStage == STAGE_UNINITIALIZED) {
analyzerBuildStage = STAGE_INITIALIZING;
this.analyzer = ImmutableField.super.getAnalyzer();
analyzerBuildStage = STAGE_INITIALIZED;
}
return this.analyzer;
}
void analyzer(String analyzer) {
this.analyzer = analyzer;
analyzerBuildStage = STAGE_INITIALIZED;
}
private byte copyToBuildStage = STAGE_UNINITIALIZED;
private ImmutableList copyTo;
ImmutableList getCopyTo() {
if (copyToBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (copyToBuildStage == STAGE_UNINITIALIZED) {
copyToBuildStage = STAGE_INITIALIZING;
this.copyTo = ImmutableList.copyOf(ImmutableField.super.getCopyTo());
copyToBuildStage = STAGE_INITIALIZED;
}
return this.copyTo;
}
void copyTo(ImmutableList copyTo) {
this.copyTo = copyTo;
copyToBuildStage = STAGE_INITIALIZED;
}
private byte excludePluginsBuildStage = STAGE_UNINITIALIZED;
private ImmutableSet excludePlugins;
ImmutableSet getExcludePlugins() {
if (excludePluginsBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (excludePluginsBuildStage == STAGE_UNINITIALIZED) {
excludePluginsBuildStage = STAGE_INITIALIZING;
this.excludePlugins = ImmutableSet.copyOf(ImmutableField.super.getExcludePlugins());
excludePluginsBuildStage = STAGE_INITIALIZED;
}
return this.excludePlugins;
}
void excludePlugins(ImmutableSet excludePlugins) {
this.excludePlugins = excludePlugins;
excludePluginsBuildStage = STAGE_INITIALIZED;
}
private byte fieldsBuildStage = STAGE_UNINITIALIZED;
private ImmutableMap fields;
ImmutableMap getFields() {
if (fieldsBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (fieldsBuildStage == STAGE_UNINITIALIZED) {
fieldsBuildStage = STAGE_INITIALIZING;
this.fields = ImmutableMap.copyOf(ImmutableField.super.getFields());
fieldsBuildStage = STAGE_INITIALIZED;
}
return this.fields;
}
void fields(ImmutableMap fields) {
this.fields = fields;
fieldsBuildStage = STAGE_INITIALIZED;
}
private byte ignoreAboveBuildStage = STAGE_UNINITIALIZED;
private Integer ignoreAbove;
Integer getIgnoreAbove() {
if (ignoreAboveBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (ignoreAboveBuildStage == STAGE_UNINITIALIZED) {
ignoreAboveBuildStage = STAGE_INITIALIZING;
this.ignoreAbove = ImmutableField.super.getIgnoreAbove();
ignoreAboveBuildStage = STAGE_INITIALIZED;
}
return this.ignoreAbove;
}
void ignoreAbove(Integer ignoreAbove) {
this.ignoreAbove = ignoreAbove;
ignoreAboveBuildStage = STAGE_INITIALIZED;
}
private byte includePluginsBuildStage = STAGE_UNINITIALIZED;
private ImmutableSet includePlugins;
ImmutableSet getIncludePlugins() {
if (includePluginsBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (includePluginsBuildStage == STAGE_UNINITIALIZED) {
includePluginsBuildStage = STAGE_INITIALIZING;
this.includePlugins = ImmutableSet.copyOf(ImmutableField.super.getIncludePlugins());
includePluginsBuildStage = STAGE_INITIALIZED;
}
return this.includePlugins;
}
void includePlugins(ImmutableSet includePlugins) {
this.includePlugins = includePlugins;
includePluginsBuildStage = STAGE_INITIALIZED;
}
private byte scalingFactorBuildStage = STAGE_UNINITIALIZED;
private Integer scalingFactor;
Integer getScalingFactor() {
if (scalingFactorBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (scalingFactorBuildStage == STAGE_UNINITIALIZED) {
scalingFactorBuildStage = STAGE_INITIALIZING;
this.scalingFactor = ImmutableField.super.getScalingFactor();
scalingFactorBuildStage = STAGE_INITIALIZED;
}
return this.scalingFactor;
}
void scalingFactor(Integer scalingFactor) {
this.scalingFactor = scalingFactor;
scalingFactorBuildStage = STAGE_INITIALIZED;
}
private byte tokenFiltersBuildStage = STAGE_UNINITIALIZED;
private ImmutableList tokenFilters;
ImmutableList getTokenFilters() {
if (tokenFiltersBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (tokenFiltersBuildStage == STAGE_UNINITIALIZED) {
tokenFiltersBuildStage = STAGE_INITIALIZING;
this.tokenFilters = ImmutableList.copyOf(ImmutableField.super.getTokenFilters());
tokenFiltersBuildStage = STAGE_INITIALIZED;
}
return this.tokenFilters;
}
void tokenFilters(ImmutableList tokenFilters) {
this.tokenFilters = tokenFilters;
tokenFiltersBuildStage = STAGE_INITIALIZED;
}
private byte typeBuildStage = STAGE_UNINITIALIZED;
private Field.Type type;
Field.Type getType() {
if (typeBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (typeBuildStage == STAGE_UNINITIALIZED) {
typeBuildStage = STAGE_INITIALIZING;
this.type = ImmutableField.super.getType();
typeBuildStage = STAGE_INITIALIZED;
}
return this.type;
}
void type(Field.Type type) {
this.type = type;
typeBuildStage = STAGE_INITIALIZED;
}
private byte docValuesBuildStage = STAGE_UNINITIALIZED;
private Boolean docValues;
Boolean isDocValues() {
if (docValuesBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (docValuesBuildStage == STAGE_UNINITIALIZED) {
docValuesBuildStage = STAGE_INITIALIZING;
this.docValues = ImmutableField.super.isDocValues();
docValuesBuildStage = STAGE_INITIALIZED;
}
return this.docValues;
}
void docValues(Boolean docValues) {
this.docValues = docValues;
docValuesBuildStage = STAGE_INITIALIZED;
}
private byte includeInAllBuildStage = STAGE_UNINITIALIZED;
private Boolean includeInAll;
Boolean isIncludeInAll() {
if (includeInAllBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (includeInAllBuildStage == STAGE_UNINITIALIZED) {
includeInAllBuildStage = STAGE_INITIALIZING;
this.includeInAll = ImmutableField.super.isIncludeInAll();
includeInAllBuildStage = STAGE_INITIALIZED;
}
return this.includeInAll;
}
void includeInAll(Boolean includeInAll) {
this.includeInAll = includeInAll;
includeInAllBuildStage = STAGE_INITIALIZED;
}
private byte indexBuildStage = STAGE_UNINITIALIZED;
private Boolean index;
Boolean isIndex() {
if (indexBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (indexBuildStage == STAGE_UNINITIALIZED) {
indexBuildStage = STAGE_INITIALIZING;
this.index = ImmutableField.super.isIndex();
indexBuildStage = STAGE_INITIALIZED;
}
return this.index;
}
void index(Boolean index) {
this.index = index;
indexBuildStage = STAGE_INITIALIZED;
}
private byte metaFieldBuildStage = STAGE_UNINITIALIZED;
private boolean metaField;
boolean isMetaField() {
if (metaFieldBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (metaFieldBuildStage == STAGE_UNINITIALIZED) {
metaFieldBuildStage = STAGE_INITIALIZING;
this.metaField = ImmutableField.super.isMetaField();
metaFieldBuildStage = STAGE_INITIALIZED;
}
return this.metaField;
}
void metaField(boolean metaField) {
this.metaField = metaField;
metaFieldBuildStage = STAGE_INITIALIZED;
}
private byte storeBuildStage = STAGE_UNINITIALIZED;
private Boolean store;
Boolean isStore() {
if (storeBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage());
if (storeBuildStage == STAGE_UNINITIALIZED) {
storeBuildStage = STAGE_INITIALIZING;
this.store = ImmutableField.super.isStore();
storeBuildStage = STAGE_INITIALIZED;
}
return this.store;
}
void store(Boolean store) {
this.store = store;
storeBuildStage = STAGE_INITIALIZED;
}
private String formatInitCycleMessage() {
List attributes = new ArrayList<>();
if (additionalTargetsBuildStage == STAGE_INITIALIZING) attributes.add("additionalTargets");
if (aliasesBuildStage == STAGE_INITIALIZING) attributes.add("aliases");
if (analyzerBuildStage == STAGE_INITIALIZING) attributes.add("analyzer");
if (copyToBuildStage == STAGE_INITIALIZING) attributes.add("copyTo");
if (excludePluginsBuildStage == STAGE_INITIALIZING) attributes.add("excludePlugins");
if (fieldsBuildStage == STAGE_INITIALIZING) attributes.add("fields");
if (ignoreAboveBuildStage == STAGE_INITIALIZING) attributes.add("ignoreAbove");
if (includePluginsBuildStage == STAGE_INITIALIZING) attributes.add("includePlugins");
if (scalingFactorBuildStage == STAGE_INITIALIZING) attributes.add("scalingFactor");
if (tokenFiltersBuildStage == STAGE_INITIALIZING) attributes.add("tokenFilters");
if (typeBuildStage == STAGE_INITIALIZING) attributes.add("type");
if (docValuesBuildStage == STAGE_INITIALIZING) attributes.add("docValues");
if (includeInAllBuildStage == STAGE_INITIALIZING) attributes.add("includeInAll");
if (indexBuildStage == STAGE_INITIALIZING) attributes.add("index");
if (metaFieldBuildStage == STAGE_INITIALIZING) attributes.add("metaField");
if (storeBuildStage == STAGE_INITIALIZING) attributes.add("store");
return "Cannot build Field, attribute initializers form cycle " + attributes;
}
}
/**
* Returns a list of fields that should be targeted by
* {@link com.arakelian.elastic.doc.ElasticDocBuilder} whenever this field is targeted.
* @return list of fields that should be targeted by
* {@link com.arakelian.elastic.doc.ElasticDocBuilder} whenever this field is targeted.
*/
@JsonProperty("additional_targets")
@JsonView(Views.Enhancement.class)
@Override
public ImmutableList getAdditionalTargets() {
InitShim shim = this.initShim;
return shim != null
? shim.getAdditionalTargets()
: this.additionalTargets;
}
/**
* Returns a list of aliases for this field.
* @return list of aliases for this field.
*/
@JsonProperty("aliases")
@JsonView(Views.Enhancement.class)
@Override
public ImmutableSet getAliases() {
InitShim shim = this.initShim;
return shim != null
? shim.getAliases()
: this.aliases;
}
/**
* Returns the analyzer used by this field.
* For TOKEN_COUNT fields, the analyzer is required, and so therefore we default one below to
* make it easy to create new mappings by just specifyig a field type.
* @return the analyzer used by this field.
*/
@JsonProperty("analyzer")
@JsonView(Views.Elastic.class)
@Override
public @Nullable String getAnalyzer() {
InitShim shim = this.initShim;
return shim != null
? shim.getAnalyzer()
: this.analyzer;
}
/**
* Returns a query time boosting. Accepts a floating point number, defaults to 1.0.
* @return a query time boosting
* @see boost
*/
@JsonProperty("boost")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Double getBoost() {
return boost;
}
/**
* Returns true if Elastic should try to convert strings to numbers and truncate fractions for
* integers.
* @return true if Elastic should try to convert strings to numbers and truncate fractions for
* integers
* @see Range
* Datatypes
*/
@JsonProperty("coerce")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean getCoerce() {
return coerce;
}
/**
* Returns a list of fields that this field value should be copied to.
* The {@link #getCopyTo()} allows you to create custom _all fields. The values of multiple
* fields can be copied into a group field, which can then be queried as a single field.
* @return list of fields that this field value should be copied to.
*/
@JsonProperty("copy_to")
@JsonView(Views.Elastic.class)
@Override
public ImmutableList getCopyTo() {
InitShim shim = this.initShim;
return shim != null
? shim.getCopyTo()
: this.copyTo;
}
/**
* @return The value of the {@code description} attribute
*/
@JsonProperty("description")
@JsonView(Views.Enhancement.class)
@Override
public @Nullable String getDescription() {
return description;
}
/**
* @return The value of the {@code excludePlugins} attribute
*/
@JsonProperty("exclude_plugins")
@JsonView(Views.Enhancement.class)
@Override
public ImmutableSet getExcludePlugins() {
InitShim shim = this.initShim;
return shim != null
? shim.getExcludePlugins()
: this.excludePlugins;
}
/**
* @return The value of the {@code fields} attribute
*/
@JsonProperty("fields")
@JsonSerialize(contentUsing = Field.SubfieldSerializer.class)
@JsonDeserialize(contentUsing = Mapping.FieldDeserializer.class)
@Override
public ImmutableMap getFields() {
InitShim shim = this.initShim;
return shim != null
? shim.getFields()
: this.fields;
}
/**
* Returns the date format used by Elastic to parse date values.
* Note that Elastic internally stores dates as a long value representing
* milliseconds-since-the-epoch in UTC.
* @return date format used by Elastic to parse date values.
*/
@JsonProperty("format")
@JsonView(Views.Elastic.class)
@Override
public @Nullable String getFormat() {
return format;
}
/**
* Returns the maximum length of strings that can be indexed or stored. Strings longer than the
* ignore_above setting will be ignored.
* @return maximum length of strings that can be indexed or stored
*/
@JsonProperty("ignore_above")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Integer getIgnoreAbove() {
InitShim shim = this.initShim;
return shim != null
? shim.getIgnoreAbove()
: this.ignoreAbove;
}
/**
* @return The value of the {@code includePlugins} attribute
*/
@JsonProperty("include_plugins")
@JsonView(Views.Enhancement.class)
@Override
public ImmutableSet getIncludePlugins() {
InitShim shim = this.initShim;
return shim != null
? shim.getIncludePlugins()
: this.includePlugins;
}
/**
* Returns setting that determines what information is added to the inverted index.
* Analyzed string fields use {@link IndexOptions#POSITIONS} as the default, and all other
* fields use {@link IndexOptions#DOCS} as the default.
* @return setting that determines what information is added to the inverted index.
*/
@JsonProperty("index_options")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Field.IndexOptions getIndexOptions() {
return indexOptions;
}
/**
* Returns the name of the Elastic index field that should be created.
* @return name of the Elastic index field that should be created.
*/
@JsonProperty("name")
@Override
public String getName() {
return name;
}
/**
* Returns the normalizer used by this field.
* @return the normalizer used by this field.
*/
@JsonProperty("normalizer")
@JsonView(Views.Elastic.class)
@Override
public @Nullable String getNormalizer() {
return normalizer;
}
/**
* Returns a value that will replace null values during indexed.
* Normally, null values cannot be indexed or searched. This parameter allows you to replace
* explicit null values with another value that can be indexed and searched instead.
* @return value that will replace null values during indexed
*/
@JsonProperty("null_value")
@JsonView(Views.Elastic.class)
@Override
public @Nullable String getNullValue() {
return nullValue;
}
/**
* Returns how to interpret vertex order for polygons / multipolygons.
* @return how to interpret vertex order for polygons / multipolygons.
*/
@JsonProperty("orientation")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Orientation getOrientation() {
return orientation;
}
/**
* @return The value of the {@code positionIncrementGap} attribute
*/
@JsonProperty("position_increment_gap")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Integer getPositionIncrementGap() {
return positionIncrementGap;
}
/**
* @return The value of the {@code precision} attribute
*/
@JsonProperty("precision")
@JsonView(Views.Elastic.class)
@Override
public @Nullable String getPrecision() {
return precision;
}
/**
* @return The value of the {@code scalingFactor} attribute
*/
@JsonProperty("scaling_factor")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Integer getScalingFactor() {
InitShim shim = this.initShim;
return shim != null
? shim.getScalingFactor()
: this.scalingFactor;
}
/**
* @return The value of the {@code searchAnalyzer} attribute
*/
@JsonProperty("search_analyzer")
@JsonView(Views.Elastic.class)
@Override
public @Nullable String getSearchAnalyzer() {
return searchAnalyzer;
}
/**
* Returns the approach for how to represent shapes at indexing and search time.
* @return the approach for how to represent shapes at indexing and search time.
*/
@JsonProperty("strategy")
@JsonView(Views.Elastic.class)
@Override
public @Nullable SpatialStrategy getStrategy() {
return strategy;
}
/**
* Returns setting that determines what information is added to the inverted index.
* Analyzed string fields use {@link IndexOptions#POSITIONS} as the default, and all other
* fields use {@link IndexOptions#DOCS} as the default.
* @return setting that determines what information is added to the inverted index.
*/
@JsonProperty("term_vector")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Field.TermVector getTermVector() {
return termVector;
}
/**
* @return The value of the {@code tokenFilters} attribute
*/
@JsonView(Views.Enhancement.class)
@JsonProperty("token_filters")
@Override
public ImmutableList getTokenFilters() {
InitShim shim = this.initShim;
return shim != null
? shim.getTokenFilters()
: this.tokenFilters;
}
/**
* @return The value of the {@code tree} attribute
*/
@JsonProperty("tree")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Tree getTree() {
return tree;
}
/**
* Returns maximum number of layers to be used by the PrefixTree. This can be used to control
* the precision of shape representations and therefore how many terms are indexed. Defaults to
* the default value of the chosen PrefixTree implementation
* @return maximum number of layers to be used by the PrefixTree
*/
@JsonProperty("tree_levels")
@JsonView(Views.Elastic.class)
@Override
public @Nullable String getTreeLevels() {
return treeLevels;
}
/**
* @return The value of the {@code type} attribute
*/
@JsonProperty("type")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Field.Type getType() {
InitShim shim = this.initShim;
return shim != null
? shim.getType()
: this.type;
}
/**
* Returns true if doc_values is enabled. Note that all fields which support doc values have
* them enabled by default.
* @return true if this field has doc_values enabled.
*/
@JsonProperty("doc_values")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isDocValues() {
InitShim shim = this.initShim;
return shim != null
? shim.isDocValues()
: this.docValues;
}
/**
* @return The value of the {@code eagerGlobalOrdinals} attribute
*/
@JsonProperty("eager_global_ordinals")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isEagerGlobalOrdinals() {
return eagerGlobalOrdinals;
}
/**
* Returns true if this field is enabled.
* The enabled setting can be applied only to the mapping type and to object fields, causes
* Elasticsearch to skip parsing of the contents of the field entirely. The JSON can still be
* retrieved from the _source field, but it is not searchable or stored in any other way.
* @return true if this field is enabled.
*/
@JsonProperty("enabled")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isEnabled() {
return enabled;
}
/**
* Returns true if field data is enabled for field.
* Fielddata can consume a lot of heap space, especially when loading high cardinality text
* fields. Once fielddata has been loaded into the heap, it remains there for the lifetime of
* the segment. Also, loading fielddata is an expensive process which can cause users to
* experience latency hits. This is why fielddata is disabled by default.
* @return true if field data is enabled for field.
*/
@JsonProperty("fielddata")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isFielddata() {
return fielddata;
}
/**
* @return The value of the {@code ignoreGlobalTokenFilters} attribute
*/
@JsonProperty("ignore_global_token_filters")
@JsonView(Views.Enhancement.class)
@Override
public @Nullable Boolean isIgnoreGlobalTokenFilters() {
return ignoreGlobalTokenFilters;
}
/**
* Returns true if this field should ignore illegal values detected when building Elastic
* document.
* @return true if this field should ignore illegal values detected when building Elastic
* document.
*/
@JsonProperty("ignore_malformed")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isIgnoreMalformed() {
return ignoreMalformed;
}
/**
* Returns true (default) if three dimension points will be accepted (stored in source) but only
* latitude and longitude values will be indexed; the third dimension is ignored. If false,
* geo-points containing any more than latitude and longitude (two dimensions) values throw an
* exception and reject the whole document.
* @return true if three dimension points will be accepted but only latitude and longitude
* values will be indexed
*/
@JsonProperty("ignore_z_value")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isIgnoreZValue() {
return ignoreZValue;
}
/**
* Returns true if this field should not be included in _all.
* @return true if this field should not be included in _all.
* @see https://www.elastic.co/guide/en/elasticsearch/reference/current/include-in-all.html
*/
@JsonProperty("include_in_all")
@JsonView(Views.Elastic.Version5.class)
@Override
public @Nullable Boolean isIncludeInAll() {
InitShim shim = this.initShim;
return shim != null
? shim.isIncludeInAll()
: this.includeInAll;
}
/**
* Returns flag that indicates if field is indexed and therefore searchable.
* Note that prior to ES 5, "analyzed" and "not_analyzed" were acceptable values for this field.
* Both values implied that index was "true", with "not_analyzed" also implying a field type of
* "keyword".
* A non-technical discussion of this on Elastic blog can be found here:
* https://www.elastic.co/blog/strings-are-dead-long-live-strings
* @return flag that indicates if field is indexed.
* @see https://github.com/elastic/elasticsearch/issues/21134
*/
@JsonProperty("index")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isIndex() {
InitShim shim = this.initShim;
return shim != null
? shim.isIndex()
: this.index;
}
/**
* @return The value of the {@code metaField} attribute
*/
@JsonProperty("metaField")
@JsonIgnore
@JsonView(Views.Elastic.class)
@Override
public boolean isMetaField() {
InitShim shim = this.initShim;
return shim != null
? shim.isMetaField()
: this.metaField;
}
/**
* @return The value of the {@code norms} attribute
*/
@JsonProperty("norms")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isNorms() {
return norms;
}
/**
* @return The value of the {@code pointsOnly} attribute
*/
@JsonProperty("points_only")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isPointsOnly() {
return pointsOnly;
}
/**
* @return The value of the {@code sortTokens} attribute
*/
@JsonProperty("sort_tokens")
@JsonView(Views.Enhancement.class)
@Override
public @Nullable Boolean isSortTokens() {
return sortTokens;
}
/**
* Returns true if the field value is stored.
* By default, field values are indexed to make them searchable, but they are not stored. This
* means that the field can be queried, but the original field value cannot be retrieved.
* @return true if this field value is stored.
*/
@JsonProperty("store")
@JsonView(Views.Elastic.class)
@Override
public @Nullable Boolean isStore() {
InitShim shim = this.initShim;
return shim != null
? shim.isStore()
: this.store;
}
/**
* Computes a hash code from attributes: {@code name}, {@code type}.
* @return hashCode value
*/
@Override
public int hashCode() {
@Var int h = 5381;
h += (h << 5) + name.hashCode();
h += (h << 5) + Objects.hashCode(type);
return h;
}
/**
* Prints the immutable value {@code Field} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return MoreObjects.toStringHelper("Field")
.omitNullValues()
.add("name", name)
.add("type", type)
.toString();
}
/**
* Creates a builder for {@link ImmutableField ImmutableField}.
*
* ImmutableField.builder()
* .addAdditionalTarget|addAllAdditionalTargets(String) // {@link Field#getAdditionalTargets() additionalTargets} elements
* .addAliase|addAllAliases(String) // {@link Field#getAliases() aliases} elements
* .analyzer(String | null) // nullable {@link Field#getAnalyzer() analyzer}
* .boost(Double | null) // nullable {@link Field#getBoost() boost}
* .coerce(Boolean | null) // nullable {@link Field#getCoerce() coerce}
* .addCopyTo|addAllCopyTo(String) // {@link Field#getCopyTo() copyTo} elements
* .description(String | null) // nullable {@link Field#getDescription() description}
* .addExcludePlugin|addAllExcludePlugins(String) // {@link Field#getExcludePlugins() excludePlugins} elements
* .putField|putAllFields(String => com.arakelian.elastic.model.Field) // {@link Field#getFields() fields} mappings
* .format(String | null) // nullable {@link Field#getFormat() format}
* .ignoreAbove(Integer | null) // nullable {@link Field#getIgnoreAbove() ignoreAbove}
* .addIncludePlugin|addAllIncludePlugins(String) // {@link Field#getIncludePlugins() includePlugins} elements
* .indexOptions(com.arakelian.elastic.model.Field.IndexOptions | null) // nullable {@link Field#getIndexOptions() indexOptions}
* .name(String) // required {@link Field#getName() name}
* .normalizer(String | null) // nullable {@link Field#getNormalizer() normalizer}
* .nullValue(String | null) // nullable {@link Field#getNullValue() nullValue}
* .orientation(com.arakelian.elastic.model.enums.Orientation | null) // nullable {@link Field#getOrientation() orientation}
* .positionIncrementGap(Integer | null) // nullable {@link Field#getPositionIncrementGap() positionIncrementGap}
* .precision(String | null) // nullable {@link Field#getPrecision() precision}
* .scalingFactor(Integer | null) // nullable {@link Field#getScalingFactor() scalingFactor}
* .searchAnalyzer(String | null) // nullable {@link Field#getSearchAnalyzer() searchAnalyzer}
* .strategy(com.arakelian.elastic.model.enums.SpatialStrategy | null) // nullable {@link Field#getStrategy() strategy}
* .termVector(com.arakelian.elastic.model.Field.TermVector | null) // nullable {@link Field#getTermVector() termVector}
* .addTokenFilter|addAllTokenFilters(com.arakelian.elastic.doc.filters.TokenFilter) // {@link Field#getTokenFilters() tokenFilters} elements
* .tree(com.arakelian.elastic.model.enums.Tree | null) // nullable {@link Field#getTree() tree}
* .treeLevels(String | null) // nullable {@link Field#getTreeLevels() treeLevels}
* .type(com.arakelian.elastic.model.Field.Type | null) // nullable {@link Field#getType() type}
* .docValues(Boolean | null) // nullable {@link Field#isDocValues() docValues}
* .eagerGlobalOrdinals(Boolean | null) // nullable {@link Field#isEagerGlobalOrdinals() eagerGlobalOrdinals}
* .enabled(Boolean | null) // nullable {@link Field#isEnabled() enabled}
* .fielddata(Boolean | null) // nullable {@link Field#isFielddata() fielddata}
* .ignoreGlobalTokenFilters(Boolean | null) // nullable {@link Field#isIgnoreGlobalTokenFilters() ignoreGlobalTokenFilters}
* .ignoreMalformed(Boolean | null) // nullable {@link Field#isIgnoreMalformed() ignoreMalformed}
* .ignoreZValue(Boolean | null) // nullable {@link Field#isIgnoreZValue() ignoreZValue}
* .includeInAll(Boolean | null) // nullable {@link Field#isIncludeInAll() includeInAll}
* .index(Boolean | null) // nullable {@link Field#isIndex() index}
* .metaField(boolean) // optional {@link Field#isMetaField() metaField}
* .norms(Boolean | null) // nullable {@link Field#isNorms() norms}
* .pointsOnly(Boolean | null) // nullable {@link Field#isPointsOnly() pointsOnly}
* .sortTokens(Boolean | null) // nullable {@link Field#isSortTokens() sortTokens}
* .store(Boolean | null) // nullable {@link Field#isStore() store}
* .build();
*
* @return A new ImmutableField builder
*/
public static ImmutableField.Builder builder() {
return new ImmutableField.Builder();
}
/**
* Builds instances of type {@link ImmutableField ImmutableField}.
* 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 = "Field", generator = "Immutables")
@NotThreadSafe
@JsonPropertyOrder({"name", "aliases", "description", "type", "scaling_factor", "format", "enabled", "store", "index", "index_options", "norms", "doc_values", "additional_targets", "ignore_global_token_filters", "sort_tokens", "token_filters", "fielddata", "tree", "precision", "tree_levels", "strategy", "orientation", "points_only", "ignore_z_value", "ignore_above", "ignore_malformed", "position_increment_gap", "eager_global_ordinals", "include_in_all", "copy_to", "normalizer", "analyzer", "search_analyzer", "include_plugins", "exclude_plugins"})
public static final class Builder {
private static final long INIT_BIT_NAME = 0x1L;
private static final long OPT_BIT_ADDITIONAL_TARGETS = 0x1L;
private static final long OPT_BIT_ALIASES = 0x2L;
private static final long OPT_BIT_ANALYZER = 0x4L;
private static final long OPT_BIT_COPY_TO = 0x8L;
private static final long OPT_BIT_EXCLUDE_PLUGINS = 0x10L;
private static final long OPT_BIT_FIELDS = 0x20L;
private static final long OPT_BIT_IGNORE_ABOVE = 0x40L;
private static final long OPT_BIT_INCLUDE_PLUGINS = 0x80L;
private static final long OPT_BIT_SCALING_FACTOR = 0x100L;
private static final long OPT_BIT_TOKEN_FILTERS = 0x200L;
private static final long OPT_BIT_TYPE = 0x400L;
private static final long OPT_BIT_DOC_VALUES = 0x800L;
private static final long OPT_BIT_INCLUDE_IN_ALL = 0x1000L;
private static final long OPT_BIT_INDEX = 0x2000L;
private static final long OPT_BIT_META_FIELD = 0x4000L;
private static final long OPT_BIT_STORE = 0x8000L;
private long initBits = 0x1L;
private long optBits;
private ImmutableList.Builder additionalTargets = ImmutableList.builder();
private ImmutableSet.Builder aliases = ImmutableSet.builder();
private @javax.annotation.Nullable String analyzer;
private @javax.annotation.Nullable Double boost;
private @javax.annotation.Nullable Boolean coerce;
private ImmutableList.Builder copyTo = ImmutableList.builder();
private @javax.annotation.Nullable String description;
private ImmutableSet.Builder excludePlugins = ImmutableSet.builder();
private ImmutableMap.Builder fields = ImmutableMap.builder();
private @javax.annotation.Nullable String format;
private @javax.annotation.Nullable Integer ignoreAbove;
private ImmutableSet.Builder includePlugins = ImmutableSet.builder();
private @javax.annotation.Nullable Field.IndexOptions indexOptions;
private @javax.annotation.Nullable String name;
private @javax.annotation.Nullable String normalizer;
private @javax.annotation.Nullable String nullValue;
private @javax.annotation.Nullable Orientation orientation;
private @javax.annotation.Nullable Integer positionIncrementGap;
private @javax.annotation.Nullable String precision;
private @javax.annotation.Nullable Integer scalingFactor;
private @javax.annotation.Nullable String searchAnalyzer;
private @javax.annotation.Nullable SpatialStrategy strategy;
private @javax.annotation.Nullable Field.TermVector termVector;
private ImmutableList.Builder tokenFilters = ImmutableList.builder();
private @javax.annotation.Nullable Tree tree;
private @javax.annotation.Nullable String treeLevels;
private @javax.annotation.Nullable Field.Type type;
private @javax.annotation.Nullable Boolean docValues;
private @javax.annotation.Nullable Boolean eagerGlobalOrdinals;
private @javax.annotation.Nullable Boolean enabled;
private @javax.annotation.Nullable Boolean fielddata;
private @javax.annotation.Nullable Boolean ignoreGlobalTokenFilters;
private @javax.annotation.Nullable Boolean ignoreMalformed;
private @javax.annotation.Nullable Boolean ignoreZValue;
private @javax.annotation.Nullable Boolean includeInAll;
private @javax.annotation.Nullable Boolean index;
private boolean metaField;
private @javax.annotation.Nullable Boolean norms;
private @javax.annotation.Nullable Boolean pointsOnly;
private @javax.annotation.Nullable Boolean sortTokens;
private @javax.annotation.Nullable Boolean store;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code Field} 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(Field instance) {
Objects.requireNonNull(instance, "instance");
addAllAdditionalTargets(instance.getAdditionalTargets());
addAllAliases(instance.getAliases());
String analyzerValue = instance.getAnalyzer();
if (analyzerValue != null) {
analyzer(analyzerValue);
}
Double boostValue = instance.getBoost();
if (boostValue != null) {
boost(boostValue);
}
Boolean coerceValue = instance.getCoerce();
if (coerceValue != null) {
coerce(coerceValue);
}
addAllCopyTo(instance.getCopyTo());
String descriptionValue = instance.getDescription();
if (descriptionValue != null) {
description(descriptionValue);
}
addAllExcludePlugins(instance.getExcludePlugins());
putAllFields(instance.getFields());
String formatValue = instance.getFormat();
if (formatValue != null) {
format(formatValue);
}
Integer ignoreAboveValue = instance.getIgnoreAbove();
if (ignoreAboveValue != null) {
ignoreAbove(ignoreAboveValue);
}
addAllIncludePlugins(instance.getIncludePlugins());
Field.IndexOptions indexOptionsValue = instance.getIndexOptions();
if (indexOptionsValue != null) {
indexOptions(indexOptionsValue);
}
name(instance.getName());
String normalizerValue = instance.getNormalizer();
if (normalizerValue != null) {
normalizer(normalizerValue);
}
String nullValueValue = instance.getNullValue();
if (nullValueValue != null) {
nullValue(nullValueValue);
}
Orientation orientationValue = instance.getOrientation();
if (orientationValue != null) {
orientation(orientationValue);
}
Integer positionIncrementGapValue = instance.getPositionIncrementGap();
if (positionIncrementGapValue != null) {
positionIncrementGap(positionIncrementGapValue);
}
String precisionValue = instance.getPrecision();
if (precisionValue != null) {
precision(precisionValue);
}
Integer scalingFactorValue = instance.getScalingFactor();
if (scalingFactorValue != null) {
scalingFactor(scalingFactorValue);
}
String searchAnalyzerValue = instance.getSearchAnalyzer();
if (searchAnalyzerValue != null) {
searchAnalyzer(searchAnalyzerValue);
}
SpatialStrategy strategyValue = instance.getStrategy();
if (strategyValue != null) {
strategy(strategyValue);
}
Field.TermVector termVectorValue = instance.getTermVector();
if (termVectorValue != null) {
termVector(termVectorValue);
}
addAllTokenFilters(instance.getTokenFilters());
Tree treeValue = instance.getTree();
if (treeValue != null) {
tree(treeValue);
}
String treeLevelsValue = instance.getTreeLevels();
if (treeLevelsValue != null) {
treeLevels(treeLevelsValue);
}
Field.Type typeValue = instance.getType();
if (typeValue != null) {
type(typeValue);
}
Boolean docValuesValue = instance.isDocValues();
if (docValuesValue != null) {
docValues(docValuesValue);
}
Boolean eagerGlobalOrdinalsValue = instance.isEagerGlobalOrdinals();
if (eagerGlobalOrdinalsValue != null) {
eagerGlobalOrdinals(eagerGlobalOrdinalsValue);
}
Boolean enabledValue = instance.isEnabled();
if (enabledValue != null) {
enabled(enabledValue);
}
Boolean fielddataValue = instance.isFielddata();
if (fielddataValue != null) {
fielddata(fielddataValue);
}
Boolean ignoreGlobalTokenFiltersValue = instance.isIgnoreGlobalTokenFilters();
if (ignoreGlobalTokenFiltersValue != null) {
ignoreGlobalTokenFilters(ignoreGlobalTokenFiltersValue);
}
Boolean ignoreMalformedValue = instance.isIgnoreMalformed();
if (ignoreMalformedValue != null) {
ignoreMalformed(ignoreMalformedValue);
}
Boolean ignoreZValueValue = instance.isIgnoreZValue();
if (ignoreZValueValue != null) {
ignoreZValue(ignoreZValueValue);
}
Boolean includeInAllValue = instance.isIncludeInAll();
if (includeInAllValue != null) {
includeInAll(includeInAllValue);
}
Boolean indexValue = instance.isIndex();
if (indexValue != null) {
index(indexValue);
}
metaField(instance.isMetaField());
Boolean normsValue = instance.isNorms();
if (normsValue != null) {
norms(normsValue);
}
Boolean pointsOnlyValue = instance.isPointsOnly();
if (pointsOnlyValue != null) {
pointsOnly(pointsOnlyValue);
}
Boolean sortTokensValue = instance.isSortTokens();
if (sortTokensValue != null) {
sortTokens(sortTokensValue);
}
Boolean storeValue = instance.isStore();
if (storeValue != null) {
store(storeValue);
}
return this;
}
/**
* Adds one element to {@link Field#getAdditionalTargets() additionalTargets} list.
* @param element A additionalTargets element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAdditionalTarget(String element) {
this.additionalTargets.add(element);
optBits |= OPT_BIT_ADDITIONAL_TARGETS;
return this;
}
/**
* Adds elements to {@link Field#getAdditionalTargets() additionalTargets} list.
* @param elements An array of additionalTargets elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAdditionalTargets(String... elements) {
this.additionalTargets.add(elements);
optBits |= OPT_BIT_ADDITIONAL_TARGETS;
return this;
}
/**
* Sets or replaces all elements for {@link Field#getAdditionalTargets() additionalTargets} list.
* @param elements An iterable of additionalTargets elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("additional_targets")
@JsonView(Views.Enhancement.class)
public final Builder additionalTargets(Iterable elements) {
this.additionalTargets = ImmutableList.builder();
return addAllAdditionalTargets(elements);
}
/**
* Adds elements to {@link Field#getAdditionalTargets() additionalTargets} list.
* @param elements An iterable of additionalTargets elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllAdditionalTargets(Iterable elements) {
this.additionalTargets.addAll(elements);
optBits |= OPT_BIT_ADDITIONAL_TARGETS;
return this;
}
/**
* Adds one element to {@link Field#getAliases() aliases} set.
* @param element A aliases element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAliase(String element) {
this.aliases.add(element);
optBits |= OPT_BIT_ALIASES;
return this;
}
/**
* Adds elements to {@link Field#getAliases() aliases} set.
* @param elements An array of aliases elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAliases(String... elements) {
this.aliases.add(elements);
optBits |= OPT_BIT_ALIASES;
return this;
}
/**
* Sets or replaces all elements for {@link Field#getAliases() aliases} set.
* @param elements An iterable of aliases elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("aliases")
@JsonView(Views.Enhancement.class)
public final Builder aliases(Iterable elements) {
this.aliases = ImmutableSet.builder();
return addAllAliases(elements);
}
/**
* Adds elements to {@link Field#getAliases() aliases} set.
* @param elements An iterable of aliases elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllAliases(Iterable elements) {
this.aliases.addAll(elements);
optBits |= OPT_BIT_ALIASES;
return this;
}
/**
* Initializes the value for the {@link Field#getAnalyzer() analyzer} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link Field#getAnalyzer() analyzer}.
* @param analyzer The value for analyzer (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("analyzer")
@JsonView(Views.Elastic.class)
public final Builder analyzer(@Nullable String analyzer) {
this.analyzer = analyzer;
optBits |= OPT_BIT_ANALYZER;
return this;
}
/**
* Initializes the value for the {@link Field#getBoost() boost} attribute.
* @param boost The value for boost (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("boost")
@JsonView(Views.Elastic.class)
public final Builder boost(@Nullable Double boost) {
this.boost = boost;
return this;
}
/**
* Initializes the value for the {@link Field#getCoerce() coerce} attribute.
* @param coerce The value for coerce (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("coerce")
@JsonView(Views.Elastic.class)
public final Builder coerce(@Nullable Boolean coerce) {
this.coerce = coerce;
return this;
}
/**
* Adds one element to {@link Field#getCopyTo() copyTo} list.
* @param element A copyTo element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addCopyTo(String element) {
this.copyTo.add(element);
optBits |= OPT_BIT_COPY_TO;
return this;
}
/**
* Adds elements to {@link Field#getCopyTo() copyTo} list.
* @param elements An array of copyTo elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addCopyTo(String... elements) {
this.copyTo.add(elements);
optBits |= OPT_BIT_COPY_TO;
return this;
}
/**
* Sets or replaces all elements for {@link Field#getCopyTo() copyTo} list.
* @param elements An iterable of copyTo elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("copy_to")
@JsonView(Views.Elastic.class)
public final Builder copyTo(Iterable elements) {
this.copyTo = ImmutableList.builder();
return addAllCopyTo(elements);
}
/**
* Adds elements to {@link Field#getCopyTo() copyTo} list.
* @param elements An iterable of copyTo elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllCopyTo(Iterable elements) {
this.copyTo.addAll(elements);
optBits |= OPT_BIT_COPY_TO;
return this;
}
/**
* Initializes the value for the {@link Field#getDescription() description} attribute.
* @param description The value for description (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("description")
@JsonView(Views.Enhancement.class)
public final Builder description(@Nullable String description) {
this.description = description;
return this;
}
/**
* Adds one element to {@link Field#getExcludePlugins() excludePlugins} set.
* @param element A excludePlugins element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addExcludePlugin(String element) {
this.excludePlugins.add(element);
optBits |= OPT_BIT_EXCLUDE_PLUGINS;
return this;
}
/**
* Adds elements to {@link Field#getExcludePlugins() excludePlugins} set.
* @param elements An array of excludePlugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addExcludePlugins(String... elements) {
this.excludePlugins.add(elements);
optBits |= OPT_BIT_EXCLUDE_PLUGINS;
return this;
}
/**
* Sets or replaces all elements for {@link Field#getExcludePlugins() excludePlugins} set.
* @param elements An iterable of excludePlugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("exclude_plugins")
@JsonView(Views.Enhancement.class)
public final Builder excludePlugins(Iterable elements) {
this.excludePlugins = ImmutableSet.builder();
return addAllExcludePlugins(elements);
}
/**
* Adds elements to {@link Field#getExcludePlugins() excludePlugins} set.
* @param elements An iterable of excludePlugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllExcludePlugins(Iterable elements) {
this.excludePlugins.addAll(elements);
optBits |= OPT_BIT_EXCLUDE_PLUGINS;
return this;
}
/**
* Put one entry to the {@link Field#getFields() fields} map.
* @param key The key in the fields map
* @param value The associated value in the fields map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putField(String key, Field value) {
this.fields.put(key, value);
optBits |= OPT_BIT_FIELDS;
return this;
}
/**
* Put one entry to the {@link Field#getFields() fields} map. Nulls are not permitted
* @param entry The key and value entry
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putField(Map.Entry entry) {
this.fields.put(entry);
optBits |= OPT_BIT_FIELDS;
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link Field#getFields() fields} map. Nulls are not permitted
* @param entries The entries that will be added to the fields map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("fields")
@JsonSerialize(contentUsing = Field.SubfieldSerializer.class)
@JsonDeserialize(contentUsing = Mapping.FieldDeserializer.class)
public final Builder fields(Map entries) {
this.fields = ImmutableMap.builder();
optBits |= OPT_BIT_FIELDS;
return putAllFields(entries);
}
/**
* Put all mappings from the specified map as entries to {@link Field#getFields() fields} map. Nulls are not permitted
* @param entries The entries that will be added to the fields map
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder putAllFields(Map entries) {
this.fields.putAll(entries);
optBits |= OPT_BIT_FIELDS;
return this;
}
/**
* Initializes the value for the {@link Field#getFormat() format} attribute.
* @param format The value for format (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("format")
@JsonView(Views.Elastic.class)
public final Builder format(@Nullable String format) {
this.format = format;
return this;
}
/**
* Initializes the value for the {@link Field#getIgnoreAbove() ignoreAbove} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link Field#getIgnoreAbove() ignoreAbove}.
* @param ignoreAbove The value for ignoreAbove (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("ignore_above")
@JsonView(Views.Elastic.class)
public final Builder ignoreAbove(@Nullable Integer ignoreAbove) {
this.ignoreAbove = ignoreAbove;
optBits |= OPT_BIT_IGNORE_ABOVE;
return this;
}
/**
* Adds one element to {@link Field#getIncludePlugins() includePlugins} set.
* @param element A includePlugins element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addIncludePlugin(String element) {
this.includePlugins.add(element);
optBits |= OPT_BIT_INCLUDE_PLUGINS;
return this;
}
/**
* Adds elements to {@link Field#getIncludePlugins() includePlugins} set.
* @param elements An array of includePlugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addIncludePlugins(String... elements) {
this.includePlugins.add(elements);
optBits |= OPT_BIT_INCLUDE_PLUGINS;
return this;
}
/**
* Sets or replaces all elements for {@link Field#getIncludePlugins() includePlugins} set.
* @param elements An iterable of includePlugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("include_plugins")
@JsonView(Views.Enhancement.class)
public final Builder includePlugins(Iterable elements) {
this.includePlugins = ImmutableSet.builder();
return addAllIncludePlugins(elements);
}
/**
* Adds elements to {@link Field#getIncludePlugins() includePlugins} set.
* @param elements An iterable of includePlugins elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllIncludePlugins(Iterable elements) {
this.includePlugins.addAll(elements);
optBits |= OPT_BIT_INCLUDE_PLUGINS;
return this;
}
/**
* Initializes the value for the {@link Field#getIndexOptions() indexOptions} attribute.
* @param indexOptions The value for indexOptions (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("index_options")
@JsonView(Views.Elastic.class)
public final Builder indexOptions(@Nullable Field.IndexOptions indexOptions) {
this.indexOptions = indexOptions;
return this;
}
/**
* Initializes the value for the {@link Field#getName() name} attribute.
* @param name The value for name
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("name")
public final Builder name(String name) {
this.name = Objects.requireNonNull(name, "name");
initBits &= ~INIT_BIT_NAME;
return this;
}
/**
* Initializes the value for the {@link Field#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")
@JsonView(Views.Elastic.class)
public final Builder normalizer(@Nullable String normalizer) {
this.normalizer = normalizer;
return this;
}
/**
* Initializes the value for the {@link Field#getNullValue() nullValue} attribute.
* @param nullValue The value for nullValue (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("null_value")
@JsonView(Views.Elastic.class)
public final Builder nullValue(@Nullable String nullValue) {
this.nullValue = nullValue;
return this;
}
/**
* Initializes the value for the {@link Field#getOrientation() orientation} attribute.
* @param orientation The value for orientation (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("orientation")
@JsonView(Views.Elastic.class)
public final Builder orientation(@Nullable Orientation orientation) {
this.orientation = orientation;
return this;
}
/**
* Initializes the value for the {@link Field#getPositionIncrementGap() positionIncrementGap} attribute.
* @param positionIncrementGap The value for positionIncrementGap (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("position_increment_gap")
@JsonView(Views.Elastic.class)
public final Builder positionIncrementGap(@Nullable Integer positionIncrementGap) {
this.positionIncrementGap = positionIncrementGap;
return this;
}
/**
* Initializes the value for the {@link Field#getPrecision() precision} attribute.
* @param precision The value for precision (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("precision")
@JsonView(Views.Elastic.class)
public final Builder precision(@Nullable String precision) {
this.precision = precision;
return this;
}
/**
* Initializes the value for the {@link Field#getScalingFactor() scalingFactor} attribute.
* If not set, this attribute will have a default value as returned by the initializer of {@link Field#getScalingFactor() scalingFactor}.
* @param scalingFactor The value for scalingFactor (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("scaling_factor")
@JsonView(Views.Elastic.class)
public final Builder scalingFactor(@Nullable Integer scalingFactor) {
this.scalingFactor = scalingFactor;
optBits |= OPT_BIT_SCALING_FACTOR;
return this;
}
/**
* Initializes the value for the {@link Field#getSearchAnalyzer() searchAnalyzer} attribute.
* @param searchAnalyzer The value for searchAnalyzer (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("search_analyzer")
@JsonView(Views.Elastic.class)
public final Builder searchAnalyzer(@Nullable String searchAnalyzer) {
this.searchAnalyzer = searchAnalyzer;
return this;
}
/**
* Initializes the value for the {@link Field#getStrategy() strategy} attribute.
* @param strategy The value for strategy (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("strategy")
@JsonView(Views.Elastic.class)
public final Builder strategy(@Nullable SpatialStrategy strategy) {
this.strategy = strategy;
return this;
}
/**
* Initializes the value for the {@link Field#getTermVector() termVector} attribute.
* @param termVector The value for termVector (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("term_vector")
@JsonView(Views.Elastic.class)
public final Builder termVector(@Nullable Field.TermVector termVector) {
this.termVector = termVector;
return this;
}
/**
* Adds one element to {@link Field#getTokenFilters() tokenFilters} list.
* @param element A tokenFilters element
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addTokenFilter(TokenFilter element) {
this.tokenFilters.add(element);
optBits |= OPT_BIT_TOKEN_FILTERS;
return this;
}
/**
* Adds elements to {@link Field#getTokenFilters() tokenFilters} list.
* @param elements An array of tokenFilters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addTokenFilters(TokenFilter... elements) {
this.tokenFilters.add(elements);
optBits |= OPT_BIT_TOKEN_FILTERS;
return this;
}
/**
* Sets or replaces all elements for {@link Field#getTokenFilters() tokenFilters} list.
* @param elements An iterable of tokenFilters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonView(Views.Enhancement.class)
@JsonProperty("token_filters")
public final Builder tokenFilters(Iterable extends TokenFilter> elements) {
this.tokenFilters = ImmutableList.builder();
return addAllTokenFilters(elements);
}
/**
* Adds elements to {@link Field#getTokenFilters() tokenFilters} list.
* @param elements An iterable of tokenFilters elements
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
public final Builder addAllTokenFilters(Iterable extends TokenFilter> elements) {
this.tokenFilters.addAll(elements);
optBits |= OPT_BIT_TOKEN_FILTERS;
return this;
}
/**
* Initializes the value for the {@link Field#getTree() tree} attribute.
* @param tree The value for tree (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("tree")
@JsonView(Views.Elastic.class)
public final Builder tree(@Nullable Tree tree) {
this.tree = tree;
return this;
}
/**
* Initializes the value for the {@link Field#getTreeLevels() treeLevels} attribute.
* @param treeLevels The value for treeLevels (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("tree_levels")
@JsonView(Views.Elastic.class)
public final Builder treeLevels(@Nullable String treeLevels) {
this.treeLevels = treeLevels;
return this;
}
/**
* Initializes the value for the {@link Field#getType() type} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link Field#getType() type}.
* @param type The value for type (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("type")
@JsonView(Views.Elastic.class)
public final Builder type(@Nullable Field.Type type) {
this.type = type;
optBits |= OPT_BIT_TYPE;
return this;
}
/**
* Initializes the value for the {@link Field#isDocValues() docValues} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link Field#isDocValues() docValues}.
* @param docValues The value for docValues (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("doc_values")
@JsonView(Views.Elastic.class)
public final Builder docValues(@Nullable Boolean docValues) {
this.docValues = docValues;
optBits |= OPT_BIT_DOC_VALUES;
return this;
}
/**
* Initializes the value for the {@link Field#isEagerGlobalOrdinals() eagerGlobalOrdinals} attribute.
* @param eagerGlobalOrdinals The value for eagerGlobalOrdinals (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("eager_global_ordinals")
@JsonView(Views.Elastic.class)
public final Builder eagerGlobalOrdinals(@Nullable Boolean eagerGlobalOrdinals) {
this.eagerGlobalOrdinals = eagerGlobalOrdinals;
return this;
}
/**
* Initializes the value for the {@link Field#isEnabled() enabled} attribute.
* @param enabled The value for enabled (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("enabled")
@JsonView(Views.Elastic.class)
public final Builder enabled(@Nullable Boolean enabled) {
this.enabled = enabled;
return this;
}
/**
* Initializes the value for the {@link Field#isFielddata() fielddata} attribute.
* @param fielddata The value for fielddata (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("fielddata")
@JsonView(Views.Elastic.class)
public final Builder fielddata(@Nullable Boolean fielddata) {
this.fielddata = fielddata;
return this;
}
/**
* Initializes the value for the {@link Field#isIgnoreGlobalTokenFilters() ignoreGlobalTokenFilters} attribute.
* @param ignoreGlobalTokenFilters The value for ignoreGlobalTokenFilters (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("ignore_global_token_filters")
@JsonView(Views.Enhancement.class)
public final Builder ignoreGlobalTokenFilters(@Nullable Boolean ignoreGlobalTokenFilters) {
this.ignoreGlobalTokenFilters = ignoreGlobalTokenFilters;
return this;
}
/**
* Initializes the value for the {@link Field#isIgnoreMalformed() ignoreMalformed} attribute.
* @param ignoreMalformed The value for ignoreMalformed (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("ignore_malformed")
@JsonView(Views.Elastic.class)
public final Builder ignoreMalformed(@Nullable Boolean ignoreMalformed) {
this.ignoreMalformed = ignoreMalformed;
return this;
}
/**
* Initializes the value for the {@link Field#isIgnoreZValue() ignoreZValue} attribute.
* @param ignoreZValue The value for ignoreZValue (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("ignore_z_value")
@JsonView(Views.Elastic.class)
public final Builder ignoreZValue(@Nullable Boolean ignoreZValue) {
this.ignoreZValue = ignoreZValue;
return this;
}
/**
* Initializes the value for the {@link Field#isIncludeInAll() includeInAll} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link Field#isIncludeInAll() includeInAll}.
* @param includeInAll The value for includeInAll (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("include_in_all")
@JsonView(Views.Elastic.Version5.class)
public final Builder includeInAll(@Nullable Boolean includeInAll) {
this.includeInAll = includeInAll;
optBits |= OPT_BIT_INCLUDE_IN_ALL;
return this;
}
/**
* Initializes the value for the {@link Field#isIndex() index} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link Field#isIndex() index}.
* @param index The value for index (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("index")
@JsonView(Views.Elastic.class)
public final Builder index(@Nullable Boolean index) {
this.index = index;
optBits |= OPT_BIT_INDEX;
return this;
}
/**
* Initializes the value for the {@link Field#isMetaField() metaField} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link Field#isMetaField() metaField}.
* @param metaField The value for metaField
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("metaField")
@JsonIgnore
@JsonView(Views.Elastic.class)
public final Builder metaField(boolean metaField) {
this.metaField = metaField;
optBits |= OPT_BIT_META_FIELD;
return this;
}
/**
* Initializes the value for the {@link Field#isNorms() norms} attribute.
* @param norms The value for norms (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("norms")
@JsonView(Views.Elastic.class)
public final Builder norms(@Nullable Boolean norms) {
this.norms = norms;
return this;
}
/**
* Initializes the value for the {@link Field#isPointsOnly() pointsOnly} attribute.
* @param pointsOnly The value for pointsOnly (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("points_only")
@JsonView(Views.Elastic.class)
public final Builder pointsOnly(@Nullable Boolean pointsOnly) {
this.pointsOnly = pointsOnly;
return this;
}
/**
* Initializes the value for the {@link Field#isSortTokens() sortTokens} attribute.
* @param sortTokens The value for sortTokens (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("sort_tokens")
@JsonView(Views.Enhancement.class)
public final Builder sortTokens(@Nullable Boolean sortTokens) {
this.sortTokens = sortTokens;
return this;
}
/**
* Initializes the value for the {@link Field#isStore() store} attribute.
*
If not set, this attribute will have a default value as returned by the initializer of {@link Field#isStore() store}.
* @param store The value for store (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@CanIgnoreReturnValue
@JsonProperty("store")
@JsonView(Views.Elastic.class)
public final Builder store(@Nullable Boolean store) {
this.store = store;
optBits |= OPT_BIT_STORE;
return this;
}
/**
* Builds a new {@link ImmutableField ImmutableField}.
* @return An immutable instance of Field
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public ImmutableField build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new ImmutableField(this);
}
private boolean additionalTargetsIsSet() {
return (optBits & OPT_BIT_ADDITIONAL_TARGETS) != 0;
}
private boolean aliasesIsSet() {
return (optBits & OPT_BIT_ALIASES) != 0;
}
private boolean analyzerIsSet() {
return (optBits & OPT_BIT_ANALYZER) != 0;
}
private boolean copyToIsSet() {
return (optBits & OPT_BIT_COPY_TO) != 0;
}
private boolean excludePluginsIsSet() {
return (optBits & OPT_BIT_EXCLUDE_PLUGINS) != 0;
}
private boolean fieldsIsSet() {
return (optBits & OPT_BIT_FIELDS) != 0;
}
private boolean ignoreAboveIsSet() {
return (optBits & OPT_BIT_IGNORE_ABOVE) != 0;
}
private boolean includePluginsIsSet() {
return (optBits & OPT_BIT_INCLUDE_PLUGINS) != 0;
}
private boolean scalingFactorIsSet() {
return (optBits & OPT_BIT_SCALING_FACTOR) != 0;
}
private boolean tokenFiltersIsSet() {
return (optBits & OPT_BIT_TOKEN_FILTERS) != 0;
}
private boolean typeIsSet() {
return (optBits & OPT_BIT_TYPE) != 0;
}
private boolean docValuesIsSet() {
return (optBits & OPT_BIT_DOC_VALUES) != 0;
}
private boolean includeInAllIsSet() {
return (optBits & OPT_BIT_INCLUDE_IN_ALL) != 0;
}
private boolean indexIsSet() {
return (optBits & OPT_BIT_INDEX) != 0;
}
private boolean metaFieldIsSet() {
return (optBits & OPT_BIT_META_FIELD) != 0;
}
private boolean storeIsSet() {
return (optBits & OPT_BIT_STORE) != 0;
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_NAME) != 0) attributes.add("name");
return "Cannot build Field, some of required attributes are not set " + attributes;
}
}
}