// Look at every getter and construct a value object for it
for ( Method method : reflector.getRelevantGetters(clazz) ) {
Object getterResult = safeInvoke(method, toWrite);
String attributeName = reflector.getAttributeName(method);
AttributeValue currentValue = null;
if ( getterResult == null && reflector.isAssignableKey(method) ) {
currentValue = getAutoGeneratedKeyAttributeValue(method, getterResult);
inMemoryUpdates.add(new ValueUpdate(method, currentValue, toWrite));
} else {
currentValue = getSimpleAttributeValue(method, getterResult);
}
if ( currentValue != null ) {
attributeValues.put(attributeName, currentValue);
}
}
if ( !requestItems.containsKey(tableName) ) {
requestItems.put(tableName, new LinkedList<WriteRequest>());
}
requestItems.get(tableName).add(
new WriteRequest().withPutRequest(new PutRequest().withItem(transformAttributes(clazz, attributeValues))));
}
for ( Object toDelete : objectsToDelete ) {
Class<?> clazz = toDelete.getClass();
String tableName = getTableName(clazz, config);
Method hashKeyGetter = reflector.getHashKeyGetter(clazz);
AttributeValue hashKeyElement = getHashKeyElement(safeInvoke(hashKeyGetter, toDelete), hashKeyGetter);
AttributeValue rangeKeyElement = null;
Method rangeKeyGetter = reflector.getRangeKeyGetter(clazz);
if ( rangeKeyGetter != null ) {
rangeKeyElement = getRangeKeyElement(safeInvoke(rangeKeyGetter, toDelete), rangeKeyGetter);
}