Class DeleteBuilder<T>

java.lang.Object
dev.hogwai.dynamodb.simplified.builder.base.AbstractDeleteBuilder<T, DeleteBuilder<T>>
dev.hogwai.dynamodb.simplified.builder.DeleteBuilder<T>
Type Parameters:
T - the type of the item

public class DeleteBuilder<T> extends AbstractDeleteBuilder<T, DeleteBuilder<T>>
A fluent builder for deleting an item from a DynamoDB table by its key, with an optional condition expression. Part of the DynamoDB Simplified library.
  • Constructor Details

    • DeleteBuilder

      public DeleteBuilder(@NonNull software.amazon.awssdk.enhanced.dynamodb.DynamoDbTable<T> table, @NonNull Object partitionKey, @Nullable Object sortKey, @Nullable software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient)
      Constructs a new DeleteBuilder for the given table and key.
      Parameters:
      table - the DynamoDB table
      partitionKey - the partition key value
      sortKey - the sort key value (may be null if the table has no sort key)
      dynamoDbClient - the low-level DynamoDB client (required for returnValues support)
  • Method Details

    • self

      protected DeleteBuilder<T> self()
      Description copied from class: AbstractDeleteBuilder
      Returns this typed as S for fluent chaining.
      Specified by:
      self in class AbstractDeleteBuilder<T, DeleteBuilder<T>>
      Returns:
      this builder
    • tableName

      protected @NonNull String tableName()
      Description copied from class: AbstractDeleteBuilder
      Returns the DynamoDB table name.
      Specified by:
      tableName in class AbstractDeleteBuilder<T, DeleteBuilder<T>>
      Returns:
      the DynamoDB table name
    • returnValues

      public @NonNull DeleteBuilder<T> returnValues(@Nullable software.amazon.awssdk.services.dynamodb.model.ReturnValue returnValues)
      Configures the return values for the delete operation. When set (e.g., ReturnValue.ALL_OLD), the operation falls back to the low-level DynamoDbClient.deleteItem(DeleteItemRequest) to include the return values in the request.
      Overrides:
      returnValues in class AbstractDeleteBuilder<T, DeleteBuilder<T>>
      Parameters:
      returnValues - the return value setting, or null to use the default
      Returns:
      this builder for chaining
    • execute

      public @NonNull Optional<T> execute()
      Executes the delete operation and returns the deleted item.
      Returns:
      the deleted item, or empty if no item matched the key