Class PutBuilder<T>
java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractPutBuilder<T, PutBuilder<T>>
dev.hogwai.dynamodb.simplified.builder.PutBuilder<T>
- Type Parameters:
T- the type of the item
A fluent builder for putting (inserting or replacing) an item in a DynamoDB table,
with an optional condition expression. Part of the DynamoDB Simplified library.
-
Field Summary
Fields inherited from class AbstractPutBuilder
conditionExpression, item, LOG, optimisticLocking, returnValues -
Constructor Summary
ConstructorsConstructorDescriptionPutBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable<T> table, @NonNull T item, @NonNull software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient) Constructs a newPutBuilderfor the given table and item. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()Executes the put operation.Executes the put operation and returns the previous item ifAbstractPutBuilder.returnValues(ReturnValue)was set toALL_OLD.protected @NonNull PutBuilder<T> self()Returnsthistyped asSfor fluent chaining.protected @NonNull StringReturns the DynamoDB table name.Methods inherited from class AbstractPutBuilder
applyOptimisticLocking, buildEnhancedRequest, buildLowLevelRequest, condition, condition, incrementVersion, onlyIfNotExists, returnValues, withOptimisticLocking
-
Constructor Details
-
PutBuilder
public PutBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable<T> table, @NonNull T item, @NonNull software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient) Constructs a newPutBuilderfor the given table and item.- Parameters:
table- the DynamoDB tableitem- the item to putdynamoDbClient- the low-level DynamoDB client (required for return values)
-
-
Method Details
-
self
Description copied from class:AbstractPutBuilderReturnsthistyped asSfor fluent chaining.- Specified by:
selfin classAbstractPutBuilder<T, PutBuilder<T>>- Returns:
- this builder
-
execute
public void execute()Executes the put operation. -
executeReturning
Executes the put operation and returns the previous item ifAbstractPutBuilder.returnValues(ReturnValue)was set toALL_OLD.If no return value was configured, returns
Optional.empty().- Returns:
- the previous item (if ReturnValue.ALL_OLD was set), or empty if the item didn't previously exist or no return value was configured
-
tableName
Description copied from class:AbstractPutBuilderReturns the DynamoDB table name.- Specified by:
tableNamein classAbstractPutBuilder<T, PutBuilder<T>>- Returns:
- the DynamoDB table name
-