Class CheckAndMutate

java.lang.Object
org.apache.hadoop.hbase.client.CheckAndMutate
All Implemented Interfaces:
Comparable<org.apache.hadoop.hbase.client.Row>, org.apache.hadoop.hbase.client.Row

@Public @Evolving public final class CheckAndMutate extends Object implements org.apache.hadoop.hbase.client.Row
Used to perform CheckAndMutate operations.

Use the builder class to instantiate a CheckAndMutate object. This builder class is fluent style APIs, the code are like:

 
 // A CheckAndMutate operation where do the specified action if the column (specified by the
 // family and the qualifier) of the row equals to the specified value
 CheckAndMutate checkAndMutate = CheckAndMutate.newBuilder(row)
   .ifEquals(family, qualifier, value)
   .build(put);

 // A CheckAndMutate operation where do the specified action if the column (specified by the
 // family and the qualifier) of the row doesn't exist
 CheckAndMutate checkAndMutate = CheckAndMutate.newBuilder(row)
   .ifNotExists(family, qualifier)
   .build(put);

 // A CheckAndMutate operation where do the specified action if the row matches the filter
 CheckAndMutate checkAndMutate = CheckAndMutate.newBuilder(row)
   .ifMatches(filter)
   .build(delete);
 
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A builder class for building a CheckAndMutate object.
  • Field Summary

    Fields inherited from interface org.apache.hadoop.hbase.client.Row

    COMPARATOR
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(org.apache.hadoop.hbase.client.Row row)
    Compare this row to another row.
    boolean
     
    org.apache.hadoop.hbase.client.Row
    Returns the action done if check succeeds
    org.apache.hadoop.hbase.CompareOperator
    Returns the comparison operator
    byte[]
    Returns the family to check
    org.apache.hadoop.hbase.filter.Filter
    Returns the filter to check
    byte[]
    Returns the qualifier to check
    byte[]
    Returns the row
    org.apache.hadoop.hbase.io.TimeRange
    Returns the time range to check
    byte[]
    Returns the expected value
    boolean
    Returns whether this has a filter or not
    int
     
    newBuilder(byte[] row)
    returns a builder object to build a CheckAndMutate object

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newBuilder

      public static CheckAndMutate.Builder newBuilder(byte[] row)
      returns a builder object to build a CheckAndMutate object
      Parameters:
      row - row
      Returns:
      a builder object
    • getRow

      public byte[] getRow()
      Returns the row
      Specified by:
      getRow in interface org.apache.hadoop.hbase.client.Row
    • compareTo

      public int compareTo(org.apache.hadoop.hbase.client.Row row)
      Description copied from interface: org.apache.hadoop.hbase.client.Row
      Compare this row to another row.
      Specified by:
      compareTo in interface Comparable<org.apache.hadoop.hbase.client.Row>
      Specified by:
      compareTo in interface org.apache.hadoop.hbase.client.Row
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getFamily

      public byte[] getFamily()
      Returns the family to check
    • getQualifier

      public byte[] getQualifier()
      Returns the qualifier to check
    • getCompareOp

      public org.apache.hadoop.hbase.CompareOperator getCompareOp()
      Returns the comparison operator
    • getValue

      public byte[] getValue()
      Returns the expected value
    • getFilter

      public org.apache.hadoop.hbase.filter.Filter getFilter()
      Returns the filter to check
    • hasFilter

      public boolean hasFilter()
      Returns whether this has a filter or not
    • getTimeRange

      public org.apache.hadoop.hbase.io.TimeRange getTimeRange()
      Returns the time range to check
    • getAction

      public org.apache.hadoop.hbase.client.Row getAction()
      Returns the action done if check succeeds