|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.SaveObjectHandler
protected abstract class DynamoDBMapper.SaveObjectHandler
The handler for saving object using DynamoDBMapper. Caller should implement the abstract methods to provide the expected behavior on each scenario, and this handler will take care of all the other basic workflow and common operations.
Field Summary | |
---|---|
protected Class<?> |
clazz
|
protected Object |
object
|
protected String |
userProvidedConditionOperator
Condition operator on the additional expected value conditions specified by the user. |
protected Map<String,ExpectedAttributeValue> |
userProvidedExpectedValueConditions
Additional expected value conditions specified by the user. |
Constructor Summary | |
---|---|
DynamoDBMapper.SaveObjectHandler(Class<?> clazz,
Object object,
String tableName,
DynamoDBMapperConfig saveConfig,
DynamoDBSaveExpression saveExpression)
Constructs a handler for saving the specified model object. |
Method Summary | |
---|---|
protected PutItemResult |
doPutItem()
Save the item using a PutItem request. |
protected UpdateItemResult |
doUpdateItem()
Save the item using a UpdateItem request. |
void |
execute()
The general workflow of a save operation. |
protected abstract void |
executeLowLevelRequest()
Implement this method to send the low-level request that is necessary to complete the save operation. |
protected Map<String,AttributeValueUpdate> |
getAttributeValueUpdates()
Get the map of AttributeValueUpdate on each modeled attribute. |
protected List<com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.ValueUpdate> |
getInMemoryUpdates()
Get the list of all the necessary in-memory update on the object. |
protected Map<String,AttributeValue> |
getKeyAttributeValues()
Get the map of all the specified key of the saved object. |
protected DynamoDBMapperConfig.SaveBehavior |
getLocalSaveBehavior()
Get the SaveBehavior used locally for this save operation. |
protected String |
getTableName()
Get the table name |
protected Map<String,ExpectedAttributeValue> |
mergeExpectedAttributeValueConditions()
Merge and return all the expected value conditions (either user-specified or imposed by the internal implementation of DynamoDBMapper) for this save operation. |
protected abstract void |
onKeyAttributeValue(String attributeName,
AttributeValue keyAttributeValue)
Implement this method to do the necessary operations when a key attribute is set with some value. |
protected void |
onNonKeyAttribute(String attributeName,
AttributeValue currentValue)
Implement this method for necessary operations when a non-key attribute is set a non-null value in the object. |
protected abstract void |
onNullNonKeyAttribute(String attributeName)
Implement this method for necessary operations when a non-key attribute is set null in the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Object object
protected final Class<?> clazz
protected final Map<String,ExpectedAttributeValue> userProvidedExpectedValueConditions
protected final String userProvidedConditionOperator
Constructor Detail |
---|
public DynamoDBMapper.SaveObjectHandler(Class<?> clazz, Object object, String tableName, DynamoDBMapperConfig saveConfig, DynamoDBSaveExpression saveExpression)
object
- The model object to be saved.clazz
- The domain class of the object.tableName
- The table name.saveConifg
- The mapper configuration used for this save.saveExpression
- The save expression, including the user-provided conditions and an optional logic operator.Method Detail |
---|
public void execute()
protected abstract void onKeyAttributeValue(String attributeName, AttributeValue keyAttributeValue)
attributeName
- The name of the key attribute.keyAttributeValue
- The AttributeValue of the key attribute as specified in
the object.protected void onNonKeyAttribute(String attributeName, AttributeValue currentValue)
attributeName
- The name of the non-key attribute.currentValue
- The updated value of the given attribute.protected abstract void onNullNonKeyAttribute(String attributeName)
attributeName
- The name of the non-key attribute.protected abstract void executeLowLevelRequest()
protected DynamoDBMapperConfig.SaveBehavior getLocalSaveBehavior()
protected String getTableName()
protected Map<String,AttributeValue> getKeyAttributeValues()
protected Map<String,AttributeValueUpdate> getAttributeValueUpdates()
protected Map<String,ExpectedAttributeValue> mergeExpectedAttributeValueConditions()
protected List<com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.ValueUpdate> getInMemoryUpdates()
protected UpdateItemResult doUpdateItem()
The ReturnedValues parameter for the UpdateItem request is set as ALL_NEW, which means the service should return all of the attributes of the new version of the item after the update. The handler will use the returned attributes to detect silent failure on the server-side.
protected PutItemResult doPutItem()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |