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

com.arakelian.elastic.bulk.ImmutableSimpleBulkOperationFactory Maven / Gradle / Ivy

package com.arakelian.elastic.bulk;

import com.arakelian.core.feature.Nullable;
import com.arakelian.elastic.doc.ElasticDocBuilder;
import com.arakelian.elastic.model.Index;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.MoreObjects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.Var;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;
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 SimpleBulkOperationFactory}.
 * 

* Use the builder to create immutable instances: * {@code ImmutableSimpleBulkOperationFactory.builder()}. */ @Generated(from = "SimpleBulkOperationFactory", generator = "Immutables") @SuppressWarnings({"all"}) @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableSimpleBulkOperationFactory extends SimpleBulkOperationFactory { private final Function deleteVersion; private final Class documentClass; private final @Nullable ElasticDocBuilder elasticDocBuilder; private final Function fromCharSequence; private final Function fromJsonNode; private final Function id; private final Index index; private final Function json; private final Predicate predicate; private final Function type; private final Function version; private ImmutableSimpleBulkOperationFactory(ImmutableSimpleBulkOperationFactory.Builder builder) { this.documentClass = builder.documentClass; this.elasticDocBuilder = builder.elasticDocBuilder; this.id = builder.id; this.index = builder.index; this.version = builder.version; if (builder.deleteVersion != null) { initShim.deleteVersion(builder.deleteVersion); } if (builder.fromCharSequence != null) { initShim.fromCharSequence(builder.fromCharSequence); } if (builder.fromJsonNode != null) { initShim.fromJsonNode(builder.fromJsonNode); } if (builder.json != null) { initShim.json(builder.json); } if (builder.predicate != null) { initShim.predicate(builder.predicate); } if (builder.type != null) { initShim.type(builder.type); } this.deleteVersion = initShim.getDeleteVersion(); this.fromCharSequence = initShim.getFromCharSequence(); this.fromJsonNode = initShim.getFromJsonNode(); this.json = initShim.getJson(); this.predicate = initShim.getPredicate(); this.type = initShim.getType(); this.initShim = null; } private ImmutableSimpleBulkOperationFactory( Function deleteVersion, Class documentClass, @Nullable ElasticDocBuilder elasticDocBuilder, Function fromCharSequence, Function fromJsonNode, Function id, Index index, Function json, Predicate predicate, Function type, Function version) { this.deleteVersion = deleteVersion; this.documentClass = documentClass; this.elasticDocBuilder = elasticDocBuilder; this.fromCharSequence = fromCharSequence; this.fromJsonNode = fromJsonNode; this.id = id; this.index = index; this.json = json; this.predicate = predicate; this.type = type; this.version = version; 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 = "SimpleBulkOperationFactory", generator = "Immutables") private final class InitShim { private byte deleteVersionBuildStage = STAGE_UNINITIALIZED; private Function deleteVersion; Function getDeleteVersion() { if (deleteVersionBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (deleteVersionBuildStage == STAGE_UNINITIALIZED) { deleteVersionBuildStage = STAGE_INITIALIZING; this.deleteVersion = Objects.requireNonNull(ImmutableSimpleBulkOperationFactory.super.getDeleteVersion(), "deleteVersion"); deleteVersionBuildStage = STAGE_INITIALIZED; } return this.deleteVersion; } void deleteVersion(Function deleteVersion) { this.deleteVersion = deleteVersion; deleteVersionBuildStage = STAGE_INITIALIZED; } private byte fromCharSequenceBuildStage = STAGE_UNINITIALIZED; private Function fromCharSequence; Function getFromCharSequence() { if (fromCharSequenceBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (fromCharSequenceBuildStage == STAGE_UNINITIALIZED) { fromCharSequenceBuildStage = STAGE_INITIALIZING; this.fromCharSequence = Objects.requireNonNull(ImmutableSimpleBulkOperationFactory.super.getFromCharSequence(), "fromCharSequence"); fromCharSequenceBuildStage = STAGE_INITIALIZED; } return this.fromCharSequence; } void fromCharSequence(Function fromCharSequence) { this.fromCharSequence = fromCharSequence; fromCharSequenceBuildStage = STAGE_INITIALIZED; } private byte fromJsonNodeBuildStage = STAGE_UNINITIALIZED; private Function fromJsonNode; Function getFromJsonNode() { if (fromJsonNodeBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (fromJsonNodeBuildStage == STAGE_UNINITIALIZED) { fromJsonNodeBuildStage = STAGE_INITIALIZING; this.fromJsonNode = Objects.requireNonNull(ImmutableSimpleBulkOperationFactory.super.getFromJsonNode(), "fromJsonNode"); fromJsonNodeBuildStage = STAGE_INITIALIZED; } return this.fromJsonNode; } void fromJsonNode(Function fromJsonNode) { this.fromJsonNode = fromJsonNode; fromJsonNodeBuildStage = STAGE_INITIALIZED; } private byte jsonBuildStage = STAGE_UNINITIALIZED; private Function json; Function getJson() { if (jsonBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (jsonBuildStage == STAGE_UNINITIALIZED) { jsonBuildStage = STAGE_INITIALIZING; this.json = Objects.requireNonNull(ImmutableSimpleBulkOperationFactory.super.getJson(), "json"); jsonBuildStage = STAGE_INITIALIZED; } return this.json; } void json(Function json) { this.json = json; jsonBuildStage = STAGE_INITIALIZED; } private byte predicateBuildStage = STAGE_UNINITIALIZED; private Predicate predicate; Predicate getPredicate() { if (predicateBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (predicateBuildStage == STAGE_UNINITIALIZED) { predicateBuildStage = STAGE_INITIALIZING; this.predicate = Objects.requireNonNull(ImmutableSimpleBulkOperationFactory.super.getPredicate(), "predicate"); predicateBuildStage = STAGE_INITIALIZED; } return this.predicate; } void predicate(Predicate predicate) { this.predicate = predicate; predicateBuildStage = STAGE_INITIALIZED; } private byte typeBuildStage = STAGE_UNINITIALIZED; private Function type; Function getType() { if (typeBuildStage == STAGE_INITIALIZING) throw new IllegalStateException(formatInitCycleMessage()); if (typeBuildStage == STAGE_UNINITIALIZED) { typeBuildStage = STAGE_INITIALIZING; this.type = Objects.requireNonNull(ImmutableSimpleBulkOperationFactory.super.getType(), "type"); typeBuildStage = STAGE_INITIALIZED; } return this.type; } void type(Function type) { this.type = type; typeBuildStage = STAGE_INITIALIZED; } private String formatInitCycleMessage() { List attributes = new ArrayList<>(); if (deleteVersionBuildStage == STAGE_INITIALIZING) attributes.add("deleteVersion"); if (fromCharSequenceBuildStage == STAGE_INITIALIZING) attributes.add("fromCharSequence"); if (fromJsonNodeBuildStage == STAGE_INITIALIZING) attributes.add("fromJsonNode"); if (jsonBuildStage == STAGE_INITIALIZING) attributes.add("json"); if (predicateBuildStage == STAGE_INITIALIZING) attributes.add("predicate"); if (typeBuildStage == STAGE_INITIALIZING) attributes.add("type"); return "Cannot build SimpleBulkOperationFactory, attribute initializers form cycle " + attributes; } } /** * Returns the date that we should use as delete version passed to Elastic. * @return date that we should use as delete version */ @Override public Function getDeleteVersion() { InitShim shim = this.initShim; return shim != null ? shim.getDeleteVersion() : this.deleteVersion; } /** * @return The value of the {@code documentClass} attribute */ @Override public Class getDocumentClass() { return documentClass; } /** * @return The value of the {@code elasticDocBuilder} attribute */ @Override public @Nullable ElasticDocBuilder getElasticDocBuilder() { return elasticDocBuilder; } /** * @return The value of the {@code fromCharSequence} attribute */ @Override public Function getFromCharSequence() { InitShim shim = this.initShim; return shim != null ? shim.getFromCharSequence() : this.fromCharSequence; } /** * @return The value of the {@code fromJsonNode} attribute */ @Override public Function getFromJsonNode() { InitShim shim = this.initShim; return shim != null ? shim.getFromJsonNode() : this.fromJsonNode; } /** * @return The value of the {@code id} attribute */ @Override public Function getId() { return id; } /** * @return The value of the {@code index} attribute */ @Override public Index getIndex() { return index; } /** * @return The value of the {@code json} attribute */ @Override public Function getJson() { InitShim shim = this.initShim; return shim != null ? shim.getJson() : this.json; } /** * @return The value of the {@code predicate} attribute */ @Override public Predicate getPredicate() { InitShim shim = this.initShim; return shim != null ? shim.getPredicate() : this.predicate; } /** * @return The value of the {@code type} attribute */ @Override public Function getType() { InitShim shim = this.initShim; return shim != null ? shim.getType() : this.type; } /** * Returns the date that we should use as index version passed to Elastic. * @return date that we should use as index version */ @Override public Function getVersion() { return version; } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getDeleteVersion() deleteVersion} 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 deleteVersion * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withDeleteVersion(Function value) { if (this.deleteVersion == value) return this; Function newValue = Objects.requireNonNull(value, "deleteVersion"); return new ImmutableSimpleBulkOperationFactory<>( newValue, this.documentClass, this.elasticDocBuilder, this.fromCharSequence, this.fromJsonNode, this.id, this.index, this.json, this.predicate, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getDocumentClass() documentClass} 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 documentClass * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withDocumentClass(Class value) { if (this.documentClass == value) return this; Class newValue = Objects.requireNonNull(value, "documentClass"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, newValue, this.elasticDocBuilder, this.fromCharSequence, this.fromJsonNode, this.id, this.index, this.json, this.predicate, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getElasticDocBuilder() elasticDocBuilder} 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 elasticDocBuilder (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withElasticDocBuilder(@Nullable ElasticDocBuilder value) { if (this.elasticDocBuilder == value) return this; return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, value, this.fromCharSequence, this.fromJsonNode, this.id, this.index, this.json, this.predicate, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getFromCharSequence() fromCharSequence} 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 fromCharSequence * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withFromCharSequence(Function value) { if (this.fromCharSequence == value) return this; Function newValue = Objects.requireNonNull(value, "fromCharSequence"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, this.elasticDocBuilder, newValue, this.fromJsonNode, this.id, this.index, this.json, this.predicate, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getFromJsonNode() fromJsonNode} 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 fromJsonNode * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withFromJsonNode(Function value) { if (this.fromJsonNode == value) return this; Function newValue = Objects.requireNonNull(value, "fromJsonNode"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, this.elasticDocBuilder, this.fromCharSequence, newValue, this.id, this.index, this.json, this.predicate, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getId() id} 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 id * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withId(Function value) { if (this.id == value) return this; Function newValue = Objects.requireNonNull(value, "id"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, this.elasticDocBuilder, this.fromCharSequence, this.fromJsonNode, newValue, this.index, this.json, this.predicate, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getIndex() index} 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 index * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withIndex(Index value) { if (this.index == value) return this; Index newValue = Objects.requireNonNull(value, "index"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, this.elasticDocBuilder, this.fromCharSequence, this.fromJsonNode, this.id, newValue, this.json, this.predicate, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getJson() json} 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 json * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withJson(Function value) { if (this.json == value) return this; Function newValue = Objects.requireNonNull(value, "json"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, this.elasticDocBuilder, this.fromCharSequence, this.fromJsonNode, this.id, this.index, newValue, this.predicate, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getPredicate() predicate} 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 predicate * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withPredicate(Predicate value) { if (this.predicate == value) return this; Predicate newValue = Objects.requireNonNull(value, "predicate"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, this.elasticDocBuilder, this.fromCharSequence, this.fromJsonNode, this.id, this.index, this.json, newValue, this.type, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getType() type} 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 type * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withType(Function value) { if (this.type == value) return this; Function newValue = Objects.requireNonNull(value, "type"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, this.elasticDocBuilder, this.fromCharSequence, this.fromJsonNode, this.id, this.index, this.json, this.predicate, newValue, this.version); } /** * Copy the current immutable object by setting a value for the {@link SimpleBulkOperationFactory#getVersion() version} 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 version * @return A modified copy of the {@code this} object */ public final ImmutableSimpleBulkOperationFactory withVersion(Function value) { if (this.version == value) return this; Function newValue = Objects.requireNonNull(value, "version"); return new ImmutableSimpleBulkOperationFactory<>( this.deleteVersion, this.documentClass, this.elasticDocBuilder, this.fromCharSequence, this.fromJsonNode, this.id, this.index, this.json, this.predicate, this.type, newValue); } /** * This instance is equal to all instances of {@code ImmutableSimpleBulkOperationFactory} 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 ImmutableSimpleBulkOperationFactory && equalTo((ImmutableSimpleBulkOperationFactory) another); } private boolean equalTo(ImmutableSimpleBulkOperationFactory another) { return deleteVersion.equals(another.deleteVersion) && documentClass.equals(another.documentClass) && Objects.equals(elasticDocBuilder, another.elasticDocBuilder) && fromCharSequence.equals(another.fromCharSequence) && fromJsonNode.equals(another.fromJsonNode) && id.equals(another.id) && index.equals(another.index) && json.equals(another.json) && predicate.equals(another.predicate) && type.equals(another.type) && version.equals(another.version); } /** * Computes a hash code from attributes: {@code deleteVersion}, {@code documentClass}, {@code elasticDocBuilder}, {@code fromCharSequence}, {@code fromJsonNode}, {@code id}, {@code index}, {@code json}, {@code predicate}, {@code type}, {@code version}. * @return hashCode value */ @Override public int hashCode() { @Var int h = 5381; h += (h << 5) + deleteVersion.hashCode(); h += (h << 5) + documentClass.hashCode(); h += (h << 5) + Objects.hashCode(elasticDocBuilder); h += (h << 5) + fromCharSequence.hashCode(); h += (h << 5) + fromJsonNode.hashCode(); h += (h << 5) + id.hashCode(); h += (h << 5) + index.hashCode(); h += (h << 5) + json.hashCode(); h += (h << 5) + predicate.hashCode(); h += (h << 5) + type.hashCode(); h += (h << 5) + version.hashCode(); return h; } /** * Prints the immutable value {@code SimpleBulkOperationFactory} with attribute values. * @return A string representation of the value */ @Override public String toString() { return MoreObjects.toStringHelper("SimpleBulkOperationFactory") .omitNullValues() .add("deleteVersion", deleteVersion) .add("documentClass", documentClass) .add("elasticDocBuilder", elasticDocBuilder) .add("fromCharSequence", fromCharSequence) .add("fromJsonNode", fromJsonNode) .add("id", id) .add("index", index) .add("json", json) .add("predicate", predicate) .add("type", type) .add("version", version) .toString(); } /** * Creates an immutable copy of a {@link SimpleBulkOperationFactory} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param generic parameter T * @param instance The instance to copy * @return A copied immutable SimpleBulkOperationFactory instance */ public static ImmutableSimpleBulkOperationFactory copyOf(SimpleBulkOperationFactory instance) { if (instance instanceof ImmutableSimpleBulkOperationFactory) { return (ImmutableSimpleBulkOperationFactory) instance; } return ImmutableSimpleBulkOperationFactory.builder() .from(instance) .build(); } /** * Creates a builder for {@link ImmutableSimpleBulkOperationFactory ImmutableSimpleBulkOperationFactory}. *

   * ImmutableSimpleBulkOperationFactory.&lt;T&gt;builder()
   *    .deleteVersion(function.Function&lt;T, java.time.ZonedDateTime&gt;) // optional {@link SimpleBulkOperationFactory#getDeleteVersion() deleteVersion}
   *    .documentClass(Class&lt;T&gt;) // required {@link SimpleBulkOperationFactory#getDocumentClass() documentClass}
   *    .elasticDocBuilder(com.arakelian.elastic.doc.ElasticDocBuilder | null) // nullable {@link SimpleBulkOperationFactory#getElasticDocBuilder() elasticDocBuilder}
   *    .fromCharSequence(function.Function&lt;CharSequence, CharSequence&gt;) // optional {@link SimpleBulkOperationFactory#getFromCharSequence() fromCharSequence}
   *    .fromJsonNode(function.Function&lt;com.fasterxml.jackson.databind.JsonNode, CharSequence&gt;) // optional {@link SimpleBulkOperationFactory#getFromJsonNode() fromJsonNode}
   *    .id(function.Function&lt;T, String&gt;) // required {@link SimpleBulkOperationFactory#getId() id}
   *    .index(com.arakelian.elastic.model.Index) // required {@link SimpleBulkOperationFactory#getIndex() index}
   *    .json(function.Function&lt;T, Object&gt;) // optional {@link SimpleBulkOperationFactory#getJson() json}
   *    .predicate(function.Predicate&lt;T&gt;) // optional {@link SimpleBulkOperationFactory#getPredicate() predicate}
   *    .type(function.Function&lt;T, String&gt;) // optional {@link SimpleBulkOperationFactory#getType() type}
   *    .version(function.Function&lt;T, java.time.ZonedDateTime&gt;) // required {@link SimpleBulkOperationFactory#getVersion() version}
   *    .build();
   * 
* @param generic parameter T * @return A new ImmutableSimpleBulkOperationFactory builder */ public static ImmutableSimpleBulkOperationFactory.Builder builder() { return new ImmutableSimpleBulkOperationFactory.Builder<>(); } /** * Builds instances of type {@link ImmutableSimpleBulkOperationFactory ImmutableSimpleBulkOperationFactory}. * 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 = "SimpleBulkOperationFactory", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_DOCUMENT_CLASS = 0x1L; private static final long INIT_BIT_ID = 0x2L; private static final long INIT_BIT_INDEX = 0x4L; private static final long INIT_BIT_VERSION = 0x8L; private long initBits = 0xfL; private @javax.annotation.Nullable Function deleteVersion; private @javax.annotation.Nullable Class documentClass; private @javax.annotation.Nullable ElasticDocBuilder elasticDocBuilder; private @javax.annotation.Nullable Function fromCharSequence; private @javax.annotation.Nullable Function fromJsonNode; private @javax.annotation.Nullable Function id; private @javax.annotation.Nullable Index index; private @javax.annotation.Nullable Function json; private @javax.annotation.Nullable Predicate predicate; private @javax.annotation.Nullable Function type; private @javax.annotation.Nullable Function version; private Builder() { } /** * Fill a builder with attribute values from the provided {@code SimpleBulkOperationFactory} 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(SimpleBulkOperationFactory instance) { Objects.requireNonNull(instance, "instance"); deleteVersion(instance.getDeleteVersion()); documentClass(instance.getDocumentClass()); ElasticDocBuilder elasticDocBuilderValue = instance.getElasticDocBuilder(); if (elasticDocBuilderValue != null) { elasticDocBuilder(elasticDocBuilderValue); } fromCharSequence(instance.getFromCharSequence()); fromJsonNode(instance.getFromJsonNode()); id(instance.getId()); index(instance.getIndex()); json(instance.getJson()); predicate(instance.getPredicate()); type(instance.getType()); version(instance.getVersion()); return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getDeleteVersion() deleteVersion} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link SimpleBulkOperationFactory#getDeleteVersion() deleteVersion}. * @param deleteVersion The value for deleteVersion * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder deleteVersion(Function deleteVersion) { this.deleteVersion = Objects.requireNonNull(deleteVersion, "deleteVersion"); return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getDocumentClass() documentClass} attribute. * @param documentClass The value for documentClass * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder documentClass(Class documentClass) { this.documentClass = Objects.requireNonNull(documentClass, "documentClass"); initBits &= ~INIT_BIT_DOCUMENT_CLASS; return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getElasticDocBuilder() elasticDocBuilder} attribute. * @param elasticDocBuilder The value for elasticDocBuilder (can be {@code null}) * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder elasticDocBuilder(@Nullable ElasticDocBuilder elasticDocBuilder) { this.elasticDocBuilder = elasticDocBuilder; return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getFromCharSequence() fromCharSequence} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link SimpleBulkOperationFactory#getFromCharSequence() fromCharSequence}. * @param fromCharSequence The value for fromCharSequence * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder fromCharSequence(Function fromCharSequence) { this.fromCharSequence = Objects.requireNonNull(fromCharSequence, "fromCharSequence"); return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getFromJsonNode() fromJsonNode} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link SimpleBulkOperationFactory#getFromJsonNode() fromJsonNode}. * @param fromJsonNode The value for fromJsonNode * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder fromJsonNode(Function fromJsonNode) { this.fromJsonNode = Objects.requireNonNull(fromJsonNode, "fromJsonNode"); return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getId() id} attribute. * @param id The value for id * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder id(Function id) { this.id = Objects.requireNonNull(id, "id"); initBits &= ~INIT_BIT_ID; return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getIndex() index} attribute. * @param index The value for index * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder index(Index index) { this.index = Objects.requireNonNull(index, "index"); initBits &= ~INIT_BIT_INDEX; return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getJson() json} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link SimpleBulkOperationFactory#getJson() json}. * @param json The value for json * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder json(Function json) { this.json = Objects.requireNonNull(json, "json"); return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getPredicate() predicate} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link SimpleBulkOperationFactory#getPredicate() predicate}. * @param predicate The value for predicate * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder predicate(Predicate predicate) { this.predicate = Objects.requireNonNull(predicate, "predicate"); return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getType() type} attribute. *

If not set, this attribute will have a default value as returned by the initializer of {@link SimpleBulkOperationFactory#getType() type}. * @param type The value for type * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder type(Function type) { this.type = Objects.requireNonNull(type, "type"); return this; } /** * Initializes the value for the {@link SimpleBulkOperationFactory#getVersion() version} attribute. * @param version The value for version * @return {@code this} builder for use in a chained invocation */ @CanIgnoreReturnValue public final Builder version(Function version) { this.version = Objects.requireNonNull(version, "version"); initBits &= ~INIT_BIT_VERSION; return this; } /** * Builds a new {@link ImmutableSimpleBulkOperationFactory ImmutableSimpleBulkOperationFactory}. * @return An immutable instance of SimpleBulkOperationFactory * @throws java.lang.IllegalStateException if any required attributes are missing */ public ImmutableSimpleBulkOperationFactory build() { if (initBits != 0) { throw new IllegalStateException(formatRequiredAttributesMessage()); } return new ImmutableSimpleBulkOperationFactory(this); } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if ((initBits & INIT_BIT_DOCUMENT_CLASS) != 0) attributes.add("documentClass"); if ((initBits & INIT_BIT_ID) != 0) attributes.add("id"); if ((initBits & INIT_BIT_INDEX) != 0) attributes.add("index"); if ((initBits & INIT_BIT_VERSION) != 0) attributes.add("version"); return "Cannot build SimpleBulkOperationFactory, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy