Class CrossTableBatchGetBuilder
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractCrossTableBatchGetBuilder<CrossTableBatchGetBuilder>
dev.hogwai.dynamodb.simplified.builder.CrossTableBatchGetBuilder
public class CrossTableBatchGetBuilder
extends AbstractCrossTableBatchGetBuilder<CrossTableBatchGetBuilder>
Builds a cross-table batch get operation to retrieve items from multiple tables by their keys.
Obtain via DynamoSimplifiedClient.batchGet().
Unlike the single-table BatchGetBuilder, this builder accepts table-scoped keys,
allowing retrieval from multiple tables in a single request.
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractCrossTableBatchGetBuilder
AbstractCrossTableBatchGetBuilder.Entry -
Field Summary
Fields inherited from class AbstractCrossTableBatchGetBuilder
consistentRead, entries, returnConsumedCapacity -
Constructor Summary
ConstructorsConstructorDescriptionCrossTableBatchGetBuilder(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient) Constructs a newCrossTableBatchGetBuilder. -
Method Summary
Modifier and TypeMethodDescription<T> @NonNull CrossTableBatchGetBuilderAdds a key to retrieve by partition key from the given table.<T> @NonNull CrossTableBatchGetBuilderAdds a key to retrieve by partition and sort key from the given table.<T> @NonNull CrossTableBatchGetBuilderaddKeys(@NonNull Table<T> table, @NonNull Collection<?> partitionKeys) Adds multiple partition keys from the given table at once.@NonNull CrossTableBatchGetResultexecute()Executes the batch get operation and returns items grouped by table.protected @NonNull StringgetTableName(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Extracts the DynamoDB table name from an entry's table reference.protected @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Extracts the table schema from an entry's table reference.protected @NonNull CrossTableBatchGetBuilderself()Returnsthistyped asSfor fluent chaining.Methods inherited from class AbstractCrossTableBatchGetBuilder
buildKey, buildRequestItems, consistentRead, groupEntriesByTable, project, project, returnConsumedCapacity
-
Constructor Details
-
CrossTableBatchGetBuilder
public CrossTableBatchGetBuilder(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient) Constructs a newCrossTableBatchGetBuilder.- Parameters:
dynamoDbClient- the low-level DynamoDB client
-
-
Method Details
-
self
Description copied from class:AbstractCrossTableBatchGetBuilderReturnsthistyped asSfor fluent chaining.- Specified by:
selfin classAbstractCrossTableBatchGetBuilder<CrossTableBatchGetBuilder>- Returns:
- this builder
-
getTableName
Description copied from class:AbstractCrossTableBatchGetBuilderExtracts the DynamoDB table name from an entry's table reference.- Specified by:
getTableNamein classAbstractCrossTableBatchGetBuilder<CrossTableBatchGetBuilder>- 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 AbstractCrossTableBatchGetBuilder.Entry entry) Description copied from class:AbstractCrossTableBatchGetBuilderExtracts the table schema from an entry's table reference.- Specified by:
getTableSchemain classAbstractCrossTableBatchGetBuilder<CrossTableBatchGetBuilder>- Parameters:
entry- the entry whose table schema to extract- Returns:
- the table schema
-
addKey
public <T> @NonNull CrossTableBatchGetBuilder addKey(@NonNull Table<T> table, @NonNull Object partitionKey) Adds a key to retrieve by partition key from the given table.- Type Parameters:
T- the item type- Parameters:
table- the typed table to read frompartitionKey- the partition key value- Returns:
- this builder
-
addKey
public <T> @NonNull CrossTableBatchGetBuilder addKey(@NonNull Table<T> table, @NonNull Object partitionKey, @NonNull Object sortKey) Adds a key to retrieve by partition and sort key from the given table.- Type Parameters:
T- the item type- Parameters:
table- the typed table to read frompartitionKey- the partition key valuesortKey- the sort key value- Returns:
- this builder
-
addKeys
public <T> @NonNull CrossTableBatchGetBuilder addKeys(@NonNull Table<T> table, @NonNull Collection<?> partitionKeys) Adds multiple partition keys from the given table at once.- Type Parameters:
T- the item type- Parameters:
table- the typed table to read frompartitionKeys- the partition key values- Returns:
- this builder
-
execute
Executes the batch get operation and returns items grouped by table.Groups entries by table name and calls the low-level DynamoDB API.
- Returns:
- a
CrossTableBatchGetResultcontaining the retrieved items and unprocessed keys - Throws:
IllegalArgumentException- if more than 100 keys are provided
-