@Test @Parameters(method = "testToCQLLiteral_parameters") public void testToCQLLiteral(AbstractType type, ByteBuffer value, String expected) { ColumnSpecification col = new ColumnSpecification("ks", "cf", null, type); String literal = CqlLiteralFlavorAdapter.toCQLLiteral(value, col); assertThat(literal).isEqualTo(expected); }
static String toCQLLiteral(ByteBuffer serializedValue, ColumnSpecification column) { if (!serializedValue.hasRemaining()) { return noValueString(column); } if (column.type.asCQL3Type() instanceof CQL3Type.Native) { switch ((CQL3Type.Native) column.type.asCQL3Type()) { case ASCII: case VARCHAR: case TEXT: return "'" + column.type.getString(serializedValue) + "'"; case TIMESTAMP: return DATE_FORMAT.format(TimestampSerializer.instance.deserialize(serializedValue)); case BLOB: return "0x" + column.type.getString(serializedValue); default: break; } } return column.type.getString(serializedValue); }
CqlLiteralFlavorAdapter { static String toCQLLiteral(ByteBuffer serializedValue, ColumnSpecification column) { if (!serializedValue.hasRemaining()) { return noValueString(column); } if (column.type.asCQL3Type() instanceof CQL3Type.Native) { switch ((CQL3Type.Native) column.type.asCQL3Type()) { case ASCII: case VARCHAR: case TEXT: return "'" + column.type.getString(serializedValue) + "'"; case TIMESTAMP: return DATE_FORMAT.format(TimestampSerializer.instance.deserialize(serializedValue)); case BLOB: return "0x" + column.type.getString(serializedValue); default: break; } } return column.type.getString(serializedValue); } }
CqlLiteralFlavorAdapter { static String toCQLLiteral(ByteBuffer serializedValue, ColumnSpecification column) { if (!serializedValue.hasRemaining()) { return noValueString(column); } if (column.type.asCQL3Type() instanceof CQL3Type.Native) { switch ((CQL3Type.Native) column.type.asCQL3Type()) { case ASCII: case VARCHAR: case TEXT: return "'" + column.type.getString(serializedValue) + "'"; case TIMESTAMP: return DATE_FORMAT.format(TimestampSerializer.instance.deserialize(serializedValue)); case BLOB: return "0x" + column.type.getString(serializedValue); default: break; } } return column.type.getString(serializedValue); } private  CqlLiteralFlavorAdapter(); }
CqlLiteralFlavorAdapter { static String toCQLLiteral(ByteBuffer serializedValue, ColumnSpecification column) { if (!serializedValue.hasRemaining()) { return noValueString(column); } if (column.type.asCQL3Type() instanceof CQL3Type.Native) { switch ((CQL3Type.Native) column.type.asCQL3Type()) { case ASCII: case VARCHAR: case TEXT: return "'" + column.type.getString(serializedValue) + "'"; case TIMESTAMP: return DATE_FORMAT.format(TimestampSerializer.instance.deserialize(serializedValue)); case BLOB: return "0x" + column.type.getString(serializedValue); default: break; } } return column.type.getString(serializedValue); } private  CqlLiteralFlavorAdapter();  }
CqlLiteralFlavorAdapter { static String toCQLLiteral(ByteBuffer serializedValue, ColumnSpecification column) { if (!serializedValue.hasRemaining()) { return noValueString(column); } if (column.type.asCQL3Type() instanceof CQL3Type.Native) { switch ((CQL3Type.Native) column.type.asCQL3Type()) { case ASCII: case VARCHAR: case TEXT: return "'" + column.type.getString(serializedValue) + "'"; case TIMESTAMP: return DATE_FORMAT.format(TimestampSerializer.instance.deserialize(serializedValue)); case BLOB: return "0x" + column.type.getString(serializedValue); default: break; } } return column.type.getString(serializedValue); } private  CqlLiteralFlavorAdapter();   }