HBASE-23892 SecureTestCluster should allow its subclasses to pass their Class referen...
[hbase.git] / hbase-common / src / main / java / org / apache / hadoop / hbase / CellBuilderFactory.java
blob6878ac6841c179fe99eb6111024eb9d4888b479f
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.
19 package org.apache.hadoop.hbase;
21 import org.apache.yetus.audience.InterfaceAudience;
23 /**
24 * Create a CellBuilder instance. Currently, we have two kinds of Cell Builder.
25 * {@link CellBuilderType#DEEP_COPY} All bytes array passed into builder will be copied to build an new Cell.
26 * The cell impl is {@link org.apache.hadoop.hbase.KeyValue}
27 * {@link CellBuilderType#SHALLOW_COPY} Just copy the references of passed bytes array to build an new Cell
28 * The cell impl is {@link org.apache.hadoop.hbase.IndividualBytesFieldCell}
29 * NOTE: The cell impl may be changed in the future. The user application SHOULD NOT depend on any concrete cell impl.
31 @InterfaceAudience.Public
32 public final class CellBuilderFactory {
34 /**
35 * Create a CellBuilder instance.
36 * @param type indicates which memory copy is used in building cell.
37 * @return An new CellBuilder
39 public static CellBuilder create(CellBuilderType type) {
40 switch (type) {
41 case SHALLOW_COPY:
42 return new IndividualBytesFieldCellBuilder();
43 case DEEP_COPY:
44 return new KeyValueBuilder();
45 default:
46 throw new UnsupportedOperationException("The type:" + type + " is unsupported");
50 private CellBuilderFactory(){