Class QueryEnhancedRequest.Builder
- java.lang.Object
-
- software.amazon.awssdk.enhanced.dynamodb.model.QueryEnhancedRequest.Builder
-
- Enclosing class:
- QueryEnhancedRequest
@NotThreadSafe public static final class QueryEnhancedRequest.Builder extends Object
A builder that is used to create a request with the desired parameters.A valid builder must set the
queryConditional
parameter. Other parameters are optional.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description QueryEnhancedRequest.Builder
addAttributeToProject(String attributeToProject)
Adds a single attribute name to be retrieved from the database.QueryEnhancedRequest.Builder
addNestedAttributesToProject(Collection<NestedAttributeName> nestedAttributeNames)
Adds a collection of nested attributes to be retrieved from the database.QueryEnhancedRequest.Builder
addNestedAttributesToProject(NestedAttributeName... nestedAttributeNames)
Adds a collection of nested attributes to be retrieved from the database.QueryEnhancedRequest.Builder
addNestedAttributeToProject(NestedAttributeName nestedAttributeName)
Adds a single nested attribute to be retrieved from the database.QueryEnhancedRequest.Builder
attributesToProject(String... attributesToProject)
Sets one or more attribute names to be retrieved from the database.QueryEnhancedRequest.Builder
attributesToProject(Collection<String> attributesToProject)
Sets a collection of the attribute names to be retrieved from the database.QueryEnhancedRequest
build()
QueryEnhancedRequest.Builder
consistentRead(Boolean consistentRead)
Determines the read consistency model: If set to true, the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.QueryEnhancedRequest.Builder
exclusiveStartKey(Map<String,AttributeValue> exclusiveStartKey)
The primary key of the first item that this operation will evaluate.QueryEnhancedRequest.Builder
filterExpression(Expression filterExpression)
Refines the query results by applying the filter expression on the results returned from the query and discards items that do not match.QueryEnhancedRequest.Builder
limit(Integer limit)
Sets a limit on how many items to evaluate in the query.QueryEnhancedRequest.Builder
queryConditional(QueryConditional queryConditional)
Determines the matching conditions for this query request.QueryEnhancedRequest.Builder
returnConsumedCapacity(String returnConsumedCapacity)
Whether to return the capacity consumed by this operation.QueryEnhancedRequest.Builder
returnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
Whether to return the capacity consumed by this operation.QueryEnhancedRequest.Builder
scanIndexForward(Boolean scanIndexForward)
Results are sorted by sort key in ascending order ifscanIndexForward
is true.
-
-
-
Method Detail
-
queryConditional
public QueryEnhancedRequest.Builder queryConditional(QueryConditional queryConditional)
Determines the matching conditions for this query request. SeeQueryConditional
for examples and constraints. Required.- Parameters:
queryConditional
- the query conditions- Returns:
- a builder of this type
-
scanIndexForward
public QueryEnhancedRequest.Builder scanIndexForward(Boolean scanIndexForward)
Results are sorted by sort key in ascending order ifscanIndexForward
is true. If its false, the order is descending. The default value is true.- Parameters:
scanIndexForward
- the sort order- Returns:
- a builder of this type
-
exclusiveStartKey
public QueryEnhancedRequest.Builder exclusiveStartKey(Map<String,AttributeValue> exclusiveStartKey)
The primary key of the first item that this operation will evaluate. By default, the operation will evaluate the whole dataset. If used, normally this parameter is populated with the value that was returned forPage.lastEvaluatedKey()
in the previous operation.- Parameters:
exclusiveStartKey
- the primary key value where DynamoDb should start to evaluate items- Returns:
- a builder of this type
-
limit
public QueryEnhancedRequest.Builder limit(Integer limit)
Sets a limit on how many items to evaluate in the query. If not set, the operation uses the maximum values allowed.Note:The limit does not refer to the number of items to return, but how many items the database should evaluate while executing the query. Use limit together with
Page.lastEvaluatedKey()
andexclusiveStartKey
in subsequent query calls to evaluate limit items per call.- Parameters:
limit
- the maximum number of items to evalute- Returns:
- a builder of this type
-
consistentRead
public QueryEnhancedRequest.Builder consistentRead(Boolean consistentRead)
Determines the read consistency model: If set to true, the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.By default, the value of this property is set to false.
- Parameters:
consistentRead
- sets consistency model of the operation to use strong consistency- Returns:
- a builder of this type
-
filterExpression
public QueryEnhancedRequest.Builder filterExpression(Expression filterExpression)
Refines the query results by applying the filter expression on the results returned from the query and discards items that do not match. SeeExpression
for examples and constraints.Note: Using the filter expression does not reduce the cost of the query, since it is applied after the database has found matching items.
- Parameters:
filterExpression
- an expression that filters results of evaluating the query- Returns:
- a builder of this type
-
attributesToProject
public QueryEnhancedRequest.Builder attributesToProject(Collection<String> attributesToProject)
Sets a collection of the attribute names to be retrieved from the database. These attributes can include scalars, sets, or elements of a JSON document.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
If there are nested attributes, use any of the addNestedAttributesToProject methods, such as
addNestedAttributesToProject(NestedAttributeName...)
.For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
- Parameters:
attributesToProject
- A collection of the attributes names to be retrieved from the database.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
attributesToProject
public QueryEnhancedRequest.Builder attributesToProject(String... attributesToProject)
Sets one or more attribute names to be retrieved from the database. These attributes can include scalars, sets, or elements of a JSON document.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
If there are nested attributes, use any of the addNestedAttributesToProject methods, such as
addNestedAttributesToProject(NestedAttributeName...)
.For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
- Parameters:
attributesToProject
- One or more attributes names to be retrieved from the database.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
addAttributeToProject
public QueryEnhancedRequest.Builder addAttributeToProject(String attributeToProject)
Adds a single attribute name to be retrieved from the database. This attribute can include scalars, sets, or elements of a JSON document.
If there are nested attributes, use any of the addNestedAttributesToProject methods, such as
addNestedAttributesToProject(NestedAttributeName...)
.- Parameters:
attributeToProject
- An additional single attribute name to be retrieved from the database.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
addNestedAttributesToProject
public QueryEnhancedRequest.Builder addNestedAttributesToProject(Collection<NestedAttributeName> nestedAttributeNames)
Adds a collection of nested attributes to be retrieved from the database. These attributes can include scalars, sets, or elements of a JSON document.This method is additive, so calling it multiple times will add to the list of nested attribute names.
- Parameters:
nestedAttributeNames
- A collection of attributes to be retrieved from the database.- Returns:
- Returns a reference to this object so that method calls can be chained together.
- See Also:
NestedAttributeName
-
addNestedAttributesToProject
public QueryEnhancedRequest.Builder addNestedAttributesToProject(NestedAttributeName... nestedAttributeNames)
Adds a collection of nested attributes to be retrieved from the database. These attributes can include scalars, sets, or elements of a JSON document.This method is additive, so calling it multiple times will add to the list of nested attribute names.
- Parameters:
nestedAttributeNames
- A collection of attributes to be retrieved from the database.- Returns:
- Returns a reference to this object so that method calls can be chained together.
- See Also:
NestedAttributeName
-
addNestedAttributeToProject
public QueryEnhancedRequest.Builder addNestedAttributeToProject(NestedAttributeName nestedAttributeName)
Adds a single nested attribute to be retrieved from the database. The attribute can include scalars, sets, or elements of a JSON document.This method is additive, so calling it multiple times will add to the list of nested attribute names.
- Parameters:
nestedAttributeName
- A single attribute name to be retrieved from the database.- Returns:
- Returns a reference to this object so that method calls can be chained together.
- See Also:
NestedAttributeName
-
returnConsumedCapacity
public QueryEnhancedRequest.Builder returnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
Whether to return the capacity consumed by this operation.
-
returnConsumedCapacity
public QueryEnhancedRequest.Builder returnConsumedCapacity(String returnConsumedCapacity)
Whether to return the capacity consumed by this operation.
-
build
public QueryEnhancedRequest build()
-
-