Class AbstractTransactWriteBuilder<S extends AbstractTransactWriteBuilder<S>>
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractTransactWriteBuilder<S>
- Type Parameters:
S- the concrete builder type (for fluent chaining)
- Direct Known Subclasses:
AsyncTransactWriteBuilder, TransactWriteBuilder
public abstract class AbstractTransactWriteBuilder<S extends AbstractTransactWriteBuilder<S>>
extends Object
Abstract base for sync and async transactional write builders.
Manages operations (put, update, delete, condition check), consumed capacity settings, and low-level request item building shared across sync and async variants.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordStores a table reference, operation type, and optional item, key values, condition expression, and update expression. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.slf4j.LoggerLogger for this builder class.protected final List<AbstractTransactWriteBuilder.Operation> The list of operations (put/update/delete/condition check) in this transaction.protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacityOptional consumed capacity reporting level. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs a newAbstractTransactWriteBuilder. -
Method Summary
Modifier and TypeMethodDescriptionprotected software.amazon.awssdk.services.dynamodb.model.TransactWriteItemBuilds aTransactWriteItemfor a condition check operation.protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItemBuilds aTransactWriteItemfor a delete operation.protected static @NonNull software.amazon.awssdk.enhanced.dynamodb.KeyBuilds aKeyfrom partition and optional sort key values.protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItemBuilds aTransactWriteItemfor a put operation.protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItemBuilds aTransactWriteItemfor the given operation.protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItemBuilds aTransactWriteItemfor an update-with-expression operation.protected abstract @NonNull StringgetTableName(@NonNull AbstractTransactWriteBuilder.Operation operation) Extracts the DynamoDB table name from an operation's table reference.protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractTransactWriteBuilder.Operation operation) Extracts the table schema from an operation's table reference.protected booleanChecks whether any operation in this transaction uses anUpdateExpression.protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.KeykeyFromItem(@NonNull AbstractTransactWriteBuilder.Operation operation, @NonNull Object item) Creates aKeyfrom the given item using the operation's table reference.protected abstract @NonNull Sself()Returnsthistyped asSfor fluent chaining.
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGLogger for this builder class. -
operations
The list of operations (put/update/delete/condition check) in this transaction. -
returnConsumedCapacity
protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacityOptional consumed capacity reporting level.
-
-
Constructor Details
-
AbstractTransactWriteBuilder
protected AbstractTransactWriteBuilder()Constructs a newAbstractTransactWriteBuilder.
-
-
Method Details
-
self
Returnsthistyped asSfor fluent chaining.- Returns:
- this builder
-
getTableName
protected abstract @NonNull String getTableName(@NonNull AbstractTransactWriteBuilder.Operation operation) Extracts the DynamoDB table name from an operation's table reference.- Parameters:
operation- the operation whose table name to extract- Returns:
- the DynamoDB table name
-
getTableSchema
protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> getTableSchema(@NonNull AbstractTransactWriteBuilder.Operation operation) Extracts the table schema from an operation's table reference.- Parameters:
operation- the operation whose table schema to extract- Returns:
- the table schema
-
keyFromItem
protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.Key keyFromItem(@NonNull AbstractTransactWriteBuilder.Operation operation, @NonNull Object item) Creates aKeyfrom the given item using the operation's table reference.- Parameters:
operation- the operation providing the table referenceitem- the item from which to extract the key- Returns:
- the constructed key
-
hasExpressionOperation
protected boolean hasExpressionOperation()Checks whether any operation in this transaction uses anUpdateExpression.- Returns:
trueif any operation has typeAbstractTransactWriteBuilder.Operation.Type.UPDATE_WITH_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
-
buildTransactWriteItem
protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItem buildTransactWriteItem(AbstractTransactWriteBuilder.Operation op) Builds aTransactWriteItemfor the given operation.- Parameters:
op- the operation to build from- Returns:
- the transact write item
-
buildPutItem
protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItem buildPutItem(AbstractTransactWriteBuilder.Operation op) Builds aTransactWriteItemfor a put operation.- Parameters:
op- the put operation- Returns:
- the transact write item
-
buildDeleteItem
protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItem buildDeleteItem(AbstractTransactWriteBuilder.Operation op) Builds aTransactWriteItemfor a delete operation.- Parameters:
op- the delete operation- Returns:
- the transact write item
-
buildConditionCheckItem
protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItem buildConditionCheckItem(AbstractTransactWriteBuilder.Operation op) Builds aTransactWriteItemfor a condition check operation.- Parameters:
op- the condition check operation- Returns:
- the transact write item
-
buildUpdateWithExpressionItem
protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItem buildUpdateWithExpressionItem(AbstractTransactWriteBuilder.Operation op) Builds aTransactWriteItemfor an update-with-expression operation.- Parameters:
op- the update operation- Returns:
- the transact write item
-