Class Index<T>

java.lang.Object
dev.hogwai.dynamodb.simplified.builder.Index<T>
Type Parameters:
T - the item type

public class Index<T> extends Object
Typed wrapper for a DynamoDB secondary index (GSI or LSI).

Obtained via table.index("indexName"). Provides fluent query and scan builders scoped to this index.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Index(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbIndex<T> dynamoDbIndex)
    Constructs a new Index wrapping the given DynamoDbIndex.
    Index(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbIndex<T> dynamoDbIndex, @Nullable software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient)
    Constructs a new Index wrapping the given DynamoDbIndex with a low-level client.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbIndex<T>
    Returns the underlying DynamoDbIndex.
    @NonNull String
    Returns the name of this index.
    @NonNull QueryBuilder<T>
    Starts building a query operation on this index.
    @NonNull ScanBuilder<T>
    Starts building a scan operation on this index.
    @NonNull String
    Returns the name of the table this index belongs to.

    Methods inherited from class Object

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

    • Index

      public Index(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbIndex<T> dynamoDbIndex)
      Constructs a new Index wrapping the given DynamoDbIndex.
      Parameters:
      dynamoDbIndex - the DynamoDB index to wrap
    • Index

      public Index(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbIndex<T> dynamoDbIndex, @Nullable software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient)
      Constructs a new Index wrapping the given DynamoDbIndex with a low-level client.
      Parameters:
      dynamoDbIndex - the DynamoDB index to wrap
      dynamoDbClient - the low-level DynamoDB client (nullable)
  • Method Details

    • getRawIndex

      public @NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbIndex<T> getRawIndex()
      Returns the underlying DynamoDbIndex.
      Returns:
      the raw DynamoDB index
    • indexName

      public @NonNull String indexName()
      Returns the name of this index.
      Returns:
      the index name
    • tableName

      public @NonNull String tableName()
      Returns the name of the table this index belongs to.
      Returns:
      the table name
    • query

      public @NonNull QueryBuilder<T> query()
      Starts building a query operation on this index.
      Returns:
      a query builder pre-configured for this index
    • scan

      public @NonNull ScanBuilder<T> scan()
      Starts building a scan operation on this index.
      Returns:
      a scan builder pre-configured for this index