Esempio n. 1
0
  public Date getDate(int i) {
    metadata.checkType(i, DataType.Name.TIMESTAMP);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return null;

    return DateType.instance.compose(value);
  }
Esempio n. 2
0
  public int getInt(int i) {
    metadata.checkType(i, DataType.Name.INT);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return 0;

    return Int32Type.instance.compose(value);
  }
Esempio n. 3
0
  public long getLong(int i) {
    metadata.checkType(i, DataType.Name.BIGINT, DataType.Name.COUNTER);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return 0L;

    return LongType.instance.compose(value);
  }
Esempio n. 4
0
  public InetAddress getInet(int i) {
    metadata.checkType(i, DataType.Name.INET);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return null;

    return InetAddressType.instance.compose(value);
  }
Esempio n. 5
0
  public boolean getBool(int i) {
    metadata.checkType(i, DataType.Name.BOOLEAN);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return false;

    return BooleanType.instance.compose(value);
  }
Esempio n. 6
0
  public BigDecimal getDecimal(int i) {
    metadata.checkType(i, DataType.Name.DECIMAL);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return null;

    return DecimalType.instance.compose(value);
  }
Esempio n. 7
0
  public BigInteger getVarint(int i) {
    metadata.checkType(i, DataType.Name.VARINT);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return null;

    return IntegerType.instance.compose(value);
  }
Esempio n. 8
0
  public double getDouble(int i) {
    metadata.checkType(i, DataType.Name.DOUBLE);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return 0.0;

    return DoubleType.instance.compose(value);
  }
Esempio n. 9
0
  public float getFloat(int i) {
    metadata.checkType(i, DataType.Name.FLOAT);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return 0.0f;

    return FloatType.instance.compose(value);
  }
Esempio n. 10
0
  public UUID getUUID(int i) {
    DataType.Name type = metadata.checkType(i, DataType.Name.UUID, DataType.Name.TIMEUUID);

    ByteBuffer value = data.get(i);
    if (value == null || value.remaining() == 0) return null;

    return type == DataType.Name.UUID
        ? UUIDType.instance.compose(value)
        : TimeUUIDType.instance.compose(value);
  }
Esempio n. 11
0
  public String getString(int i) {
    DataType.Name type =
        metadata.checkType(i, DataType.Name.VARCHAR, DataType.Name.TEXT, DataType.Name.ASCII);

    ByteBuffer value = data.get(i);
    if (value == null) return null;

    return type == DataType.Name.ASCII
        ? AsciiType.instance.compose(value)
        : UTF8Type.instance.compose(value);
  }
Esempio n. 12
0
 public ByteBuffer getBytes(int i) {
   metadata.checkType(i, DataType.Name.BLOB);
   return getBytesUnsafe(i);
 }