Class AbstractTransactGetBuilder<S extends AbstractTransactGetBuilder<S>>
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractTransactGetBuilder<S>
- Type Parameters:
S- the concrete builder type (for fluent chaining)
- Direct Known Subclasses:
AsyncTransactGetBuilder, TransactGetBuilder
public abstract class AbstractTransactGetBuilder<S extends AbstractTransactGetBuilder<S>>
extends Object
Abstract base for sync and async transact get builders.
Manages entries (table + key associations) and projection 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 final List<AbstractTransactGetBuilder.Entry> The list of entries (table + key + projection) in this transaction.protected static final org.slf4j.LoggerLogger for this builder class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a newAbstractTransactGetBuilder. -
Method Summary
Modifier and TypeMethodDescriptionprotected static @NonNull software.amazon.awssdk.enhanced.dynamodb.KeyBuilds aKeyfrom partition and optional sort key values.protected List<software.amazon.awssdk.services.dynamodb.model.TransactGetItem> Builds a list ofTransactGetItemfrom the current entries for low-level API calls.protected abstract @NonNull StringgetTableName(@NonNull AbstractTransactGetBuilder.Entry entry) Extracts the DynamoDB table name from an entry's table reference.protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractTransactGetBuilder.Entry entry) Extracts the table schema from an entry's table reference.protected static booleanhasNonEmptyProjection(@NonNull AbstractTransactGetBuilder.Entry entry) Checks whether the given entry has a non-empty projection expression.@NonNull SRestricts the returned attributes for the most recently added item to the specified attribute names.@NonNull Sproject(@NonNull Consumer<ProjectionExpression> consumer) Restricts the returned attributes for the most recently added item using aProjectionExpressionbuilder consumer.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) in this transaction.
-
-
Constructor Details
-
AbstractTransactGetBuilder
protected AbstractTransactGetBuilder()Constructs a newAbstractTransactGetBuilder.
-
-
Method Details
-
self
Returnsthistyped asSfor fluent chaining.- Returns:
- this builder
-
getTableName
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 AbstractTransactGetBuilder.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 item 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 items have been added yet
-
project
Restricts the returned attributes for the most recently added item using aProjectionExpressionbuilder consumer.- Parameters:
consumer- a consumer to configure the projection expression- Returns:
- this builder
- Throws:
IllegalStateException- if no items have been added yet
-
hasNonEmptyProjection
Checks whether the given entry has a non-empty projection expression.- Parameters:
entry- the entry to check- Returns:
trueif the entry has a non-null, non-empty projection expression
-
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
-
buildTransactItems
Builds a list ofTransactGetItemfrom the current entries for low-level API calls.- Returns:
- a list of transact get items
-