Q:

Optional attributes in aws Dynamodbmapper

Using Dynamodb mapper how do optional attributes get marshaled? I have a number attribute that only exists for some items, and 0 is a valid value for this attribute. 
I am observing that for items where this attribute doesn't exist, it's being marshalled as a "0". Any idea how I can differentiate Items where I have a valid value of 0 vs. where the attribute doesn't exist?

A:

So anyone else who is struggling with the same problem, Dynamodbmapper supports marshaling to both primitive types and class types for numbers. While Number itself is not supported, one can map to Double (instead of double), Integer (instead of int) and Float (instead of float). This allows you the ability to check for null values. 
//map to Integer
private Double myValue;
//create getter and setter 
...
//later you can check if the value exists
if(myClass.getMyValue() != null){
    //attribute exists.
}

