DynamicComposite extends AbstractComposite { @Override public <T> DynamicComposite addComponent(int index, T element, ComponentEquality equality) { super.addComponent(index, element, equality); return this; } DynamicComposite();  DynamicComposite(Object... o);  DynamicComposite(List<?> l); static DynamicComposite fromByteBuffer(ByteBuffer byteBuffer); static ByteBuffer toByteBuffer(Object... o); static ByteBuffer toByteBuffer(List<?> l); @Override DynamicComposite addComponent(int index, T element, ComponentEquality equality); @Override DynamicComposite addComponent(T value, Serializer<T> s); @Override DynamicComposite addComponent(T value, Serializer<T> s,
      String comparator); @Override DynamicComposite addComponent(T value, Serializer<T> s,
      String comparator, ComponentEquality equality); @Override DynamicComposite addComponent(int index, T value,
      Serializer<T> s, String comparator, ComponentEquality equality); final static String DEFAULT_DYNAMIC_COMPOSITE_ALIASES; }
@Test public void testUUIDGetSlice() { Map<UUID, Set<UUID>> ids = init(); for(Entry<UUID, Set<UUID>> entry : ids.entrySet()) { UUID component0 = entry.getKey(); DynamicComposite start = new DynamicComposite(); start.addComponent(component0, us); DynamicComposite end = new DynamicComposite(); end.addComponent(component0, us, us.getComparatorType().getTypeName(), ComponentEquality.GREATER_THAN_EQUAL); ColumnSliceIterator<String, DynamicComposite, String> iterator = getIterator(rowKey, start, end); while(iterator.hasNext()) { HColumn<DynamicComposite, String> column = iterator.next(); DynamicComposite composite = column.getName(); assertEquals(component0, composite.get(0, us)); assertTrue(ids.get(component0).contains(composite.get(1, us))); } } }
@Test public void testStringGetSlice() { Mutator<String> mutator = createMutator(keyspace, ss); DynamicComposite composite = (DynamicComposite) new DynamicComposite(). addComponent("a", ss). addComponent("ba", ss). addComponent("ca", ss). addComponent("da", ss); mutator.addInsertion(rowKey, columnFamily, HFactory.createColumn(composite, composite.toString(), ds, ss)); composite = (DynamicComposite) new DynamicComposite(). addComponent("a", ss). addComponent("bb", ss). addComponent("cb", ss). addComponent("db", ss); mutator.addInsertion(rowKey, columnFamily, HFactory.createColumn(composite, composite.toString(), ds, ss)); composite = (DynamicComposite) new DynamicComposite(). addComponent("b", ss). addComponent("ba", ss). addComponent("ca", ss). addComponent("da", ss); mutator.addInsertion(rowKey, columnFamily, HFactory.createColumn(composite, composite.toString(), ds, ss)); composite = (DynamicComposite) new DynamicComposite(). addComponent("b", ss). addComponent("bb", ss). addComponent("cb", ss). addComponent("db", ss); mutator.addInsertion(rowKey, columnFamily, HFactory.createColumn(composite, composite.toString(), ds, ss)); mutator.execute(); String compType = ss.getComparatorType().getTypeName(); System.out.println("LESS_THAN_EQUAL"); DynamicComposite end = (DynamicComposite) new DynamicComposite(). addComponent("b", ss, compType). addComponent("ba", ss). addComponent("ca", ss). addComponent("da", ss, compType, ComponentEquality.LESS_THAN_EQUAL); ColumnSliceIterator<String, DynamicComposite, String> iterator = getIterator(rowKey, null, end); while(iterator.hasNext()) { System.out.println(iterator.next().getName()); } System.out.println("EQUAL"); end = (DynamicComposite) new DynamicComposite(). addComponent("b", ss, compType). addComponent("ba", ss). addComponent("ca", ss). addComponent("da", ss, compType, ComponentEquality.EQUAL); iterator = getIterator(rowKey, null, end); while(iterator.hasNext()) { System.out.println(iterator.next().getName()); } System.out.println("GREATER_THAN_EQUAL"); end = (DynamicComposite) new DynamicComposite(). addComponent("b", ss, compType). addComponent("bb", ss, compType, ComponentEquality.GREATER_THAN_EQUAL); iterator = getIterator(rowKey, null, end); while(iterator.hasNext()) { System.out.println(iterator.next().getName()); } }