12
I'm using Amazon Web Services SDK for Java for DynamoDB; trying to suffice the interface for @DynamoDBMarshalling:
Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass();
I build a marshaller that receives any Enum:
public class EnumMarshaller<T extends Enum<T>> implements DynamoDBMarshaller<T>
{
@Override
public String marshall(T getterReturnResult)
{
return getterReturnResult.toString();
}
@Override
public T unmarshall(Class<T> clazz, String obj)
{
return Enum.valueOf(clazz, obj);
}
}
The problem is that when I'm trying to use the annotation on my field I can't figure it out:
public static enum MyEnum {BLA, BLA2}
@DynamoDBMarshalling(marshallerClass=EnumMarshaller<MyEnum>.class)
public MyEnum getStatus()
{
return status;
}
I can't call .class on a generic type and some other tries came up different errors. I'm starting to think it's impossible with Amazon's contract...