I\'m using Amazon Web Services SDK for Java for DynamoDB; trying to suffice the interface for @DynamoDBMarshalling:
Class extends DynamoDBMarshaller<
The following worked fine to me:
The Marshaller:
public class EnumMarshaller implements DynamoDBMarshaller {
@Override
public String marshall(Enum getterReturnResult) {
return getterReturnResult.name();
}
@Override
public Enum unmarshall(Class clazz, String obj) {
return Enum.valueOf(clazz, obj);
}
}
In my table class with an enum:
@DynamoDBMarshalling(marshallerClass=EnumMarshaller.class)
@DynamoDBAttribute(attributeName = "MyEnum")
public MyEnum getMyEnum() {
return myEnum;
}