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.

  • Field Details

    • LOG

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

      protected final List<AbstractTransactGetBuilder.Entry> entries
      The list of entries (table + key + projection) in this transaction.
  • Constructor Details

    • AbstractTransactGetBuilder

      protected AbstractTransactGetBuilder()
      Constructs a new AbstractTransactGetBuilder.
  • 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 AbstractTransactGetBuilder.Entry entry)
      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

      public @NonNull S project(@NonNull String... attributes)
      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

      public @NonNull S project(@NonNull Consumer<ProjectionExpression> consumer)
      Restricts the returned attributes for the most recently added item using a ProjectionExpression builder consumer.
      Parameters:
      consumer - a consumer to configure the projection expression
      Returns:
      this builder
      Throws:
      IllegalStateException - if no items have been added yet
    • hasNonEmptyProjection

      protected static boolean hasNonEmptyProjection(@NonNull AbstractTransactGetBuilder.Entry entry)
      Checks whether the given entry has a non-empty projection expression.
      Parameters:
      entry - the entry to check
      Returns:
      true if 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 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
    • buildTransactItems

      protected List<software.amazon.awssdk.services.dynamodb.model.TransactGetItem> buildTransactItems()
      Builds a list of TransactGetItem from the current entries for low-level API calls.
      Returns:
      a list of transact get items