@Entity @Table(name = "AnonumousColumnFamily") @AnonymousPropertyHandling(type = Long.class, serializer = LongSerializer.class, adder = "addAnonymousProp", getter = "getAnonymousProps") class AnonymousWithLongSerializer { private Map<String, Long> anonymousProps = new HashMap<String, Long>(); public void addAnonymousProp(String name, Long value) { anonymousProps.put(name, value); } public Collection<Entry<String, Long>> getAnonymousProps() { return anonymousProps.entrySet(); } }
private <T> void parseInheritanceAnnotation(AnonymousPropertyHandling anno, CFMappingDef<T> cfMapDef) { cfMapDef.setAnonymousValueType(anno.type()); try { cfMapDef.setAnonymousValueSerializer(instantiateSerializer(anno.serializer())); } catch (Throwable e) { throw new HectorObjectMapperException( "exception while instantiating anonymous converter for class, " + cfMapDef.getRealClass() + ", with converter type, " + anno.serializer(), e); addMeth = cfMapDef.getRealClass().getMethod(anno.adder(), String.class, anno.type()); } catch (NoSuchMethodException e) { throw new HectorObjectMapperException("Could not find anonymous add handler for class, " + cfMapDef.getRealClass() + ", with anonymous value type, " + anno.type()); } catch (Throwable e) { throw new HectorObjectMapperException( "exception while finding anonymous add handler for class, " + cfMapDef.getRealClass() + ", with anonymous value type, " + anno.type(), e); getMeth = cfMapDef.getRealClass().getMethod(anno.getter()); } catch (NoSuchMethodException e) { throw new HectorObjectMapperException("Could not find anonymous get handler for class, "
@Entity @Table(name = "AnonumousColumnFamily") @AnonymousPropertyHandling(type = Drawer.class, serializer = ObjectSerializer.class, adder = "addAnonymousProp", getter = "getAnonymousProps") public class AnonymousWithCustomType { private Map<String, Drawer> anonymousProps = new HashMap<String, Drawer>(); @Id private long id; public void addAnonymousProp(String name, Drawer value) { anonymousProps.put(name, value); } public Collection<Entry<String, Drawer>> getAnonymousProps() { return anonymousProps.entrySet(); } public long getId() { return id; } public void setId(long id) { this.id = id; } }
@Entity @Table(name="TestColumnFamily") @AnonymousPropertyHandling(adder="addAnonymousProp", getter="getAnonymousProps") public class MyPojo { @Id
@DiscriminatorValue("NoColor") @Table(name = "TestBeanColumnFamily") @AnonymousPropertyHandling(type=String.class, serializer=StringSerializer.class, adder="addAnonymousProp", getter="getAnonymousProps") public class MyTestBean { @Id