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

com.scalar.db.api.DeleteIfExists Maven / Gradle / Ivy

Go to download

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

The newest version!
package com.scalar.db.api;

import com.google.common.base.MoreObjects;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;

/**
 * An optional parameter of {@link Delete} for conditional delete. {@link Delete} with this
 * condition makes the operation take effect only if a specified entry exists.
 *
 * @author Hiroyuki Yamada
 */
@Immutable
public class DeleteIfExists implements MutationCondition {

  /**
   * @deprecated As of release 3.6.0. Will be removed in release 5.0.0. Use {@link ConditionBuilder}
   *     to build a condition instead
   */
  @Deprecated
  public DeleteIfExists() {}

  /**
   * Returns an empty list of {@link ConditionalExpression}s since any conditions are not given to
   * this object.
   *
   * @return an empty list of {@code ConditionalExpression}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 DeleteIfExists} *
* * @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; } return o instanceof DeleteIfExists; } @Override public int hashCode() { return DeleteIfExists.class.hashCode(); } @Override public String toString() { return MoreObjects.toStringHelper(this).toString(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy