com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper
Interface ItemConverter


public interface ItemConverter

The concrete realization of a strategy for converting between Java objects and DynamoDB AttributeValues. Typically created by a ConversionSchema.


Method Summary
 AttributeValue convert(java.lang.reflect.Method getter, java.lang.Object value)
          Converts a Java object into a DynamoDB AttributeValue.
 java.util.Map<java.lang.String,AttributeValue> convert(java.lang.Object value)
          Converts an appropriately-annotated POJO into a Map of AttributeValues.
 DynamoDBMapperFieldModel getFieldModel(java.lang.reflect.Method getter)
          Returns the metadata (e.g.
<T> T
unconvert(java.lang.Class<T> clazz, java.util.Map<java.lang.String,AttributeValue> values)
          Reverses the convert(Object) method, turning a map of attribute values back into a POJO of the given class.
 java.lang.Object unconvert(java.lang.reflect.Method getter, java.lang.reflect.Method setter, AttributeValue value)
          Reverses the convert(Method, Object) method, turning a DynamoDB AttributeValue back into a Java object suitable for passing to the given setter.
 

Method Detail

getFieldModel

DynamoDBMapperFieldModel getFieldModel(java.lang.reflect.Method getter)
Returns the metadata (e.g. name, type) of the DynamoDB attribute that the return value of the given getter will be converted to.

Parameters:
getter - the getter method to inspect
Returns:
the metadata of the DynamoDB attribute that the result of the getter will be converted to

convert

AttributeValue convert(java.lang.reflect.Method getter,
                       java.lang.Object value)
Converts a Java object into a DynamoDB AttributeValue. Potentially able to handle both scalar and complex types.

Parameters:
getter - the getter that returned the value to be converted
value - the value to be converted
Returns:
the converted AttributeValue

convert

java.util.Map<java.lang.String,AttributeValue> convert(java.lang.Object value)
Converts an appropriately-annotated POJO into a Map of AttributeValues.

Parameters:
value - the POJO to convert
Returns:
the resulting map of attribute values

unconvert

java.lang.Object unconvert(java.lang.reflect.Method getter,
                           java.lang.reflect.Method setter,
                           AttributeValue value)
Reverses the convert(Method, Object) method, turning a DynamoDB AttributeValue back into a Java object suitable for passing to the given setter.

Parameters:
getter - the getter for the value to be unconverted
setter - the setter for the value to be unconverted
value - the attribute value to be unconverted
Returns:
the unconverted Java object

unconvert

<T> T unconvert(java.lang.Class<T> clazz,
                java.util.Map<java.lang.String,AttributeValue> values)
Reverses the convert(Object) method, turning a map of attribute values back into a POJO of the given class.

Type Parameters:
T - the compile-time type of the object to create
Parameters:
clazz - the runtime type of the object to create
values - the the map of attribute values to unconvert
Returns:
the unconverted POJO


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.