Interface PaginatedOperation<ItemT,RequestT,ResponseT>
-
- Type Parameters:
ItemT
- The modelled object that this table maps records to.RequestT
- The type of the request object for the DynamoDb call in the low levelDynamoDbClient
orDynamoDbAsyncClient
.ResponseT
- The type of the response object for the DynamoDb call in the low levelDynamoDbClient
orDynamoDbAsyncClient
.
- All Known Subinterfaces:
PaginatedIndexOperation<ItemT,RequestT,ResponseT>
,PaginatedTableOperation<ItemT,RequestT,ResponseT>
- All Known Implementing Classes:
QueryOperation
,ScanOperation
public interface PaginatedOperation<ItemT,RequestT,ResponseT>
Common interface for an operation that can be executed in a synchronous or non-blocking asynchronous fashion against a mapped database table and is expected to return a paginated list of results. These operations can be made against either the primary index of a table or a secondary index, although some implementations of this interface do not support secondary indices and will throw an exception when executed against one. Typically, each page of results that is served will automatically perform an additional service call to DynamoDb to retrieve the next set of results.This interface is extended by
PaginatedTableOperation
andPaginatedIndexOperation
which contain implementations of the behavior to actually execute the operation in the context of a table or secondary index and are used byDynamoDbTable
orDynamoDbAsyncTable
andDynamoDbIndex
orDynamoDbAsyncIndex
respectively. By sharing this common interface operations are able to re-use code regardless of whether they are executed in the context of a primary or secondary index or whether they are being executed in a synchronous or non-blocking asynchronous fashion.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Function<RequestT,SdkPublisher<ResponseT>>
asyncServiceCall(DynamoDbAsyncClient dynamoDbAsyncClient)
Provides a function for making the low level non-blocking asynchronous SDK call to DynamoDb.default PageIterable<ItemT>
execute(TableSchema<ItemT> tableSchema, OperationContext context, DynamoDbEnhancedClientExtension extension, DynamoDbClient dynamoDbClient)
Default implementation of a complete synchronous execution of this operation against either the primary or a secondary index.default PagePublisher<ItemT>
executeAsync(TableSchema<ItemT> tableSchema, OperationContext context, DynamoDbEnhancedClientExtension extension, DynamoDbAsyncClient dynamoDbAsyncClient)
Default implementation of a complete non-blocking asynchronous execution of this operation against either the primary or a secondary index.RequestT
generateRequest(TableSchema<ItemT> tableSchema, OperationContext context, DynamoDbEnhancedClientExtension extension)
This method generates the request that needs to be sent to a low levelDynamoDbClient
.Function<RequestT,SdkIterable<ResponseT>>
serviceCall(DynamoDbClient dynamoDbClient)
Provides a function for making the low level synchronous SDK call to DynamoDb.Page<ItemT>
transformResponse(ResponseT response, TableSchema<ItemT> tableSchema, OperationContext context, DynamoDbEnhancedClientExtension dynamoDbEnhancedClientExtension)
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(TableSchema<ItemT> tableSchema, OperationContext context, DynamoDbEnhancedClientExtension extension)
This method generates the request that needs to be sent to a low levelDynamoDbClient
.- Parameters:
tableSchema
- ATableSchema
that maps the table to a modelled object.context
- An object containing the context, or target, of the command execution.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,SdkIterable<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 a paginated DynamoDb operation with a provided request object and returns the response object.
-
asyncServiceCall
Function<RequestT,SdkPublisher<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 a paginated DynamoDb operation with a provided request object and returns the response object.
-
transformResponse
Page<ItemT> transformResponse(ResponseT response, TableSchema<ItemT> tableSchema, OperationContext context, DynamoDbEnhancedClientExtension dynamoDbEnhancedClientExtension)
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.tableSchema
- ATableSchema
that maps the table to a modelled object.context
- An object containing the context, or target, of the command execution.dynamoDbEnhancedClientExtension
- 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 PageIterable<ItemT> execute(TableSchema<ItemT> tableSchema, OperationContext context, DynamoDbEnhancedClientExtension extension, DynamoDbClient dynamoDbClient)
Default implementation of a complete synchronous execution of this operation against either the primary or a secondary index.It performs three steps:
- Call
generateRequest(software.amazon.awssdk.enhanced.dynamodb.TableSchema<ItemT>, software.amazon.awssdk.enhanced.dynamodb.OperationContext, software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClientExtension)
to get the request object. - Call
asyncServiceCall(software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient)
and call it using the request object generated in the previous step. - Wraps the
SdkIterable
that was returned by the previous step with a transformation that turns each object returned to a high level result.
- Parameters:
tableSchema
- ATableSchema
that maps the table to a modelled object.context
- An object containing the context, or target, of the command execution.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.
- Call
-
executeAsync
default PagePublisher<ItemT> executeAsync(TableSchema<ItemT> tableSchema, OperationContext context, DynamoDbEnhancedClientExtension extension, DynamoDbAsyncClient dynamoDbAsyncClient)
Default implementation of a complete non-blocking asynchronous execution of this operation against either the primary or a secondary index.It performs three steps:
- Call
generateRequest(software.amazon.awssdk.enhanced.dynamodb.TableSchema<ItemT>, software.amazon.awssdk.enhanced.dynamodb.OperationContext, software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClientExtension)
to get the request object. - Call
asyncServiceCall(software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient)
and call it using the request object generated in the previous step. - Wraps the
SdkPublisher
returned by the SDK in a new one that calls transformResponse() to convert the response objects published to a high level result.
- Parameters:
tableSchema
- ATableSchema
that maps the table to a modelled object.context
- An object containing the context, or target, of the command execution.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:
- An
SdkPublisher
that will publish pages of the high level result object as specified by the implementation of this operation.
- Call
-
-