public final class DefaultDynamoDbAsyncTable<T> extends Object implements DynamoDbAsyncTable<T>
| Modifier and Type | Method and 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 primary
Key. |
CompletableFuture<T> |
deleteItem(DeleteItemEnhancedRequest request)
Deletes a single item from the mapped table using a supplied primary
Key. |
DynamoDbAsyncClient |
dynamoDbClient() |
boolean |
equals(Object o) |
CompletableFuture<T> |
getItem(Consumer<GetItemEnhancedRequest.Builder> requestConsumer)
Retrieves a single item from the mapped table using a supplied primary
Key. |
CompletableFuture<T> |
getItem(GetItemEnhancedRequest request)
Retrieves a single item from the mapped table using a supplied primary
Key. |
int |
hashCode() |
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.
|
Key |
keyFrom(T item)
Creates a
Key object from a modelled item. |
DynamoDbEnhancedClientExtension |
mapperExtension()
Gets the
DynamoDbEnhancedClientExtension associated with this mapped resource. |
CompletableFuture<Void> |
putItem(Class<? extends T> itemClass,
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.
|
SdkPublisher<Page<T>> |
query(Consumer<QueryEnhancedRequest.Builder> requestConsumer)
Executes a query against the primary index of the table using a
QueryConditional expression to retrieve a list of
items matching the given conditions. |
SdkPublisher<Page<T>> |
query(QueryEnhancedRequest request)
Executes a query against the primary index of the table using a
QueryConditional expression to retrieve a list of
items matching the given conditions. |
SdkPublisher<Page<T>> |
scan()
Scans the table and retrieves all items using default settings.
|
SdkPublisher<Page<T>> |
scan(Consumer<ScanEnhancedRequest.Builder> requestConsumer)
Scans the table and retrieves all items.
|
SdkPublisher<Page<T>> |
scan(ScanEnhancedRequest request)
Scans the table and retrieves all items.
|
String |
tableName()
Gets the physical table name that operations performed by this object will be executed against.
|
TableSchema<T> |
tableSchema()
Gets the
TableSchema object that this mapped table was built with. |
CompletableFuture<T> |
updateItem(Class<? extends T> itemClass,
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.
|
public DynamoDbEnhancedClientExtension mapperExtension()
MappedTableResourceDynamoDbEnhancedClientExtension associated with this mapped resource.mapperExtension in interface MappedTableResource<T>DynamoDbEnhancedClientExtension associated with this mapped resource.public TableSchema<T> tableSchema()
MappedTableResourceTableSchema object that this mapped table was built with.tableSchema in interface MappedTableResource<T>TableSchema object for this mapped table.public DynamoDbAsyncClient dynamoDbClient()
public String tableName()
MappedTableResourcetableName in interface MappedTableResource<T>public DefaultDynamoDbAsyncIndex<T> index(String indexName)
DynamoDbAsyncTableindex in interface DynamoDbAsyncTable<T>indexName - The name of the secondary index to build the command interface for.DynamoDbAsyncIndex object that can be used to execute database commands against.public CompletableFuture<Void> createTable(CreateTableEnhancedRequest request)
DynamoDbAsyncTableCreateTableEnhancedRequest.
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. Consult the CreateTable documentation for further details and constraints.
Example:
ProvisionedThroughput provisionedThroughput = ProvisionedThroughput.builder()
.readCapacityUnits(50L)
.writeCapacityUnits(50L)
.build();
mappedTable.createTable(CreateTableEnhancedRequest.builder()
.provisionedThroughput(provisionedThroughput)
.build())
.join();
createTable in interface DynamoDbAsyncTable<T>request - A CreateTableEnhancedRequest containing optional parameters for table creation.CompletableFuture of Void.public CompletableFuture<Void> createTable(Consumer<CreateTableEnhancedRequest.Builder> requestConsumer)
DynamoDbAsyncTableCreateTableEnhancedRequest.
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. Consult the CreateTable 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 CreateTableEnhancedRequest.builder().
Example:
ProvisionedThroughput provisionedThroughput = ProvisionedThroughput.builder()
.readCapacityUnits(50L)
.writeCapacityUnits(50L)
.build();
mappedTable.createTable(r -> r.provisionedThroughput(provisionedThroughput)).join();
createTable in interface DynamoDbAsyncTable<T>requestConsumer - A Consumer of CreateTableEnhancedRequest.Builder containing optional parameters
for table creation.CompletableFuture of Void.public CompletableFuture<Void> createTable()
DynamoDbAsyncTable
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. Currently, there is no mechanism supported within this library to wait for/check the status of a created table. You must provide this functionality yourself. Consult the CreateTable documentation for further details and constraints.
Example:
mappedTable.createTable().join();
createTable in interface DynamoDbAsyncTable<T>CompletableFuture of Void.public CompletableFuture<T> deleteItem(DeleteItemEnhancedRequest request)
DynamoDbAsyncTableKey.
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:
mappedTable.delete(DeleteItemEnhancedRequest.builder().key(key).build()).join();
deleteItem in interface DynamoDbAsyncTable<T>request - A DeleteItemEnhancedRequest with key and optional directives for deleting an item from the table.CompletableFuture of the deleted itempublic CompletableFuture<T> deleteItem(Consumer<DeleteItemEnhancedRequest.Builder> requestConsumer)
DynamoDbAsyncTableKey.
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:
mappedTable.delete(r -> r.key(key)).join();
deleteItem in interface DynamoDbAsyncTable<T>requestConsumer - A Consumer of DeleteItemEnhancedRequest with key and
optional directives for deleting an item from the table.CompletableFuture of the deleted itempublic CompletableFuture<T> getItem(GetItemEnhancedRequest request)
DynamoDbAsyncTableKey.
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();
getItem in interface DynamoDbAsyncTable<T>request - A GetItemEnhancedRequest with key and optional directives for retrieving an item from the table.CompletableFuture of the retrieved itempublic CompletableFuture<T> getItem(Consumer<GetItemEnhancedRequest.Builder> requestConsumer)
DynamoDbAsyncTableKey.
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();
getItem in interface DynamoDbAsyncTable<T>requestConsumer - A Consumer of GetItemEnhancedRequest.Builder with key and optional directives
for retrieving an item from the table.CompletableFuture of the retrieved itempublic SdkPublisher<Page<T>> query(QueryEnhancedRequest request)
DynamoDbAsyncTableQueryConditional expression 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 by default; this behavior can be overridden in the QueryEnhancedRequest.
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 for further details and constraints.
Example:
QueryConditional queryConditional = QueryConditional.keyEqualTo(Key.builder().partitionValue("id-value").build());
SdkPublisher<Page<MyItem>> publisher = mappedTable.query(QueryEnhancedRequest.builder()
.queryConditional(queryConditional)
.build());
query in interface DynamoDbAsyncTable<T>request - A QueryEnhancedRequest defining the query conditions and how
to handle the results.SdkPublisher with paginated results (see Page).public SdkPublisher<Page<T>> query(Consumer<QueryEnhancedRequest.Builder> requestConsumer)
DynamoDbAsyncTableQueryConditional expression 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 by default; this behavior can be overridden in the QueryEnhancedRequest.
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 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 QueryEnhancedRequest.builder().
Example:
SdkPublisher<Page<MyItem>> publisher =
mappedTable.query(r -> r.queryConditional(QueryConditional.keyEqualTo(k -> k.partitionValue("id-value"))));
query in interface DynamoDbAsyncTable<T>requestConsumer - A Consumer of QueryEnhancedRequest defining the query conditions and how to
handle the results.SdkPublisher with paginated results (see Page).public CompletableFuture<Void> putItem(PutItemEnhancedRequest<T> request)
DynamoDbAsyncTable
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();
putItem in interface DynamoDbAsyncTable<T>request - A PutItemEnhancedRequest that includes the item to enter into
the table, its class and optional directives.CompletableFuture of Void.public CompletableFuture<Void> putItem(Class<? extends T> itemClass, Consumer<PutItemEnhancedRequest.Builder<T>> requestConsumer)
DynamoDbAsyncTable
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(MyItem.class, r -> r.item(item)).join();
putItem in interface DynamoDbAsyncTable<T>requestConsumer - A Consumer of PutItemEnhancedRequest.Builder that includes the item
to enter into the table, its class and optional directives.CompletableFuture of Void.public SdkPublisher<Page<T>> scan(ScanEnhancedRequest request)
DynamoDbAsyncTable
The result is accessed through iterable pages (see Page) in an interactive way; 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:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan(ScanEnhancedRequest.builder().consistentRead(true).build());
scan in interface DynamoDbAsyncTable<T>request - A ScanEnhancedRequest defining how to handle the results.SdkPublisher with paginated results (see Page).public SdkPublisher<Page<T>> scan(Consumer<ScanEnhancedRequest.Builder> requestConsumer)
DynamoDbAsyncTable
The result is accessed through iterable pages (see Page) in an interactive way; 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:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan(r -> r.limit(5));
scan in interface DynamoDbAsyncTable<T>requestConsumer - A Consumer of ScanEnhancedRequest defining the query conditions and how to
handle the results.SdkPublisher with paginated results (see Page).public SdkPublisher<Page<T>> scan()
DynamoDbAsyncTable
The result is accessed through iterable pages (see Page) in an interactive way; 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.
Example:
SdkPublisher<Page<MyItem>> publisher = mappedTable.scan();
scan in interface DynamoDbAsyncTable<T>SdkPublisher with paginated results (see Page).public CompletableFuture<T> updateItem(UpdateItemEnhancedRequest<T> request)
DynamoDbAsyncTable
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();
updateItem in interface DynamoDbAsyncTable<T>request - A UpdateItemEnhancedRequest that includes the item to be updated,
its class and optional directives.CompletableFuture of the updated itempublic CompletableFuture<T> updateItem(Class<? extends T> itemClass, Consumer<UpdateItemEnhancedRequest.Builder<T>> requestConsumer)
DynamoDbAsyncTable
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(MyItem.class, r -> r.item(item)).join();
updateItem in interface DynamoDbAsyncTable<T>requestConsumer - A Consumer of UpdateItemEnhancedRequest.Builder that includes the item
to be updated, its class and optional directives.CompletableFuture of the updated itempublic Key keyFrom(T item)
MappedTableResourceKey object from a modelled item. This key can be used in query conditionals and get
operations to locate a specific record.keyFrom in interface MappedTableResource<T>item - The item to extract the key fields from.Copyright © 2020. All rights reserved.