HBASE-24163 MOB compactor implementations should use format specifiers when calling...
[hbase.git] / hbase-common / src / main / java / org / apache / hadoop / hbase / RawCell.java
blobea598d21ca3b15d4ec31d55c68d086600eb7cd1a
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org.apache.hadoop.hbase;
20 import java.util.Iterator;
21 import java.util.Optional;
23 import org.apache.yetus.audience.InterfaceAudience;
25 /**
26 * An extended version of cell that gives more power to CPs
28 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
29 public interface RawCell extends Cell {
30 static final int MAX_TAGS_LENGTH = (2 * Short.MAX_VALUE) + 1;
32 /**
33 * Allows cloning the tags in the cell to a new byte[]
34 * @return the byte[] having the tags
36 default byte[] cloneTags() {
37 return PrivateCellUtil.cloneTags(this);
40 /**
41 * Creates a list of tags in the current cell
42 * @return a list of tags
44 default Iterator<Tag> getTags() {
45 return PrivateCellUtil.tagsIterator(this);
48 /**
49 * Returns the specific tag of the given type
50 * @param type the type of the tag
51 * @return the specific tag if available or null
53 default Optional<Tag> getTag(byte type) {
54 return PrivateCellUtil.getTag(this, type);
57 /**
58 * Check the length of tags. If it is invalid, throw IllegalArgumentException
59 * @param tagsLength the given length of tags
60 * @throws IllegalArgumentException if tagslength is invalid
62 public static void checkForTagsLength(int tagsLength) {
63 if (tagsLength > MAX_TAGS_LENGTH) {
64 throw new IllegalArgumentException("tagslength " + tagsLength + " > " + MAX_TAGS_LENGTH);