Class AsyncTransactGetBuilder
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractTransactGetBuilder<AsyncTransactGetBuilder>
dev.hogwai.dynamodb.simplified.async.AsyncTransactGetBuilder
Builds an async transactional get operation that reads up to 100 items atomically
across one or more tables.
Obtain via AsyncDynamoSimplifiedClient.transactGet(). All items are retrieved
in a single all-or-nothing transaction. If any item cannot be read, the entire
transaction fails and no results are returned.
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractTransactGetBuilder
AbstractTransactGetBuilder.Entry -
Field Summary
Fields inherited from class AbstractTransactGetBuilder
entries -
Constructor Summary
ConstructorsConstructorDescriptionAsyncTransactGetBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient enhancedClient) Constructs a newAsyncTransactGetBuilder.AsyncTransactGetBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient enhancedClient, @NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient) Constructs a newAsyncTransactGetBuilderwith the low-level async client for projection support. -
Method Summary
Modifier and TypeMethodDescription<T> @NonNull AsyncTransactGetBuilderaddGetItem(@NonNull AsyncTable<T> table, @NonNull Object partitionKey) Adds an item to retrieve by partition key.<T> @NonNull AsyncTransactGetBuilderaddGetItem(@NonNull AsyncTable<T> table, @NonNull Object partitionKey, @NonNull Object sortKey) Adds an item to retrieve by partition and sort key.@NonNull CompletableFuture<TransactGetResults<software.amazon.awssdk.enhanced.dynamodb.DynamoDbAsyncTable<?>>> execute()Executes the transactional get operation asynchronously.protected @NonNull StringgetTableName(@NonNull AbstractTransactGetBuilder.Entry entry) Extracts the DynamoDB table name from an entry's table reference.protected @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractTransactGetBuilder.Entry entry) Extracts the table schema from an entry's table reference.protected @NonNull AsyncTransactGetBuilderself()Returnsthistyped asSfor fluent chaining.Methods inherited from class AbstractTransactGetBuilder
buildKey, buildTransactItems, hasNonEmptyProjection, project, project
-
Constructor Details
-
AsyncTransactGetBuilder
public AsyncTransactGetBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient enhancedClient) Constructs a newAsyncTransactGetBuilder.- Parameters:
enhancedClient- the enhanced async DynamoDB client
-
AsyncTransactGetBuilder
public AsyncTransactGetBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient enhancedClient, @NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient dynamoDbAsyncClient) Constructs a newAsyncTransactGetBuilderwith the low-level async client for projection support.- Parameters:
enhancedClient- the enhanced async DynamoDB clientdynamoDbAsyncClient- the low-level async DynamoDB client
-
-
Method Details
-
self
Description copied from class:AbstractTransactGetBuilderReturnsthistyped asSfor fluent chaining.- Specified by:
selfin classAbstractTransactGetBuilder<AsyncTransactGetBuilder>- Returns:
- this builder
-
getTableName
Description copied from class:AbstractTransactGetBuilderExtracts the DynamoDB table name from an entry's table reference.- Specified by:
getTableNamein classAbstractTransactGetBuilder<AsyncTransactGetBuilder>- Parameters:
entry- the entry whose table name to extract- Returns:
- the DynamoDB table name
-
getTableSchema
protected @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractTransactGetBuilder.Entry entry) Description copied from class:AbstractTransactGetBuilderExtracts the table schema from an entry's table reference.- Specified by:
getTableSchemain classAbstractTransactGetBuilder<AsyncTransactGetBuilder>- Parameters:
entry- the entry whose table schema to extract- Returns:
- the table schema
-
addGetItem
public <T> @NonNull AsyncTransactGetBuilder addGetItem(@NonNull AsyncTable<T> table, @NonNull Object partitionKey) Adds an item to retrieve by partition key.- Type Parameters:
T- the item type- Parameters:
table- the typed async table to read frompartitionKey- the partition key value- Returns:
- this builder
-
addGetItem
public <T> @NonNull AsyncTransactGetBuilder addGetItem(@NonNull AsyncTable<T> table, @NonNull Object partitionKey, @NonNull Object sortKey) Adds an item to retrieve by partition and sort key.- Type Parameters:
T- the item type- Parameters:
table- the typed async table to read frompartitionKey- the partition key valuesortKey- the sort key value- Returns:
- this builder
-
execute
public @NonNull CompletableFuture<TransactGetResults<software.amazon.awssdk.enhanced.dynamodb.DynamoDbAsyncTable<?>>> execute()Executes the transactional get operation asynchronously.If any item has a projection expression configured via
AbstractTransactGetBuilder.project(String...), the operation falls back to the low-level DynamoDB API to support attribute filtering.- Returns:
- a
CompletableFuturecontaining aTransactGetResultsobject providing typed access to retrieved items
-