Interface DynamoDbEnhancedClientExtension
- All Known Implementing Classes:
AtomicCounterExtension
,AutoGeneratedTimestampRecordExtension
,AutoGeneratedUuidExtension
,ChainExtension
,VersionedRecordExtension
Interface for extending the DynamoDb Enhanced client. Two hooks are provided, one that is called just before a record
is written to the database, and one called just after a record is read from the database. This gives the extension the
opportunity to act as an invisible layer between the application and the database and transform the data accordingly.
Multiple extensions can be used with the enhanced client, but the order in which they are loaded is important. For instance one extension may overwrite the value of an attribute that another extension then includes in a checksum calculation.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ReadModification
This hook is called just after an operation that has read data from the database.default WriteModification
This hook is called just before an operation is going to write data to the database.
-
Method Details
-
beforeWrite
This hook is called just before an operation is going to write data to the database. The extension that implements this method can choose to transform the item itself, or add a condition to the write operation or both.- Parameters:
context
- TheDynamoDbExtensionContext.BeforeWrite
context containing the state of the execution.- Returns:
- A
WriteModification
object that can alter the behavior of the write operation.
-
afterRead
This hook is called just after an operation that has read data from the database. The extension that implements this method can choose to transform the item, and then it is the transformed item that will be mapped back to the application instead of the item that was actually read from the database.- Parameters:
context
- TheDynamoDbExtensionContext.AfterRead
context containing the state of the execution.- Returns:
- A
ReadModification
object that can alter the results of a read operation.
-