Class AbstractCrossTableBatchWriteBuilder<S extends AbstractCrossTableBatchWriteBuilder<S>>

java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractCrossTableBatchWriteBuilder<S>
Type Parameters:
S - the concrete builder type (for fluent chaining)
Direct Known Subclasses:
AsyncCrossTableBatchWriteBuilder, CrossTableBatchWriteBuilder

public abstract class AbstractCrossTableBatchWriteBuilder<S extends AbstractCrossTableBatchWriteBuilder<S>> extends Object
Abstract base for sync and async cross-table batch write builders.

Manages operations (put and delete), consumed capacity settings, and request item building shared across sync and async variants.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
    Stores a table reference, operation type, and optional item or key values.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final org.slf4j.Logger
    Logger for this builder class.
    The list of operations (put/delete) in this batch write.
    protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity
    Optional consumed capacity reporting level.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Constructs a new AbstractCrossTableBatchWriteBuilder.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    protected @NonNull Map<String, List<software.amazon.awssdk.services.dynamodb.model.WriteRequest>>
    Builds the request items map from the current operations.
    @NonNull S
    delete(@NonNull Object table, @NonNull Object partitionKey)
    Adds a delete action for the given partition key in the given table.
    @NonNull S
    delete(@NonNull Object table, @NonNull Object partitionKey, @NonNull Object sortKey)
    Adds a delete action for the given partition and sort key in the given table.
    protected abstract @NonNull String
    Extracts the DynamoDB table name from an operation's table reference.
    protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?>
    Extracts the table schema from an operation's table reference.
    <T> @NonNull S
    put(@NonNull Object table, @NonNull T item)
    Adds a put action to insert or replace an item in the given table.
    @NonNull S
    returnConsumedCapacity(@NonNull software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacity)
    Configures whether to return consumed capacity information for the operation.
    protected abstract @NonNull S
    Returns this typed as S for fluent chaining.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOG

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

      The list of operations (put/delete) in this batch write.
    • returnConsumedCapacity

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

    • AbstractCrossTableBatchWriteBuilder

      protected AbstractCrossTableBatchWriteBuilder()
      Constructs a new AbstractCrossTableBatchWriteBuilder.
  • 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 AbstractCrossTableBatchWriteBuilder.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 AbstractCrossTableBatchWriteBuilder.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
    • put

      public <T> @NonNull S put(@NonNull Object table, @NonNull T item)
      Adds a put action to insert or replace an item in the given table.
      Type Parameters:
      T - the item type
      Parameters:
      table - the table to write to
      item - the item to put
      Returns:
      this builder
    • delete

      public @NonNull S delete(@NonNull Object table, @NonNull Object partitionKey)
      Adds a delete action for the given partition key in the given table.
      Parameters:
      table - the table to delete from
      partitionKey - the partition key value
      Returns:
      this builder
    • delete

      public @NonNull S delete(@NonNull Object table, @NonNull Object partitionKey, @NonNull Object sortKey)
      Adds a delete action for the given partition and sort key in the given table.
      Parameters:
      table - the table to delete from
      partitionKey - the partition key value
      sortKey - the sort key value
      Returns:
      this builder
    • 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
    • buildRequestItems

      protected @NonNull Map<String, List<software.amazon.awssdk.services.dynamodb.model.WriteRequest>> buildRequestItems()
      Builds the request items map from the current operations.
      Returns:
      the request items keyed by table name
    • 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