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 TypeCodec.LongCodec.instance.deserializeNoBoxing(value); }
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 TypeCodec.DecimalCodec.instance.deserialize(value); }
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 TypeCodec.IntCodec.instance.deserializeNoBoxing(value); }
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 TypeCodec.FloatCodec.instance.deserializeNoBoxing(value); }
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 TypeCodec.InetCodec.instance.deserialize(value); }
public ByteBuffer getBytes(int i) { metadata.checkType(i, DataType.Name.BLOB); return getBytesUnsafe(i); }
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 TypeCodec.DateCodec.instance.deserialize(value); }
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 TypeCodec.BooleanCodec.instance.deserializeNoBoxing(value); }
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 TypeCodec.DoubleCodec.instance.deserializeNoBoxing(value); }
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 TypeCodec.BigIntegerCodec.instance.deserialize(value); }
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 ? TypeCodec.UUIDCodec.instance.deserialize(value) : TypeCodec.TimeUUIDCodec.instance.deserialize(value); }
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 ? TypeCodec.StringCodec.asciiInstance.deserialize(value) : TypeCodec.StringCodec.utf8Instance.deserialize(value); }
/** * Sets the {@code i}th value to the provided boolean. * * @param i the index of the variable to set. * @param v the value to set. * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type BOOLEAN. */ public BoundStatement setBool(int i, boolean v) { metadata().checkType(i, DataType.Name.BOOLEAN); return setValue(i, TypeCodec.BooleanCodec.instance.serializeNoBoxing(v)); }
/** * Set the {@code i}th value to the provided date. * * @param i the index of the variable to set. * @param v the value to set. * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type TIMESTAMP. */ public BoundStatement setDate(int i, Date v) { metadata().checkType(i, DataType.Name.TIMESTAMP); return setValue(i, v == null ? null : TypeCodec.DateCodec.instance.serialize(v)); }
/** * Sets the {@code i}th value to the provided float. * * @param i the index of the variable to set. * @param v the value to set. * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type FLOAT. */ public BoundStatement setFloat(int i, float v) { metadata().checkType(i, DataType.Name.FLOAT); return setValue(i, TypeCodec.FloatCodec.instance.serializeNoBoxing(v)); }
/** * Sets the {@code i}th value to the provided big decimal. * * @param i the index of the variable to set. * @param v the value to set. * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type DECIMAL. */ public BoundStatement setDecimal(int i, BigDecimal v) { metadata().checkType(i, DataType.Name.DECIMAL); return setValue(i, v == null ? null : TypeCodec.DecimalCodec.instance.serialize(v)); }
/** * Sets the {@code i}th value to the provided double. * * @param i the index of the variable to set. * @param v the value to set. * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type DOUBLE. */ public BoundStatement setDouble(int i, double v) { metadata().checkType(i, DataType.Name.DOUBLE); return setValue(i, TypeCodec.DoubleCodec.instance.serializeNoBoxing(v)); }
/** * Sets the {@code i}th value to the provided long. * * @param i the index of the variable to set. * @param v the value to set. * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type BIGINT or COUNTER. */ public BoundStatement setLong(int i, long v) { metadata().checkType(i, DataType.Name.BIGINT, DataType.Name.COUNTER); return setValue(i, TypeCodec.LongCodec.instance.serializeNoBoxing(v)); }
/** * Sets the {@code i}th value to the provided big integer. * * @param i the index of the variable to set. * @param v the value to set. * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type VARINT. */ public BoundStatement setVarint(int i, BigInteger v) { metadata().checkType(i, DataType.Name.VARINT); return setValue(i, v == null ? null : TypeCodec.BigIntegerCodec.instance.serialize(v)); }
/** * Sets the {@code i}th value to the provided inet address. * * @param i the index of the variable to set. * @param v the value to set. * @return this BoundStatement. * * @throws IndexOutOfBoundsException if {@code i < 0 || i >= this.preparedStatement().variables().size()}. * @throws InvalidTypeException if column {@code i} is not of type INET. */ public BoundStatement setInet(int i, InetAddress v) { metadata().checkType(i, DataType.Name.INET); return setValue(i, v == null ? null : TypeCodec.InetCodec.instance.serialize(v)); }