Class AbstractCrossTableBatchGetBuilder<S extends AbstractCrossTableBatchGetBuilder<S>>
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractCrossTableBatchGetBuilder<S>
- Type Parameters:
S- the concrete builder type (for fluent chaining)
- Direct Known Subclasses:
AsyncCrossTableBatchGetBuilder, CrossTableBatchGetBuilder
public abstract class AbstractCrossTableBatchGetBuilder<S extends AbstractCrossTableBatchGetBuilder<S>>
extends Object
Abstract base for sync and async cross-table batch get builders.
Manages entries (key + table associations), consistent read, projection, and consumed capacity settings shared across sync and async variants.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordStores a table reference, key, and optional per-entry projection expression. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BooleanWhether to use strongly consistent reads, ornullto use the default.protected final List<AbstractCrossTableBatchGetBuilder.Entry> The list of entries (table + key + projection) to retrieve.protected static final org.slf4j.LoggerLogger for this builder class.protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacityOptional consumed capacity reporting level. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a newAbstractCrossTableBatchGetBuilder. -
Method Summary
Modifier and TypeMethodDescriptionprotected static @NonNull software.amazon.awssdk.enhanced.dynamodb.KeyBuilds aKeyfrom partition and optional sort key values.buildRequestItems(Map<String, List<AbstractCrossTableBatchGetBuilder.Entry>> entriesByTable, Map<String, software.amazon.awssdk.enhanced.dynamodb.TableSchema<?>> tableSchemas) Builds the request items map from entries grouped by table.@NonNull SconsistentRead(boolean consistentRead) Configures whether to use strongly consistent reads for this batch get operation.protected abstract @NonNull StringgetTableName(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Extracts the DynamoDB table name from an entry's table reference.protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Extracts the table schema from an entry's table reference.protected Map<String, List<AbstractCrossTableBatchGetBuilder.Entry>> Groups entries by their DynamoDB table name.@NonNull SRestricts the returned attributes for the most recently added entry to the specified attribute names.@NonNull Sproject(@NonNull Consumer<ProjectionExpression> consumer) Restricts the returned attributes for the most recently added entry using aProjectionExpressionbuilder consumer.@NonNull SreturnConsumedCapacity(@NonNull software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacity) Configures whether to return consumed capacity information for the operation.protected abstract @NonNull Sself()Returnsthistyped asSfor fluent chaining.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger for this builder class. -
entries
The list of entries (table + key + projection) to retrieve. -
consistentRead
Whether to use strongly consistent reads, ornullto use the default. -
returnConsumedCapacity
protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacityOptional consumed capacity reporting level.
-
-
Constructor Details
-
AbstractCrossTableBatchGetBuilder
protected AbstractCrossTableBatchGetBuilder()Constructs a newAbstractCrossTableBatchGetBuilder.
-
-
Method Details
-
self
Returnsthistyped asSfor fluent chaining.- Returns:
- this builder
-
getTableName
protected abstract @NonNull String getTableName(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Extracts the DynamoDB table name from an entry's table reference.- Parameters:
entry- the entry whose table name to extract- Returns:
- the DynamoDB table name
-
getTableSchema
protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractCrossTableBatchGetBuilder.Entry entry) Extracts the table schema from an entry's table reference.- Parameters:
entry- the entry whose table schema to extract- Returns:
- the table schema
-
project
Restricts the returned attributes for the most recently added entry to the specified attribute names.Projection is applied server-side, reducing data transfer and consumed capacity.
- Parameters:
attributes- the attribute names to include- Returns:
- this builder
- Throws:
IllegalStateException- if no entries have been added yet
-
project
Restricts the returned attributes for the most recently added entry using aProjectionExpressionbuilder consumer.- Parameters:
consumer- a consumer to configure the projection expression- Returns:
- this builder
- Throws:
IllegalStateException- if no entries have been added yet
-
returnConsumedCapacity
public @NonNull S returnConsumedCapacity(@NonNull software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacity) Configures whether to return consumed capacity information for the operation.- Parameters:
returnConsumedCapacity- the consumed capacity reporting level- Returns:
- this builder for chaining
-
consistentRead
Configures whether to use strongly consistent reads for this batch get operation.If not set, DynamoDB defaults to eventually consistent reads.
- Parameters:
consistentRead-truefor strongly consistent reads- Returns:
- this builder for chaining
-
buildKey
protected static @NonNull software.amazon.awssdk.enhanced.dynamodb.Key buildKey(@NonNull Object partitionKey, @Nullable Object sortKey) Builds aKeyfrom partition and optional sort key values.- Parameters:
partitionKey- the partition key valuesortKey- the sort key value, ornullif the table has no sort key- Returns:
- the constructed key
-
groupEntriesByTable
Groups entries by their DynamoDB table name.- Returns:
- a map from table name to its entries
-
buildRequestItems
protected Map<String, software.amazon.awssdk.services.dynamodb.model.KeysAndAttributes> buildRequestItems(Map<String, List<AbstractCrossTableBatchGetBuilder.Entry>> entriesByTable, Map<String, software.amazon.awssdk.enhanced.dynamodb.TableSchema<?>> tableSchemas) Builds the request items map from entries grouped by table.Also populates the
tableSchemasmap with the schema for each table, needed downstream for deserialization.- Parameters:
entriesByTable- entries grouped by table nametableSchemas- map to populate with table schemas (output)- Returns:
- the request items for the batch get operation
-