joshelser commented on a change in pull request #1648: URL: https://github.com/apache/hbase/pull/1648#discussion_r433439130
########## File path: hbase-client/src/main/java/org/apache/hadoop/hbase/client/CheckAndMutate.java ########## @@ -0,0 +1,360 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.client; + +import java.util.Collections; +import java.util.List; +import java.util.NavigableMap; +import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.CellBuilder; +import org.apache.hadoop.hbase.CellBuilderType; +import org.apache.hadoop.hbase.CompareOperator; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.filter.Filter; +import org.apache.hadoop.hbase.io.TimeRange; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.yetus.audience.InterfaceAudience; +import org.apache.yetus.audience.InterfaceStability; +import org.apache.hbase.thirdparty.com.google.common.base.Preconditions; + +/** + * Used to perform CheckAndMutate operations. Currently {@link Put}, {@link Delete} + * and {@link RowMutations} are supported. + * <p> + * Use the builder class to instantiate a CheckAndMutate object. + * This builder class is fluent style APIs, the code are like: + * <pre> + * <code> + * // 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); + * </code> + * </pre> + */ [email protected] [email protected] +public final class CheckAndMutate extends Mutation { + + /** + * A builder class for building a CheckAndMutate object. + */ + public static final class Builder { Review comment: Best practice to have interface audience/stability here too, I think. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
