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

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

The newest version!
package com.algolia.search.models.indexing;

import com.fasterxml.jackson.annotation.JsonProperty;

public class PartialUpdateOperation {

  @JsonProperty("_operation")
  private String operation;

  @JsonProperty("value")
  private T value;

  public PartialUpdateOperation(String operation, T value) {
    this.operation = operation;
    this.value = value;
  }

  public String getOperation() {
    return operation;
  }

  public void setOperation(String operation) {
    this.operation = operation;
  }

  public T getValue() {
    return value;
  }

  public void setValue(T value) {
    this.value = value;
  }

  public static PartialUpdateOperation increment(Integer value) {
    return new PartialUpdateOperation<>(PartialUpdateOperationType.INCREMENT, value);
  }

  public static PartialUpdateOperation incrementFrom(Integer value) {
    return new PartialUpdateOperation<>(PartialUpdateOperationType.INCREMENT_FROM, value);
  }

  public static PartialUpdateOperation incrementSet(Integer value) {
    return new PartialUpdateOperation<>(PartialUpdateOperationType.INCREMENT_SET, value);
  }

  public static PartialUpdateOperation decrement(Integer value) {
    return new PartialUpdateOperation<>(PartialUpdateOperationType.DECREMENT, value);
  }

  public static  PartialUpdateOperation add(T value) {
    return new PartialUpdateOperation<>(PartialUpdateOperationType.ADD, value);
  }

  public static  PartialUpdateOperation addUnique(T value) {
    return new PartialUpdateOperation<>(PartialUpdateOperationType.ADD_UNIQUE, value);
  }

  public static  PartialUpdateOperation remove(T value) {
    return new PartialUpdateOperation<>(PartialUpdateOperationType.REMOVE, value);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy