Interface DynamoDbEnhancedClientExtension

  • All Known Implementing Classes:
    AtomicCounterExtension, AutoGeneratedTimestampRecordExtension, AutoGeneratedUuidExtension, ChainExtension, VersionedRecordExtension

    @ThreadSafe
    public interface DynamoDbEnhancedClientExtension
    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 Detail

      • afterRead

        default ReadModification afterRead​(DynamoDbExtensionContext.AfterRead context)
        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 - The DynamoDbExtensionContext.AfterRead context containing the state of the execution.
        Returns:
        A ReadModification object that can alter the results of a read operation.