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 Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Expressionexpression(TableSchema<?> tableSchema, String indexName)Generates a conditionalExpressionbased on specific context that is supplied as arguments.static QueryConditionalkeyEqualTo(Consumer<Key.Builder> keyConsumer)Creates aQueryConditionalthat matches when the key of an index is equal to a specific value.static QueryConditionalkeyEqualTo(Key key)Creates aQueryConditionalthat matches when the key of an index is equal to a specific value.static QueryConditionalsortBeginsWith(Consumer<Key.Builder> keyConsumer)Creates aQueryConditionalthat matches when the key of an index begins with a specific value.static QueryConditionalsortBeginsWith(Key key)Creates aQueryConditionalthat matches when the key of an index begins with a specific value.static QueryConditionalsortBetween(Consumer<Key.Builder> keyFromConsumer, Consumer<Key.Builder> keyToConsumer)Creates aQueryConditionalthat matches when the key of an index is between two specific values.static QueryConditionalsortBetween(Key keyFrom, Key keyTo)Creates aQueryConditionalthat matches when the key of an index is between two specific values.static QueryConditionalsortGreaterThan(Consumer<Key.Builder> keyConsumer)Creates aQueryConditionalthat matches when the key of an index is greater than a specific value.static QueryConditionalsortGreaterThan(Key key)Creates aQueryConditionalthat matches when the key of an index is greater than a specific value.static QueryConditionalsortGreaterThanOrEqualTo(Consumer<Key.Builder> keyConsumer)Creates aQueryConditionalthat matches when the key of an index is greater than or equal to a specific value.static QueryConditionalsortGreaterThanOrEqualTo(Key key)Creates aQueryConditionalthat matches when the key of an index is greater than or equal to a specific value.static QueryConditionalsortLessThan(Consumer<Key.Builder> keyConsumer)Creates aQueryConditionalthat matches when the key of an index is less than a specific value.static QueryConditionalsortLessThan(Key key)Creates aQueryConditionalthat matches when the key of an index is less than a specific value.static QueryConditionalsortLessThanOrEqualTo(Consumer<Key.Builder> keyConsumer)Creates aQueryConditionalthat matches when the key of an index is less than or equal to a specific value.static QueryConditionalsortLessThanOrEqualTo(Key key)Creates aQueryConditionalthat matches when the key of an index is less than or equal to a specific value.
-
-
-
Method Detail
-
keyEqualTo
static QueryConditional keyEqualTo(Key key)
Creates aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 aQueryConditionalthat 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 againstkeyTo- 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 aQueryConditionalthat 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 againstkeyToConsumer- '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 aQueryConditionalthat 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 aQueryConditionalthat 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 conditionalExpressionbased on specific context that is supplied as arguments.- Parameters:
tableSchema- ATableSchemathat this expression will be used withindexName- The specific index name of the index this expression will be used with- Returns:
- A specific
Expressionthat can be used as part of a query request
-
-