protected abstract class DynamoDBMapper.SaveObjectHandler extends Object
Modifier and Type | Field and Description |
---|---|
protected Class<?> |
clazz |
protected Object |
object |
Constructor and Description |
---|
SaveObjectHandler(Class<?> clazz,
Object object,
String tableName,
DynamoDBMapperConfig.SaveBehavior saveBehavior,
Map<String,ExpectedAttributeValue> userProvidedExpectedValues)
Constructs a handler for saving the specified model object.
|
Modifier and Type | Method and Description |
---|---|
void |
execute()
The general workflow of a save operation.
|
protected abstract void |
executeLowLevelRequest(boolean onlyKeyAttributeSpecified)
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 Map<String,ExpectedAttributeValue> |
getExpectedAttributeValues()
Get the map of ExpectedAttributeValue 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 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.
|
public SaveObjectHandler(Class<?> clazz, Object object, String tableName, DynamoDBMapperConfig.SaveBehavior saveBehavior, Map<String,ExpectedAttributeValue> userProvidedExpectedValues)
object
- The model object to be saved.clazz
- The domain class of the object.tableName
- The table name.userProvidedExpectedValues
- Any expected values that should be applied to the savepublic 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(boolean onlyKeyAttributeSpecified)
onlyKeyAttributeSpecified
- Whether the object to be saved is only specified with key
attributes.protected DynamoDBMapperConfig.SaveBehavior getLocalSaveBehavior()
protected String getTableName()
protected Map<String,AttributeValue> getKeyAttributeValues()
protected Map<String,AttributeValueUpdate> getAttributeValueUpdates()
protected Map<String,ExpectedAttributeValue> getExpectedAttributeValues()
protected List<com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper.ValueUpdate> getInMemoryUpdates()
Copyright © 2016. All rights reserved.