org.apache.hadoop.hbase.rest.model
Class CellModel

java.lang.Object
  extended by org.apache.hadoop.hbase.rest.model.CellModel
All Implemented Interfaces:
Serializable, ProtobufMessageHandler

public class CellModel
extends Object
implements ProtobufMessageHandler, Serializable

Representation of a cell. A cell is a single value associated a column and optional qualifier, and either the timestamp when it was stored or the user- provided timestamp if one was explicitly supplied.

 <complexType name="Cell">
   <sequence>
     <element name="value" maxOccurs="1" minOccurs="1">
       <simpleType>
         <restriction base="base64Binary"/>
       </simpleType>
     </element>
   </sequence>
   <attribute name="column" type="base64Binary" />
   <attribute name="timestamp" type="int" />
 </complexType>
 

See Also:
Serialized Form

Constructor Summary
CellModel()
          Default constructor
CellModel(byte[] column, byte[] value)
          Constructor
CellModel(byte[] column, byte[] qualifier, byte[] value)
          Constructor
CellModel(byte[] column, byte[] qualifier, long timestamp, byte[] value)
          Constructor
CellModel(byte[] column, long timestamp, byte[] value)
          Constructor
CellModel(KeyValue kv)
          Constructor from KeyValue
 
Method Summary
 byte[] createProtobufOutput()
           
 byte[] getColumn()
           
 ProtobufMessageHandler getObjectFromMessage(byte[] message)
          Initialize the model from a protobuf representation.
 long getTimestamp()
           
 byte[] getValue()
           
 boolean hasUserTimestamp()
           
 void setColumn(byte[] column)
           
 void setTimestamp(long timestamp)
           
 void setValue(byte[] value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CellModel

public CellModel()
Default constructor


CellModel

public CellModel(byte[] column,
                 byte[] value)
Constructor

Parameters:
column -
value -

CellModel

public CellModel(byte[] column,
                 byte[] qualifier,
                 byte[] value)
Constructor

Parameters:
column -
qualifier -
value -

CellModel

public CellModel(KeyValue kv)
Constructor from KeyValue

Parameters:
kv -

CellModel

public CellModel(byte[] column,
                 long timestamp,
                 byte[] value)
Constructor

Parameters:
column -
timestamp -
value -

CellModel

public CellModel(byte[] column,
                 byte[] qualifier,
                 long timestamp,
                 byte[] value)
Constructor

Parameters:
column -
qualifier -
timestamp -
value -
Method Detail

getColumn

public byte[] getColumn()
Returns:
the column

setColumn

public void setColumn(byte[] column)
Parameters:
column - the column to set

hasUserTimestamp

public boolean hasUserTimestamp()
Returns:
true if the timestamp property has been specified by the user

getTimestamp

public long getTimestamp()
Returns:
the timestamp

setTimestamp

public void setTimestamp(long timestamp)
Parameters:
timestamp - the timestamp to set

getValue

public byte[] getValue()
Returns:
the value

setValue

public void setValue(byte[] value)
Parameters:
value - the value to set

createProtobufOutput

public byte[] createProtobufOutput()
Specified by:
createProtobufOutput in interface ProtobufMessageHandler
Returns:
the protobuf represention of the model

getObjectFromMessage

public ProtobufMessageHandler getObjectFromMessage(byte[] message)
                                            throws IOException
Description copied from interface: ProtobufMessageHandler
Initialize the model from a protobuf representation.

Specified by:
getObjectFromMessage in interface ProtobufMessageHandler
Parameters:
message - the raw bytes of the protobuf message
Returns:
reference to self for convenience
Throws:
IOException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.