com.netflix.astyanax.query.AbstractPreparedCqlQuery Maven / Gradle / Ivy
package com.netflix.astyanax.query;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.UUID;
import com.google.common.collect.Lists;
import com.netflix.astyanax.Serializer;
import com.netflix.astyanax.serializers.BooleanSerializer;
import com.netflix.astyanax.serializers.DoubleSerializer;
import com.netflix.astyanax.serializers.FloatSerializer;
import com.netflix.astyanax.serializers.IntegerSerializer;
import com.netflix.astyanax.serializers.LongSerializer;
import com.netflix.astyanax.serializers.ShortSerializer;
import com.netflix.astyanax.serializers.StringSerializer;
import com.netflix.astyanax.serializers.UUIDSerializer;
public abstract class AbstractPreparedCqlQuery implements PreparedCqlQuery {
private List values = Lists.newArrayList();
protected List getValues() {
return values;
}
@Override
public PreparedCqlQuery withByteBufferValue(V value, Serializer serializer) {
return withValue(serializer.toByteBuffer(value));
}
@Override
public PreparedCqlQuery withValue(ByteBuffer value) {
values.add(value);
return this;
}
@Override
public PreparedCqlQuery withValues(List values) {
this.values.addAll(values);
return this;
}
@Override
public PreparedCqlQuery withStringValue(String value) {
return withByteBufferValue(value, StringSerializer.get());
}
@Override
public PreparedCqlQuery withIntegerValue(Integer value) {
return withByteBufferValue(value, IntegerSerializer.get());
}
@Override
public PreparedCqlQuery withBooleanValue(Boolean value) {
return withByteBufferValue(value, BooleanSerializer.get());
}
@Override
public PreparedCqlQuery withDoubleValue(Double value) {
return withByteBufferValue(value, DoubleSerializer.get());
}
@Override
public PreparedCqlQuery withLongValue(Long value) {
return withByteBufferValue(value, LongSerializer.get());
}
@Override
public PreparedCqlQuery withFloatValue(Float value) {
return withByteBufferValue(value, FloatSerializer.get());
}
@Override
public PreparedCqlQuery withShortValue(Short value) {
return withByteBufferValue(value, ShortSerializer.get());
}
@Override
public PreparedCqlQuery withUUIDValue(UUID value) {
return withByteBufferValue(value, UUIDSerializer.get());
}
}