com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper
Class DynamoDBQueryExpression<T>

java.lang.Object
  extended by com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBQueryExpression<T>

public class DynamoDBQueryExpression<T>
extends java.lang.Object

A query expression.


Constructor Summary
DynamoDBQueryExpression()
           
 
Method Summary
 DynamoDBQueryExpression<T> addExpressionAttributeNamesEntry(java.lang.String key, java.lang.String value)
          One or more substitution variables for simplifying complex expressions.
 DynamoDBQueryExpression<T> addExpressionAttributeValuesEntry(java.lang.String key, AttributeValue value)
          One or more values that can be substituted in an expression.
 DynamoDBQueryExpression<T> clearExpressionAttributeNamesEntries()
          Removes all the entries added into ExpressionAttributeNames.
 DynamoDBQueryExpression<T> clearExpressionAttributeValuesEntries()
          Removes all the entries added into ExpressionAttributeValues.
 java.lang.String getConditionalOperator()
          Returns the logical operator on the query filter conditions.
 java.util.Map<java.lang.String,AttributeValue> getExclusiveStartKey()
          Returns the exclusive start key for this query.
 java.util.Map<java.lang.String,java.lang.String> getExpressionAttributeNames()
          One or more substitution variables for simplifying complex expressions.
 java.util.Map<java.lang.String,AttributeValue> getExpressionAttributeValues()
          One or more values that can be substituted in an expression.
 java.lang.String getFilterExpression()
          Evaluates the query results and returns only the desired values.
 T getHashKeyValues()
          Gets the hash key value(s) for this query.
 java.lang.String getIndexName()
          Returns the name of the index to be used by this query.
 java.lang.Integer getLimit()
          Returns the maximum number of items to retrieve in each service request to DynamoDB.
 java.util.Map<java.lang.String,Condition> getQueryFilter()
          Returns the query filter applied on this query.
 java.util.Map<java.lang.String,Condition> getRangeKeyConditions()
          Gets the range key condition for this query.
 boolean isConsistentRead()
          Returns whether this query uses consistent reads.
 boolean isScanIndexForward()
          Returns whether this query scans forward.
 void setConditionalOperator(ConditionalOperator conditionalOperator)
          Sets the logical operator on the query filter conditions.
 void setConditionalOperator(java.lang.String conditionalOperator)
          Sets the logical operator on the query filter conditions.
 void setConsistentRead(boolean consistentRead)
          Sets whether this query uses consistent reads.
 void setExclusiveStartKey(java.util.Map<java.lang.String,AttributeValue> exclusiveStartKey)
          Sets the exclusive start key for this query.
 void setExpressionAttributeNames(java.util.Map<java.lang.String,java.lang.String> expressionAttributeNames)
          One or more substitution variables for simplifying complex expressions.
 void setExpressionAttributeValues(java.util.Map<java.lang.String,AttributeValue> expressionAttributeValues)
          One or more values that can be substituted in an expression.
 void setFilterExpression(java.lang.String filterExpression)
          Evaluates the query results and returns only the desired values.
 void setHashKeyValues(T hashKeyValues)
          Sets the hash key value(s) for this query.
 void setIndexName(java.lang.String indexName)
          Sets the name of the index to be used by this query.
 void setLimit(java.lang.Integer limit)
          Sets the maximum number of items to retrieve in each service request to DynamoDB.
 void setQueryFilter(java.util.Map<java.lang.String,Condition> queryFilter)
          Sets the query filter applied on this query.
 void setRangeKeyConditions(java.util.Map<java.lang.String,Condition> rangeKeyConditions)
          Sets the range key condition for this query.
 void setScanIndexForward(boolean scanIndexForward)
          Sets whether this query scans forward.
 DynamoDBQueryExpression<T> withConditionalOperator(ConditionalOperator conditionalOperator)
          Sets the logical operator on the query filter conditions.
 DynamoDBQueryExpression<T> withConditionalOperator(java.lang.String conditionalOperator)
          Sets the logical operator on the query filter conditions.
 DynamoDBQueryExpression<T> withConsistentRead(boolean consistentRead)
          Sets whether this query uses consistent reads and returns a pointer to this object for method-chaining.
 DynamoDBQueryExpression<T> withExclusiveStartKey(java.util.Map<java.lang.String,AttributeValue> exclusiveStartKey)
          Sets the exclusive start key for this query and returns a pointer to this object for method-chaining.
 DynamoDBQueryExpression<T> withExpressionAttributeNames(java.util.Map<java.lang.String,java.lang.String> expressionAttributeNames)
          One or more substitution variables for simplifying complex expressions.
 DynamoDBQueryExpression<T> withExpressionAttributeValues(java.util.Map<java.lang.String,AttributeValue> expressionAttributeValues)
          One or more values that can be substituted in an expression.
 DynamoDBQueryExpression<T> withFilterExpression(java.lang.String filterExpression)
          Evaluates the query results and returns only the desired values.
 DynamoDBQueryExpression<T> withHashKeyValues(T hashKObject)
          Sets the hash key value(s) for this query.
 DynamoDBQueryExpression<T> withIndexName(java.lang.String indexName)
          Sets the name of the index to be used by this query.
 DynamoDBQueryExpression<T> withLimit(java.lang.Integer limit)
          Sets the maximum number of items to retrieve in each service request to DynamoDB and returns a pointer to this object for method-chaining.
 DynamoDBQueryExpression<T> withQueryFilter(java.util.Map<java.lang.String,Condition> queryFilter)
          Sets the query filter applied on this query.
 DynamoDBQueryExpression<T> withQueryFilterEntry(java.lang.String attributeName, Condition condition)
          Adds a new condition to the the query filter.
 DynamoDBQueryExpression<T> withRangeKeyCondition(java.lang.String rangeKeyAttributeName, Condition rangeKeyCondition)
          Sets one range key condition for this query, using the attribute name of the range key.
 DynamoDBQueryExpression<T> withRangeKeyConditions(java.util.Map<java.lang.String,Condition> rangeKeyConditions)
          Sets the range key condition for this query.
 DynamoDBQueryExpression<T> withScanIndexForward(boolean scanIndexForward)
          Sets whether this query scans forward and returns a pointer to this object for method-chaining.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamoDBQueryExpression

