Class DynamoDBScanExpression


  • public class DynamoDBScanExpression
    extends Object
    Options for filtering results from a scan operation. For example, callers can specify filter conditions so that only objects whose attributes match different conditions are returned (see ComparisonOperator for more information on the available comparison types).
    See Also:
    DynamoDBMapper.scan(Class, DynamoDBScanExpression)
    • Constructor Detail

      • DynamoDBScanExpression

        public DynamoDBScanExpression()
    • Method Detail

      • getIndexName

        public String getIndexName()
        Returns the name of the index to be used by this scan; or null if there is none.
      • setIndexName

        public void setIndexName​(String indexName)
        Sets the name of the index to be used by this scan.
      • withIndexName

        public DynamoDBScanExpression withIndexName​(String indexName)
        Sets the name of the index to be used by this scan.

        Returns a pointer to this object for method-chaining.

      • getScanFilter

        public Map<String,​Condition> getScanFilter()
        Returns the scan filter as a map of attribute names to conditions.
        Returns:
        The scan filter as a map of attribute names to conditions.
      • setScanFilter

        public void setScanFilter​(Map<String,​Condition> scanFilter)
        Sets the scan filter to the map of attribute names to conditions given.
        Parameters:
        scanFilter - The map of attribute names to conditions to use when filtering scan results.
      • withScanFilter

        public DynamoDBScanExpression withScanFilter​(Map<String,​Condition> scanFilter)
        Sets the scan filter to the map of attribute names to conditions given and returns a pointer to this object for method-chaining.
        Parameters:
        scanFilter - The map of attribute names to conditions to use when filtering scan results.
      • addFilterCondition

        public void addFilterCondition​(String attributeName,
                                       Condition condition)
        Adds a new filter condition to the current scan filter.
        Parameters:
        attributeName - The name of the attribute on which the specified condition operates.
        condition - The condition which describes how the specified attribute is compared and if a row of data is included in the results returned by the scan operation.
      • withFilterConditionEntry

        public DynamoDBScanExpression withFilterConditionEntry​(String attributeName,
                                                               Condition condition)
        Adds a new filter condition to the current scan filter and returns a pointer to this object for method-chaining.
        Parameters:
        attributeName - The name of the attribute on which the specified condition operates.
        condition - The condition which describes how the specified attribute is compared and if a row of data is included in the results returned by the scan operation.
      • getExclusiveStartKey

        public Map<String,​AttributeValue> getExclusiveStartKey()
        Returns the exclusive start key for this scan.
      • setExclusiveStartKey

        public void setExclusiveStartKey​(Map<String,​AttributeValue> exclusiveStartKey)
        Sets the exclusive start key for this scan.
      • withExclusiveStartKey

        public DynamoDBScanExpression withExclusiveStartKey​(Map<String,​AttributeValue> exclusiveStartKey)
        Sets the exclusive start key for this scan and returns a pointer to this object for method-chaining.
      • getLimit

        public Integer getLimit()
        Returns the limit of items to scan during this scan.

        Use with caution. Please note that this is not the same as the number of items to return from the scan operation -- the operation will cease and return as soon as this many items are scanned, even if no matching results are found. Furthermore, PaginatedScanList will execute as many scan operations as necessary until it either reaches the end of the result set as indicated by DynamoDB or enough elements are available to fulfill the list operation (e.g. iteration). Therefore, except when scanning without a scan filter, it's usually bad practice to set a low limit, since doing so will often generate the same amount of traffic to DynamoDB but with a greater number of round trips and therefore more overall latency.

      • setLimit

        public void setLimit​(Integer limit)
        Sets the limit of items to scan during this scan. Please note that this is not the same as the number of items to return from the scan operation -- the operation will cease and return as soon as this many items are scanned, even if no matching results are found.
        See Also:
        getLimit()
      • withLimit

        public DynamoDBScanExpression withLimit​(Integer limit)
        Sets the limit of items to scan and returns a pointer to this object for method-chaining. Please note that this is not the same as the number of items to return from the scan operation -- the operation will cease and return as soon as this many items are scanned, even if no matching results are found.
        See Also:
        getLimit()
      • getTotalSegments

        public Integer getTotalSegments()
        Returns the total number of segments into which the scan will be divided.
      • setTotalSegments

        public void setTotalSegments​(Integer totalSegments)
        Sets the total number of segments into which the scan will be divided.
      • withTotalSegments

        public DynamoDBScanExpression withTotalSegments​(Integer totalSegments)
        Sets the total number of segments into which the scan will be divided and returns a pointer to this object for method-chaining.
      • getSegment

        public Integer getSegment()
        Returns the ID of the segment to be scanned.
      • setSegment

        public void setSegment​(Integer segment)
        Sets the ID of the segment to be scanned.
      • withSegment

        public DynamoDBScanExpression withSegment​(Integer segment)
        Sets the ID of the segment to be scanned and returns a pointer to this object for method-chaining.
      • getConditionalOperator

        public String getConditionalOperator()
        Returns the logical operator on the filter conditions of this scan.
      • setConditionalOperator

        public void setConditionalOperator​(String conditionalOperator)
        Sets the logical operator on the filter conditions of this scan.
      • withConditionalOperator

        public DynamoDBScanExpression withConditionalOperator​(String conditionalOperator)
        Sets the logical operator on the filter conditions of this scan and returns a pointer to this object for method-chaining.
      • setConditionalOperator

        public void setConditionalOperator​(ConditionalOperator conditionalOperator)
        Sets the logical operator on the filter conditions of this scan.
      • withConditionalOperator

        public DynamoDBScanExpression withConditionalOperator​(ConditionalOperator conditionalOperator)
        Sets the logical operator on the filter conditions of this scan and returns a pointer to this object for method-chaining.
      • getFilterExpression

        public 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:
        ScanRequest.getFilterExpression()
      • setFilterExpression

        public void setFilterExpression​(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:
        ScanRequest.setFilterExpression(String)
      • withFilterExpression

        public DynamoDBScanExpression withFilterExpression​(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:
        ScanRequest.withFilterExpression(String)
      • getExpressionAttributeNames

        public Map<String,​String> getExpressionAttributeNames()
        One or more substitution variables for simplifying complex expressions.
        Returns:
        One or more substitution variables for simplifying complex expressions.
        See Also:
        scanRequest#getExpressionAttributeNames()
      • setExpressionAttributeNames

        public void setExpressionAttributeNames​(Map<String,​String> expressionAttributeNames)
        One or more substitution variables for simplifying complex expressions.
        Parameters:
        expressionAttributeNames - One or more substitution variables for simplifying complex expressions.
        See Also:
        ScanRequest.setExpressionAttributeNames(Map)
      • withExpressionAttributeNames

        public DynamoDBScanExpression withExpressionAttributeNames​(Map<String,​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:
        ScanRequest.withExpressionAttributeNames(Map)
      • addExpressionAttributeNamesEntry

        public DynamoDBScanExpression addExpressionAttributeNamesEntry​(String key,
                                                                       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:
        ScanRequest.addExpressionAttributeNamesEntry(String, String)
      • clearExpressionAttributeNamesEntries

        public DynamoDBScanExpression clearExpressionAttributeNamesEntries()
        Removes all the entries added into ExpressionAttributeNames.

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

      • setExpressionAttributeValues

        public void setExpressionAttributeValues​(Map<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:
        ScanRequest.setExpressionAttributeValues(Map)
      • withExpressionAttributeValues

        public DynamoDBScanExpression withExpressionAttributeValues​(Map<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:
        ScanRequest.withExpressionAttributeValues(Map)
      • addExpressionAttributeValuesEntry

        public DynamoDBScanExpression addExpressionAttributeValuesEntry​(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:
        ScanRequest.addExpressionAttributeValuesEntry(String, AttributeValue)
      • clearExpressionAttributeValuesEntries

        public DynamoDBScanExpression clearExpressionAttributeValuesEntries()
        Removes all the entries added into ExpressionAttributeValues.

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

      • getSelect

        public String getSelect()
        The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.

        Constraints:
        Allowed Values: ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT

        Returns:
        The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
        See Also:
        Select
      • setSelect

        public void setSelect​(String select)
        The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.

        Constraints:
        Allowed Values: ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT

        Parameters:
        select - The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
        See Also:
        Select
      • withSelect

        public DynamoDBScanExpression withSelect​(String select)
        The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.

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

        Constraints:
        Allowed Values: ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT

        Parameters:
        select - The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
        Returns:
        A reference to this updated object so that method calls can be chained together.
        See Also:
        Select
      • setSelect

        public void setSelect​(Select select)
        The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.

        Constraints:
        Allowed Values: ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT

        Parameters:
        select - The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
        See Also:
        Select
      • withSelect

        public DynamoDBScanExpression withSelect​(Select select)
        The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.

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

        Constraints:
        Allowed Values: ALL_ATTRIBUTES, ALL_PROJECTED_ATTRIBUTES, SPECIFIC_ATTRIBUTES, COUNT

        Parameters:
        select - The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
        Returns:
        A reference to this updated object so that method calls can be chained together.
        See Also:
        Select
      • getProjectionExpression

        public String getProjectionExpression()
        A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.

        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.

        For more information, go to Accessing Item Attributes in the Amazon DynamoDB Developer Guide.

        Returns:
        A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.

        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.

        For more information, go to Accessing Item Attributes in the Amazon DynamoDB Developer Guide.

      • setProjectionExpression

        public void setProjectionExpression​(String projectionExpression)
        A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.

        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.

        For more information, go to Accessing Item Attributes in the Amazon DynamoDB Developer Guide.

        Parameters:
        projectionExpression - A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.

        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.

        For more information, go to Accessing Item Attributes in the Amazon DynamoDB Developer Guide.

      • withProjectionExpression

        public DynamoDBScanExpression withProjectionExpression​(String projectionExpression)
        A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.

        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.

        For more information, go to Accessing Item Attributes in the Amazon DynamoDB Developer Guide.

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

        Parameters:
        projectionExpression - A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.

        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.

        For more information, go to Accessing Item Attributes in the Amazon DynamoDB Developer Guide.

        Returns:
        A reference to this updated object so that method calls can be chained together.
      • getReturnConsumedCapacity

        public String getReturnConsumedCapacity()
        A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

        Constraints:
        Allowed Values: INDEXES, TOTAL, NONE

        If enabled, the underlying request to DynamoDB will include the configured parameter value and the low-level response from DynamoDB will include the amount of capacity consumed by the scan. Currently, the consumed capacity is only exposed through the DynamoDBMapper when you call DynamoDBMapper.scanPage, not DynamoDBMapper.scan.

        Returns:
        A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
        See Also:
        ReturnConsumedCapacity
      • setReturnConsumedCapacity

        public void setReturnConsumedCapacity​(String returnConsumedCapacity)
        A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

        Constraints:
        Allowed Values: INDEXES, TOTAL, NONE

        If enabled, the underlying request to DynamoDB will include the configured parameter value and the low-level response from DynamoDB will include the amount of capacity consumed by the scan. Currently, the consumed capacity is only exposed through the DynamoDBMapper when you call DynamoDBMapper.scanPage, not DynamoDBMapper.scan.

        Parameters:
        returnConsumedCapacity - A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
        See Also:
        ReturnConsumedCapacity
      • withReturnConsumedCapacity

        public DynamoDBScanExpression withReturnConsumedCapacity​(String returnConsumedCapacity)
        A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

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

        Constraints:
        Allowed Values: INDEXES, TOTAL, NONE

        If enabled, the underlying request to DynamoDB will include the configured parameter value and the low-level response from DynamoDB will include the amount of capacity consumed by the scan. Currently, the consumed capacity is only exposed through the DynamoDBMapper when you call DynamoDBMapper.scanPage, not DynamoDBMapper.scan.

        Parameters:
        returnConsumedCapacity - A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
        Returns:
        A reference to this updated object so that method calls can be chained together.
        See Also:
        ReturnConsumedCapacity
      • setReturnConsumedCapacity

        public void setReturnConsumedCapacity​(ReturnConsumedCapacity returnConsumedCapacity)
        A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

        Constraints:
        Allowed Values: INDEXES, TOTAL, NONE

        If enabled, the underlying request to DynamoDB will include the configured parameter value and the low-level response from DynamoDB will include the amount of capacity consumed by the scan. Currently, the consumed capacity is only exposed through the DynamoDBMapper when you call DynamoDBMapper.scanPage, not DynamoDBMapper.scan.

        Parameters:
        returnConsumedCapacity - A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
        See Also:
        ReturnConsumedCapacity
      • withReturnConsumedCapacity

        public DynamoDBScanExpression withReturnConsumedCapacity​(ReturnConsumedCapacity returnConsumedCapacity)
        A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.

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

        Constraints:
        Allowed Values: INDEXES, TOTAL, NONE

        If enabled, the underlying request to DynamoDB will include the configured parameter value and the low-level response from DynamoDB will include the amount of capacity consumed by the scan. Currently, the consumed capacity is only exposed through the DynamoDBMapper when you call DynamoDBMapper.scanPage, not DynamoDBMapper.scan.

        Parameters:
        returnConsumedCapacity - A value that if set to TOTAL, the response includes ConsumedCapacity data for tables and indexes. If set to INDEXES, the response includes ConsumedCapacity for indexes. If set to NONE (the default), ConsumedCapacity is not included in the response.
        Returns:
        A reference to this updated object so that method calls can be chained together.
        See Also:
        ReturnConsumedCapacity
      • setConsistentRead

        public void setConsistentRead​(Boolean consistentRead)
        Sets whether this scan uses consistent reads.
      • withConsistentRead

        public DynamoDBScanExpression withConsistentRead​(Boolean consistentRead)
        Sets whether this scan uses consistent reads and returns a reference to this object for method chaining.