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.

  • Field Details

    • LOG

      protected static final org.slf4j.Logger LOG
      Logger for this builder class.
    • operations

      protected final List<AbstractTransactWriteBuilder.Operation> operations
      The list of operations (put/update/delete/condition check) in this transaction.
    • returnConsumedCapacity

      protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacity
      Optional consumed capacity reporting level.
  • Constructor Details

    • AbstractTransactWriteBuilder

      protected AbstractTransactWriteBuilder()
      Constructs a new AbstractTransactWriteBuilder.
  • Method Details

    • self

      protected abstract @NonNull S self()
      Returns this typed as S for 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 a Key from the given item using the operation's table reference.
      Parameters:
      operation - the operation providing the table reference
      item - the item from which to extract the key
      Returns:
      the constructed key
    • hasExpressionOperation

      protected boolean hasExpressionOperation()
      Checks whether any operation in this transaction uses an UpdateExpression.
      Returns:
      true if any operation has type AbstractTransactWriteBuilder.Operation.Type.UPDATE_WITH_EXPRESSION
    • buildKey

      protected static @NonNull software.amazon.awssdk.enhanced.dynamodb.Key buildKey(@NonNull Object partitionKey, @Nullable Object sortKey)
      Builds a Key from partition and optional sort key values.
      Parameters:
      partitionKey - the partition key value
      sortKey - the sort key value, or null if the table has no sort key
      Returns:
      the constructed key
    • buildTransactWriteItem

      protected software.amazon.awssdk.services.dynamodb.model.TransactWriteItem buildTransactWriteItem(AbstractTransactWriteBuilder.Operation op)
      Builds a TransactWriteItem for 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 a TransactWriteItem for 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 a TransactWriteItem for 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 a TransactWriteItem for 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 a TransactWriteItem for an update-with-expression operation.
      Parameters:
      op - the update operation
      Returns:
      the transact write item