Package org.apache.hadoop.hbase.types
This package provides the definition and implementation of HBase's
extensible data type API. DataType
is the entry point. Basic type implementations are provided based on two
different encoding schemes: the Raw* implementations use the
toXXX methods in Bytes and
the Ordered* implementations use the encoding scheme defined in
OrderedBytes. Complex types are also
supported in the form of Struct and
the abstract Union classes.
DataType implementations are used to
convert a POJO into a byte[] while maintaining application-level
constraints over the values produces and consumed. They also provide hints
to consumers about the nature of encoded values as well as the relationship
between different instances. See the class comments on
DataType for details.
The DataType interface is primarily
of use for creating rowkeys and column qualifiers. It can also be used as a
an encoder for primitive values. It does not support concerns of complex
object serialization, concepts like schema version and migration. These
concepts are handled more thoroughly by tools like Thrift, Avro, and
Protobuf.
- Since:
- 0.95.2
-
ClassDescriptionCopyOnWriteArrayMap<K,
V> A Map that keeps a sorted array in order to provide the concurrent map interface.DataType<T>DataTypeis the base class for all HBase data types.Wraps an existingDataTypeimplementation as a fixed-length version of itself.Abyte[]of variable-length.An alternative toOrderedBlobfor use byStructfields that do not terminate the fields list.Base class for data types backed by theOrderedBytesencoding implementations.Afloatof 32-bits using a fixed-length encoding.Adoubleof 64-bits using a fixed-length encoding.Ashortof 16-bits using a fixed-length encoding.Anintof 32-bits using a fixed-length encoding.Alongof 64-bits using a fixed-length encoding.Abyteof 8-bits using a fixed-length encoding.AnNumberof arbitrary precision and variable-length encoding.AStringof variable-length.An example for using protobuf objects withDataTypeAPI.PBType<T extends org.apache.hbase.thirdparty.com.google.protobuf.Message>A base-class forDataTypeimplementations backed by protobuf.AnDataTypefor interacting with values encoded usingBytes.putByte(byte[], int, byte).AnDataTypefor interacting with variable-length values encoded usingBytes.putBytes(byte[], int, byte[], int, int).AnDataTypethat encodes fixed-length values encoded usingBytes.putBytes(byte[], int, byte[], int, int).AnDataTypethat encodes variable-length values encoded usingBytes.putBytes(byte[], int, byte[], int, int).AnDataTypefor interacting with values encoded usingBytes.putDouble(byte[], int, double).AnDataTypefor interacting with values encoded usingBytes.putFloat(byte[], int, float).AnDataTypefor interacting with values encoded usingBytes.putInt(byte[], int, int).AnDataTypefor interacting with values encoded usingBytes.putLong(byte[], int, long).AnDataTypefor interacting with values encoded usingBytes.putShort(byte[], int, short).AnDataTypefor interacting with values encoded usingBytes.toBytes(String).AnDataTypethat encodes fixed-length values encoded usingBytes.toBytes(String).AnDataTypethat encodes variable-length values encoded usingBytes.toBytes(String).Structis a simpleDataTypefor implementing "compound rowkey" and "compound qualifier" schema design strategies.A helper for buildingStructinstances.AnIteratorover encodedStructmembers.Wraps an existingDataTypeimplementation as a terminated version of itself.Union2<A,B> Union3<A,B, C> TheUnionfamily ofDataTypes encode one of a fixed collection of Objects.Union4<A,B, C, D> TheUnionfamily ofDataTypes encode one of a fixed collection of Objects.