All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.dynamodb.model.ScanRequest Maven / Gradle / Ivy

Go to download

The Amazon Web Services SDK for Java provides Java APIs for building software on AWS' cost-effective, scalable, and reliable infrastructure products. The AWS Java SDK allows developers to code against APIs for all of Amazon's infrastructure web services (Amazon S3, Amazon EC2, Amazon SQS, Amazon Relational Database Service, Amazon AutoScaling, etc).

The newest version!
/*
 * Copyright 2010-2014 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 com.amazonaws.services.dynamodb.model;
import com.amazonaws.AmazonWebServiceRequest;
import java.io.Serializable;

/**
 * Container for the parameters to the {@link com.amazonaws.services.dynamodb.AmazonDynamoDB#scan(ScanRequest) Scan operation}.
 * 

* Retrieves one or more items and its attributes by performing a full scan of a table. *

*

* Provide a ScanFilter to get more specific results. *

* * @see com.amazonaws.services.dynamodb.AmazonDynamoDB#scan(ScanRequest) * * @deprecated Use {@link com.amazonaws.services.dynamodbv2.model.ScanRequest} instead. */ @Deprecated public class ScanRequest extends AmazonWebServiceRequest implements Serializable { /** * The name of the table in which you want to scan. Allowed characters * are a-z, A-Z, 0-9, * _ (underscore), - (hyphen) and * . (period). *

* Constraints:
* Length: 3 - 255
* Pattern: [a-zA-Z0-9_.-]+
*/ private String tableName; /** * List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. *

* Constraints:
* Length: 1 -
*/ private java.util.List attributesToGet; /** * The maximum number of items to return. If Amazon DynamoDB hits this * limit while scanning the table, it stops the scan and returns the * matching values up to the limit, and a LastEvaluatedKey * to apply in a subsequent operation to continue the scan. Also, if the * scanned data set size exceeds 1 MB before Amazon DynamoDB hits this * limit, it stops the scan and returns the matching values up to the * limit, and a LastEvaluatedKey to apply in a subsequent * operation to continue the scan. *

* Constraints:
* Range: 1 -
*/ private Integer limit; /** * If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. */ private Boolean count; /** * Evaluates the scan results and returns only the desired values. */ private java.util.Map scanFilter; /** * Primary key of the item from which to continue an earlier scan. An * earlier scan might provide this value if that scan operation was * interrupted before scanning the entire table; either because of the * result set size or the Limit parameter. The * LastEvaluatedKey can be passed back in a new scan request * to continue the operation from that point. */ private Key exclusiveStartKey; /** * Default constructor for a new ScanRequest object. Callers should use the * setter or fluent setter (with...) methods to initialize this object after creating it. */ public ScanRequest() {} /** * Constructs a new ScanRequest object. * Callers should use the setter or fluent setter (with...) methods to * initialize any additional object members. * * @param tableName The name of the table in which you want to scan. * Allowed characters are a-z, A-Z, * 0-9, _ (underscore), - (hyphen) * and . (period). */ public ScanRequest(String tableName) { this.tableName = tableName; } /** * The name of the table in which you want to scan. Allowed characters * are a-z, A-Z, 0-9, * _ (underscore), - (hyphen) and * . (period). *

* Constraints:
* Length: 3 - 255
* Pattern: [a-zA-Z0-9_.-]+
* * @return The name of the table in which you want to scan. Allowed characters * are a-z, A-Z, 0-9, * _ (underscore), - (hyphen) and * . (period). */ public String getTableName() { return tableName; } /** * The name of the table in which you want to scan. Allowed characters * are a-z, A-Z, 0-9, * _ (underscore), - (hyphen) and * . (period). *

* Constraints:
* Length: 3 - 255
* Pattern: [a-zA-Z0-9_.-]+
* * @param tableName The name of the table in which you want to scan. Allowed characters * are a-z, A-Z, 0-9, * _ (underscore), - (hyphen) and * . (period). */ public void setTableName(String tableName) { this.tableName = tableName; } /** * The name of the table in which you want to scan. Allowed characters * are a-z, A-Z, 0-9, * _ (underscore), - (hyphen) and * . (period). *

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

* Constraints:
* Length: 3 - 255
* Pattern: [a-zA-Z0-9_.-]+
* * @param tableName The name of the table in which you want to scan. Allowed characters * are a-z, A-Z, 0-9, * _ (underscore), - (hyphen) and * . (period). * * @return A reference to this updated object so that method calls can be chained * together. */ public ScanRequest withTableName(String tableName) { this.tableName = tableName; return this; } /** * List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. *

* Constraints:
* Length: 1 -
* * @return List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. */ public java.util.List getAttributesToGet() { return attributesToGet; } /** * List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. *

* Constraints:
* Length: 1 -
* * @param attributesToGet List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. */ public void setAttributesToGet(java.util.Collection attributesToGet) { if (attributesToGet == null) { this.attributesToGet = null; return; } java.util.List attributesToGetCopy = new java.util.ArrayList(attributesToGet.size()); attributesToGetCopy.addAll(attributesToGet); this.attributesToGet = attributesToGetCopy; } /** * List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. *

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

* Constraints:
* Length: 1 -
* * @param attributesToGet List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. * * @return A reference to this updated object so that method calls can be chained * together. */ public ScanRequest withAttributesToGet(String... attributesToGet) { if (getAttributesToGet() == null) setAttributesToGet(new java.util.ArrayList(attributesToGet.length)); for (String value : attributesToGet) { getAttributesToGet().add(value); } return this; } /** * List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. *

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

* Constraints:
* Length: 1 -
* * @param attributesToGet List of Attribute names. If attribute names are not * specified then all attributes will be returned. If some attributes are * not found, they will not appear in the result. * * @return A reference to this updated object so that method calls can be chained * together. */ public ScanRequest withAttributesToGet(java.util.Collection attributesToGet) { if (attributesToGet == null) { this.attributesToGet = null; } else { java.util.List attributesToGetCopy = new java.util.ArrayList(attributesToGet.size()); attributesToGetCopy.addAll(attributesToGet); this.attributesToGet = attributesToGetCopy; } return this; } /** * The maximum number of items to return. If Amazon DynamoDB hits this * limit while scanning the table, it stops the scan and returns the * matching values up to the limit, and a LastEvaluatedKey * to apply in a subsequent operation to continue the scan. Also, if the * scanned data set size exceeds 1 MB before Amazon DynamoDB hits this * limit, it stops the scan and returns the matching values up to the * limit, and a LastEvaluatedKey to apply in a subsequent * operation to continue the scan. *

* Constraints:
* Range: 1 -
* * @return The maximum number of items to return. If Amazon DynamoDB hits this * limit while scanning the table, it stops the scan and returns the * matching values up to the limit, and a LastEvaluatedKey * to apply in a subsequent operation to continue the scan. Also, if the * scanned data set size exceeds 1 MB before Amazon DynamoDB hits this * limit, it stops the scan and returns the matching values up to the * limit, and a LastEvaluatedKey to apply in a subsequent * operation to continue the scan. */ public Integer getLimit() { return limit; } /** * The maximum number of items to return. If Amazon DynamoDB hits this * limit while scanning the table, it stops the scan and returns the * matching values up to the limit, and a LastEvaluatedKey * to apply in a subsequent operation to continue the scan. Also, if the * scanned data set size exceeds 1 MB before Amazon DynamoDB hits this * limit, it stops the scan and returns the matching values up to the * limit, and a LastEvaluatedKey to apply in a subsequent * operation to continue the scan. *

* Constraints:
* Range: 1 -
* * @param limit The maximum number of items to return. If Amazon DynamoDB hits this * limit while scanning the table, it stops the scan and returns the * matching values up to the limit, and a LastEvaluatedKey * to apply in a subsequent operation to continue the scan. Also, if the * scanned data set size exceeds 1 MB before Amazon DynamoDB hits this * limit, it stops the scan and returns the matching values up to the * limit, and a LastEvaluatedKey to apply in a subsequent * operation to continue the scan. */ public void setLimit(Integer limit) { this.limit = limit; } /** * The maximum number of items to return. If Amazon DynamoDB hits this * limit while scanning the table, it stops the scan and returns the * matching values up to the limit, and a LastEvaluatedKey * to apply in a subsequent operation to continue the scan. Also, if the * scanned data set size exceeds 1 MB before Amazon DynamoDB hits this * limit, it stops the scan and returns the matching values up to the * limit, and a LastEvaluatedKey to apply in a subsequent * operation to continue the scan. *

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

* Constraints:
* Range: 1 -
* * @param limit The maximum number of items to return. If Amazon DynamoDB hits this * limit while scanning the table, it stops the scan and returns the * matching values up to the limit, and a LastEvaluatedKey * to apply in a subsequent operation to continue the scan. Also, if the * scanned data set size exceeds 1 MB before Amazon DynamoDB hits this * limit, it stops the scan and returns the matching values up to the * limit, and a LastEvaluatedKey to apply in a subsequent * operation to continue the scan. * * @return A reference to this updated object so that method calls can be chained * together. */ public ScanRequest withLimit(Integer limit) { this.limit = limit; return this; } /** * If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. * * @return If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. */ public Boolean isCount() { return count; } /** * If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. * * @param count If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. */ public void setCount(Boolean count) { this.count = count; } /** * If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. *

* Returns a reference to this object so that method calls can be chained together. * * @param count If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. * * @return A reference to this updated object so that method calls can be chained * together. */ public ScanRequest withCount(Boolean count) { this.count = count; return this; } /** * If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. * * @return If set to true, Amazon DynamoDB returns a total number of * items for the Scan operation, even if the operation has * no matching items for the assigned filter. Do not set * Count to true while providing a list of * AttributesToGet, otherwise Amazon DynamoDB returns a * validation error. */ public Boolean getCount() { return count; } /** * Evaluates the scan results and returns only the desired values. * * @return Evaluates the scan results and returns only the desired values. */ public java.util.Map getScanFilter() { return scanFilter; } /** * Evaluates the scan results and returns only the desired values. * * @param scanFilter Evaluates the scan results and returns only the desired values. */ public void setScanFilter(java.util.Map scanFilter) { this.scanFilter = scanFilter; } /** * Evaluates the scan results and returns only the desired values. *

* Returns a reference to this object so that method calls can be chained together. * * @param scanFilter Evaluates the scan results and returns only the desired values. * * @return A reference to this updated object so that method calls can be chained * together. */ public ScanRequest withScanFilter(java.util.Map scanFilter) { setScanFilter(scanFilter); return this; } /** * Primary key of the item from which to continue an earlier scan. An * earlier scan might provide this value if that scan operation was * interrupted before scanning the entire table; either because of the * result set size or the Limit parameter. The * LastEvaluatedKey can be passed back in a new scan request * to continue the operation from that point. * * @return Primary key of the item from which to continue an earlier scan. An * earlier scan might provide this value if that scan operation was * interrupted before scanning the entire table; either because of the * result set size or the Limit parameter. The * LastEvaluatedKey can be passed back in a new scan request * to continue the operation from that point. */ public Key getExclusiveStartKey() { return exclusiveStartKey; } /** * Primary key of the item from which to continue an earlier scan. An * earlier scan might provide this value if that scan operation was * interrupted before scanning the entire table; either because of the * result set size or the Limit parameter. The * LastEvaluatedKey can be passed back in a new scan request * to continue the operation from that point. * * @param exclusiveStartKey Primary key of the item from which to continue an earlier scan. An * earlier scan might provide this value if that scan operation was * interrupted before scanning the entire table; either because of the * result set size or the Limit parameter. The * LastEvaluatedKey can be passed back in a new scan request * to continue the operation from that point. */ public void setExclusiveStartKey(Key exclusiveStartKey) { this.exclusiveStartKey = exclusiveStartKey; } /** * Primary key of the item from which to continue an earlier scan. An * earlier scan might provide this value if that scan operation was * interrupted before scanning the entire table; either because of the * result set size or the Limit parameter. The * LastEvaluatedKey can be passed back in a new scan request * to continue the operation from that point. *

* Returns a reference to this object so that method calls can be chained together. * * @param exclusiveStartKey Primary key of the item from which to continue an earlier scan. An * earlier scan might provide this value if that scan operation was * interrupted before scanning the entire table; either because of the * result set size or the Limit parameter. The * LastEvaluatedKey can be passed back in a new scan request * to continue the operation from that point. * * @return A reference to this updated object so that method calls can be chained * together. */ public ScanRequest withExclusiveStartKey(Key exclusiveStartKey) { this.exclusiveStartKey = exclusiveStartKey; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getTableName() != null) sb.append("TableName: " + getTableName() + ", "); if (getAttributesToGet() != null) sb.append("AttributesToGet: " + getAttributesToGet() + ", "); if (getLimit() != null) sb.append("Limit: " + getLimit() + ", "); if (isCount() != null) sb.append("Count: " + isCount() + ", "); if (getScanFilter() != null) sb.append("ScanFilter: " + getScanFilter() + ", "); if (getExclusiveStartKey() != null) sb.append("ExclusiveStartKey: " + getExclusiveStartKey() + ", "); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode()); hashCode = prime * hashCode + ((getAttributesToGet() == null) ? 0 : getAttributesToGet().hashCode()); hashCode = prime * hashCode + ((getLimit() == null) ? 0 : getLimit().hashCode()); hashCode = prime * hashCode + ((isCount() == null) ? 0 : isCount().hashCode()); hashCode = prime * hashCode + ((getScanFilter() == null) ? 0 : getScanFilter().hashCode()); hashCode = prime * hashCode + ((getExclusiveStartKey() == null) ? 0 : getExclusiveStartKey().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ScanRequest == false) return false; ScanRequest other = (ScanRequest)obj; if (other.getTableName() == null ^ this.getTableName() == null) return false; if (other.getTableName() != null && other.getTableName().equals(this.getTableName()) == false) return false; if (other.getAttributesToGet() == null ^ this.getAttributesToGet() == null) return false; if (other.getAttributesToGet() != null && other.getAttributesToGet().equals(this.getAttributesToGet()) == false) return false; if (other.getLimit() == null ^ this.getLimit() == null) return false; if (other.getLimit() != null && other.getLimit().equals(this.getLimit()) == false) return false; if (other.isCount() == null ^ this.isCount() == null) return false; if (other.isCount() != null && other.isCount().equals(this.isCount()) == false) return false; if (other.getScanFilter() == null ^ this.getScanFilter() == null) return false; if (other.getScanFilter() != null && other.getScanFilter().equals(this.getScanFilter()) == false) return false; if (other.getExclusiveStartKey() == null ^ this.getExclusiveStartKey() == null) return false; if (other.getExclusiveStartKey() != null && other.getExclusiveStartKey().equals(this.getExclusiveStartKey()) == false) return false; return true; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy