com.amazonaws.services.dynamodb.model
Class QueryRequest

java.lang.Object
  extended by com.amazonaws.AmazonWebServiceRequest
      extended by com.amazonaws.services.dynamodb.model.QueryRequest

public class QueryRequest
extends AmazonWebServiceRequest

Container for the parameters to the Query operation.

The Query operation gets the values of one or more items and its attributes by primary key (composite primary key, only). Narrow the scope of the query using comparison operators on the RangeKeyValue of the composite key. Use the ScanIndexForward parameter to get results in forward or reverse order by range key.

See Also:
AmazonDynamoDB.query(QueryRequest)

Constructor Summary
QueryRequest()
          Default constructor for a new QueryRequest object.
QueryRequest(String tableName, AttributeValue hashKeyValue)
          Constructs a new QueryRequest object.
 
Method Summary
 boolean equals(Object obj)
           
 List<String> getAttributesToGet()
          Array of Attribute names.
 Boolean getConsistentRead()
          If set to true, then a consistent read is issued, otherwise eventually consistent is used.
 Boolean getCount()
          If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes.
 Key getExclusiveStartKey()
          Primary key of the item from which to continue an earlier query.
 AttributeValue getHashKeyValue()
          Attribute value of the hash component of the composite primary key.
 Integer getLimit()
          The maximum number of items to return.
 Condition getRangeKeyCondition()
          A container for the attribute values and comparison operators to use for the query.
 Boolean getScanIndexForward()
          Specifies forward or backward traversal of the index.
 String getTableName()
          Returns the value of the TableName property for this object.
 int hashCode()
           
 Boolean isConsistentRead()
          If set to true, then a consistent read is issued, otherwise eventually consistent is used.
 Boolean isCount()
          If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes.
 Boolean isScanIndexForward()
          Specifies forward or backward traversal of the index.
 void setAttributesToGet(Collection<String> attributesToGet)
          Array of Attribute names.
 void setConsistentRead(Boolean consistentRead)
          If set to true, then a consistent read is issued, otherwise eventually consistent is used.
 void setCount(Boolean count)
          If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes.
 void setExclusiveStartKey(Key exclusiveStartKey)
          Primary key of the item from which to continue an earlier query.
 void setHashKeyValue(AttributeValue hashKeyValue)
          Attribute value of the hash component of the composite primary key.
 void setLimit(Integer limit)
          The maximum number of items to return.
 void setRangeKeyCondition(Condition rangeKeyCondition)
          A container for the attribute values and comparison operators to use for the query.
 void setScanIndexForward(Boolean scanIndexForward)
          Specifies forward or backward traversal of the index.
 void setTableName(String tableName)
          Sets the value of the TableName property for this object.
 String toString()
          Returns a string representation of this object; useful for testing and debugging.
 QueryRequest withAttributesToGet(Collection<String> attributesToGet)
          Array of Attribute names.
 QueryRequest withAttributesToGet(String... attributesToGet)
          Array of Attribute names.
 QueryRequest withConsistentRead(Boolean consistentRead)
          If set to true, then a consistent read is issued, otherwise eventually consistent is used.
 QueryRequest withCount(Boolean count)
          If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes.
 QueryRequest withExclusiveStartKey(Key exclusiveStartKey)
          Primary key of the item from which to continue an earlier query.
 QueryRequest withHashKeyValue(AttributeValue hashKeyValue)
          Attribute value of the hash component of the composite primary key.
 QueryRequest withLimit(Integer limit)
          The maximum number of items to return.
 QueryRequest withRangeKeyCondition(Condition rangeKeyCondition)
          A container for the attribute values and comparison operators to use for the query.
 QueryRequest withScanIndexForward(Boolean scanIndexForward)
          Specifies forward or backward traversal of the index.
 QueryRequest withTableName(String tableName)
          Sets the value of the TableName property for this object.
 
Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyPrivateRequestParameters, getRequestClientOptions, getRequestCredentials, setRequestCredentials
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryRequest

