HectorObjectMapper { private Collection<HColumn<String, byte[]>> createColumnSet(Object obj) { Map<String, HColumn<String, byte[]>> map = createColumnMap(obj); if (null != map) { return map.values(); } else { return null; } } HectorObjectMapper(ClassCacheMgr cacheMgr); T getObject(Keyspace keyspace, String colFamName, I pkObj); T saveObj(Keyspace keyspace, T obj); Collection<?> saveObjCollection(Keyspace keyspace, Collection<?> objColl); Collection<?> saveObjCollection(Keyspace keyspace, Collection<?> objColl, Mutator<byte[]> m); static Serializer<?> determineSerializer(Class<?> theType); static boolean isSerializable(Class<?> clazz); static boolean isImplementedBy(Class<?> clazz, Class<?> target); void setKeyConcatStrategy(KeyConcatenationStrategy keyConcatStrategy);  }
@Test public void testCreateColumnSet() { MyTestBean obj = new MyTestBean(); obj.setBaseId(UUID.randomUUID()); obj.setLongProp1(111L); obj.setLongProp2(222L); obj.setIntProp1(333); obj.setIntProp2(444); obj.setBoolProp1(false); obj.setBoolProp2(true); obj.setStrProp("aStr"); obj.setUuidProp(UUID.randomUUID()); obj.setDateProp(new Date()); obj.setBytesProp("somebytes".getBytes()); obj.setColor(Colors.BLUE); obj.setSerialProp(new MySerial(1, 2L)); obj.addAnonymousProp("foo", "bar"); obj.addAnonymousProp("rice", "beans"); Map<String, HColumn<String, byte[]>> colMap = new HectorObjectMapper(cacheMgr).createColumnMap(obj); assertNull("id should not have been added to column collection", colMap.get("id")); assertEquals(obj.getLongProp1(), (long) LongSerializer.get().fromBytes(colMap.get("lp1").getValue())); assertEquals(obj.getLongProp2(), LongSerializer.get().fromBytes(colMap.get("lp2").getValue())); assertEquals(obj.getIntProp1(), (int) IntegerSerializer.get().fromBytes(colMap.get("ip1").getValue())); assertEquals(obj.getIntProp2(), IntegerSerializer.get().fromBytes(colMap.get("ip2").getValue())); assertEquals(obj.isBoolProp1(), BooleanSerializer.get().fromBytes(colMap.get("bp1").getValue())); assertEquals(obj.getBoolProp2(), BooleanSerializer.get() .fromBytes(colMap.get("bp2").getValue())); assertEquals(obj.getStrProp(), StringSerializer.get().fromBytes(colMap.get("sp").getValue())); assertEquals(obj.getUuidProp(), UUIDSerializer.get().fromBytes(colMap.get("up").getValue())); assertEquals(obj.getDateProp(), DateSerializer.get().fromBytes(colMap.get("dp").getValue())); assertEquals("somebytes", new String(BytesArraySerializer.get().fromBytes(colMap.get("bytes").getValue()))); assertEquals(obj.getSerialProp(), ObjectSerializer.get().fromBytes(colMap.get("serialProp").getValue())); assertEquals(2, obj.getAnonymousProps().size()); assertEquals(obj.getAnonymousProp("foo"), new String(colMap.get("foo").getValue())); assertEquals(obj.getAnonymousProp("rice"), new String(colMap.get("rice").getValue())); }