Class AbstractDeleteBuilder<T, S extends AbstractDeleteBuilder<T,S>>

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

public abstract class AbstractDeleteBuilder<T, S extends AbstractDeleteBuilder<T,S>> extends Object
Abstract base for sync and async delete-item builders.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Optional condition expression that gates the delete operation.
    protected static final org.slf4j.Logger
    Logger for this builder class.
    protected final Object
    The partition key value.
    protected software.amazon.awssdk.services.dynamodb.model.ReturnValue
    Optional return values setting for the delete operation.
    protected final @Nullable Object
    The sort key value, or null if the table has no sort key.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractDeleteBuilder(@NonNull Object partitionKey, @Nullable Object sortKey)
    Constructs a new AbstractDeleteBuilder with the given key values.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected @NonNull software.amazon.awssdk.enhanced.dynamodb.model.DeleteItemEnhancedRequest
    Builds a high-level DeleteItemEnhancedRequest from the current key and optional condition expression.
    protected @NonNull Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue>
    buildKeyMap(@NonNull String pkName, @Nullable String skName)
    Builds a key map for low-level requests using the given key attribute names.
    protected @NonNull software.amazon.awssdk.services.dynamodb.model.DeleteItemRequest
    buildLowLevelRequest(@NonNull Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> keyMap)
    Builds a low-level DeleteItemRequest from the given key map, using the configured return values and condition expression.
    @NonNull S
    condition(@Nullable ConditionExpression condition)
    Configures a condition expression that gates the delete operation.
    @NonNull S
    Configures a condition expression that gates the delete operation.
    @NonNull S
    onlyIfExists(@NonNull String attribute)
    Adds a condition that the specified attribute must exist on the item for the deletion to succeed.
    @NonNull S
    returnValues(@Nullable software.amazon.awssdk.services.dynamodb.model.ReturnValue returnValues)
    Configures the return values for the delete 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.
    • partitionKey

      protected final Object partitionKey
      The partition key value.
    • sortKey

      protected final @Nullable Object sortKey
      The sort key value, or null if the table has no sort key.
    • conditionExpression

      protected ConditionExpression conditionExpression
      Optional condition expression that gates the delete operation.
    • returnValues

      protected software.amazon.awssdk.services.dynamodb.model.ReturnValue returnValues
      Optional return values setting for the delete operation.
  • Constructor Details

    • AbstractDeleteBuilder

      protected AbstractDeleteBuilder(@NonNull Object partitionKey, @Nullable Object sortKey)
      Constructs a new AbstractDeleteBuilder with the given key values.
      Parameters:
      partitionKey - the partition key value
      sortKey - the sort key value, or null if the table has no sort key
  • Method Details

    • self

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

      public @NonNull S condition(@NonNull Consumer<ConditionExpression.Builder> configurator)
      Configures a condition expression that gates the delete operation. DynamoDB evaluates this condition before deleting the item (unlike a filter expression which applies after reading).
      Parameters:
      configurator - a consumer to build the condition expression
      Returns:
      this builder for chaining
    • condition

      public @NonNull S condition(@Nullable ConditionExpression condition)
      Configures a condition expression that gates the delete operation. DynamoDB evaluates this condition before deleting the item (unlike a filter expression which applies after reading).
      Parameters:
      condition - the condition expression
      Returns:
      this builder for chaining
    • onlyIfExists

      public @NonNull S onlyIfExists(@NonNull String attribute)
      Adds a condition that the specified attribute must exist on the item for the deletion to succeed.
      Parameters:
      attribute - the attribute name to check for existence
      Returns:
      this builder for chaining
    • returnValues

      public @NonNull S 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 client to include the return values in the request.
      Parameters:
      returnValues - the return value setting, or null to use the default
      Returns:
      this builder for chaining
    • buildEnhancedRequest

      protected @NonNull software.amazon.awssdk.enhanced.dynamodb.model.DeleteItemEnhancedRequest buildEnhancedRequest()
      Builds a high-level DeleteItemEnhancedRequest from the current key and optional condition expression.
      Returns:
      the built enhanced request
    • buildLowLevelRequest

      protected @NonNull software.amazon.awssdk.services.dynamodb.model.DeleteItemRequest buildLowLevelRequest(@NonNull Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> keyMap)
      Builds a low-level DeleteItemRequest from the given key map, using the configured return values and condition expression.
      Parameters:
      keyMap - the key attribute map
      Returns:
      the built low-level request
    • buildKeyMap

      protected @NonNull Map<String, software.amazon.awssdk.services.dynamodb.model.AttributeValue> buildKeyMap(@NonNull String pkName, @Nullable String skName)
      Builds a key map for low-level requests using the given key attribute names.
      Parameters:
      pkName - the partition key attribute name
      skName - the sort key attribute name, or null if none
      Returns:
      the built key map
    • tableName

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