@Test public void parseValueText() { for (final DataType dataType : textualTypes) { assertThat(CassandraUtils.parseValue(dataType, "unquoted_text")) .isEqualTo("unquoted_text"); assertThat(CassandraUtils.parseValue(dataType, "'quoted_text'")) .isEqualTo("'quoted_text'"); assertThat(CassandraUtils.parseValue(dataType, "'unescaped_'quoted_text'")) .isEqualTo("'unescaped_'quoted_text'"); } }
public static Object parseValue(final DataType type, final String value) { if (value == null) { return null; } switch (type.getName()) { case TEXT: case VARCHAR: case ASCII: return value; case INET: return type.parse("'" + value + "'"); case INT: case VARINT: case BIGINT: case FLOAT: case DOUBLE: case DECIMAL: case BOOLEAN: return type.parse(value.replaceAll("\\s+", "")); default: return type.parse(value); } }
CassandraUtils { public static Object parseValue(final DataType type, final String value) { if (value == null) { return null; } switch (type.getName()) { case TEXT: case VARCHAR: case ASCII: return value; case INET: return type.parse("'" + value + "'"); case INT: case VARINT: case BIGINT: case FLOAT: case DOUBLE: case DECIMAL: case BOOLEAN: return type.parse(value.replaceAll("\\s+", "")); default: return type.parse(value); } } }
CassandraUtils { public static Object parseValue(final DataType type, final String value) { if (value == null) { return null; } switch (type.getName()) { case TEXT: case VARCHAR: case ASCII: return value; case INET: return type.parse("'" + value + "'"); case INT: case VARINT: case BIGINT: case FLOAT: case DOUBLE: case DECIMAL: case BOOLEAN: return type.parse(value.replaceAll("\\s+", "")); default: return type.parse(value); } } private  CassandraUtils(); }
CassandraUtils { public static Object parseValue(final DataType type, final String value) { if (value == null) { return null; } switch (type.getName()) { case TEXT: case VARCHAR: case ASCII: return value; case INET: return type.parse("'" + value + "'"); case INT: case VARINT: case BIGINT: case FLOAT: case DOUBLE: case DECIMAL: case BOOLEAN: return type.parse(value.replaceAll("\\s+", "")); default: return type.parse(value); } } private  CassandraUtils(); static void executeCqlScript(final Session session, final String script); static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table); static Object parseValue(final DataType type, final String value); }
CassandraUtils { public static Object parseValue(final DataType type, final String value) { if (value == null) { return null; } switch (type.getName()) { case TEXT: case VARCHAR: case ASCII: return value; case INET: return type.parse("'" + value + "'"); case INT: case VARINT: case BIGINT: case FLOAT: case DOUBLE: case DECIMAL: case BOOLEAN: return type.parse(value.replaceAll("\\s+", "")); default: return type.parse(value); } } private  CassandraUtils(); static void executeCqlScript(final Session session, final String script); static TableMetadata getTableMetadata(final Session session, final String keyspace, final String table); static Object parseValue(final DataType type, final String value);  }