Java Code Examples for org.apache.cassandra.db.marshal.ListType#getInstance()
The following examples show how to use
org.apache.cassandra.db.marshal.ListType#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CassandraTypeConverterTest.java From debezium-incubator with Apache License 2.0 | 6 votes |
@Test public void testList() { // list of ints // test non-frozen DataType listType = DataType.list(DataType.cint(), false); AbstractType<?> convertedType = CassandraTypeConverter.convert(listType); ListType<?> expectedType = ListType.getInstance(Int32Type.instance, true); Assert.assertEquals(expectedType, convertedType); // test frozen listType = DataType.list(DataType.cint(), true); convertedType = CassandraTypeConverter.convert(listType); expectedType = ListType.getInstance(Int32Type.instance, false); Assert.assertEquals(expectedType, convertedType); Assert.assertTrue("Expected convertedType to be frozen", convertedType.isFrozenCollection()); }
Example 2
Source File: CassandraTypeDeserializerTest.java From debezium-incubator with Apache License 2.0 | 6 votes |
@Test public void testListType() { List<Integer> expectedList = new ArrayList<>(); expectedList.add(1); expectedList.add(3); expectedList.add(5); // non-frozen ListType<Integer> nonFrozenListType = ListType.getInstance(Int32Type.instance, true); ByteBuffer serializedList = nonFrozenListType.decompose(expectedList); Object deserializedList = CassandraTypeDeserializer.deserialize(nonFrozenListType, serializedList); Assert.assertEquals(expectedList, deserializedList); // frozen ListType<Integer> frozenListType = ListType.getInstance(Int32Type.instance, false); serializedList = frozenListType.decompose(expectedList); deserializedList = CassandraTypeDeserializer.deserialize(frozenListType, serializedList); Assert.assertEquals(expectedList, deserializedList); }
Example 3
Source File: ListTypeConverter.java From debezium-incubator with Apache License 2.0 | 5 votes |
@Override public ListType convert(DataType dataType) { // list only has one inner type. DataType innerDataType = dataType.getTypeArguments().get(0); AbstractType<?> innerAbstractType = CassandraTypeConverter.convert(innerDataType); return ListType.getInstance(innerAbstractType, !dataType.isFrozen()); }
Example 4
Source File: AbstractMarker.java From stratio-cassandra with Apache License 2.0 | 4 votes |
private static ColumnSpecification makeInReceiver(ColumnSpecification receiver) { ColumnIdentifier inName = new ColumnIdentifier("in(" + receiver.name + ")", true); return new ColumnSpecification(receiver.ksName, receiver.cfName, inName, ListType.getInstance(receiver.type, false)); }
Example 5
Source File: Lists.java From stratio-cassandra with Apache License 2.0 | 4 votes |
public Lists(String name, Generator valueType, GeneratorConfig config) { super(ListType.getInstance(valueType.type, true), config, name, List.class); this.valueType = valueType; buffer = new Object[(int) sizeDistribution.maxValue()]; }