コード例 #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;
 }
コード例 #2
0
ファイル: CassandraUtils.java プロジェクト: forjsharp/archiva
  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());
  }