} else if ( Collection.class.isAssignableFrom(returnType) ) {
throw new DynamoDBMappingException("Non-set collections aren't supported: "
+ (getter.getDeclaringClass() + "." + getter.getName()));
} else { // Non-set return type
if ( Date.class.isAssignableFrom(returnType) ) {
marshaller = new StringAttributeMarshaller() {
@Override
public AttributeValue marshall(Object obj) {
return new AttributeValue().withS(new DateUtils().formatIso8601Date((Date) obj));
}
};
} else if ( Calendar.class.isAssignableFrom(returnType) ) {
marshaller = new StringAttributeMarshaller() {
@Override
public AttributeValue marshall(Object obj) {
return new AttributeValue().withS(new DateUtils()
.formatIso8601Date(((Calendar) obj).getTime()));
}
};
} else if ( boolean.class.isAssignableFrom(returnType)
|| Boolean.class.isAssignableFrom(returnType) ) {
marshaller = new NumberAttributeMarshaller() {
@Override
public AttributeValue marshall(Object obj) {
if ( obj == null || !(Boolean) obj ) {
return new AttributeValue().withN("0");
} else {
return new AttributeValue().withN("1");
}
}
};
} else if ( returnType.isPrimitive() || Number.class.isAssignableFrom(returnType) ) {
marshaller = new NumberAttributeMarshaller() {
@Override
public AttributeValue marshall(Object obj) {
return new AttributeValue().withN(String.valueOf(obj));
}
};
} else if ( returnType == String.class ) {
marshaller = new StringAttributeMarshaller() {
@Override
public AttributeValue marshall(Object obj) {
if ( ((String) obj).length() == 0 )
return null;