public QueryRequest()
Default constructor for a new QueryRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.


QueryRequest

public QueryRequest(String tableName,
                    AttributeValue hashKeyValue)
Constructs a new QueryRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
tableName -
hashKeyValue - Attribute value of the hash component of the composite primary key.
Method Detail

getTableName

public String getTableName()
Returns the value of the TableName property for this object.

Constraints:
Length: 3 - 255
Pattern: [a-zA-Z0-9_.-]+

Returns:
The value of the TableName property for this object.

setTableName

public void setTableName(String tableName)
Sets the value of the TableName property for this object.

Constraints:
Length: 3 - 255
Pattern: [a-zA-Z0-9_.-]+

Parameters:
tableName - The new value for the TableName property for this object.

withTableName

public QueryRequest withTableName(String tableName)
Sets the value of the TableName property for this object.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 3 - 255
Pattern: [a-zA-Z0-9_.-]+

Parameters:
tableName - The new value for the TableName property for this object.
Returns:
A reference to this updated object so that method calls can be chained together.

getAttributesToGet

public List<String> getAttributesToGet()
Array of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result.

Constraints:
Length: 1 -

Returns:
Array of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result.

setAttributesToGet

public void setAttributesToGet(Collection<String> attributesToGet)
Array of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result.

Constraints:
Length: 1 -

Parameters:
attributesToGet - Array of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result.

withAttributesToGet

public QueryRequest withAttributesToGet(String... attributesToGet)
Array of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 -

Parameters:
attributesToGet - Array of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result.
Returns:
A reference to this updated object so that method calls can be chained together.

withAttributesToGet

public QueryRequest withAttributesToGet(Collection<String> attributesToGet)
Array of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 -

Parameters:
attributesToGet - Array of Attribute names. If attribute names are not specified then all attributes will be returned. If some attributes are not found, they will not appear in the result.
Returns:
A reference to this updated object so that method calls can be chained together.

getLimit

public Integer getLimit()
The maximum number of items to return. If Amazon DynamoDB hits this limit while querying the table, it stops the query and returns the matching values up to the limit, and a LastEvaluatedKey to apply in a subsequent operation to continue the query. Also, if the result set size exceeds 1MB before Amazon DynamoDB hits this limit, it stops the query and returns the matching values, and a LastEvaluatedKey to apply in a subsequent operation to continue the query.

Constraints:
Range: 1 -

Returns:
The maximum number of items to return. If Amazon DynamoDB hits this limit while querying the table, it stops the query and returns the matching values up to the limit, and a LastEvaluatedKey to apply in a subsequent operation to continue the query. Also, if the result set size exceeds 1MB before Amazon DynamoDB hits this limit, it stops the query and returns the matching values, and a LastEvaluatedKey to apply in a subsequent operation to continue the query.

setLimit

public void setLimit(Integer limit)
The maximum number of items to return. If Amazon DynamoDB hits this limit while querying the table, it stops the query and returns the matching values up to the limit, and a LastEvaluatedKey to apply in a subsequent operation to continue the query. Also, if the result set size exceeds 1MB before Amazon DynamoDB hits this limit, it stops the query and returns the matching values, and a LastEvaluatedKey to apply in a subsequent operation to continue the query.

Constraints:
Range: 1 -

Parameters:
limit - The maximum number of items to return. If Amazon DynamoDB hits this limit while querying the table, it stops the query and returns the matching values up to the limit, and a LastEvaluatedKey to apply in a subsequent operation to continue the query. Also, if the result set size exceeds 1MB before Amazon DynamoDB hits this limit, it stops the query and returns the matching values, and a LastEvaluatedKey to apply in a subsequent operation to continue the query.

withLimit

public QueryRequest withLimit(Integer limit)
The maximum number of items to return. If Amazon DynamoDB hits this limit while querying the table, it stops the query and returns the matching values up to the limit, and a LastEvaluatedKey to apply in a subsequent operation to continue the query. Also, if the result set size exceeds 1MB before Amazon DynamoDB hits this limit, it stops the query and returns the matching values, and a LastEvaluatedKey to apply in a subsequent operation to continue the query.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Range: 1 -

Parameters:
limit - The maximum number of items to return. If Amazon DynamoDB hits this limit while querying the table, it stops the query and returns the matching values up to the limit, and a LastEvaluatedKey to apply in a subsequent operation to continue the query. Also, if the result set size exceeds 1MB before Amazon DynamoDB hits this limit, it stops the query and returns the matching values, and a LastEvaluatedKey to apply in a subsequent operation to continue the query.
Returns:
A reference to this updated object so that method calls can be chained together.

isConsistentRead

public Boolean isConsistentRead()
If set to true, then a consistent read is issued, otherwise eventually consistent is used.

Returns:
If set to true, then a consistent read is issued, otherwise eventually consistent is used.

setConsistentRead

public void setConsistentRead(Boolean consistentRead)
If set to true, then a consistent read is issued, otherwise eventually consistent is used.

Parameters:
consistentRead - If set to true, then a consistent read is issued, otherwise eventually consistent is used.

withConsistentRead

public QueryRequest withConsistentRead(Boolean consistentRead)
If set to true, then a consistent read is issued, otherwise eventually consistent is used.

Returns a reference to this object so that method calls can be chained together.

Parameters:
consistentRead - If set to true, then a consistent read is issued, otherwise eventually consistent is used.
Returns:
A reference to this updated object so that method calls can be chained together.

getConsistentRead

public Boolean getConsistentRead()
If set to true, then a consistent read is issued, otherwise eventually consistent is used.

Returns:
If set to true, then a consistent read is issued, otherwise eventually consistent is used.

isCount

public Boolean isCount()
If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon DynamoDB returns a validation error.

Returns:
If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon DynamoDB returns a validation error.

setCount

public void setCount(Boolean count)
If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon DynamoDB returns a validation error.

Parameters:
count - If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon DynamoDB returns a validation error.

withCount

public QueryRequest withCount(Boolean count)
If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon DynamoDB returns a validation error.

Returns a reference to this object so that method calls can be chained together.

Parameters:
count - If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon DynamoDB returns a validation error.
Returns:
A reference to this updated object so that method calls can be chained together.

getCount

public Boolean getCount()
If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon DynamoDB returns a validation error.

Returns:
If set to true, Amazon DynamoDB returns a total number of items that match the query parameters, instead of a list of the matching items and their attributes. Do not set Count to true while providing a list of AttributesToGet, otherwise Amazon DynamoDB returns a validation error.

getHashKeyValue

public AttributeValue getHashKeyValue()
Attribute value of the hash component of the composite primary key.

Returns:
Attribute value of the hash component of the composite primary key.

setHashKeyValue

public void setHashKeyValue(AttributeValue hashKeyValue)
Attribute value of the hash component of the composite primary key.

Parameters:
hashKeyValue - Attribute value of the hash component of the composite primary key.

withHashKeyValue

public QueryRequest withHashKeyValue(AttributeValue hashKeyValue)
Attribute value of the hash component of the composite primary key.

Returns a reference to this object so that method calls can be chained together.

Parameters:
hashKeyValue - Attribute value of the hash component of the composite primary key.
Returns:
A reference to this updated object so that method calls can be chained together.

getRangeKeyCondition

public Condition getRangeKeyCondition()
A container for the attribute values and comparison operators to use for the query.

Returns:
A container for the attribute values and comparison operators to use for the query.

setRangeKeyCondition

public void setRangeKeyCondition(Condition rangeKeyCondition)
A container for the attribute values and comparison operators to use for the query.

Parameters:
rangeKeyCondition - A container for the attribute values and comparison operators to use for the query.

withRangeKeyCondition

public QueryRequest withRangeKeyCondition(Condition rangeKeyCondition)
A container for the attribute values and comparison operators to use for the query.

Returns a reference to this object so that method calls can be chained together.

Parameters:
rangeKeyCondition - A container for the attribute values and comparison operators to use for the query.
Returns:
A reference to this updated object so that method calls can be chained together.

isScanIndexForward

public Boolean isScanIndexForward()
Specifies forward or backward traversal of the index. Amazon DynamoDB returns results reflecting the requested order, determined by the range key. Default is true (forward).

Returns:
Specifies forward or backward traversal of the index. Amazon DynamoDB returns results reflecting the requested order, determined by the range key. Default is true (forward).

setScanIndexForward

public void setScanIndexForward(Boolean scanIndexForward)
Specifies forward or backward traversal of the index. Amazon DynamoDB returns results reflecting the requested order, determined by the range key. Default is true (forward).

Parameters:
scanIndexForward - Specifies forward or backward traversal of the index. Amazon DynamoDB returns results reflecting the requested order, determined by the range key. Default is true (forward).

withScanIndexForward

public QueryRequest withScanIndexForward(Boolean scanIndexForward)
Specifies forward or backward traversal of the index. Amazon DynamoDB returns results reflecting the requested order, determined by the range key. Default is true (forward).

Returns a reference to this object so that method calls can be chained together.

Parameters:
scanIndexForward - Specifies forward or backward traversal of the index. Amazon DynamoDB returns results reflecting the requested order, determined by the range key. Default is true (forward).
Returns:
A reference to this updated object so that method calls can be chained together.

getScanIndexForward

public Boolean getScanIndexForward()
Specifies forward or backward traversal of the index. Amazon DynamoDB returns results reflecting the requested order, determined by the range key. Default is true (forward).

Returns:
Specifies forward or backward traversal of the index. Amazon DynamoDB returns results reflecting the requested order, determined by the range key. Default is true (forward).

getExclusiveStartKey

public Key getExclusiveStartKey()
Primary key of the item from which to continue an earlier query. An earlier query might provide this value as the LastEvaluatedKey if that query operation was interrupted before completing the query; either because of the result set size or the Limit parameter. The LastEvaluatedKey can be passed back in a new query request to continue the operation from that point.

Returns:
Primary key of the item from which to continue an earlier query. An earlier query might provide this value as the LastEvaluatedKey if that query operation was interrupted before completing the query; either because of the result set size or the Limit parameter. The LastEvaluatedKey can be passed back in a new query request to continue the operation from that point.

setExclusiveStartKey

public void setExclusiveStartKey(Key exclusiveStartKey)
Primary key of the item from which to continue an earlier query. An earlier query might provide this value as the LastEvaluatedKey if that query operation was interrupted before completing the query; either because of the result set size or the Limit parameter. The LastEvaluatedKey can be passed back in a new query request to continue the operation from that point.

Parameters:
exclusiveStartKey - Primary key of the item from which to continue an earlier query. An earlier query might provide this value as the LastEvaluatedKey if that query operation was interrupted before completing the query; either because of the result set size or the Limit parameter. The LastEvaluatedKey can be passed back in a new query request to continue the operation from that point.

withExclusiveStartKey

public QueryRequest withExclusiveStartKey(Key exclusiveStartKey)
Primary key of the item from which to continue an earlier query. An earlier query might provide this value as the LastEvaluatedKey if that query operation was interrupted before completing the query; either because of the result set size or the Limit parameter. The LastEvaluatedKey can be passed back in a new query request to continue the operation from that point.

Returns a reference to this object so that method calls can be chained together.

Parameters:
exclusiveStartKey - Primary key of the item from which to continue an earlier query. An earlier query might provide this value as the LastEvaluatedKey if that query operation was interrupted before completing the query; either because of the result set size or the Limit parameter. The LastEvaluatedKey can be passed back in a new query request to continue the operation from that point.
Returns:
A reference to this updated object so that method calls can be chained together.

toString

public String toString()
Returns a string representation of this object; useful for testing and debugging.

Overrides:
toString in class Object
Returns:
A string representation of this object.
See Also:
Object.toString()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.