Class AbstractBatchWriteBuilder<T, S extends AbstractBatchWriteBuilder<T,S>>

java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractBatchWriteBuilder<T,S>
Type Parameters:
T - the item type
S - the concrete builder type (for fluent chaining)
Direct Known Subclasses:
AsyncBatchWriteBuilder, BatchWriteBuilder

public abstract class AbstractBatchWriteBuilder<T, S extends AbstractBatchWriteBuilder<T,S>> extends Object
Abstract base for sync and async batch write builders.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final List<T>
    The list of items to put in the batch write.
    protected final List<software.amazon.awssdk.enhanced.dynamodb.Key>
    The list of keys to delete in the batch write.
    protected static final org.slf4j.Logger
    Logger for this builder class.
    protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity
    Optional consumed capacity reporting level.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    protected @NonNull Map<String, List<software.amazon.awssdk.services.dynamodb.model.WriteRequest>>
    Builds the request items map from the current puts and deletes.
    @NonNull S
    delete(@NonNull Object partitionKey)
    Adds a delete operation for the given partition key.
    @NonNull S
    delete(@NonNull Object partitionKey, @NonNull Object sortKey)
    Adds a delete operation for the given partition and sort key.
    @NonNull S
    put(@NonNull T item)
    Adds an item to be put (inserted or replaced) in the batch write.
    @NonNull S
    returnConsumedCapacity(@NonNull software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity returnConsumedCapacity)
    Configures whether to return consumed capacity information for the operation.
    protected abstract S
    Returns this typed as S for fluent chaining.
    protected abstract @NonNull String
    Returns the DynamoDB table name.
    protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<T>
    Returns the table schema for converting items to attribute maps.

    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.
    • itemsToPut

      protected final List<T> itemsToPut
      The list of items to put in the batch write.
    • keysToDelete

      protected final List<software.amazon.awssdk.enhanced.dynamodb.Key> keysToDelete
      The list of keys to delete in the batch write.
    • returnConsumedCapacity

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

    • AbstractBatchWriteBuilder

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

    • self

      protected abstract S self()
      Returns this typed as S for fluent chaining.
      Returns:
      this builder
    • tableSchema

      protected abstract @NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<T> tableSchema()
      Returns the table schema for converting items to attribute maps.
      Returns:
      the table schema
    • tableName

      protected abstract @NonNull String tableName()
      Returns the DynamoDB table name.
      Returns:
      the DynamoDB table name
    • put

      public @NonNull S put(@NonNull T item)
      Adds an item to be put (inserted or replaced) in the batch write.
      Parameters:
      item - the item to put
      Returns:
      this builder
    • delete

      public @NonNull S delete(@NonNull Object partitionKey)
      Adds a delete operation for the given partition key.
      Parameters:
      partitionKey - the partition key of the item to delete
      Returns:
      this builder
    • delete

      public @NonNull S delete(@NonNull Object partitionKey, @NonNull Object sortKey)
      Adds a delete operation for the given partition and sort key.
      Parameters:
      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 puts and deletes.
      Returns:
      the request items keyed by table name