Oh dear, it seems that client set marshalers are not possible. The AWS SDK is hardcoded to single-line values ββonly (SUnmarshaller ()).
DynamoDBReflector in AWS SDK 1.3.13, line 185:
if ( isCustomMarshaller(getter) ) { unmarshaller = new SUnmarshaller() { @Override public Object unmarshall(AttributeValue value) { return getCustomMarshalledValue(toReturn, getter, value); } }; }
UPDATE
As a completely dirty hack, I put something together that works by copying / pasting the whole class :( That's why private static end services are useful, and dependency injection is good.
This will work, so you can use one client converter ( UuidConverter in my case) for getters that return instances of UUID or Set<UUID> .
I added a method called getCustomMarshalledValueSet that iterates over the List returned by .getSS (), calls the custom marshaller for each and adds the result to the Set that it returns.
@SuppressWarnings({ "rawtypes", "unchecked" }) private <T> T getCustomMarshalledValueSet(T toReturn, Method getter, AttributeValue value) { DynamoDBMarshalling annotation = getter.getAnnotation(DynamoDBMarshalling.class); Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass = annotation.marshallerClass(); DynamoDBMarshaller marshaller; try { marshaller = marshallerClass.newInstance(); } catch (InstantiationException e) { throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e); } catch (IllegalAccessException e) { throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e); } Set<T> set = new HashSet<T>(); for (String part : value.getSS()) { set.add((T) marshaller.unmarshall(getter.getReturnType(), part)); } return (T) set; }
Additionally, getArgumentUnmarshaller was modified to bring the isCollection check to the condition, to decide which type of unmarshaller to use, and changed the custom marshaller block to select the correct type.
if (isCustomMarshaller(getter)) { if (isCollection) { unmarshaller = new SSUnmarshaller() { @Override public Object unmarshall(AttributeValue value) { return getCustomMarshalledValueSet(toReturn, getter, value); } }; } else { unmarshaller = new SUnmarshaller() { @Override public Object unmarshall(AttributeValue value) { return getCustomMarshalledValue(toReturn, getter, value); } }; } }