Class ConditionExpression.Builder

java.lang.Object
dev.hogwai.dynamodb.simplified.expression.FilterExpression
dev.hogwai.dynamodb.simplified.expression.ConditionExpression.Builder
Enclosing class:
ConditionExpression

public static final class ConditionExpression.Builder extends FilterExpression
Fluent builder for ConditionExpression.

Extends FilterExpression to inherit all expression-building capability, with covariant return types to preserve the builder type through method chaining, and a terminal build() method.

  • Constructor Details

    • Builder

      public Builder()
      Creates a new condition expression builder.
  • Method Details

    • eq

      public @NonNull ConditionExpression.Builder eq(@NonNull String attr, @NonNull Object value)
      Description copied from class: FilterExpression
      Adds an equality condition: attribute = value.
      Overrides:
      eq in class FilterExpression
      Parameters:
      attr - the attribute name
      value - the value to compare against
      Returns:
      this builder for chaining
    • ne

      public @NonNull ConditionExpression.Builder ne(@NonNull String attr, @NonNull Object value)
      Description copied from class: FilterExpression
      Adds a not-equal condition: attribute <> value.
      Overrides:
      ne in class FilterExpression
      Parameters:
      attr - the attribute name
      value - the value to compare against
      Returns:
      this builder for chaining
    • lt

      public @NonNull ConditionExpression.Builder lt(@NonNull String attr, @NonNull Object value)
      Description copied from class: FilterExpression
      Adds a less-than condition: attribute < value.
      Overrides:
      lt in class FilterExpression
      Parameters:
      attr - the attribute name
      value - the value to compare against
      Returns:
      this builder for chaining
    • le

      public @NonNull ConditionExpression.Builder le(@NonNull String attr, @NonNull Object value)
      Description copied from class: FilterExpression
      Adds a less-than-or-equal condition: attribute <= value.
      Overrides:
      le in class FilterExpression
      Parameters:
      attr - the attribute name
      value - the value to compare against
      Returns:
      this builder for chaining
    • gt

      public @NonNull ConditionExpression.Builder gt(@NonNull String attr, @NonNull Object value)
      Description copied from class: FilterExpression
      Adds a greater-than condition: attribute > value.
      Overrides:
      gt in class FilterExpression
      Parameters:
      attr - the attribute name
      value - the value to compare against
      Returns:
      this builder for chaining
    • ge

      public @NonNull ConditionExpression.Builder ge(@NonNull String attr, @NonNull Object value)
      Description copied from class: FilterExpression
      Adds a greater-than-or-equal condition: attribute >= value.
      Overrides:
      ge in class FilterExpression
      Parameters:
      attr - the attribute name
      value - the value to compare against
      Returns:
      this builder for chaining
    • beginsWith

      public @NonNull ConditionExpression.Builder beginsWith(@NonNull String attr, @NonNull String prefix)
      Description copied from class: FilterExpression
      Adds a begins_with function condition checking whether the attribute value starts with the given prefix.
      Overrides:
      beginsWith in class FilterExpression
      Parameters:
      attr - the attribute name
      prefix - the string prefix to test
      Returns:
      this builder for chaining
    • contains

      public @NonNull ConditionExpression.Builder contains(@NonNull String attr, @NonNull Object value)
      Description copied from class: FilterExpression
      Adds a contains function condition checking whether the attribute value contains the given substring (for strings) or element (for sets).
      Overrides:
      contains in class FilterExpression
      Parameters:
      attr - the attribute name
      value - the value to search for within the attribute
      Returns:
      this builder for chaining
    • sizeEq

      public @NonNull ConditionExpression.Builder sizeEq(@NonNull String attr, int size)
      Description copied from class: FilterExpression
      Adds a condition that the server-side size() of the attribute equals the given value.
      Overrides:
      sizeEq in class FilterExpression
      Parameters:
      attr - the attribute name
      size - the expected size
      Returns:
      this builder for chaining
    • sizeLt

      public @NonNull ConditionExpression.Builder sizeLt(@NonNull String attr, int size)
      Description copied from class: FilterExpression
      Adds a condition that the server-side size() of the attribute is less than the given value.
      Overrides:
      sizeLt in class FilterExpression
      Parameters:
      attr - the attribute name
      size - the size to compare against
      Returns:
      this builder for chaining
    • sizeLe

      public @NonNull ConditionExpression.Builder sizeLe(@NonNull String attr, int size)
      Description copied from class: FilterExpression
      Adds a condition that the server-side size() of the attribute is less than or equal to the given value.
      Overrides:
      sizeLe in class FilterExpression
      Parameters:
      attr - the attribute name
      size - the size to compare against
      Returns:
      this builder for chaining
    • sizeGt

      public @NonNull ConditionExpression.Builder sizeGt(@NonNull String attr, int size)
      Description copied from class: FilterExpression
      Adds a condition that the server-side size() of the attribute is greater than the given value.
      Overrides:
      sizeGt in class FilterExpression
      Parameters:
      attr - the attribute name
      size - the size to compare against
      Returns:
      this builder for chaining
    • sizeGe

      public @NonNull ConditionExpression.Builder sizeGe(@NonNull String attr, int size)
      Description copied from class: FilterExpression
      Adds a condition that the server-side size() of the attribute is greater than or equal to the given value.
      Overrides:
      sizeGe in class FilterExpression
      Parameters:
      attr - the attribute name
      size - the size to compare against
      Returns:
      this builder for chaining
    • sizeBetween

      public @NonNull ConditionExpression.Builder sizeBetween(@NonNull String attr, int min, int max)
      Description copied from class: FilterExpression
      Adds a condition that the server-side size() of the attribute is between the given minimum and maximum values (inclusive).
      Overrides:
      sizeBetween in class FilterExpression
      Parameters:
      attr - the attribute name
      min - the minimum size
      max - the maximum size
      Returns:
      this builder for chaining
    • exists

      public @NonNull ConditionExpression.Builder exists(@NonNull String attr)
      Description copied from class: FilterExpression
      Adds an attribute_exists condition that checks whether the specified attribute is present on the item.
      Overrides:
      exists in class FilterExpression
      Parameters:
      attr - the attribute name
      Returns:
      this builder for chaining
    • notExists

      public @NonNull ConditionExpression.Builder notExists(@NonNull String attr)
      Description copied from class: FilterExpression
      Adds an attribute_not_exists condition that checks whether the specified attribute is not present on the item.
      Overrides:
      notExists in class FilterExpression
      Parameters:
      attr - the attribute name
      Returns:
      this builder for chaining
    • attributeType

      public @NonNull ConditionExpression.Builder attributeType(@NonNull String attr, @NonNull FilterExpression.AttributeType type)
      Description copied from class: FilterExpression
      Adds an attribute_type condition that checks whether the specified attribute is of the given DynamoDB type.
      Overrides:
      attributeType in class FilterExpression
      Parameters:
      attr - the attribute name
      type - the expected FilterExpression.AttributeType
      Returns:
      this builder for chaining
    • between

      public @NonNull ConditionExpression.Builder between(@NonNull String attr, @NonNull Object low, @NonNull Object high)
      Description copied from class: FilterExpression
      Adds a BETWEEN condition: attribute BETWEEN low AND high (inclusive). Supports strings, numbers, and binaries.
      Overrides:
      between in class FilterExpression
      Parameters:
      attr - the attribute name
      low - the lower bound
      high - the upper bound
      Returns:
      this builder for chaining
    • in

      public @NonNull ConditionExpression.Builder in(@NonNull String attr, @NonNull Object... values)
      Description copied from class: FilterExpression
      Adds an IN condition: attribute IN (val1, val2, ...). The attribute must match at least one of the provided values.
      Overrides:
      in in class FilterExpression
      Parameters:
      attr - the attribute name
      values - one or more values to test against
      Returns:
      this builder for chaining
    • and

      public @NonNull ConditionExpression.Builder and()
      Description copied from class: FilterExpression
      Appends an AND logical operator to combine two filter conditions.
      Overrides:
      and in class FilterExpression
      Returns:
      this builder for chaining
    • or

      public @NonNull ConditionExpression.Builder or()
      Description copied from class: FilterExpression
      Appends an OR logical operator to combine two filter conditions.
      Overrides:
      or in class FilterExpression
      Returns:
      this builder for chaining
    • not

      public @NonNull ConditionExpression.Builder not()
      Description copied from class: FilterExpression
      Appends a NOT logical operator to negate the following condition.
      Overrides:
      not in class FilterExpression
      Returns:
      this builder for chaining
    • group

      public @NonNull ConditionExpression.Builder group(@NonNull FilterExpression nested)
      Wraps the given nested expression in parentheses and merges its expression attribute names and values into this builder.
      Overrides:
      group in class FilterExpression
      Parameters:
      nested - the expression to wrap in parentheses
      Returns:
      this builder for chaining
    • nestedEq

      public @NonNull ConditionExpression.Builder nestedEq(@NonNull String path, @NonNull Object value)
      Description copied from class: FilterExpression
      Adds an equality condition on a nested attribute path (e.g., address.city). Dot-separated path segments are resolved to individual expression attribute names, and list indices (e.g., items[0]) are supported.
      Overrides:
      nestedEq in class FilterExpression
      Parameters:
      path - the nested attribute path (e.g., "address.city")
      value - the value to compare against
      Returns:
      this builder for chaining
    • build

      public @NonNull ConditionExpression build()
      Returns:
      a new condition expression with the accumulated conditions