Ejemplo n.º 1
0
 public static Object getOriginalValueFromColumnValue(
     ByteBuffer byteBuffer, AttributeType attributeType) throws IOException {
   switch (attributeType) {
     case BOOL:
       {
         return booleanSerializer.fromByteBuffer(byteBuffer);
       }
     case INT:
       {
         return integerSerializer.fromByteBuffer(byteBuffer);
       }
     case DOUBLE:
       {
         return doubleSerializer.fromByteBuffer(byteBuffer);
       }
     case FLOAT:
       {
         return floatSerializer.fromByteBuffer(byteBuffer);
       }
     case LONG:
       {
         return longSerializer.fromByteBuffer(byteBuffer);
       }
     case STRING:
       {
         return stringSerializer.fromByteBuffer(byteBuffer);
       }
   }
   return null;
 }
Ejemplo n.º 2
0
  public static Long getAsLongValue(ColumnSlice<String, String> columnSlice, String columnName) {
    LongSerializer ls = LongSerializer.get();
    if (StringUtils.isEmpty(columnName)) {
      return null;
    }

    HColumn<String, String> hColumn = columnSlice.getColumnByName(columnName);
    return hColumn == null ? null : ls.fromByteBuffer(hColumn.getValueBytes());
  }