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

com.scalar.database.api.PutIfNotExists Maven / Gradle / Ivy

Go to download

A universal transaction manager that achieves database-agnostic transactions and distributed transactions that span multiple databases

There is a newer version: 3.14.0-alpha.1
Show newest version
package com.scalar.database.api;

import com.scalar.database.io.Value;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;

/**
 * An optional parameter of {@link Put} for conditional put. {@link Put} with this condition makes
 * the operation take effect only if a specified entry does not exist.
 *
 * @author Hiroyuki Yamada
 */
@Immutable
public class PutIfNotExists implements MutationCondition {

  public PutIfNotExists() {}

  /**
   * Returns an empty list of {@link Value}s since any conditions are not given to this object.
   *
   * @return an empty list of {@code Value}s
   */
  @Override
  @Nonnull
  public List getExpressions() {
    return Collections.emptyList();
  }

  @Override
  public void accept(MutationConditionVisitor visitor) {
    visitor.visit(this);
  }

  /**
   * Indicates whether some other object is "equal to" this object. The other object is considered
   * equal if:
   *
   * 
    *
  • it is also an {@code PutIfNotExists} *
* * @param o an object to be tested for equality * @return {@code true} if the other object is "equal to" this object otherwise {@code false} */ @Override public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof PutIfNotExists)) { return false; } return true; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy