/**
* Produce a block with the given values in the last field.
*/
private Block createBlock(List<Object> values)
{
Type type = getValueType();
BlockBuilder blockBuilder = type.createBlockBuilder(new BlockBuilderStatus());
for (Object value : values) {
Class<?> javaType = type.getJavaType();
if (value == null) {
blockBuilder.appendNull();
}
else if (javaType == boolean.class) {
type.writeBoolean(blockBuilder, (Boolean) value);
}
else if (javaType == long.class) {
type.writeLong(blockBuilder, (Long) value);
}
else if (javaType == double.class) {
type.writeDouble(blockBuilder, (Double) value);
}
else if (javaType == Slice.class) {
Slice slice = (Slice) value;
type.writeSlice(blockBuilder, slice, 0, slice.length());
}
else {
throw new UnsupportedOperationException("not yet implemented: " + javaType);
}
}