Class AbstractBatchGetBuilder<T, S extends AbstractBatchGetBuilder<T,S>>

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

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

    Fields
    Modifier and Type
    Field
    Description
    protected Boolean
    Whether to use strongly consistent reads, or null to use the default.
    protected final List<software.amazon.awssdk.enhanced.dynamodb.Key>
    The list of keys to retrieve.
    protected static final org.slf4j.Logger
    Logger for this builder class.
    Optional projection expression to restrict returned attributes.
    protected software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity
    Optional consumed capacity reporting level.
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    @NonNull S
    addKey(@NonNull Object partitionKey)
    Adds a key to retrieve by partition key only.
    @NonNull S
    addKey(@NonNull Object partitionKey, @NonNull Object sortKey)
    Adds a key to retrieve by partition and sort key.
    @NonNull S
    addKeys(@NonNull Collection<software.amazon.awssdk.enhanced.dynamodb.Key> keys)
    Adds multiple keys at once.
    protected @NonNull software.amazon.awssdk.services.dynamodb.model.KeysAndAttributes
    buildKeysAndAttributes(@NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> schema)
    Builds a KeysAndAttributes from the current keys and projection/consistency settings.
    @NonNull S
    consistentRead(boolean consistentRead)
    Enables or disables strongly consistent reads for this batch get.
    @NonNull S
    keys(@NonNull List<Object> partitionKeys)
    Adds multiple keys from a list of partition key values (without sort keys).
    @NonNull S
    project(@NonNull String... attributes)
    Restricts the returned attributes to the specified ones.
    @NonNull S
    project(@NonNull Consumer<ProjectionExpression> projectionBuilder)
    Restricts the returned attributes by configuring a ProjectionExpression via a consumer.
    @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.

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

      protected final List<software.amazon.awssdk.enhanced.dynamodb.Key> keys
      The list of keys to retrieve.
    • consistentRead

      protected Boolean consistentRead
      Whether to use strongly consistent reads, or null to use the default.
    • projectionExpression

      protected ProjectionExpression projectionExpression
      Optional projection expression to restrict returned attributes.
    • returnConsumedCapacity

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

    • AbstractBatchGetBuilder

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

    • self

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

      public @NonNull S addKey(@NonNull Object partitionKey)
      Adds a key to retrieve by partition key only.
      Parameters:
      partitionKey - the partition key value
      Returns:
      this builder
    • addKey

      public @NonNull S addKey(@NonNull Object partitionKey, @NonNull Object sortKey)
      Adds a key to retrieve by partition and sort key.
      Parameters:
      partitionKey - the partition key value
      sortKey - the sort key value
      Returns:
      this builder
    • addKeys

      public @NonNull S addKeys(@NonNull Collection<software.amazon.awssdk.enhanced.dynamodb.Key> keys)
      Adds multiple keys at once.
      Parameters:
      keys - the keys to retrieve
      Returns:
      this builder
    • keys

      public @NonNull S keys(@NonNull List<Object> partitionKeys)
      Adds multiple keys from a list of partition key values (without sort keys).
      Parameters:
      partitionKeys - the partition key values
      Returns:
      this builder
    • consistentRead

      public @NonNull S consistentRead(boolean consistentRead)
      Enables or disables strongly consistent reads for this batch get.

      If not set, the default (eventually consistent) is used by the DynamoDB API.

      Parameters:
      consistentRead - true for strongly consistent reads
      Returns:
      this builder
    • project

      public @NonNull S project(@NonNull String... attributes)
      Restricts the returned attributes to the specified ones.
      Parameters:
      attributes - the attribute names to include in each result
      Returns:
      this builder for chaining
    • project

      public @NonNull S project(@NonNull Consumer<ProjectionExpression> projectionBuilder)
      Restricts the returned attributes by configuring a ProjectionExpression via a consumer.
      Parameters:
      projectionBuilder - a consumer that configures the ProjectionExpression
      Returns:
      this builder for chaining
    • 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
    • buildKeysAndAttributes

      protected @NonNull software.amazon.awssdk.services.dynamodb.model.KeysAndAttributes buildKeysAndAttributes(@NonNull software.amazon.awssdk.enhanced.dynamodb.TableSchema<?> schema)
      Builds a KeysAndAttributes from the current keys and projection/consistency settings.
      Parameters:
      schema - the table schema for converting enhanced keys to SDK key maps
      Returns:
      the configured KeysAndAttributes
    • tableName

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