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

com.amazonaws.services.dynamodbv2.model.Get Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon DynamoDB module holds the client classes that are used for communicating with Amazon DynamoDB Service

There is a newer version: 1.12.778
Show newest version
/*
 * Copyright 2019-2024 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.dynamodbv2.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 

* Specifies an item and related attribute values to retrieve in a TransactGetItem object. *

* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Get implements Serializable, Cloneable, StructuredPojo { /** *

* A map of attribute names to AttributeValue objects that specifies the primary key of the item to * retrieve. *

*/ private java.util.Map key; /** *

* The name of the table from which to retrieve the specified item. You can also provide the Amazon Resource Name * (ARN) of the table in this parameter. *

*/ private String tableName; /** *

* A string that identifies one or more attributes of the specified item to retrieve from the table. The attributes * in the expression must be separated by commas. If no attribute names are specified, then all attributes of the * specified item are returned. If any of the requested attributes are not found, they do not appear in the result. *

*/ private String projectionExpression; /** *

* One or more substitution tokens for attribute names in the ProjectionExpression parameter. *

*/ private java.util.Map expressionAttributeNames; /** *

* A map of attribute names to AttributeValue objects that specifies the primary key of the item to * retrieve. *

* * @return A map of attribute names to AttributeValue objects that specifies the primary key of the * item to retrieve. */ public java.util.Map getKey() { return key; } /** *

* A map of attribute names to AttributeValue objects that specifies the primary key of the item to * retrieve. *

* * @param key * A map of attribute names to AttributeValue objects that specifies the primary key of the item * to retrieve. */ public void setKey(java.util.Map key) { this.key = key; } /** *

* A map of attribute names to AttributeValue objects that specifies the primary key of the item to * retrieve. *

* * @param key * A map of attribute names to AttributeValue objects that specifies the primary key of the item * to retrieve. * @return Returns a reference to this object so that method calls can be chained together. */ public Get withKey(java.util.Map key) { setKey(key); return this; } /** * Add a single Key entry * * @see Get#withKey * @returns a reference to this object so that method calls can be chained together. */ public Get addKeyEntry(String key, AttributeValue value) { if (null == this.key) { this.key = new java.util.HashMap(); } if (this.key.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.key.put(key, value); return this; } /** * Removes all the entries added into Key. * * @return Returns a reference to this object so that method calls can be chained together. */ public Get clearKeyEntries() { this.key = null; return this; } /** *

* The name of the table from which to retrieve the specified item. You can also provide the Amazon Resource Name * (ARN) of the table in this parameter. *

* * @param tableName * The name of the table from which to retrieve the specified item. You can also provide the Amazon Resource * Name (ARN) of the table in this parameter. */ public void setTableName(String tableName) { this.tableName = tableName; } /** *

* The name of the table from which to retrieve the specified item. You can also provide the Amazon Resource Name * (ARN) of the table in this parameter. *

* * @return The name of the table from which to retrieve the specified item. You can also provide the Amazon Resource * Name (ARN) of the table in this parameter. */ public String getTableName() { return this.tableName; } /** *

* The name of the table from which to retrieve the specified item. You can also provide the Amazon Resource Name * (ARN) of the table in this parameter. *

* * @param tableName * The name of the table from which to retrieve the specified item. You can also provide the Amazon Resource * Name (ARN) of the table in this parameter. * @return Returns a reference to this object so that method calls can be chained together. */ public Get withTableName(String tableName) { setTableName(tableName); return this; } /** *

* A string that identifies one or more attributes of the specified item to retrieve from the table. The attributes * in the expression must be separated by commas. If no attribute names are specified, then all attributes of the * specified item are returned. If any of the requested attributes are not found, they do not appear in the result. *

* * @param projectionExpression * A string that identifies one or more attributes of the specified item to retrieve from the table. The * attributes in the expression must be separated by commas. If no attribute names are specified, then all * attributes of the specified item are returned. If any of the requested attributes are not found, they do * not appear in the result. */ public void setProjectionExpression(String projectionExpression) { this.projectionExpression = projectionExpression; } /** *

* A string that identifies one or more attributes of the specified item to retrieve from the table. The attributes * in the expression must be separated by commas. If no attribute names are specified, then all attributes of the * specified item are returned. If any of the requested attributes are not found, they do not appear in the result. *

* * @return A string that identifies one or more attributes of the specified item to retrieve from the table. The * attributes in the expression must be separated by commas. If no attribute names are specified, then all * attributes of the specified item are returned. If any of the requested attributes are not found, they do * not appear in the result. */ public String getProjectionExpression() { return this.projectionExpression; } /** *

* A string that identifies one or more attributes of the specified item to retrieve from the table. The attributes * in the expression must be separated by commas. If no attribute names are specified, then all attributes of the * specified item are returned. If any of the requested attributes are not found, they do not appear in the result. *

* * @param projectionExpression * A string that identifies one or more attributes of the specified item to retrieve from the table. The * attributes in the expression must be separated by commas. If no attribute names are specified, then all * attributes of the specified item are returned. If any of the requested attributes are not found, they do * not appear in the result. * @return Returns a reference to this object so that method calls can be chained together. */ public Get withProjectionExpression(String projectionExpression) { setProjectionExpression(projectionExpression); return this; } /** *

* One or more substitution tokens for attribute names in the ProjectionExpression parameter. *

* * @return One or more substitution tokens for attribute names in the ProjectionExpression parameter. */ public java.util.Map getExpressionAttributeNames() { return expressionAttributeNames; } /** *

* One or more substitution tokens for attribute names in the ProjectionExpression parameter. *

* * @param expressionAttributeNames * One or more substitution tokens for attribute names in the ProjectionExpression parameter. */ public void setExpressionAttributeNames(java.util.Map expressionAttributeNames) { this.expressionAttributeNames = expressionAttributeNames; } /** *

* One or more substitution tokens for attribute names in the ProjectionExpression parameter. *

* * @param expressionAttributeNames * One or more substitution tokens for attribute names in the ProjectionExpression parameter. * @return Returns a reference to this object so that method calls can be chained together. */ public Get withExpressionAttributeNames(java.util.Map expressionAttributeNames) { setExpressionAttributeNames(expressionAttributeNames); return this; } /** * Add a single ExpressionAttributeNames entry * * @see Get#withExpressionAttributeNames * @returns a reference to this object so that method calls can be chained together. */ public Get addExpressionAttributeNamesEntry(String key, String value) { if (null == this.expressionAttributeNames) { this.expressionAttributeNames = new java.util.HashMap(); } if (this.expressionAttributeNames.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.expressionAttributeNames.put(key, value); return this; } /** * Removes all the entries added into ExpressionAttributeNames. * * @return Returns a reference to this object so that method calls can be chained together. */ public Get clearExpressionAttributeNamesEntries() { this.expressionAttributeNames = null; return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKey() != null) sb.append("Key: ").append(getKey()).append(","); if (getTableName() != null) sb.append("TableName: ").append(getTableName()).append(","); if (getProjectionExpression() != null) sb.append("ProjectionExpression: ").append(getProjectionExpression()).append(","); if (getExpressionAttributeNames() != null) sb.append("ExpressionAttributeNames: ").append(getExpressionAttributeNames()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Get == false) return false; Get other = (Get) obj; if (other.getKey() == null ^ this.getKey() == null) return false; if (other.getKey() != null && other.getKey().equals(this.getKey()) == false) return false; if (other.getTableName() == null ^ this.getTableName() == null) return false; if (other.getTableName() != null && other.getTableName().equals(this.getTableName()) == false) return false; if (other.getProjectionExpression() == null ^ this.getProjectionExpression() == null) return false; if (other.getProjectionExpression() != null && other.getProjectionExpression().equals(this.getProjectionExpression()) == false) return false; if (other.getExpressionAttributeNames() == null ^ this.getExpressionAttributeNames() == null) return false; if (other.getExpressionAttributeNames() != null && other.getExpressionAttributeNames().equals(this.getExpressionAttributeNames()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKey() == null) ? 0 : getKey().hashCode()); hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode()); hashCode = prime * hashCode + ((getProjectionExpression() == null) ? 0 : getProjectionExpression().hashCode()); hashCode = prime * hashCode + ((getExpressionAttributeNames() == null) ? 0 : getExpressionAttributeNames().hashCode()); return hashCode; } @Override public Get clone() { try { return (Get) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.dynamodbv2.model.transform.GetMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy