Class FilterBuilder

java.lang.Object
com.datastax.astra.client.model.FilterBuilder

public class FilterBuilder extends Object
Helper to build a where clause in natural language (fluent API).
Author:
Cedrick LUNVEN (@clunven)
  • Constructor Details

    • FilterBuilder

      protected FilterBuilder(Filter filter, String fieldName)
      Only constructor allowed
      Parameters:
      filter - sample filter
      fieldName - field name
  • Method Details

    • isEqualsTo

      public Filter isEqualsTo(Object value)
      "fieldName": "value" ($eq is omitted)
      Parameters:
      value - value
      Returns:
      self reference
    • isAnArrayContaining

      @SafeVarargs public final <V> Filter isAnArrayContaining(V... value)
      $eq: [ ... ]
      Type Parameters:
      V - the type of the values
      Parameters:
      value - value
      Returns:
      self reference
    • isInArray

      public <V> Filter isInArray(V[] value)
      $in: [ ... ]
      Type Parameters:
      V - the type of the values
      Parameters:
      value - value
      Returns:
      self reference
    • isNotInArray

      public <V> Filter isNotInArray(V[] value)
      $in: [ ... ]
      Type Parameters:
      V - the type of the values
      Parameters:
      value - value
      Returns:
      self reference
    • isAnArrayExactlyEqualsTo

      public Filter isAnArrayExactlyEqualsTo(Object[] value)
      $all: [ ... ]
      Parameters:
      value - value
      Returns:
      self reference
    • hasSubFieldsEqualsTo

      public Filter hasSubFieldsEqualsTo(Map<String,Object> value)
      $eq: [ ... ]
      Parameters:
      value - value
      Returns:
      self reference
    • isLessThan

      public Filter isLessThan(Object value)
      Add condition is less than.
      Parameters:
      value - value
      Returns:
      self reference
    • isLessOrEqualsThan

      public Filter isLessOrEqualsThan(Object value)
      Add condition is less than.
      Parameters:
      value - value
      Returns:
      self reference
    • isGreaterThan

      public Filter isGreaterThan(Object value)
      Add condition is less than.
      Parameters:
      value - value
      Returns:
      self reference
    • isGreaterOrEqualsThan

      public Filter isGreaterOrEqualsThan(Object value)
      Add condition is greater than.
      Parameters:
      value - value
      Returns:
      self reference
    • isNotEqualsTo

      public Filter isNotEqualsTo(Object value)
      Add condition is not equals to.
      Parameters:
      value - value
      Returns:
      self reference
    • exists

      public Filter exists()
      Add condition exists.
      Returns:
      self reference
    • hasSize

      public Filter hasSize(int size)
      Condition to evaluate size
      Parameters:
      size - current size value
      Returns:
      self reference