public DynamoDBQueryExpression()
Method Detail

isConsistentRead

public boolean isConsistentRead()
Returns whether this query uses consistent reads.


setConsistentRead

public void setConsistentRead(boolean consistentRead)
Sets whether this query uses consistent reads.


withConsistentRead

public DynamoDBQueryExpression<T> withConsistentRead(boolean consistentRead)
Sets whether this query uses consistent reads and returns a pointer to this object for method-chaining.


isScanIndexForward

public boolean isScanIndexForward()
Returns whether this query scans forward.


setScanIndexForward

public void setScanIndexForward(boolean scanIndexForward)
Sets whether this query scans forward.


withScanIndexForward

public DynamoDBQueryExpression<T> withScanIndexForward(boolean scanIndexForward)
Sets whether this query scans forward and returns a pointer to this object for method-chaining.


getExclusiveStartKey

public java.util.Map<java.lang.String,AttributeValue> getExclusiveStartKey()
Returns the exclusive start key for this query.


setExclusiveStartKey

public void setExclusiveStartKey(java.util.Map<java.lang.String,AttributeValue> exclusiveStartKey)
Sets the exclusive start key for this query.


withExclusiveStartKey

public DynamoDBQueryExpression<T> withExclusiveStartKey(java.util.Map<java.lang.String,AttributeValue> exclusiveStartKey)
Sets the exclusive start key for this query and returns a pointer to this object for method-chaining.


getLimit

public java.lang.Integer getLimit()
Returns the maximum number of items to retrieve in each service request to DynamoDB.

Note that when calling DynamoDBMapper.query, multiple requests are made to DynamoDB if needed to retrieve the entire result set. Setting this will limit the number of items retrieved by each request, NOT the total number of results that will be retrieved. Use DynamoDBMapper.queryPage to retrieve a single page of items from DynamoDB.


setLimit

public void setLimit(java.lang.Integer limit)
Sets the maximum number of items to retrieve in each service request to DynamoDB.

Note that when calling DynamoDBMapper.query, multiple requests are made to DynamoDB if needed to retrieve the entire result set. Setting this will limit the number of items retrieved by each request, NOT the total number of results that will be retrieved. Use DynamoDBMapper.queryPage to retrieve a single page of items from DynamoDB.


withLimit

public DynamoDBQueryExpression<T> withLimit(java.lang.Integer limit)
Sets the maximum number of items to retrieve in each service request to DynamoDB and returns a pointer to this object for method-chaining.

Note that when calling DynamoDBMapper.query, multiple requests are made to DynamoDB if needed to retrieve the entire result set. Setting this will limit the number of items retrieved by each request, NOT the total number of results that will be retrieved. Use DynamoDBMapper.queryPage to retrieve a single page of items from DynamoDB.


getHashKeyValues

public T getHashKeyValues()
Gets the hash key value(s) for this query. All hash key attributes for the table must be specified with this key object.


setHashKeyValues

public void setHashKeyValues(T hashKeyValues)
Sets the hash key value(s) for this query. All hash key attributes for the table must be specified with this key object. Note 1: Currently the DynamoDBMapper supports only one value per hash key. Note 2: Currently the Amazon DynamoDB supports only one hash key per table/index.


