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

com.algolia.search.models.indexing.BatchOperation Maven / Gradle / Ivy

There is a newer version: 3.16.9
Show newest version
package com.algolia.search.models.indexing;

import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import javax.annotation.Nonnull;

@JsonInclude(JsonInclude.Include.NON_NULL)
@SuppressWarnings({"unused", "WeakerAccess"})
public class BatchOperation implements Serializable {

  public static  BatchOperation createAddObject(@Nonnull T body) {
    return new BatchOperation<>(ActionEnum.ADD_OBJECT, body);
  }

  public static  BatchOperation createUpdateObject(@Nonnull T body) {
    return new BatchOperation<>(ActionEnum.UPDATE_OBJECT, body);
  }

  public static  BatchOperation createPartialUpdateObject(@Nonnull T body) {
    return new BatchOperation<>(ActionEnum.PARTIAL_UPDATE_OBJECT, body);
  }

  public static  BatchOperation createPartialUpdateObjectNoCreate(@Nonnull T body) {
    return new BatchOperation<>(ActionEnum.PARTIAL_UPDATE_OBJECT_NO_CREATE, body);
  }

  public static  BatchOperation createDeleteObject(@Nonnull T body) {
    return new BatchOperation<>(ActionEnum.DELETE_OBJECT, body);
  }

  public static  BatchOperation createDelete(@Nonnull T body) {
    return new BatchOperation<>(ActionEnum.DELETE, body);
  }

  public BatchOperation(String indexName, String action, T body) {
    this.action = action;
    this.indexName = indexName;
    this.body = body;
  }

  public BatchOperation(String indexName, String action) {
    this.action = action;
    this.indexName = indexName;
  }

  public BatchOperation(String action, T body) {
    this.action = action;
    this.body = body;
  }

  public String getAction() {
    return action;
  }

  public BatchOperation setAction(String action) {
    this.action = action;
    return this;
  }

  public String getIndexName() {
    return indexName;
  }

  public BatchOperation setIndexName(String indexName) {
    this.indexName = indexName;
    return this;
  }

  public T getBody() {
    return body;
  }

  public BatchOperation setBody(T body) {
    this.body = body;
    return this;
  }

  private String action;
  private String indexName;
  private T body;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy