Interface DatabaseOperation<RequestT,ResponseT,ResultT>
-
- Type Parameters:
RequestT
- The type of the request object for the DynamoDb call in the low levelDynamoDbClient
.ResponseT
- The type of the response object for the DynamoDb call in the low levelDynamoDbClient
.ResultT
- The type of the mapped result object that will be returned by the execution of this operation.
- All Known Implementing Classes:
BatchWriteItemOperation
,TransactGetItemsOperation
,TransactWriteItemsOperation
public interface DatabaseOperation<RequestT,ResponseT,ResultT>
Interface for a single operation that can be executed against a mapped database. These operations do not operate on a specific table or index, and may reference multiple tables and indexes (eg: batch operations). Conceptually an operation maps 1:1 with an actual DynamoDb call.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Function<RequestT,CompletableFuture<ResponseT>>
asyncServiceCall(DynamoDbAsyncClient dynamoDbAsyncClient)
Provides a function for making the low level non-blocking asynchronous SDK call to DynamoDb.default ResultT
execute(DynamoDbClient dynamoDbClient, DynamoDbEnhancedClientExtension extension)
Default implementation of a complete synchronous execution of this operation.default CompletableFuture<ResultT>
executeAsync(DynamoDbAsyncClient dynamoDbAsyncClient, DynamoDbEnhancedClientExtension extension)
Default implementation of a complete non-blocking asynchronous execution of this operation.RequestT
generateRequest(DynamoDbEnhancedClientExtension extension)
This method generates the request that needs to be sent to a low levelDynamoDbClient
.OperationName
operationName()
The type, or name, of the operation.Function<RequestT,ResponseT>
serviceCall(DynamoDbClient dynamoDbClient)
Provides a function for making the low level synchronous SDK call to DynamoDb.ResultT
transformResponse(ResponseT response, DynamoDbEnhancedClientExtension extension)
Takes the response object returned by the actual DynamoDb call and maps it into a higher level abstracted result object.
-
-
-
Method Detail
-
generateRequest
RequestT generateRequest(DynamoDbEnhancedClientExtension extension)
This method generates the request that needs to be sent to a low levelDynamoDbClient
.- Parameters:
extension
- ADynamoDbEnhancedClientExtension
that may modify the request of this operation. A null value here will result in no modifications.- Returns:
- A request that can be used as an argument to a
DynamoDbClient
call to perform the operation.
-
serviceCall
Function<RequestT,ResponseT> serviceCall(DynamoDbClient dynamoDbClient)
Provides a function for making the low level synchronous SDK call to DynamoDb.- Parameters:
dynamoDbClient
- A low levelDynamoDbClient
to make the call against.- Returns:
- A function that calls DynamoDb with a provided request object and returns the response object.
-
asyncServiceCall
Function<RequestT,CompletableFuture<ResponseT>> asyncServiceCall(DynamoDbAsyncClient dynamoDbAsyncClient)
Provides a function for making the low level non-blocking asynchronous SDK call to DynamoDb.- Parameters:
dynamoDbAsyncClient
- A low levelDynamoDbAsyncClient
to make the call against.- Returns:
- A function that calls DynamoDb with a provided request object and returns a
CompletableFuture
for the response object.
-
transformResponse
ResultT transformResponse(ResponseT response, DynamoDbEnhancedClientExtension extension)
Takes the response object returned by the actual DynamoDb call and maps it into a higher level abstracted result object.- Parameters:
response
- The response object returned by the DynamoDb call for this operation.extension
- ADynamoDbEnhancedClientExtension
that may modify the result of this operation. A null value here will result in no modifications.- Returns:
- A high level result object as specified by the implementation of this operation.
-
execute
default ResultT execute(DynamoDbClient dynamoDbClient, DynamoDbEnhancedClientExtension extension)
Default implementation of a complete synchronous execution of this operation. It performs three steps: 1) Call generateRequest() to get the request object. 2) Call getServiceCall() and call it using the request object generated in the previous step. 3) Call transformResponse() to convert the response object returned in the previous step to a high level result.- Parameters:
dynamoDbClient
- ADynamoDbClient
to make the call against.extension
- ADynamoDbEnhancedClientExtension
that may modify the request or result of this operation. A null value here will result in no modifications.- Returns:
- A high level result object as specified by the implementation of this operation.
-
executeAsync
default CompletableFuture<ResultT> executeAsync(DynamoDbAsyncClient dynamoDbAsyncClient, DynamoDbEnhancedClientExtension extension)
Default implementation of a complete non-blocking asynchronous execution of this operation. It performs three steps: 1) Call generateRequest() to get the request object. 2) Call getServiceCall() and call it using the request object generated in the previous step. 3) Wraps theCompletableFuture
returned by the SDK in a new one that calls transformResponse() to convert the response object returned in the previous step to a high level result.- Parameters:
dynamoDbAsyncClient
- ADynamoDbAsyncClient
to make the call against.extension
- ADynamoDbEnhancedClientExtension
that may modify the request or result of this operation. A null value here will result in no modifications.- Returns:
- A high level result object as specified by the implementation of this operation.
-
operationName
OperationName operationName()
The type, or name, of the operation.
-
-