Class AsyncEntityTableBuilder<T>
java.lang.Object
dev.hogwai.dynamodb.simplified.entity.AsyncEntityTableBuilder<T>
- Type Parameters:
T- the entity type
Builder for creating
AsyncEntityTable instances for single-table design.
The entity class must be annotated with @Entity and may use
@KeyComponent and @KeyPrefix annotations to define the entity schema.
Usage:
AsyncEntityTable<User> userTable = new AsyncEntityTableBuilder<>(User.class)
.dynamoDbAsyncClient(asyncClient)
.build();
Alternatively, use
AsyncDynamoSimplifiedClient.entityTable(Class)
for a simpler end-to-end flow.
-
Constructor Summary
ConstructorsConstructorDescriptionAsyncEntityTableBuilder(@NonNull Class<T> entityClass) Creates a new builder for the given entity class. -
Method Summary
Modifier and TypeMethodDescription@NonNull AsyncEntityTable<T> build()Builds theAsyncEntityTableinstance.dynamoDbAsyncClient(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient client) Sets the low-levelDynamoDbAsyncClientto use.enhancedAsyncClient(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient client) Sets theDynamoDbEnhancedAsyncClientto use.
-
Constructor Details
-
AsyncEntityTableBuilder
-
-
Method Details
-
dynamoDbAsyncClient
public AsyncEntityTableBuilder<T> dynamoDbAsyncClient(@NonNull software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient client) Sets the low-levelDynamoDbAsyncClientto use.- Parameters:
client- the DynamoDB async client- Returns:
- this builder for chaining
-
enhancedAsyncClient
public AsyncEntityTableBuilder<T> enhancedAsyncClient(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient client) Sets theDynamoDbEnhancedAsyncClientto use.If not set, one will be built from the provided
dynamoDbAsyncClient(DynamoDbAsyncClient).- Parameters:
client- the enhanced async DynamoDB client- Returns:
- this builder for chaining
-
build
Builds theAsyncEntityTableinstance.Reads the entity schema from annotations, creates the underlying DynamoDB table mapping, and wraps it in an
AsyncDefaultEntityTable.- Returns:
- a new
AsyncEntityTable<T> - Throws:
IllegalArgumentException- if the entity class is not annotated with@EntityNullPointerException- if noDynamoDbAsyncClientis set
-