withHashKeyValues

public DynamoDBQueryExpression<T> withHashKeyValues(T hashKObject)
Sets the hash key value(s) for this query. All hash key attributes for the table must be specified with this key object.


getRangeKeyConditions

public java.util.Map<java.lang.String,Condition> getRangeKeyConditions()
Gets the range key condition for this query. All range key attributes for the table must be specified by attribute name in the map.


setRangeKeyConditions

public void setRangeKeyConditions(java.util.Map<java.lang.String,Condition> rangeKeyConditions)
Sets the range key condition for this query. All range key attributes for the table must be specified by attribute name in the map.

Parameters:
rangeKeyConditions - a map from key name to condition NOTE: The current DynamoDB service only allows up to one range key condition per query. Providing more than one range key condition will result in an AmazonClientException.

withRangeKeyConditions

public DynamoDBQueryExpression<T> withRangeKeyConditions(java.util.Map<java.lang.String,Condition> rangeKeyConditions)
Sets the range key condition for this query. All range key attributes for the table must be specified by attribute name in the map.

Parameters:
rangeKeyConditions - a map from key name to condition NOTE: The current DynamoDB service only allows up to one range key condition per query. Providing more than one range key condition will result in an AmazonClientException.

withRangeKeyCondition

public DynamoDBQueryExpression<T> withRangeKeyCondition(java.lang.String rangeKeyAttributeName,
                                                        Condition rangeKeyCondition)
Sets one range key condition for this query, using the attribute name of the range key. All range key attributes for the table must be specified by using DynamoDBRangeKey or DynamoDBIndexRangeKey annotations before executing the query.
If the attribute is the primary range key
users should NOT set any index name for this query.
If the attribute is an index range key
DynamoDBMapper will automatically set the index name if the range key is annotated as only used by one local secondary index, otherwise users must set the index name manually by either setIndexName(String) or withIndexName(String).

Parameters:
rangeKeyAttributeName - This can be either the primary range key of the table or an index range key.
rangeKeyCondition - Condition specified on the given range key for this query.

getIndexName

public java.lang.String getIndexName()
Returns the name of the index to be used by this query.


setIndexName

public void setIndexName(java.lang.String indexName)
Sets the name of the index to be used by this query. The hash key and/or range key of the index must be specified by adding DynamoDBIndexHashKey or DynamoDBIndexRangeKey annotations to the appropriate getter methods of the mapped object.


withIndexName

public DynamoDBQueryExpression<T> withIndexName(java.lang.String indexName)
Sets the name of the index to be used by this query. The hash key and/or range key of the index must be specified by adding DynamoDBIndexHashKey or DynamoDBIndexRangeKey annotations to the appropriate getter methods of the mapped object.

Returns a pointer to this object for method-chaining.


getQueryFilter

public java.util.Map<java.lang.String,Condition> getQueryFilter()
Returns the query filter applied on this query.


setQueryFilter

public void setQueryFilter(java.util.Map<java.lang.String,Condition> queryFilter)
Sets the query filter applied on this query.


withQueryFilter

public DynamoDBQueryExpression<T> withQueryFilter(java.util.Map<java.lang.String,Condition> queryFilter)
Sets the query filter applied on this query.

Returns a pointer to this object for method-chaining.


withQueryFilterEntry

public DynamoDBQueryExpression<T> withQueryFilterEntry(java.lang.String attributeName,
                                                       Condition condition)
Adds a new condition to the the query filter.

Returns a pointer to this object for method-chaining.

Parameters:
attributeName - The name of the attribute on which the specified condition operates.
condition - The filter condition applied on the attribute.

getConditionalOperator

public java.lang.String getConditionalOperator()
Returns the logical operator on the query filter conditions.


setConditionalOperator

public void setConditionalOperator(java.lang.String conditionalOperator)
Sets the logical operator on the query filter conditions.


withConditionalOperator

public DynamoDBQueryExpression<T> withConditionalOperator(java.lang.String conditionalOperator)
Sets the logical operator on the query filter conditions.

Returns a pointer to this object for method-chaining.


setConditionalOperator

public void setConditionalOperator(ConditionalOperator conditionalOperator)
Sets the logical operator on the query filter conditions.


withConditionalOperator

public DynamoDBQueryExpression<T> withConditionalOperator(ConditionalOperator conditionalOperator)
Sets the logical operator on the query filter conditions.

Returns a pointer to this object for method-chaining.


getFilterExpression

public java.lang.String getFilterExpression()
Evaluates the query results and returns only the desired values.

The condition you specify is applied to the items queried; any items that do not match the expression are not returned.

Returns:
Evaluates the query results and returns only the desired values.

The condition you specify is applied to the items queried; any items that do not match the expression are not returned.

See Also:
QueryRequest.getFilterExpression()

setFilterExpression

public void setFilterExpression(java.lang.String filterExpression)
Evaluates the query results and returns only the desired values.

The condition you specify is applied to the items queried; any items that do not match the expression are not returned.

Parameters:
filterExpression - Evaluates the query results and returns only the desired values.

The condition you specify is applied to the items queried; any items that do not match the expression are not returned.

See Also:
QueryRequest.setFilterExpression(String)

withFilterExpression

public DynamoDBQueryExpression<T> withFilterExpression(java.lang.String filterExpression)
Evaluates the query results and returns only the desired values.

The condition you specify is applied to the items queried; any items that do not match the expression are not returned.

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

Parameters:
filterExpression - Evaluates the query results and returns only the desired values.

The condition you specify is applied to the items queried; any items that do not match the expression are not returned.

Returns:
A reference to this updated object so that method calls can be chained together.
See Also:
QueryRequest.withFilterExpression(String)

getExpressionAttributeNames

public java.util.Map<java.lang.String,java.lang.String> getExpressionAttributeNames()
One or more substitution variables for simplifying complex expressions.

Returns:
One or more substitution variables for simplifying complex expressions.
See Also:
QueryRequest.getExpressionAttributeNames()

setExpressionAttributeNames

public void setExpressionAttributeNames(java.util.Map<java.lang.String,java.lang.String> expressionAttributeNames)
One or more substitution variables for simplifying complex expressions.

Parameters:
expressionAttributeNames - One or more substitution variables for simplifying complex expressions.
See Also:
QueryRequest.setExpressionAttributeNames(Map)

withExpressionAttributeNames

public DynamoDBQueryExpression<T> withExpressionAttributeNames(java.util.Map<java.lang.String,java.lang.String> expressionAttributeNames)
One or more substitution variables for simplifying complex expressions.

Parameters:
expressionAttributeNames - One or more substitution variables for simplifying complex expressions.
Returns:
A reference to this updated object so that method calls can be chained together.
See Also:
QueryRequest.withExpressionAttributeNames(Map)

addExpressionAttributeNamesEntry

public DynamoDBQueryExpression<T> addExpressionAttributeNamesEntry(java.lang.String key,
                                                                   java.lang.String value)
One or more substitution variables for simplifying complex expressions. The method adds a new key-value pair into ExpressionAttributeNames parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key - The key of the entry to be added into ExpressionAttributeNames.
value - The corresponding value of the entry to be added into ExpressionAttributeNames.
See Also:
QueryRequest.addExpressionAttributeNamesEntry(String, String)

clearExpressionAttributeNamesEntries

public DynamoDBQueryExpression<T> clearExpressionAttributeNamesEntries()
Removes all the entries added into ExpressionAttributeNames.

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


getExpressionAttributeValues

public java.util.Map<java.lang.String,AttributeValue> getExpressionAttributeValues()
One or more values that can be substituted in an expression.

Returns:
One or more values that can be substituted in an expression.
See Also:
QueryRequest.getExpressionAttributeValues()

setExpressionAttributeValues

public void setExpressionAttributeValues(java.util.Map<java.lang.String,AttributeValue> expressionAttributeValues)
One or more values that can be substituted in an expression.

Parameters:
expressionAttributeValues - One or more values that can be substituted in an expression.
See Also:
QueryRequest.setExpressionAttributeValues(Map)

withExpressionAttributeValues

public DynamoDBQueryExpression<T> withExpressionAttributeValues(java.util.Map<java.lang.String,AttributeValue> expressionAttributeValues)
One or more values that can be substituted in an expression.

Parameters:
expressionAttributeValues - One or more values that can be substituted in an expression.
Returns:
A reference to this updated object so that method calls can be chained together.
See Also:
QueryRequest.withExpressionAttributeValues(Map)

addExpressionAttributeValuesEntry

public DynamoDBQueryExpression<T> addExpressionAttributeValuesEntry(java.lang.String key,
                                                                    AttributeValue value)
One or more values that can be substituted in an expression. The method adds a new key-value pair into ExpressionAttributeValues parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key - The key of the entry to be added into ExpressionAttributeValues.
value - The corresponding value of the entry to be added into ExpressionAttributeValues.
See Also:
QueryRequest.addExpressionAttributeValuesEntry(String, AttributeValue)

clearExpressionAttributeValuesEntries

public DynamoDBQueryExpression<T> clearExpressionAttributeValuesEntries()
Removes all the entries added into ExpressionAttributeValues.

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



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