
software.amazon.awssdk.services.dynamodb.model.ScanRequest Maven / Gradle / Ivy
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.dynamodb.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.utils.CollectionUtils;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents the input of a Scan
operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ScanRequest extends DynamoDbRequest implements ToCopyableBuilder {
private final String tableName;
private final String indexName;
private final List attributesToGet;
private final Integer limit;
private final String select;
private final Map scanFilter;
private final String conditionalOperator;
private final Map exclusiveStartKey;
private final String returnConsumedCapacity;
private final Integer totalSegments;
private final Integer segment;
private final String projectionExpression;
private final String filterExpression;
private final Map expressionAttributeNames;
private final Map expressionAttributeValues;
private final Boolean consistentRead;
private ScanRequest(BuilderImpl builder) {
super(builder);
this.tableName = builder.tableName;
this.indexName = builder.indexName;
this.attributesToGet = builder.attributesToGet;
this.limit = builder.limit;
this.select = builder.select;
this.scanFilter = builder.scanFilter;
this.conditionalOperator = builder.conditionalOperator;
this.exclusiveStartKey = builder.exclusiveStartKey;
this.returnConsumedCapacity = builder.returnConsumedCapacity;
this.totalSegments = builder.totalSegments;
this.segment = builder.segment;
this.projectionExpression = builder.projectionExpression;
this.filterExpression = builder.filterExpression;
this.expressionAttributeNames = builder.expressionAttributeNames;
this.expressionAttributeValues = builder.expressionAttributeValues;
this.consistentRead = builder.consistentRead;
}
/**
*
* The name of the table containing the requested items; or, if you provide IndexName
, the name of the
* table to which that index belongs.
*
*
* @return The name of the table containing the requested items; or, if you provide IndexName
, the name
* of the table to which that index belongs.
*/
public String tableName() {
return tableName;
}
/**
*
* The name of a secondary index to scan. This index can be any local secondary index or global secondary index.
* Note that if you use the IndexName
parameter, you must also provide TableName
.
*
*
* @return The name of a secondary index to scan. This index can be any local secondary index or global secondary
* index. Note that if you use the IndexName
parameter, you must also provide
* TableName
.
*/
public String indexName() {
return indexName;
}
/**
*
* This is a legacy parameter. Use ProjectionExpression
instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return This is a legacy parameter. Use ProjectionExpression
instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
*/
public List attributesToGet() {
return attributesToGet;
}
/**
*
* The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the
* number of items up to the limit while processing the results, it stops the operation and returns the matching
* values up to that point, and a key in LastEvaluatedKey
to apply in a subsequent operation, so that
* you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches
* this limit, it stops the operation and returns the matching values up to the limit, and a key in
* LastEvaluatedKey
to apply in a subsequent operation to continue the operation. For more information,
* see Query and
* Scan in the Amazon DynamoDB Developer Guide.
*
*
* @return The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB
* processes the number of items up to the limit while processing the results, it stops the operation and
* returns the matching values up to that point, and a key in LastEvaluatedKey
to apply in a
* subsequent operation, so that you can pick up where you left off. Also, if the processed data set size
* exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values
* up to the limit, and a key in LastEvaluatedKey
to apply in a subsequent operation to
* continue the operation. For more information, see Query and
* Scan in the Amazon DynamoDB Developer Guide.
*/
public Integer limit() {
return limit;
}
/**
*
* 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.
*
*
* -
*
* ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If you query
* a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item from the
* parent table. If the index is configured to project all item attributes, then all of the data can be obtained
* from the local secondary index, and no fetching is required.
*
*
* -
*
* ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes that have
* been projected into the index. If the index is configured to project all attributes, this return value is
* equivalent to specifying ALL_ATTRIBUTES
.
*
*
* -
*
* COUNT
- Returns the number of matching items, rather than the matching items themselves.
*
*
* -
*
* SPECIFIC_ATTRIBUTES
- Returns only the attributes listed in AttributesToGet
. This
* return value is equivalent to specifying AttributesToGet
without specifying any value for
* Select
.
*
*
* If you query or scan a local secondary index and request only attributes that are projected into that index, the
* operation will read only the index and not the table. If any of the requested attributes are not projected into
* the local secondary index, DynamoDB will fetch each of these attributes from the parent table. This extra
* fetching incurs additional throughput cost and latency.
*
*
* If you query or scan a global secondary index, you can only request attributes that are projected into the index.
* Global secondary index queries cannot fetch attributes from the parent table.
*
*
*
*
* If neither Select
nor AttributesToGet
are specified, DynamoDB defaults to
* ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when accessing an
* index. You cannot use both Select
and AttributesToGet
together in a single request,
* unless the value for Select
is SPECIFIC_ATTRIBUTES
. (This usage is equivalent to
* specifying AttributesToGet
without any value for Select
.)
*
*
*
* If you use the ProjectionExpression
parameter, then the value for Select
can only be
* SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an error.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #select} will
* return {@link Select#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #selectAsString}.
*
*
* @return 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.
*
* -
*
* ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If
* you query a local secondary index, then for each matching item in the index DynamoDB will fetch the
* entire item from the parent table. If the index is configured to project all item attributes, then all of
* the data can be obtained from the local secondary index, and no fetching is required.
*
*
* -
*
* ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes
* that have been projected into the index. If the index is configured to project all attributes, this
* return value is equivalent to specifying ALL_ATTRIBUTES
.
*
*
* -
*
* COUNT
- Returns the number of matching items, rather than the matching items themselves.
*
*
* -
*
* SPECIFIC_ATTRIBUTES
- Returns only the attributes listed in AttributesToGet
.
* This return value is equivalent to specifying AttributesToGet
without specifying any value
* for Select
.
*
*
* If you query or scan a local secondary index and request only attributes that are projected into that
* index, the operation will read only the index and not the table. If any of the requested attributes are
* not projected into the local secondary index, DynamoDB will fetch each of these attributes from the
* parent table. This extra fetching incurs additional throughput cost and latency.
*
*
* If you query or scan a global secondary index, you can only request attributes that are projected into
* the index. Global secondary index queries cannot fetch attributes from the parent table.
*
*
*
*
* If neither Select
nor AttributesToGet
are specified, DynamoDB defaults to
* ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when
* accessing an index. You cannot use both Select
and AttributesToGet
together in
* a single request, unless the value for Select
is SPECIFIC_ATTRIBUTES
. (This
* usage is equivalent to specifying AttributesToGet
without any value for Select
* .)
*
*
*
* If you use the ProjectionExpression
parameter, then the value for Select
can
* only be SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an error.
*
* @see Select
*/
public Select select() {
return Select.fromValue(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.
*
*
* -
*
* ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If you query
* a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item from the
* parent table. If the index is configured to project all item attributes, then all of the data can be obtained
* from the local secondary index, and no fetching is required.
*
*
* -
*
* ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes that have
* been projected into the index. If the index is configured to project all attributes, this return value is
* equivalent to specifying ALL_ATTRIBUTES
.
*
*
* -
*
* COUNT
- Returns the number of matching items, rather than the matching items themselves.
*
*
* -
*
* SPECIFIC_ATTRIBUTES
- Returns only the attributes listed in AttributesToGet
. This
* return value is equivalent to specifying AttributesToGet
without specifying any value for
* Select
.
*
*
* If you query or scan a local secondary index and request only attributes that are projected into that index, the
* operation will read only the index and not the table. If any of the requested attributes are not projected into
* the local secondary index, DynamoDB will fetch each of these attributes from the parent table. This extra
* fetching incurs additional throughput cost and latency.
*
*
* If you query or scan a global secondary index, you can only request attributes that are projected into the index.
* Global secondary index queries cannot fetch attributes from the parent table.
*
*
*
*
* If neither Select
nor AttributesToGet
are specified, DynamoDB defaults to
* ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when accessing an
* index. You cannot use both Select
and AttributesToGet
together in a single request,
* unless the value for Select
is SPECIFIC_ATTRIBUTES
. (This usage is equivalent to
* specifying AttributesToGet
without any value for Select
.)
*
*
*
* If you use the ProjectionExpression
parameter, then the value for Select
can only be
* SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an error.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #select} will
* return {@link Select#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #selectAsString}.
*
*
* @return 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.
*
* -
*
* ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If
* you query a local secondary index, then for each matching item in the index DynamoDB will fetch the
* entire item from the parent table. If the index is configured to project all item attributes, then all of
* the data can be obtained from the local secondary index, and no fetching is required.
*
*
* -
*
* ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes
* that have been projected into the index. If the index is configured to project all attributes, this
* return value is equivalent to specifying ALL_ATTRIBUTES
.
*
*
* -
*
* COUNT
- Returns the number of matching items, rather than the matching items themselves.
*
*
* -
*
* SPECIFIC_ATTRIBUTES
- Returns only the attributes listed in AttributesToGet
.
* This return value is equivalent to specifying AttributesToGet
without specifying any value
* for Select
.
*
*
* If you query or scan a local secondary index and request only attributes that are projected into that
* index, the operation will read only the index and not the table. If any of the requested attributes are
* not projected into the local secondary index, DynamoDB will fetch each of these attributes from the
* parent table. This extra fetching incurs additional throughput cost and latency.
*
*
* If you query or scan a global secondary index, you can only request attributes that are projected into
* the index. Global secondary index queries cannot fetch attributes from the parent table.
*
*
*
*
* If neither Select
nor AttributesToGet
are specified, DynamoDB defaults to
* ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when
* accessing an index. You cannot use both Select
and AttributesToGet
together in
* a single request, unless the value for Select
is SPECIFIC_ATTRIBUTES
. (This
* usage is equivalent to specifying AttributesToGet
without any value for Select
* .)
*
*
*
* If you use the ProjectionExpression
parameter, then the value for Select
can
* only be SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an error.
*
* @see Select
*/
public String selectAsString() {
return select;
}
/**
*
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ScanFilter in the Amazon DynamoDB Developer Guide.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return This is a legacy parameter. Use FilterExpression
instead. For more information, see ScanFilter in the Amazon DynamoDB Developer Guide.
*/
public Map scanFilter() {
return scanFilter;
}
/**
*
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #conditionalOperator} will return {@link ConditionalOperator#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #conditionalOperatorAsString}.
*
*
* @return This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
* @see ConditionalOperator
*/
public ConditionalOperator conditionalOperator() {
return ConditionalOperator.fromValue(conditionalOperator);
}
/**
*
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #conditionalOperator} will return {@link ConditionalOperator#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #conditionalOperatorAsString}.
*
*
* @return This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
* @see ConditionalOperator
*/
public String conditionalOperatorAsString() {
return conditionalOperator;
}
/**
*
* The primary key of the first item that this operation will evaluate. Use the value that was returned for
* LastEvaluatedKey
in the previous operation.
*
*
* The data type for ExclusiveStartKey
must be String, Number or Binary. No set data types are allowed.
*
*
* In a parallel scan, a Scan
request that includes ExclusiveStartKey
must specify the
* same segment whose previous Scan
returned the corresponding value of LastEvaluatedKey
.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return The primary key of the first item that this operation will evaluate. Use the value that was returned for
* LastEvaluatedKey
in the previous operation.
*
* The data type for ExclusiveStartKey
must be String, Number or Binary. No set data types are
* allowed.
*
*
* In a parallel scan, a Scan
request that includes ExclusiveStartKey
must specify
* the same segment whose previous Scan
returned the corresponding value of
* LastEvaluatedKey
.
*/
public Map exclusiveStartKey() {
return exclusiveStartKey;
}
/**
* Returns the value of the ReturnConsumedCapacity property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #returnConsumedCapacity} will return {@link ReturnConsumedCapacity#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #returnConsumedCapacityAsString}.
*
*
* @return The value of the ReturnConsumedCapacity property for this object.
* @see ReturnConsumedCapacity
*/
public ReturnConsumedCapacity returnConsumedCapacity() {
return ReturnConsumedCapacity.fromValue(returnConsumedCapacity);
}
/**
* Returns the value of the ReturnConsumedCapacity property for this object.
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #returnConsumedCapacity} will return {@link ReturnConsumedCapacity#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #returnConsumedCapacityAsString}.
*
*
* @return The value of the ReturnConsumedCapacity property for this object.
* @see ReturnConsumedCapacity
*/
public String returnConsumedCapacityAsString() {
return returnConsumedCapacity;
}
/**
*
* For a parallel Scan
request, TotalSegments
represents the total number of segments into
* which the Scan
operation will be divided. The value of TotalSegments
corresponds to the
* number of application workers that will perform the parallel scan. For example, if you want to use four
* application threads to scan a table or an index, specify a TotalSegments
value of 4.
*
*
* The value for TotalSegments
must be greater than or equal to 1, and less than or equal to 1000000.
* If you specify a TotalSegments
value of 1, the Scan
operation will be sequential rather
* than parallel.
*
*
* If you specify TotalSegments
, you must also specify Segment
.
*
*
* @return For a parallel Scan
request, TotalSegments
represents the total number of
* segments into which the Scan
operation will be divided. The value of
* TotalSegments
corresponds to the number of application workers that will perform the
* parallel scan. For example, if you want to use four application threads to scan a table or an index,
* specify a TotalSegments
value of 4.
*
* The value for TotalSegments
must be greater than or equal to 1, and less than or equal to
* 1000000. If you specify a TotalSegments
value of 1, the Scan
operation will be
* sequential rather than parallel.
*
*
* If you specify TotalSegments
, you must also specify Segment
.
*/
public Integer totalSegments() {
return totalSegments;
}
/**
*
* For a parallel Scan
request, Segment
identifies an individual segment to be scanned by
* an application worker.
*
*
* Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four application
* threads to scan a table or an index, then the first thread specifies a Segment
value of 0, the
* second thread specifies 1, and so on.
*
*
* The value of LastEvaluatedKey
returned from a parallel Scan
request must be used as
* ExclusiveStartKey
with the same segment ID in a subsequent Scan
operation.
*
*
* The value for Segment
must be greater than or equal to 0, and less than the value provided for
* TotalSegments
.
*
*
* If you provide Segment
, you must also provide TotalSegments
.
*
*
* @return For a parallel Scan
request, Segment
identifies an individual segment to be
* scanned by an application worker.
*
* Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four
* application threads to scan a table or an index, then the first thread specifies a Segment
* value of 0, the second thread specifies 1, and so on.
*
*
* The value of LastEvaluatedKey
returned from a parallel Scan
request must be
* used as ExclusiveStartKey
with the same segment ID in a subsequent Scan
* operation.
*
*
* The value for Segment
must be greater than or equal to 0, and less than the value provided
* for TotalSegments
.
*
*
* If you provide Segment
, you must also provide TotalSegments
.
*/
public Integer segment() {
return segment;
}
/**
*
* A string that identifies one or more attributes to retrieve from the specified table or index. 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, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
*
*
* @return A string that identifies one or more attributes to retrieve from the specified table or index. 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, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
*/
public String projectionExpression() {
return projectionExpression;
}
/**
*
* A string that contains conditions that DynamoDB applies after the Scan
operation, but before the
* data is returned to you. Items that do not satisfy the FilterExpression
criteria are not returned.
*
*
*
* A FilterExpression
is applied after the items have already been read; the process of filtering does
* not consume any additional read capacity units.
*
*
*
* For more information, see Filter
* Expressions in the Amazon DynamoDB Developer Guide.
*
*
* @return A string that contains conditions that DynamoDB applies after the Scan
operation, but before
* the data is returned to you. Items that do not satisfy the FilterExpression
criteria are not
* returned.
*
* A FilterExpression
is applied after the items have already been read; the process of
* filtering does not consume any additional read capacity units.
*
*
*
* For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide.
*/
public String filterExpression() {
return filterExpression;
}
/**
*
* One or more substitution tokens for attribute names in an expression. The following are some use cases for using
* ExpressionAttributeNames
:
*
*
* -
*
* To access an attribute whose name conflicts with a DynamoDB reserved word.
*
*
* -
*
* To create a placeholder for repeating occurrences of an attribute name in an expression.
*
*
* -
*
* To prevent special characters in an attribute name from being misinterpreted in an expression.
*
*
*
*
* Use the # character in an expression to dereference an attribute name. For example, consider the following
* attribute name:
*
*
* -
*
* Percentile
*
*
*
*
* The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For
* the complete list of reserved words, see Reserved Words in
* the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for
* ExpressionAttributeNames
:
*
*
* -
*
* {"#P":"Percentile"}
*
*
*
*
* You could then use this substitution in an expression, as in this example:
*
*
* -
*
* #P = :val
*
*
*
*
*
* Tokens that begin with the : character are expression attribute values, which are placeholders for
* the actual value at runtime.
*
*
*
* For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return One or more substitution tokens for attribute names in an expression. The following are some use cases
* for using ExpressionAttributeNames
:
*
* -
*
* To access an attribute whose name conflicts with a DynamoDB reserved word.
*
*
* -
*
* To create a placeholder for repeating occurrences of an attribute name in an expression.
*
*
* -
*
* To prevent special characters in an attribute name from being misinterpreted in an expression.
*
*
*
*
* Use the # character in an expression to dereference an attribute name. For example, consider the
* following attribute name:
*
*
* -
*
* Percentile
*
*
*
*
* The name of this attribute conflicts with a reserved word, so it cannot be used directly in an
* expression. (For the complete list of reserved words, see Reserved
* Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the
* following for ExpressionAttributeNames
:
*
*
* -
*
* {"#P":"Percentile"}
*
*
*
*
* You could then use this substitution in an expression, as in this example:
*
*
* -
*
* #P = :val
*
*
*
*
*
* Tokens that begin with the : character are expression attribute values, which are
* placeholders for the actual value at runtime.
*
*
*
* For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
*/
public Map expressionAttributeNames() {
return expressionAttributeNames;
}
/**
*
* One or more values that can be substituted in an expression.
*
*
* Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that
* you wanted to check whether the value of the ProductStatus attribute was one of the following:
*
*
* Available | Backordered | Discontinued
*
*
* You would first need to specify ExpressionAttributeValues
as follows:
*
*
* { ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }
*
*
* You could then use these values in an expression, such as this:
*
*
* ProductStatus IN (:avail, :back, :disc)
*
*
* For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return One or more values that can be substituted in an expression.
*
* Use the : (colon) character in an expression to dereference an attribute value. For example,
* suppose that you wanted to check whether the value of the ProductStatus attribute was one of the
* following:
*
*
* Available | Backordered | Discontinued
*
*
* You would first need to specify ExpressionAttributeValues
as follows:
*
*
* { ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }
*
*
* You could then use these values in an expression, such as this:
*
*
* ProductStatus IN (:avail, :back, :disc)
*
*
* For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide.
*/
public Map expressionAttributeValues() {
return expressionAttributeValues;
}
/**
*
* A Boolean value that determines the read consistency model during the scan:
*
*
* -
*
* If ConsistentRead
is false
, then the data returned from Scan
might not
* contain the results from other recently completed write operations (PutItem, UpdateItem or DeleteItem).
*
*
* -
*
* If ConsistentRead
is true
, then all of the write operations that completed before the
* Scan
began are guaranteed to be contained in the Scan
response.
*
*
*
*
* The default setting for ConsistentRead
is false
.
*
*
* The ConsistentRead
parameter is not supported on global secondary indexes. If you scan a global
* secondary index with ConsistentRead
set to true, you will receive a ValidationException
* .
*
*
* @return A Boolean value that determines the read consistency model during the scan:
*
* -
*
* If ConsistentRead
is false
, then the data returned from Scan
might
* not contain the results from other recently completed write operations (PutItem, UpdateItem or
* DeleteItem).
*
*
* -
*
* If ConsistentRead
is true
, then all of the write operations that completed
* before the Scan
began are guaranteed to be contained in the Scan
response.
*
*
*
*
* The default setting for ConsistentRead
is false
.
*
*
* The ConsistentRead
parameter is not supported on global secondary indexes. If you scan a
* global secondary index with ConsistentRead
set to true, you will receive a
* ValidationException
.
*/
public Boolean consistentRead() {
return consistentRead;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(tableName());
hashCode = 31 * hashCode + Objects.hashCode(indexName());
hashCode = 31 * hashCode + Objects.hashCode(attributesToGet());
hashCode = 31 * hashCode + Objects.hashCode(limit());
hashCode = 31 * hashCode + Objects.hashCode(selectAsString());
hashCode = 31 * hashCode + Objects.hashCode(scanFilter());
hashCode = 31 * hashCode + Objects.hashCode(conditionalOperatorAsString());
hashCode = 31 * hashCode + Objects.hashCode(exclusiveStartKey());
hashCode = 31 * hashCode + Objects.hashCode(returnConsumedCapacityAsString());
hashCode = 31 * hashCode + Objects.hashCode(totalSegments());
hashCode = 31 * hashCode + Objects.hashCode(segment());
hashCode = 31 * hashCode + Objects.hashCode(projectionExpression());
hashCode = 31 * hashCode + Objects.hashCode(filterExpression());
hashCode = 31 * hashCode + Objects.hashCode(expressionAttributeNames());
hashCode = 31 * hashCode + Objects.hashCode(expressionAttributeValues());
hashCode = 31 * hashCode + Objects.hashCode(consistentRead());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ScanRequest)) {
return false;
}
ScanRequest other = (ScanRequest) obj;
return Objects.equals(tableName(), other.tableName()) && Objects.equals(indexName(), other.indexName())
&& Objects.equals(attributesToGet(), other.attributesToGet()) && Objects.equals(limit(), other.limit())
&& Objects.equals(selectAsString(), other.selectAsString()) && Objects.equals(scanFilter(), other.scanFilter())
&& Objects.equals(conditionalOperatorAsString(), other.conditionalOperatorAsString())
&& Objects.equals(exclusiveStartKey(), other.exclusiveStartKey())
&& Objects.equals(returnConsumedCapacityAsString(), other.returnConsumedCapacityAsString())
&& Objects.equals(totalSegments(), other.totalSegments()) && Objects.equals(segment(), other.segment())
&& Objects.equals(projectionExpression(), other.projectionExpression())
&& Objects.equals(filterExpression(), other.filterExpression())
&& Objects.equals(expressionAttributeNames(), other.expressionAttributeNames())
&& Objects.equals(expressionAttributeValues(), other.expressionAttributeValues())
&& Objects.equals(consistentRead(), other.consistentRead());
}
@Override
public String toString() {
return ToString.builder("ScanRequest").add("TableName", tableName()).add("IndexName", indexName())
.add("AttributesToGet", attributesToGet()).add("Limit", limit()).add("Select", selectAsString())
.add("ScanFilter", scanFilter()).add("ConditionalOperator", conditionalOperatorAsString())
.add("ExclusiveStartKey", exclusiveStartKey()).add("ReturnConsumedCapacity", returnConsumedCapacityAsString())
.add("TotalSegments", totalSegments()).add("Segment", segment())
.add("ProjectionExpression", projectionExpression()).add("FilterExpression", filterExpression())
.add("ExpressionAttributeNames", expressionAttributeNames())
.add("ExpressionAttributeValues", expressionAttributeValues()).add("ConsistentRead", consistentRead()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TableName":
return Optional.ofNullable(clazz.cast(tableName()));
case "IndexName":
return Optional.ofNullable(clazz.cast(indexName()));
case "AttributesToGet":
return Optional.ofNullable(clazz.cast(attributesToGet()));
case "Limit":
return Optional.ofNullable(clazz.cast(limit()));
case "Select":
return Optional.ofNullable(clazz.cast(selectAsString()));
case "ScanFilter":
return Optional.ofNullable(clazz.cast(scanFilter()));
case "ConditionalOperator":
return Optional.ofNullable(clazz.cast(conditionalOperatorAsString()));
case "ExclusiveStartKey":
return Optional.ofNullable(clazz.cast(exclusiveStartKey()));
case "ReturnConsumedCapacity":
return Optional.ofNullable(clazz.cast(returnConsumedCapacityAsString()));
case "TotalSegments":
return Optional.ofNullable(clazz.cast(totalSegments()));
case "Segment":
return Optional.ofNullable(clazz.cast(segment()));
case "ProjectionExpression":
return Optional.ofNullable(clazz.cast(projectionExpression()));
case "FilterExpression":
return Optional.ofNullable(clazz.cast(filterExpression()));
case "ExpressionAttributeNames":
return Optional.ofNullable(clazz.cast(expressionAttributeNames()));
case "ExpressionAttributeValues":
return Optional.ofNullable(clazz.cast(expressionAttributeValues()));
case "ConsistentRead":
return Optional.ofNullable(clazz.cast(consistentRead()));
default:
return Optional.empty();
}
}
public interface Builder extends DynamoDbRequest.Builder, CopyableBuilder {
/**
*
* The name of the table containing the requested items; or, if you provide IndexName
, the name of
* the table to which that index belongs.
*
*
* @param tableName
* The name of the table containing the requested items; or, if you provide IndexName
, the
* name of the table to which that index belongs.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tableName(String tableName);
/**
*
* The name of a secondary index to scan. This index can be any local secondary index or global secondary index.
* Note that if you use the IndexName
parameter, you must also provide TableName
.
*
*
* @param indexName
* The name of a secondary index to scan. This index can be any local secondary index or global secondary
* index. Note that if you use the IndexName
parameter, you must also provide
* TableName
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder indexName(String indexName);
/**
*
* This is a legacy parameter. Use ProjectionExpression
instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
*
*
* @param attributesToGet
* This is a legacy parameter. Use ProjectionExpression
instead. For more information, see
* AttributesToGet in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder attributesToGet(Collection attributesToGet);
/**
*
* This is a legacy parameter. Use ProjectionExpression
instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
*
*
* @param attributesToGet
* This is a legacy parameter. Use ProjectionExpression
instead. For more information, see
* AttributesToGet in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder attributesToGet(String... attributesToGet);
/**
*
* The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes
* the number of items up to the limit while processing the results, it stops the operation and returns the
* matching values up to that point, and a key in LastEvaluatedKey
to apply in a subsequent
* operation, so that you can pick up where you left off. Also, if the processed data set size exceeds 1 MB
* before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit,
* and a key in LastEvaluatedKey
to apply in a subsequent operation to continue the operation. For
* more information, see Query and Scan
* in the Amazon DynamoDB Developer Guide.
*
*
* @param limit
* The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB
* processes the number of items up to the limit while processing the results, it stops the operation and
* returns the matching values up to that point, and a key in LastEvaluatedKey
to apply in a
* subsequent operation, so that you can pick up where you left off. Also, if the processed data set size
* exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching
* values up to the limit, and a key in LastEvaluatedKey
to apply in a subsequent operation
* to continue the operation. For more information, see Query and
* Scan in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder limit(Integer limit);
/**
*
* 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.
*
*
* -
*
* ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If you
* query a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item
* from the parent table. If the index is configured to project all item attributes, then all of the data can be
* obtained from the local secondary index, and no fetching is required.
*
*
* -
*
* ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes that
* have been projected into the index. If the index is configured to project all attributes, this return value
* is equivalent to specifying ALL_ATTRIBUTES
.
*
*
* -
*
* COUNT
- Returns the number of matching items, rather than the matching items themselves.
*
*
* -
*
* SPECIFIC_ATTRIBUTES
- Returns only the attributes listed in AttributesToGet
. This
* return value is equivalent to specifying AttributesToGet
without specifying any value for
* Select
.
*
*
* If you query or scan a local secondary index and request only attributes that are projected into that index,
* the operation will read only the index and not the table. If any of the requested attributes are not
* projected into the local secondary index, DynamoDB will fetch each of these attributes from the parent table.
* This extra fetching incurs additional throughput cost and latency.
*
*
* If you query or scan a global secondary index, you can only request attributes that are projected into the
* index. Global secondary index queries cannot fetch attributes from the parent table.
*
*
*
*
* If neither Select
nor AttributesToGet
are specified, DynamoDB defaults to
* ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when accessing
* an index. You cannot use both Select
and AttributesToGet
together in a single
* request, unless the value for Select
is SPECIFIC_ATTRIBUTES
. (This usage is
* equivalent to specifying AttributesToGet
without any value for Select
.)
*
*
*
* If you use the ProjectionExpression
parameter, then the value for Select
can only
* be SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an error.
*
*
*
* @param 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.
*
* -
*
* ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If
* you query a local secondary index, then for each matching item in the index DynamoDB will fetch the
* entire item from the parent table. If the index is configured to project all item attributes, then all
* of the data can be obtained from the local secondary index, and no fetching is required.
*
*
* -
*
* ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes
* that have been projected into the index. If the index is configured to project all attributes, this
* return value is equivalent to specifying ALL_ATTRIBUTES
.
*
*
* -
*
* COUNT
- Returns the number of matching items, rather than the matching items themselves.
*
*
* -
*
* SPECIFIC_ATTRIBUTES
- Returns only the attributes listed in AttributesToGet
.
* This return value is equivalent to specifying AttributesToGet
without specifying any
* value for Select
.
*
*
* If you query or scan a local secondary index and request only attributes that are projected into that
* index, the operation will read only the index and not the table. If any of the requested attributes
* are not projected into the local secondary index, DynamoDB will fetch each of these attributes from
* the parent table. This extra fetching incurs additional throughput cost and latency.
*
*
* If you query or scan a global secondary index, you can only request attributes that are projected into
* the index. Global secondary index queries cannot fetch attributes from the parent table.
*
*
*
*
* If neither Select
nor AttributesToGet
are specified, DynamoDB defaults to
* ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when
* accessing an index. You cannot use both Select
and AttributesToGet
together
* in a single request, unless the value for Select
is SPECIFIC_ATTRIBUTES
.
* (This usage is equivalent to specifying AttributesToGet
without any value for
* Select
.)
*
*
*
* If you use the ProjectionExpression
parameter, then the value for Select
can
* only be SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an
* error.
*
* @see Select
* @return Returns a reference to this object so that method calls can be chained together.
* @see Select
*/
Builder select(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.
*
*
* -
*
* ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If you
* query a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item
* from the parent table. If the index is configured to project all item attributes, then all of the data can be
* obtained from the local secondary index, and no fetching is required.
*
*
* -
*
* ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes that
* have been projected into the index. If the index is configured to project all attributes, this return value
* is equivalent to specifying ALL_ATTRIBUTES
.
*
*
* -
*
* COUNT
- Returns the number of matching items, rather than the matching items themselves.
*
*
* -
*
* SPECIFIC_ATTRIBUTES
- Returns only the attributes listed in AttributesToGet
. This
* return value is equivalent to specifying AttributesToGet
without specifying any value for
* Select
.
*
*
* If you query or scan a local secondary index and request only attributes that are projected into that index,
* the operation will read only the index and not the table. If any of the requested attributes are not
* projected into the local secondary index, DynamoDB will fetch each of these attributes from the parent table.
* This extra fetching incurs additional throughput cost and latency.
*
*
* If you query or scan a global secondary index, you can only request attributes that are projected into the
* index. Global secondary index queries cannot fetch attributes from the parent table.
*
*
*
*
* If neither Select
nor AttributesToGet
are specified, DynamoDB defaults to
* ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when accessing
* an index. You cannot use both Select
and AttributesToGet
together in a single
* request, unless the value for Select
is SPECIFIC_ATTRIBUTES
. (This usage is
* equivalent to specifying AttributesToGet
without any value for Select
.)
*
*
*
* If you use the ProjectionExpression
parameter, then the value for Select
can only
* be SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an error.
*
*
*
* @param 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.
*
* -
*
* ALL_ATTRIBUTES
- Returns all of the item attributes from the specified table or index. If
* you query a local secondary index, then for each matching item in the index DynamoDB will fetch the
* entire item from the parent table. If the index is configured to project all item attributes, then all
* of the data can be obtained from the local secondary index, and no fetching is required.
*
*
* -
*
* ALL_PROJECTED_ATTRIBUTES
- Allowed only when querying an index. Retrieves all attributes
* that have been projected into the index. If the index is configured to project all attributes, this
* return value is equivalent to specifying ALL_ATTRIBUTES
.
*
*
* -
*
* COUNT
- Returns the number of matching items, rather than the matching items themselves.
*
*
* -
*
* SPECIFIC_ATTRIBUTES
- Returns only the attributes listed in AttributesToGet
.
* This return value is equivalent to specifying AttributesToGet
without specifying any
* value for Select
.
*
*
* If you query or scan a local secondary index and request only attributes that are projected into that
* index, the operation will read only the index and not the table. If any of the requested attributes
* are not projected into the local secondary index, DynamoDB will fetch each of these attributes from
* the parent table. This extra fetching incurs additional throughput cost and latency.
*
*
* If you query or scan a global secondary index, you can only request attributes that are projected into
* the index. Global secondary index queries cannot fetch attributes from the parent table.
*
*
*
*
* If neither Select
nor AttributesToGet
are specified, DynamoDB defaults to
* ALL_ATTRIBUTES
when accessing a table, and ALL_PROJECTED_ATTRIBUTES
when
* accessing an index. You cannot use both Select
and AttributesToGet
together
* in a single request, unless the value for Select
is SPECIFIC_ATTRIBUTES
.
* (This usage is equivalent to specifying AttributesToGet
without any value for
* Select
.)
*
*
*
* If you use the ProjectionExpression
parameter, then the value for Select
can
* only be SPECIFIC_ATTRIBUTES
. Any other value for Select
will return an
* error.
*
* @see Select
* @return Returns a reference to this object so that method calls can be chained together.
* @see Select
*/
Builder select(Select select);
/**
*
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ScanFilter in the Amazon DynamoDB Developer Guide.
*
*
* @param scanFilter
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ScanFilter in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder scanFilter(Map scanFilter);
/**
*
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
*
*
* @param conditionalOperator
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
* @see ConditionalOperator
* @return Returns a reference to this object so that method calls can be chained together.
* @see ConditionalOperator
*/
Builder conditionalOperator(String conditionalOperator);
/**
*
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
*
*
* @param conditionalOperator
* This is a legacy parameter. Use FilterExpression
instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide.
* @see ConditionalOperator
* @return Returns a reference to this object so that method calls can be chained together.
* @see ConditionalOperator
*/
Builder conditionalOperator(ConditionalOperator conditionalOperator);
/**
*
* The primary key of the first item that this operation will evaluate. Use the value that was returned for
* LastEvaluatedKey
in the previous operation.
*
*
* The data type for ExclusiveStartKey
must be String, Number or Binary. No set data types are
* allowed.
*
*
* In a parallel scan, a Scan
request that includes ExclusiveStartKey
must specify the
* same segment whose previous Scan
returned the corresponding value of
* LastEvaluatedKey
.
*
*
* @param exclusiveStartKey
* The primary key of the first item that this operation will evaluate. Use the value that was returned
* for LastEvaluatedKey
in the previous operation.
*
* The data type for ExclusiveStartKey
must be String, Number or Binary. No set data types
* are allowed.
*
*
* In a parallel scan, a Scan
request that includes ExclusiveStartKey
must
* specify the same segment whose previous Scan
returned the corresponding value of
* LastEvaluatedKey
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder exclusiveStartKey(Map exclusiveStartKey);
/**
* Sets the value of the ReturnConsumedCapacity property for this object.
*
* @param returnConsumedCapacity
* The new value for the ReturnConsumedCapacity property for this object.
* @see ReturnConsumedCapacity
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReturnConsumedCapacity
*/
Builder returnConsumedCapacity(String returnConsumedCapacity);
/**
* Sets the value of the ReturnConsumedCapacity property for this object.
*
* @param returnConsumedCapacity
* The new value for the ReturnConsumedCapacity property for this object.
* @see ReturnConsumedCapacity
* @return Returns a reference to this object so that method calls can be chained together.
* @see ReturnConsumedCapacity
*/
Builder returnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity);
/**
*
* For a parallel Scan
request, TotalSegments
represents the total number of segments
* into which the Scan
operation will be divided. The value of TotalSegments
* corresponds to the number of application workers that will perform the parallel scan. For example, if you
* want to use four application threads to scan a table or an index, specify a TotalSegments
value
* of 4.
*
*
* The value for TotalSegments
must be greater than or equal to 1, and less than or equal to
* 1000000. If you specify a TotalSegments
value of 1, the Scan
operation will be
* sequential rather than parallel.
*
*
* If you specify TotalSegments
, you must also specify Segment
.
*
*
* @param totalSegments
* For a parallel Scan
request, TotalSegments
represents the total number of
* segments into which the Scan
operation will be divided. The value of
* TotalSegments
corresponds to the number of application workers that will perform the
* parallel scan. For example, if you want to use four application threads to scan a table or an index,
* specify a TotalSegments
value of 4.
*
* The value for TotalSegments
must be greater than or equal to 1, and less than or equal to
* 1000000. If you specify a TotalSegments
value of 1, the Scan
operation will
* be sequential rather than parallel.
*
*
* If you specify TotalSegments
, you must also specify Segment
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder totalSegments(Integer totalSegments);
/**
*
* For a parallel Scan
request, Segment
identifies an individual segment to be scanned
* by an application worker.
*
*
* Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four
* application threads to scan a table or an index, then the first thread specifies a Segment
value
* of 0, the second thread specifies 1, and so on.
*
*
* The value of LastEvaluatedKey
returned from a parallel Scan
request must be used as
* ExclusiveStartKey
with the same segment ID in a subsequent Scan
operation.
*
*
* The value for Segment
must be greater than or equal to 0, and less than the value provided for
* TotalSegments
.
*
*
* If you provide Segment
, you must also provide TotalSegments
.
*
*
* @param segment
* For a parallel Scan
request, Segment
identifies an individual segment to be
* scanned by an application worker.
*
* Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four
* application threads to scan a table or an index, then the first thread specifies a
* Segment
value of 0, the second thread specifies 1, and so on.
*
*
* The value of LastEvaluatedKey
returned from a parallel Scan
request must be
* used as ExclusiveStartKey
with the same segment ID in a subsequent Scan
* operation.
*
*
* The value for Segment
must be greater than or equal to 0, and less than the value
* provided for TotalSegments
.
*
*
* If you provide Segment
, you must also provide TotalSegments
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder segment(Integer segment);
/**
*
* A string that identifies one or more attributes to retrieve from the specified table or index. 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, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
*
*
* @param projectionExpression
* A string that identifies one or more attributes to retrieve from the specified table or index. 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, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder projectionExpression(String projectionExpression);
/**
*
* A string that contains conditions that DynamoDB applies after the Scan
operation, but before the
* data is returned to you. Items that do not satisfy the FilterExpression
criteria are not
* returned.
*
*
*
* A FilterExpression
is applied after the items have already been read; the process of filtering
* does not consume any additional read capacity units.
*
*
*
* For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide.
*
*
* @param filterExpression
* A string that contains conditions that DynamoDB applies after the Scan
operation, but
* before the data is returned to you. Items that do not satisfy the FilterExpression
* criteria are not returned.
*
* A FilterExpression
is applied after the items have already been read; the process of
* filtering does not consume any additional read capacity units.
*
*
*
* For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder filterExpression(String filterExpression);
/**
*
* One or more substitution tokens for attribute names in an expression. The following are some use cases for
* using ExpressionAttributeNames
:
*
*
* -
*
* To access an attribute whose name conflicts with a DynamoDB reserved word.
*
*
* -
*
* To create a placeholder for repeating occurrences of an attribute name in an expression.
*
*
* -
*
* To prevent special characters in an attribute name from being misinterpreted in an expression.
*
*
*
*
* Use the # character in an expression to dereference an attribute name. For example, consider the
* following attribute name:
*
*
* -
*
* Percentile
*
*
*
*
* The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression.
* (For the complete list of reserved words, see Reserved Words
* in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for
* ExpressionAttributeNames
:
*
*
* -
*
* {"#P":"Percentile"}
*
*
*
*
* You could then use this substitution in an expression, as in this example:
*
*
* -
*
* #P = :val
*
*
*
*
*
* Tokens that begin with the : character are expression attribute values, which are placeholders
* for the actual value at runtime.
*
*
*
* For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
*
*
* @param expressionAttributeNames
* One or more substitution tokens for attribute names in an expression. The following are some use cases
* for using ExpressionAttributeNames
:
*
* -
*
* To access an attribute whose name conflicts with a DynamoDB reserved word.
*
*
* -
*
* To create a placeholder for repeating occurrences of an attribute name in an expression.
*
*
* -
*
* To prevent special characters in an attribute name from being misinterpreted in an expression.
*
*
*
*
* Use the # character in an expression to dereference an attribute name. For example, consider
* the following attribute name:
*
*
* -
*
* Percentile
*
*
*
*
* The name of this attribute conflicts with a reserved word, so it cannot be used directly in an
* expression. (For the complete list of reserved words, see Reserved
* Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the
* following for ExpressionAttributeNames
:
*
*
* -
*
* {"#P":"Percentile"}
*
*
*
*
* You could then use this substitution in an expression, as in this example:
*
*
* -
*
* #P = :val
*
*
*
*
*
* Tokens that begin with the : character are expression attribute values, which are
* placeholders for the actual value at runtime.
*
*
*
* For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder expressionAttributeNames(Map expressionAttributeNames);
/**
*
* One or more values that can be substituted in an expression.
*
*
* Use the : (colon) character in an expression to dereference an attribute value. For example, suppose
* that you wanted to check whether the value of the ProductStatus attribute was one of the following:
*
*
* Available | Backordered | Discontinued
*
*
* You would first need to specify ExpressionAttributeValues
as follows:
*
*
* { ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }
*
*
* You could then use these values in an expression, such as this:
*
*
* ProductStatus IN (:avail, :back, :disc)
*
*
* For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide.
*
*
* @param expressionAttributeValues
* One or more values that can be substituted in an expression.
*
* Use the : (colon) character in an expression to dereference an attribute value. For example,
* suppose that you wanted to check whether the value of the ProductStatus attribute was one of
* the following:
*
*
* Available | Backordered | Discontinued
*
*
* You would first need to specify ExpressionAttributeValues
as follows:
*
*
* { ":avail":{"S":"Available"}, ":back":{"S":"Backordered"}, ":disc":{"S":"Discontinued"} }
*
*
* You could then use these values in an expression, such as this:
*
*
* ProductStatus IN (:avail, :back, :disc)
*
*
* For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder expressionAttributeValues(Map expressionAttributeValues);
/**
*
* A Boolean value that determines the read consistency model during the scan:
*
*
* -
*
* If ConsistentRead
is false
, then the data returned from Scan
might not
* contain the results from other recently completed write operations (PutItem, UpdateItem or DeleteItem).
*
*
* -
*
* If ConsistentRead
is true
, then all of the write operations that completed before
* the Scan
began are guaranteed to be contained in the Scan
response.
*
*
*
*
* The default setting for ConsistentRead
is false
.
*
*
* The ConsistentRead
parameter is not supported on global secondary indexes. If you scan a global
* secondary index with ConsistentRead
set to true, you will receive a
* ValidationException
.
*
*
* @param consistentRead
* A Boolean value that determines the read consistency model during the scan:
*
* -
*
* If ConsistentRead
is false
, then the data returned from Scan
* might not contain the results from other recently completed write operations (PutItem, UpdateItem or
* DeleteItem).
*
*
* -
*
* If ConsistentRead
is true
, then all of the write operations that completed
* before the Scan
began are guaranteed to be contained in the Scan
response.
*
*
*
*
* The default setting for ConsistentRead
is false
.
*
*
* The ConsistentRead
parameter is not supported on global secondary indexes. If you scan a
* global secondary index with ConsistentRead
set to true, you will receive a
* ValidationException
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder consistentRead(Boolean consistentRead);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends DynamoDbRequest.BuilderImpl implements Builder {
private String tableName;
private String indexName;
private List attributesToGet = DefaultSdkAutoConstructList.getInstance();
private Integer limit;
private String select;
private Map scanFilter = DefaultSdkAutoConstructMap.getInstance();
private String conditionalOperator;
private Map exclusiveStartKey = DefaultSdkAutoConstructMap.getInstance();
private String returnConsumedCapacity;
private Integer totalSegments;
private Integer segment;
private String projectionExpression;
private String filterExpression;
private Map expressionAttributeNames = DefaultSdkAutoConstructMap.getInstance();
private Map expressionAttributeValues = DefaultSdkAutoConstructMap.getInstance();
private Boolean consistentRead;
private BuilderImpl() {
}
private BuilderImpl(ScanRequest model) {
super(model);
tableName(model.tableName);
indexName(model.indexName);
attributesToGet(model.attributesToGet);
limit(model.limit);
select(model.select);
scanFilter(model.scanFilter);
conditionalOperator(model.conditionalOperator);
exclusiveStartKey(model.exclusiveStartKey);
returnConsumedCapacity(model.returnConsumedCapacity);
totalSegments(model.totalSegments);
segment(model.segment);
projectionExpression(model.projectionExpression);
filterExpression(model.filterExpression);
expressionAttributeNames(model.expressionAttributeNames);
expressionAttributeValues(model.expressionAttributeValues);
consistentRead(model.consistentRead);
}
public final String getTableName() {
return tableName;
}
@Override
public final Builder tableName(String tableName) {
this.tableName = tableName;
return this;
}
public final void setTableName(String tableName) {
this.tableName = tableName;
}
public final String getIndexName() {
return indexName;
}
@Override
public final Builder indexName(String indexName) {
this.indexName = indexName;
return this;
}
public final void setIndexName(String indexName) {
this.indexName = indexName;
}
public final Collection getAttributesToGet() {
return attributesToGet;
}
@Override
public final Builder attributesToGet(Collection attributesToGet) {
this.attributesToGet = AttributeNameListCopier.copy(attributesToGet);
return this;
}
@Override
@SafeVarargs
public final Builder attributesToGet(String... attributesToGet) {
attributesToGet(Arrays.asList(attributesToGet));
return this;
}
public final void setAttributesToGet(Collection attributesToGet) {
this.attributesToGet = AttributeNameListCopier.copy(attributesToGet);
}
public final Integer getLimit() {
return limit;
}
@Override
public final Builder limit(Integer limit) {
this.limit = limit;
return this;
}
public final void setLimit(Integer limit) {
this.limit = limit;
}
public final String getSelect() {
return select;
}
@Override
public final Builder select(String select) {
this.select = select;
return this;
}
@Override
public final Builder select(Select select) {
this.select(select.toString());
return this;
}
public final void setSelect(String select) {
this.select = select;
}
public final Map getScanFilter() {
return scanFilter != null ? CollectionUtils.mapValues(scanFilter, Condition::toBuilder) : null;
}
@Override
public final Builder scanFilter(Map scanFilter) {
this.scanFilter = FilterConditionMapCopier.copy(scanFilter);
return this;
}
public final void setScanFilter(Map scanFilter) {
this.scanFilter = FilterConditionMapCopier.copyFromBuilder(scanFilter);
}
public final String getConditionalOperator() {
return conditionalOperator;
}
@Override
public final Builder conditionalOperator(String conditionalOperator) {
this.conditionalOperator = conditionalOperator;
return this;
}
@Override
public final Builder conditionalOperator(ConditionalOperator conditionalOperator) {
this.conditionalOperator(conditionalOperator.toString());
return this;
}
public final void setConditionalOperator(String conditionalOperator) {
this.conditionalOperator = conditionalOperator;
}
public final Map getExclusiveStartKey() {
return exclusiveStartKey != null ? CollectionUtils.mapValues(exclusiveStartKey, AttributeValue::toBuilder) : null;
}
@Override
public final Builder exclusiveStartKey(Map exclusiveStartKey) {
this.exclusiveStartKey = KeyCopier.copy(exclusiveStartKey);
return this;
}
public final void setExclusiveStartKey(Map exclusiveStartKey) {
this.exclusiveStartKey = KeyCopier.copyFromBuilder(exclusiveStartKey);
}
public final String getReturnConsumedCapacity() {
return returnConsumedCapacity;
}
@Override
public final Builder returnConsumedCapacity(String returnConsumedCapacity) {
this.returnConsumedCapacity = returnConsumedCapacity;
return this;
}
@Override
public final Builder returnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity) {
this.returnConsumedCapacity(returnConsumedCapacity.toString());
return this;
}
public final void setReturnConsumedCapacity(String returnConsumedCapacity) {
this.returnConsumedCapacity = returnConsumedCapacity;
}
public final Integer getTotalSegments() {
return totalSegments;
}
@Override
public final Builder totalSegments(Integer totalSegments) {
this.totalSegments = totalSegments;
return this;
}
public final void setTotalSegments(Integer totalSegments) {
this.totalSegments = totalSegments;
}
public final Integer getSegment() {
return segment;
}
@Override
public final Builder segment(Integer segment) {
this.segment = segment;
return this;
}
public final void setSegment(Integer segment) {
this.segment = segment;
}
public final String getProjectionExpression() {
return projectionExpression;
}
@Override
public final Builder projectionExpression(String projectionExpression) {
this.projectionExpression = projectionExpression;
return this;
}
public final void setProjectionExpression(String projectionExpression) {
this.projectionExpression = projectionExpression;
}
public final String getFilterExpression() {
return filterExpression;
}
@Override
public final Builder filterExpression(String filterExpression) {
this.filterExpression = filterExpression;
return this;
}
public final void setFilterExpression(String filterExpression) {
this.filterExpression = filterExpression;
}
public final Map getExpressionAttributeNames() {
return expressionAttributeNames;
}
@Override
public final Builder expressionAttributeNames(Map expressionAttributeNames) {
this.expressionAttributeNames = ExpressionAttributeNameMapCopier.copy(expressionAttributeNames);
return this;
}
public final void setExpressionAttributeNames(Map expressionAttributeNames) {
this.expressionAttributeNames = ExpressionAttributeNameMapCopier.copy(expressionAttributeNames);
}
public final Map getExpressionAttributeValues() {
return expressionAttributeValues != null ? CollectionUtils.mapValues(expressionAttributeValues,
AttributeValue::toBuilder) : null;
}
@Override
public final Builder expressionAttributeValues(Map expressionAttributeValues) {
this.expressionAttributeValues = ExpressionAttributeValueMapCopier.copy(expressionAttributeValues);
return this;
}
public final void setExpressionAttributeValues(Map expressionAttributeValues) {
this.expressionAttributeValues = ExpressionAttributeValueMapCopier.copyFromBuilder(expressionAttributeValues);
}
public final Boolean getConsistentRead() {
return consistentRead;
}
@Override
public final Builder consistentRead(Boolean consistentRead) {
this.consistentRead = consistentRead;
return this;
}
public final void setConsistentRead(Boolean consistentRead) {
this.consistentRead = consistentRead;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public ScanRequest build() {
return new ScanRequest(this);
}
}
}