Interface QueryConditional

All Known Implementing Classes:
BeginsWithConditional, BetweenConditional, EqualToConditional, SingleKeyItemConditional

@ThreadSafe public interface QueryConditional
An interface for a literal conditional that can be used in an enhanced DynamoDB query. Contains convenient static methods that can be used to construct the most common conditional statements. Query conditionals are not linked to any specific table or schema and can be re-used in different contexts.

Example:

 
 QueryConditional sortValueGreaterThanFour = QueryConditional.sortGreaterThan(k -> k.partitionValue(10).sortValue(4));
 
 
  • Method Details

    • keyEqualTo

      static QueryConditional keyEqualTo(Key key)
      Creates a QueryConditional that matches when the key of an index is equal to a specific value.
      Parameters:
      key - the literal key used to compare the value of the index against
    • keyEqualTo

      static QueryConditional keyEqualTo(Consumer<Key.Builder> keyConsumer)
      Creates a QueryConditional that matches when the key of an index is equal to a specific value.
      Parameters:
      keyConsumer - 'builder consumer' for the literal key used to compare the value of the index against
    • sortGreaterThan

      static QueryConditional sortGreaterThan(Key key)
      Creates a QueryConditional that matches when the key of an index is greater than a specific value.
      Parameters:
      key - the literal key used to compare the value of the index against
    • sortGreaterThan

      static QueryConditional sortGreaterThan(Consumer<Key.Builder> keyConsumer)
      Creates a QueryConditional that matches when the key of an index is greater than a specific value.
      Parameters:
      keyConsumer - 'builder consumer' for the literal key used to compare the value of the index against
    • sortGreaterThanOrEqualTo

      static QueryConditional sortGreaterThanOrEqualTo(Key key)
      Creates a QueryConditional that matches when the key of an index is greater than or equal to a specific value.
      Parameters:
      key - the literal key used to compare the value of the index against
    • sortGreaterThanOrEqualTo

      static QueryConditional sortGreaterThanOrEqualTo(Consumer<Key.Builder> keyConsumer)
      Creates a QueryConditional that matches when the key of an index is greater than or equal to a specific value.
      Parameters:
      keyConsumer - 'builder consumer' for the literal key used to compare the value of the index against
    • sortLessThan

      static QueryConditional sortLessThan(Key key)
      Creates a QueryConditional that matches when the key of an index is less than a specific value.
      Parameters:
      key - the literal key used to compare the value of the index against
    • sortLessThan

      static QueryConditional sortLessThan(Consumer<Key.Builder> keyConsumer)
      Creates a QueryConditional that matches when the key of an index is less than a specific value.
      Parameters:
      keyConsumer - 'builder consumer' for the literal key used to compare the value of the index against
    • sortLessThanOrEqualTo

      static QueryConditional sortLessThanOrEqualTo(Key key)
      Creates a QueryConditional that matches when the key of an index is less than or equal to a specific value.
      Parameters:
      key - the literal key used to compare the value of the index against
    • sortLessThanOrEqualTo

      static QueryConditional sortLessThanOrEqualTo(Consumer<Key.Builder> keyConsumer)
      Creates a QueryConditional that matches when the key of an index is less than or equal to a specific value.
      Parameters:
      keyConsumer - 'builder consumer' for the literal key used to compare the value of the index against
    • sortBetween

      static QueryConditional sortBetween(Key keyFrom, Key keyTo)
      Creates a QueryConditional that matches when the key of an index is between two specific values.
      Parameters:
      keyFrom - the literal key used to compare the start of the range to compare the value of the index against
      keyTo - the literal key used to compare the end of the range to compare the value of the index against
    • sortBetween

      static QueryConditional sortBetween(Consumer<Key.Builder> keyFromConsumer, Consumer<Key.Builder> keyToConsumer)
      Creates a QueryConditional that matches when the key of an index is between two specific values.
      Parameters:
      keyFromConsumer - 'builder consumer' for the literal key used to compare the start of the range to compare the value of the index against
      keyToConsumer - 'builder consumer' for the literal key used to compare the end of the range to compare the value of the index against
    • sortBeginsWith

      static QueryConditional sortBeginsWith(Key key)
      Creates a QueryConditional that matches when the key of an index begins with a specific value.
      Parameters:
      key - the literal key used to compare the start of the value of the index against
    • sortBeginsWith

      static QueryConditional sortBeginsWith(Consumer<Key.Builder> keyConsumer)
      Creates a QueryConditional that matches when the key of an index begins with a specific value.
      Parameters:
      keyConsumer - 'builder consumer' the literal key used to compare the start of the value of the index against
    • expression

      Expression expression(TableSchema<?> tableSchema, String indexName)
      Generates a conditional Expression based on specific context that is supplied as arguments.
      Parameters:
      tableSchema - A TableSchema that this expression will be used with
      indexName - The specific index name of the index this expression will be used with
      Returns:
      A specific Expression that can be used as part of a query request