Class DefaultDynamoDbAsyncTable<T>
- java.lang.Object
-
- software.amazon.awssdk.enhanced.dynamodb.internal.client.DefaultDynamoDbAsyncTable<T>
-
- All Implemented Interfaces:
DynamoDbAsyncTable<T>,MappedTableResource<T>
public final class DefaultDynamoDbAsyncTable<T> extends Object implements DynamoDbAsyncTable<T>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>createTable()Creates a new table in DynamoDb with the name and schema already defined for this DynamoDbTable.CompletableFuture<Void>createTable(Consumer<CreateTableEnhancedRequest.Builder> requestConsumer)Creates a new table in DynamoDb with the name and schema already defined for this DynamoDbTable together with additional parameters specified in the supplied request object,CreateTableEnhancedRequest.CompletableFuture<Void>createTable(CreateTableEnhancedRequest request)Creates a new table in DynamoDb with the name and schema already defined for this DynamoDbTable together with additional parameters specified in the supplied request object,CreateTableEnhancedRequest.CompletableFuture<T>deleteItem(Consumer<DeleteItemEnhancedRequest.Builder> requestConsumer)Deletes a single item from the mapped table using a supplied primaryKey.CompletableFuture<T>deleteItem(Key key)Deletes a single item from the mapped table using a supplied primaryKey.CompletableFuture<T>deleteItem(DeleteItemEnhancedRequest request)Deletes a single item from the mapped table using a supplied primaryKey.CompletableFuture<T>deleteItem(T keyItem)Deletes a single item from the mapped table using just the key of a supplied modelled 'key item' object.CompletableFuture<DeleteItemEnhancedResponse<T>>deleteItemWithResponse(Consumer<DeleteItemEnhancedRequest.Builder> requestConsumer)Deletes a single item from the mapped table using a supplied primaryKey.CompletableFuture<DeleteItemEnhancedResponse<T>>deleteItemWithResponse(DeleteItemEnhancedRequest request)Deletes a single item from the mapped table using a supplied primaryKey.CompletableFuture<Void>deleteTable()Deletes a table in DynamoDb with the name and schema already defined for this DynamoDbTable.CompletableFuture<DescribeTableEnhancedResponse>describeTable()Describes a table in DynamoDb with the name defined for thisDynamoDbAsyncTable.DynamoDbAsyncClientdynamoDbClient()booleanequals(Object o)CompletableFuture<T>getItem(Consumer<GetItemEnhancedRequest.Builder> requestConsumer)Retrieves a single item from the mapped table using a supplied primaryKey.CompletableFuture<T>getItem(Key key)Retrieves a single item from the mapped table using a supplied primaryKey.CompletableFuture<T>getItem(GetItemEnhancedRequest request)Retrieves a single item from the mapped table using a supplied primaryKey.CompletableFuture<T>getItem(T keyItem)Retrieves a single item from the mapped table using just the key of a supplied modelled 'key item'.CompletableFuture<GetItemEnhancedResponse<T>>getItemWithResponse(Consumer<GetItemEnhancedRequest.Builder> requestConsumer)Retrieves a single item from the mapped table using a supplied primaryKey.CompletableFuture<GetItemEnhancedResponse<T>>getItemWithResponse(GetItemEnhancedRequest request)Retrieves a single item from the mapped table using a supplied primaryKey.inthashCode()DefaultDynamoDbAsyncIndex<T>index(String indexName)Returns a mapped index that can be used to execute commands against a secondary index belonging to the table being mapped by this object.KeykeyFrom(T item)Creates aKeyobject from a modelled item.DynamoDbEnhancedClientExtensionmapperExtension()Gets theDynamoDbEnhancedClientExtensionassociated with this mapped resource.CompletableFuture<Void>putItem(Consumer<PutItemEnhancedRequest.Builder<T>> requestConsumer)Puts a single item in the mapped table.CompletableFuture<Void>putItem(PutItemEnhancedRequest<T> request)Puts a single item in the mapped table.CompletableFuture<Void>putItem(T item)Puts a single item in the mapped table.CompletableFuture<PutItemEnhancedResponse<T>>putItemWithResponse(Consumer<PutItemEnhancedRequest.Builder<T>> requestConsumer)Puts a single item in the mapped table.CompletableFuture<PutItemEnhancedResponse<T>>putItemWithResponse(PutItemEnhancedRequest<T> request)Puts a single item in the mapped table.PagePublisher<T>query(Consumer<QueryEnhancedRequest.Builder> requestConsumer)Executes a query against the primary index of the table using aQueryConditionalexpression to retrieve a list of items matching the given conditions.PagePublisher<T>query(QueryConditional queryConditional)Executes a query against the primary index of the table using aQueryConditionalexpression to retrieve a list of items matching the given conditions.PagePublisher<T>query(QueryEnhancedRequest request)Executes a query against the primary index of the table using aQueryConditionalexpression to retrieve a list of items matching the given conditions.PagePublisher<T>scan()Scans the table and retrieves all items using default settings.PagePublisher<T>scan(Consumer<ScanEnhancedRequest.Builder> requestConsumer)Scans the table and retrieves all items.PagePublisher<T>scan(ScanEnhancedRequest request)Scans the table and retrieves all items.StringtableName()Gets the physical table name that operations performed by this object will be executed against.TableSchema<T>tableSchema()Gets theTableSchemaobject that this mapped table was built with.CompletableFuture<T>updateItem(Consumer<UpdateItemEnhancedRequest.Builder<T>> requestConsumer)Updates an item in the mapped table, or adds it if it doesn't exist.CompletableFuture<T>updateItem(UpdateItemEnhancedRequest<T> request)Updates an item in the mapped table, or adds it if it doesn't exist.CompletableFuture<T>updateItem(T item)Updates an item in the mapped table, or adds it if it doesn't exist.CompletableFuture<UpdateItemEnhancedResponse<T>>updateItemWithResponse(Consumer<UpdateItemEnhancedRequest.Builder<T>> requestConsumer)Updates an item in the mapped table, or adds it if it doesn't exist.CompletableFuture<UpdateItemEnhancedResponse<T>>updateItemWithResponse(UpdateItemEnhancedRequest<T> request)Updates an item in the mapped table, or adds it if it doesn't exist.
-
-
-
Method Detail
-
mapperExtension
public DynamoDbEnhancedClientExtension mapperExtension()
Description copied from interface:MappedTableResourceGets theDynamoDbEnhancedClientExtensionassociated with this mapped resource.- Specified by:
mapperExtensionin interfaceMappedTableResource<T>- Returns:
- The
DynamoDbEnhancedClientExtensionassociated with this mapped resource.
-
tableSchema
public TableSchema<T> tableSchema()
Description copied from interface:MappedTableResourceGets theTableSchemaobject that this mapped table was built with.- Specified by:
tableSchemain interfaceMappedTableResource<T>- Returns:
- The
TableSchemaobject for this mapped table.
-
dynamoDbClient
public DynamoDbAsyncClient dynamoDbClient()
-
tableName
public String tableName()
Description copied from interface:MappedTableResourceGets the physical table name that operations performed by this object will be executed against.- Specified by:
tableNamein interfaceMappedTableResource<T>- Returns:
- The physical table name.
-
index
public DefaultDynamoDbAsyncIndex<T> index(String indexName)
Description copied from interface:DynamoDbAsyncTableReturns a mapped index that can be used to execute commands against a secondary index belonging to the table being mapped by this object. Note that only a subset of the commands that work against a table will work against a secondary index.- Specified by:
indexin interfaceDynamoDbAsyncTable<T>- Parameters:
indexName- The name of the secondary index to build the command interface for.- Returns:
- An
DynamoDbAsyncIndexobject that can be used to execute database commands against.
-
createTable
public CompletableFuture<Void> createTable(CreateTableEnhancedRequest request)
Description copied from interface:DynamoDbAsyncTableCreates a new table in DynamoDb with the name and schema already defined for this DynamoDbTable together with additional parameters specified in the supplied request object,CreateTableEnhancedRequest.Use
DynamoDbEnhancedClient.table(String, TableSchema)to define the mapped table resource.This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous operation and that the table may not immediately be available for writes and reads. You can use
DynamoDbAsyncWaiter.waitUntilTableExists(DescribeTableRequest)to wait for the resource to be ready.Example:
ProvisionedThroughput provisionedThroughput = ProvisionedThroughput.builder() .readCapacityUnits(50L) .writeCapacityUnits(50L) .build(); mappedTable.createTable(CreateTableEnhancedRequest.builder() .provisionedThroughput(provisionedThroughput) .build()) .join(); asyncClient.waiter().waitUntilTableExists(b -> b.tableName(tableName)).join();- Specified by:
createTablein interfaceDynamoDbAsyncTable<T>- Parameters:
request- ACreateTableEnhancedRequestcontaining optional parameters for table creation.- Returns:
- a
CompletableFutureofVoid.
-
createTable
public CompletableFuture<Void> createTable(Consumer<CreateTableEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncTableCreates a new table in DynamoDb with the name and schema already defined for this DynamoDbTable together with additional parameters specified in the supplied request object,CreateTableEnhancedRequest.Use
DynamoDbEnhancedClient.table(String, TableSchema)to define the mapped table resource.This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous operation and that the table may not immediately be available for writes and reads. You can use
DynamoDbAsyncWaiter.waitUntilTableExists(DescribeTableRequest)to wait for the resource to be ready.Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one manually via
CreateTableEnhancedRequest.builder().Example:
ProvisionedThroughput provisionedThroughput = ProvisionedThroughput.builder() .readCapacityUnits(50L) .writeCapacityUnits(50L) .build(); mappedTable.createTable(r -> r.provisionedThroughput(provisionedThroughput)).join(); asyncClient.waiter().waitUntilTableExists(b -> b.tableName(tableName)).join();- Specified by:
createTablein interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofCreateTableEnhancedRequest.Buildercontaining optional parameters for table creation.- Returns:
- a
CompletableFutureofVoid.
-
createTable
public CompletableFuture<Void> createTable()
Description copied from interface:DynamoDbAsyncTableCreates a new table in DynamoDb with the name and schema already defined for this DynamoDbTable.Use
DynamoDbEnhancedClient.table(String, TableSchema)to define the mapped table resource.This operation calls the low-level DynamoDB API CreateTable operation. Note that this is an asynchronous operation and that the table may not immediately be available for writes and reads. You can use
DynamoDbAsyncWaiter.waitUntilTableExists(DescribeTableRequest)to wait for the resource to be ready.Example:
mappedTable.createTable().join(); asyncClient.waiter().waitUntilTableExists(b -> b.tableName(tableName)).join();- Specified by:
createTablein interfaceDynamoDbAsyncTable<T>- Returns:
- a
CompletableFutureofVoid.
-
deleteItem
public CompletableFuture<T> deleteItem(DeleteItemEnhancedRequest request)
Description copied from interface:DynamoDbAsyncTableDeletes a single item from the mapped table using a supplied primaryKey.The additional configuration parameters that the enhanced client supports are defined in the
DeleteItemEnhancedRequest.This operation calls the low-level DynamoDB API DeleteItem operation. Consult the DeleteItem documentation for further details and constraints.
Example:
MyItem previouslyPersistedItem = mappedTable.delete(DeleteItemEnhancedRequest.builder().key(key).build()).join();- Specified by:
deleteItemin interfaceDynamoDbAsyncTable<T>- Parameters:
request- ADeleteItemEnhancedRequestwith key and optional directives for deleting an item from the table.- Returns:
- a
CompletableFutureof the item that was persisted in the database before it was deleted.
-
deleteItem
public CompletableFuture<T> deleteItem(Consumer<DeleteItemEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncTableDeletes a single item from the mapped table using a supplied primaryKey.The additional configuration parameters that the enhanced client supports are defined in the
DeleteItemEnhancedRequest.This operation calls the low-level DynamoDB API DeleteItem operation. Consult the DeleteItem documentation for further details and constraints.
Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one manually via
DeleteItemEnhancedRequest.builder().Example:
MyItem previouslyPersistedItem = mappedTable.delete(r -> r.key(key)).join();- Specified by:
deleteItemin interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofDeleteItemEnhancedRequestwith key and optional directives for deleting an item from the table.- Returns:
- a
CompletableFutureof the item that was persisted in the database before it was deleted.
-
deleteItem
public CompletableFuture<T> deleteItem(Key key)
Description copied from interface:DynamoDbAsyncTableDeletes a single item from the mapped table using a supplied primaryKey.This operation calls the low-level DynamoDB API DeleteItem operation. Consult the DeleteItem documentation for further details and constraints.
Example:
MyItem previouslyPersistedItem = mappedTable.delete(key).join;- Specified by:
deleteItemin interfaceDynamoDbAsyncTable<T>- Parameters:
key- AKeythat will be used to match a specific record to delete from the database table.- Returns:
- a
CompletableFutureof the item that was persisted in the database before it was deleted.
-
deleteItem
public CompletableFuture<T> deleteItem(T keyItem)
Description copied from interface:DynamoDbAsyncTableDeletes a single item from the mapped table using just the key of a supplied modelled 'key item' object.This operation calls the low-level DynamoDB API DeleteItem operation. Consult the DeleteItem documentation for further details and constraints.
Example:
MyItem previouslyPersistedItem = mappedTable.deleteItem(keyItem).join();- Specified by:
deleteItemin interfaceDynamoDbAsyncTable<T>- Parameters:
keyItem- A modelled item with the primary key fields set that will be used to match a specific record to delete from the database table.- Returns:
- a
CompletableFutureof the item that was persisted in the database before it was deleted.
-
deleteItemWithResponse
public CompletableFuture<DeleteItemEnhancedResponse<T>> deleteItemWithResponse(DeleteItemEnhancedRequest request)
Description copied from interface:DynamoDbAsyncTableDeletes a single item from the mapped table using a supplied primaryKey.The additional configuration parameters that the enhanced client supports are defined in the
DeleteItemEnhancedRequest.This operation calls the low-level DynamoDB API DeleteItem operation. Consult the DeleteItem documentation for further details and constraints. Unlike
DynamoDbAsyncTable.deleteItem(DeleteItemEnhancedRequest), this returns a response object, allowing the user to retrieve additional information from DynamoDB related to the API call, such asConsumedCapacityif specified on the request.Example:
DeleteItemEnhancedRequest request = DeleteItemEnhancedRequest.builder().key(key).build(); DeleteItemEnhancedResponse<MyItem> response = mappedTable.deleteItemWithResponse(request).join();- Specified by:
deleteItemWithResponsein interfaceDynamoDbAsyncTable<T>- Parameters:
request- ADeleteItemEnhancedRequestwith key and optional directives for deleting an item from the table.- Returns:
- A
CompletableFuturecontaining the response returned by DynamoDB.
-
deleteItemWithResponse
public CompletableFuture<DeleteItemEnhancedResponse<T>> deleteItemWithResponse(Consumer<DeleteItemEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncTableDeletes a single item from the mapped table using a supplied primaryKey.The additional configuration parameters that the enhanced client supports are defined in the
DeleteItemEnhancedRequest.This operation calls the low-level DynamoDB API DeleteItem operation. Consult the DeleteItem documentation for further details and constraints. Unlike
DynamoDbAsyncTable.deleteItem(Consumer), this returns a response object, allowing the user to retrieve additional information from DynamoDB related to the API call, such asConsumedCapacityif specified on the request.Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one manually via
DeleteItemEnhancedRequest.builder().Example:
DeleteItemEnhancedResponse<MyItem> response = mappedTable.deleteWithResponse(r -> r.key(key)).join();- Specified by:
deleteItemWithResponsein interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofDeleteItemEnhancedRequestwith key and optional directives for deleting an item from the table.- Returns:
- A
CompletableFuturecontaining the response returned by DynamoDB.
-
getItem
public CompletableFuture<T> getItem(GetItemEnhancedRequest request)
Description copied from interface:DynamoDbAsyncTableRetrieves a single item from the mapped table using a supplied primaryKey.The additional configuration parameters that the enhanced client supports are defined in the
GetItemEnhancedRequest.This operation calls the low-level DynamoDB API GetItem operation. Consult the GetItem documentation for further details and constraints.
Example:
MyItem item = mappedTable.getItem(GetItemEnhancedRequest.builder().key(key).build()).join();- Specified by:
getItemin interfaceDynamoDbAsyncTable<T>- Parameters:
request- AGetItemEnhancedRequestwith key and optional directives for retrieving an item from the table.- Returns:
- a
CompletableFutureof the retrieved item.
-
getItem
public CompletableFuture<T> getItem(Consumer<GetItemEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncTableRetrieves a single item from the mapped table using a supplied primaryKey.The additional configuration parameters that the enhanced client supports are defined in the
GetItemEnhancedRequest.This operation calls the low-level DynamoDB API GetItem operation. Consult the GetItem documentation for further details and constraints.
Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one manually via
GetItemEnhancedRequest.builder().Example:
MyItem item = mappedTable.getItem(r -> r.key(key)).join();- Specified by:
getItemin interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofGetItemEnhancedRequest.Builderwith key and optional directives for retrieving an item from the table.- Returns:
- a
CompletableFutureof the retrieved item
-
getItem
public CompletableFuture<T> getItem(Key key)
Description copied from interface:DynamoDbAsyncTableRetrieves a single item from the mapped table using a supplied primaryKey.This operation calls the low-level DynamoDB API GetItem operation. Consult the GetItem documentation for further details and constraints.
Example:
MyItem item = mappedTable.getItem(key).join();- Specified by:
getItemin interfaceDynamoDbAsyncTable<T>- Parameters:
key- AKeythat will be used to match a specific record to retrieve from the database table.- Returns:
- a
CompletableFutureof the retrieved item
-
getItem
public CompletableFuture<T> getItem(T keyItem)
Description copied from interface:DynamoDbAsyncTableRetrieves a single item from the mapped table using just the key of a supplied modelled 'key item'.This operation calls the low-level DynamoDB API GetItem operation. Consult the GetItem documentation for further details and constraints.
Example:
MyItem item = mappedTable.getItem(keyItem).join();- Specified by:
getItemin interfaceDynamoDbAsyncTable<T>- Parameters:
keyItem- A modelled item with the primary key fields set that will be used to match a specific record to retrieve from the database table.- Returns:
- a
CompletableFutureof the retrieved item
-
getItemWithResponse
public CompletableFuture<GetItemEnhancedResponse<T>> getItemWithResponse(GetItemEnhancedRequest request)
Description copied from interface:DynamoDbAsyncTableRetrieves a single item from the mapped table using a supplied primaryKey. This is similar toDynamoDbAsyncTable.getItem(GetItemEnhancedRequest)but returnsGetItemEnhancedResponsefor additional information.The additional configuration parameters that the enhanced client supports are defined in the
GetItemEnhancedRequest.This operation calls the low-level DynamoDB API GetItem operation. Consult the GetItem documentation for further details and constraints.
Example:
MyItem item = mappedTable.getItemWithResponse(GetItemEnhancedRequest.builder().key(key).build()).join();- Specified by:
getItemWithResponsein interfaceDynamoDbAsyncTable<T>- Parameters:
request- AGetItemEnhancedRequestwith key and optional directives for retrieving an item from the table.- Returns:
- a
CompletableFuturecontaining the response returned by DynamoDB.
-
getItemWithResponse
public CompletableFuture<GetItemEnhancedResponse<T>> getItemWithResponse(Consumer<GetItemEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncTableRetrieves a single item from the mapped table using a supplied primaryKey. This is similar to#getItem(Consumerbut returns) GetItemEnhancedResponsefor additional information.The additional configuration parameters that the enhanced client supports are defined in the
GetItemEnhancedRequest.This operation calls the low-level DynamoDB API GetItem operation. Consult the GetItem documentation for further details and constraints.
Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one manually via
GetItemEnhancedRequest.builder().Example:
MyItem item = mappedTable.getItemWithResponse(r -> r.key(key)).join();- Specified by:
getItemWithResponsein interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofGetItemEnhancedRequest.Builderwith key and optional directives for retrieving an item from the table.- Returns:
- a
CompletableFuturecontaining the response returned by DynamoDB.
-
query
public PagePublisher<T> query(QueryEnhancedRequest request)
Description copied from interface:DynamoDbAsyncTableExecutes a query against the primary index of the table using aQueryConditionalexpression to retrieve a list of items matching the given conditions.The return type is a custom publisher that can be subscribed to request a stream of
Pages or a stream of items across all pages. Results are sorted by sort key value in ascending order by default; this behavior can be overridden in theQueryEnhancedRequest.The additional configuration parameters that the enhanced client supports are defined in the
QueryEnhancedRequest.This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation
DynamoDbAsyncClient.queryPaginator(software.amazon.awssdk.services.dynamodb.model.QueryRequest)for further details and constraints.Example:
1) Subscribing to
PagesQueryConditional queryConditional = QueryConditional.keyEqualTo(Key.builder().partitionValue("id-value").build()); PagePublisher<MyItem> publisher = mappedTable.query(QueryEnhancedRequest.builder() .queryConditional(queryConditional) .build()); publisher.subscribe(page -> page.items().forEach(item -> System.out.println(item)));2) Subscribing to items across all pages
QueryConditional queryConditional = QueryConditional.keyEqualTo(Key.builder().partitionValue("id-value").build()); PagePublisher<MyItem> publisher = mappedTable.query(QueryEnhancedRequest.builder() .queryConditional(queryConditional) .build()) .items(); publisher.items().subscribe(item -> System.out.println(item));- Specified by:
queryin interfaceDynamoDbAsyncTable<T>- Parameters:
request- AQueryEnhancedRequestdefining the query conditions and how to handle the results.- Returns:
- a publisher
PagePublisherwith paginated results (seePage). - See Also:
DynamoDbAsyncTable.query(Consumer),DynamoDbAsyncTable.query(QueryConditional),DynamoDbAsyncClient.queryPaginator(software.amazon.awssdk.services.dynamodb.model.QueryRequest)
-
query
public PagePublisher<T> query(Consumer<QueryEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncTableExecutes a query against the primary index of the table using aQueryConditionalexpression to retrieve a list of items matching the given conditions.Note: This is a convenience method that creates an instance of the request builder avoiding the need to create one manually via
QueryEnhancedRequest.builder().Example:
PagePublisher<MyItem> publisher = mappedTable.query(r -> r.queryConditional(QueryConditional.keyEqualTo(k -> k.partitionValue("id-value"))));- Specified by:
queryin interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofQueryEnhancedRequestdefining the query conditions and how to handle the results.- Returns:
- a publisher
PagePublisherwith paginated results (seePage). - See Also:
DynamoDbAsyncTable.query(QueryEnhancedRequest),DynamoDbAsyncTable.query(QueryConditional),DynamoDbAsyncClient.queryPaginator(software.amazon.awssdk.services.dynamodb.model.QueryRequest)
-
query
public PagePublisher<T> query(QueryConditional queryConditional)
Description copied from interface:DynamoDbAsyncTableExecutes a query against the primary index of the table using aQueryConditionalexpression to retrieve a list of items matching the given conditions.The result is accessed through iterable pages (see
Page) in an interactive way; each time a result page is retrieved, a query call is made to DynamoDb to get those entries. If no matches are found, the resulting iterator will contain an empty page. Results are sorted by sort key value in ascending order.This operation calls the low-level DynamoDB API Query operation. Consult the Query documentation for further details and constraints.
Example:
PagePublisher<MyItem> results = mappedTable.query(QueryConditional.keyEqualTo(Key.builder().partitionValue("id-value").build()));- Specified by:
queryin interfaceDynamoDbAsyncTable<T>- Parameters:
queryConditional- AQueryConditionaldefining the matching criteria for records to be queried.- Returns:
- a publisher
PagePublisherwith paginated results (seePage). - See Also:
DynamoDbAsyncTable.query(QueryEnhancedRequest),DynamoDbAsyncTable.query(Consumer),DynamoDbAsyncClient.queryPaginator(software.amazon.awssdk.services.dynamodb.model.QueryRequest)
-
putItem
public CompletableFuture<Void> putItem(PutItemEnhancedRequest<T> request)
Description copied from interface:DynamoDbAsyncTablePuts a single item in the mapped table. If the table contains an item with the same primary key, it will be replaced with this item.The additional configuration parameters that the enhanced client supports are defined in the
PutItemEnhancedRequest.This operation calls the low-level DynamoDB API PutItem operation. Consult the PutItem documentation for further details and constraints.
Example:
mappedTable.putItem(PutItemEnhancedRequest.builder(MyItem.class).item(item).build()).join();- Specified by:
putItemin interfaceDynamoDbAsyncTable<T>- Parameters:
request- APutItemEnhancedRequestthat includes the item to enter into the table, its class and optional directives.- Returns:
- a
CompletableFuturethat returns no results which will complete when the operation is done.
-
putItem
public CompletableFuture<Void> putItem(Consumer<PutItemEnhancedRequest.Builder<T>> requestConsumer)
Description copied from interface:DynamoDbAsyncTablePuts a single item in the mapped table. If the table contains an item with the same primary key, it will be replaced with this item.The additional configuration parameters that the enhanced client supports are defined in the
PutItemEnhancedRequest.This operation calls the low-level DynamoDB API PutItem operation. Consult the PutItem documentation for further details and constraints.
Example:
mappedTable.putItem(r -> r.item(item)).join();- Specified by:
putItemin interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofPutItemEnhancedRequest.Builderthat includes the item to enter into the table, its class and optional directives.- Returns:
- a
CompletableFuturethat returns no results which will complete when the operation is done.
-
putItem
public CompletableFuture<Void> putItem(T item)
Description copied from interface:DynamoDbAsyncTablePuts a single item in the mapped table. If the table contains an item with the same primary key, it will be replaced with this item.This operation calls the low-level DynamoDB API PutItem operation. Consult the PutItem documentation for further details and constraints.
Example:
mappedTable.putItem(item);- Specified by:
putItemin interfaceDynamoDbAsyncTable<T>- Parameters:
item- the modelled item to be inserted into or overwritten in the database table.- Returns:
- a
CompletableFuturethat returns no results which will complete when the operation is done.
-
putItemWithResponse
public CompletableFuture<PutItemEnhancedResponse<T>> putItemWithResponse(PutItemEnhancedRequest<T> request)
Description copied from interface:DynamoDbAsyncTablePuts a single item in the mapped table. If the table contains an item with the same primary key, it will be replaced with this item. This is similar toDynamoDbAsyncTable.putItem(PutItemEnhancedRequest)but returnsPutItemEnhancedResponsefor additional information.The additional configuration parameters that the enhanced client supports are defined in the
PutItemEnhancedRequest.This operation calls the low-level DynamoDB API PutItem operation. Consult the PutItem documentation for further details and constraints.
Example:
mappedTable.putItem(PutItemEnhancedRequest.builder(MyItem.class).item(item).build());- Specified by:
putItemWithResponsein interfaceDynamoDbAsyncTable<T>- Parameters:
request- APutItemEnhancedRequestthat includes the item to enter into the table, its class and optional directives.- Returns:
- A
CompletableFuturethat contains the response returned by DynamoDB.
-
putItemWithResponse
public CompletableFuture<PutItemEnhancedResponse<T>> putItemWithResponse(Consumer<PutItemEnhancedRequest.Builder<T>> requestConsumer)
Description copied from interface:DynamoDbAsyncTablePuts a single item in the mapped table. If the table contains an item with the same primary key, it will be replaced with this item. This is similar toDynamoDbAsyncTable.putItem(PutItemEnhancedRequest)but returnsPutItemEnhancedResponsefor additional information.The additional configuration parameters that the enhanced client supports are defined in the
PutItemEnhancedRequest.This operation calls the low-level DynamoDB API PutItem operation. Consult the PutItem documentation for further details and constraints.
Example:
mappedTable.putItem(PutItemEnhancedRequest.builder(MyItem.class).item(item).build());- Specified by:
putItemWithResponsein interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofPutItemEnhancedRequest.Builderthat includes the item to enter into the table, its class and optional directives.- Returns:
- A
CompletableFuturethat contains the response returned by DynamoDB.
-
scan
public PagePublisher<T> scan(ScanEnhancedRequest request)
Description copied from interface:DynamoDbAsyncTableScans the table and retrieves all items.The return type is a custom publisher that can be subscribed to request a stream of
Pages or a stream of flattened items across all pages. Each time a result page is retrieved, a scan call is made to DynamoDb to get those entries. If no matches are found, the resulting iterator will contain an empty page.The additional configuration parameters that the enhanced client supports are defined in the
ScanEnhancedRequest.Example:
1) Subscribing to
PagesPagePublisher<MyItem> publisher = mappedTable.scan(ScanEnhancedRequest.builder().consistentRead(true).build()); publisher.subscribe(page -> page.items().forEach(item -> System.out.println(item)));2) Subscribing to items across all pages.
PagePublisher<MyItem> publisher = mappedTable.scan(ScanEnhancedRequest.builder().consistentRead(true).build()); publisher.items().subscribe(item -> System.out.println(item));- Specified by:
scanin interfaceDynamoDbAsyncTable<T>- Parameters:
request- AScanEnhancedRequestdefining how to handle the results.- Returns:
- a publisher
PagePublisherwith paginated results (seePage). - See Also:
DynamoDbAsyncTable.scan(Consumer),DynamoDbAsyncTable.scan(),DynamoDbAsyncClient.scanPaginator(software.amazon.awssdk.services.dynamodb.model.ScanRequest)
-
scan
public PagePublisher<T> scan(Consumer<ScanEnhancedRequest.Builder> requestConsumer)
Description copied from interface:DynamoDbAsyncTableScans the table and retrieves all items.Example:
PagePublisher<MyItem> publisher = mappedTable.scan(r -> r.limit(5));- Specified by:
scanin interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofScanEnhancedRequestdefining the query conditions and how to handle the results.- Returns:
- a publisher
PagePublisherwith paginated results (seePage). - See Also:
DynamoDbAsyncTable.scan(ScanEnhancedRequest),DynamoDbAsyncTable.scan(),DynamoDbAsyncClient.scanPaginator(software.amazon.awssdk.services.dynamodb.model.ScanRequest)
-
scan
public PagePublisher<T> scan()
Description copied from interface:DynamoDbAsyncTableScans the table and retrieves all items using default settings. Example:PagePublisher<MyItem> publisher = mappedTable.scan();- Specified by:
scanin interfaceDynamoDbAsyncTable<T>- Returns:
- a publisher
PagePublisherwith paginated results (seePage). - See Also:
DynamoDbAsyncTable.scan(ScanEnhancedRequest),DynamoDbAsyncTable.scan(Consumer),DynamoDbAsyncClient.scanPaginator(software.amazon.awssdk.services.dynamodb.model.ScanRequest)
-
updateItem
public CompletableFuture<T> updateItem(UpdateItemEnhancedRequest<T> request)
Description copied from interface:DynamoDbAsyncTableUpdates an item in the mapped table, or adds it if it doesn't exist.The additional configuration parameters that the enhanced client supports are defined in the
UpdateItemEnhancedRequest.This operation calls the low-level DynamoDB API UpdateItem operation. Consult the UpdateItem documentation for further details and constraints.
Example:
MyItem item = mappedTable.updateItem(UpdateItemEnhancedRequest.builder(MyItem.class).item(item).build()).join();- Specified by:
updateItemin interfaceDynamoDbAsyncTable<T>- Parameters:
request- AUpdateItemEnhancedRequestthat includes the item to be updated, its class and optional directives.- Returns:
- a
CompletableFutureof the updated item
-
updateItem
public CompletableFuture<T> updateItem(Consumer<UpdateItemEnhancedRequest.Builder<T>> requestConsumer)
Description copied from interface:DynamoDbAsyncTableUpdates an item in the mapped table, or adds it if it doesn't exist.The additional configuration parameters that the enhanced client supports are defined in the
UpdateItemEnhancedRequest.This operation calls the low-level DynamoDB API UpdateItem operation. Consult the UpdateItem documentation for further details and constraints.
Example:
MyItem item = mappedTable.updateItem(r -> r.item(item)).join();- Specified by:
updateItemin interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofUpdateItemEnhancedRequest.Builderthat includes the item to be updated, its class and optional directives.- Returns:
- a
CompletableFutureof the updated item
-
updateItemWithResponse
public CompletableFuture<UpdateItemEnhancedResponse<T>> updateItemWithResponse(UpdateItemEnhancedRequest<T> request)
Description copied from interface:DynamoDbAsyncTableUpdates an item in the mapped table, or adds it if it doesn't exist. This is similar toDynamoDbAsyncTable.updateItem(UpdateItemEnhancedRequest)} but returnsUpdateItemEnhancedResponsefor additional information.This operation calls the low-level DynamoDB API UpdateItem operation. Consult the UpdateItem documentation for further details and constraints.
Example:
UpdateItemEnhancedRequest<MyItem> request = UpdateItemEnhancedRequest.builder(MyItem.class).item(myItem).build(); UpdateItemEnhancedResponse<MyItem> response = mappedTable.updateItemWithResponse(request).join();- Specified by:
updateItemWithResponsein interfaceDynamoDbAsyncTable<T>- Parameters:
request- the modelled item to be inserted into or updated in the database table.- Returns:
- A
CompletableFuturecontaining the response from DynamoDB.
-
updateItemWithResponse
public CompletableFuture<UpdateItemEnhancedResponse<T>> updateItemWithResponse(Consumer<UpdateItemEnhancedRequest.Builder<T>> requestConsumer)
Description copied from interface:DynamoDbAsyncTableUpdates an item in the mapped table, or adds it if it doesn't exist. This is similar toDynamoDbAsyncTable.updateItem(Consumer)but returnsUpdateItemEnhancedResponsefor additional information.This operation calls the low-level DynamoDB API UpdateItem operation. Consult the UpdateItem documentation for further details and constraints.
Example:
UpdateItemEnhancedResponse<MyItem> response = mappedTable.updateItemWithResponse(r ->r.item(myItem)).join();- Specified by:
updateItemWithResponsein interfaceDynamoDbAsyncTable<T>- Parameters:
requestConsumer- AConsumerofUpdateItemEnhancedRequest.Builderthat includes the item * to be updated, its class and optional directives.- Returns:
- A
CompletableFuturecontaining the response from DynamoDB.
-
updateItem
public CompletableFuture<T> updateItem(T item)
Description copied from interface:DynamoDbAsyncTableUpdates an item in the mapped table, or adds it if it doesn't exist.This operation calls the low-level DynamoDB API UpdateItem operation. Consult the UpdateItem documentation for further details and constraints.
Example:
MyItem item = mappedTable.updateItem(item).join();- Specified by:
updateItemin interfaceDynamoDbAsyncTable<T>- Parameters:
item- the modelled item to be inserted into or updated in the database table.- Returns:
- a
CompletableFutureof the updated item
-
keyFrom
public Key keyFrom(T item)
Description copied from interface:MappedTableResourceCreates aKeyobject from a modelled item. This key can be used in query conditionals and get operations to locate a specific record.- Specified by:
keyFromin interfaceMappedTableResource<T>- Parameters:
item- The item to extract the key fields from.- Returns:
- A key that has been initialized with the index values extracted from the modelled object.
-
deleteTable
public CompletableFuture<Void> deleteTable()
Description copied from interface:DynamoDbAsyncTableDeletes a table in DynamoDb with the name and schema already defined for this DynamoDbTable.Use
DynamoDbEnhancedClient.table(String, TableSchema)to define the mapped table resource.This operation calls the low-level DynamoDB API DeleteTable operation. Note that this is an asynchronous operation and that the table may not immediately deleted. You can use
DynamoDbAsyncWaiter.waitUntilTableNotExists(software.amazon.awssdk.services.dynamodb.model.DescribeTableRequest)in the underlying client.Example:
mappedTable.deleteTable().join();- Specified by:
deleteTablein interfaceDynamoDbAsyncTable<T>- Returns:
- a
CompletableFutureofVoid.
-
describeTable
public CompletableFuture<DescribeTableEnhancedResponse> describeTable()
Description copied from interface:DynamoDbAsyncTableDescribes a table in DynamoDb with the name defined for thisDynamoDbAsyncTable. This operation calls the low-level DynamoDB API DescribeTable operation, seeDynamoDbAsyncClient.describeTable(DescribeTableRequest)Example:
DescribeTableEnhancedResponse response = mappedTable.describeTable().join();- Specified by:
describeTablein interfaceDynamoDbAsyncTable<T>
-
-