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

com.amazonaws.services.dynamodb.model.GetItemRequest 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#getItem(GetItemRequest) GetItem operation}.
 * 

* Retrieves a set of Attributes for an item that matches the primary key. *

*

* The GetItem operation provides an eventually-consistent read by default. If eventually-consistent reads are not acceptable for your * application, use ConsistentRead . Although this operation might take longer than a standard read, it always returns the last updated * value. *

* * @see com.amazonaws.services.dynamodb.AmazonDynamoDB#getItem(GetItemRequest) * * @deprecated Use {@link com.amazonaws.services.dynamodbv2.model.GetItemRequest} instead. */ @Deprecated public class GetItemRequest extends AmazonWebServiceRequest implements Serializable { /** * The name of the table in which you want to get an item. 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; /** * The primary key that uniquely identifies each item in a table. A * primary key can be a one attribute (hash) primary key or a two * attribute (hash-and-range) primary key. */ private Key key; /** * 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; /** * If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. */ private Boolean consistentRead; /** * Default constructor for a new GetItemRequest object. Callers should use the * setter or fluent setter (with...) methods to initialize this object after creating it. */ public GetItemRequest() {} /** * Constructs a new GetItemRequest 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 get an * item. Allowed characters are a-z, A-Z, * 0-9, _ (underscore), - (hyphen) * and . (period). * @param key The primary key that uniquely identifies each item in a * table. A primary key can be a one attribute (hash) primary key or a * two attribute (hash-and-range) primary key. */ public GetItemRequest(String tableName, Key key) { this.tableName = tableName; this.key = key; } /** * The name of the table in which you want to get an item. 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 get an item. 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 get an item. 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 get an item. 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 get an item. 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 get an item. 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 GetItemRequest withTableName(String tableName) { this.tableName = tableName; return this; } /** * The primary key that uniquely identifies each item in a table. A * primary key can be a one attribute (hash) primary key or a two * attribute (hash-and-range) primary key. * * @return The primary key that uniquely identifies each item in a table. A * primary key can be a one attribute (hash) primary key or a two * attribute (hash-and-range) primary key. */ public Key getKey() { return key; } /** * The primary key that uniquely identifies each item in a table. A * primary key can be a one attribute (hash) primary key or a two * attribute (hash-and-range) primary key. * * @param key The primary key that uniquely identifies each item in a table. A * primary key can be a one attribute (hash) primary key or a two * attribute (hash-and-range) primary key. */ public void setKey(Key key) { this.key = key; } /** * The primary key that uniquely identifies each item in a table. A * primary key can be a one attribute (hash) primary key or a two * attribute (hash-and-range) primary key. *

* Returns a reference to this object so that method calls can be chained together. * * @param key The primary key that uniquely identifies each item in a table. A * primary key can be a one attribute (hash) primary key or a two * attribute (hash-and-range) primary key. * * @return A reference to this updated object so that method calls can be chained * together. */ public GetItemRequest withKey(Key key) { this.key = key; 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 GetItemRequest 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 GetItemRequest 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; } /** * If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. * * @return If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. */ public Boolean isConsistentRead() { return consistentRead; } /** * If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. * * @param consistentRead If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. */ public void setConsistentRead(Boolean consistentRead) { this.consistentRead = consistentRead; } /** * If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. *

* Returns a reference to this object so that method calls can be chained together. * * @param consistentRead If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. * * @return A reference to this updated object so that method calls can be chained * together. */ public GetItemRequest withConsistentRead(Boolean consistentRead) { this.consistentRead = consistentRead; return this; } /** * If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. * * @return If set to true, then a consistent read is issued. * Otherwise eventually-consistent is used. */ public Boolean getConsistentRead() { return consistentRead; } /** * 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 (getKey() != null) sb.append("Key: " + getKey() + ", "); if (getAttributesToGet() != null) sb.append("AttributesToGet: " + getAttributesToGet() + ", "); if (isConsistentRead() != null) sb.append("ConsistentRead: " + isConsistentRead() + ", "); 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 + ((getKey() == null) ? 0 : getKey().hashCode()); hashCode = prime * hashCode + ((getAttributesToGet() == null) ? 0 : getAttributesToGet().hashCode()); hashCode = prime * hashCode + ((isConsistentRead() == null) ? 0 : isConsistentRead().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof GetItemRequest == false) return false; GetItemRequest other = (GetItemRequest)obj; if (other.getTableName() == null ^ this.getTableName() == null) return false; if (other.getTableName() != null && other.getTableName().equals(this.getTableName()) == false) return false; if (other.getKey() == null ^ this.getKey() == null) return false; if (other.getKey() != null && other.getKey().equals(this.getKey()) == 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.isConsistentRead() == null ^ this.isConsistentRead() == null) return false; if (other.isConsistentRead() != null && other.isConsistentRead().equals(this.isConsistentRead()) == false) return false; return true; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy