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

com.amazonaws.services.dynamodbv2.model.ConditionCheck 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

The 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;

/**
 * 

* Represents a request to perform a check that an item exists or to check the condition of specific attributes of the * item. *

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

* The primary key of the item to be checked. Each element consists of an attribute name and a value for that * attribute. *

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

* Name of the table for the check item request. You can also provide the Amazon Resource Name (ARN) of the table in * this parameter. *

*/ private String tableName; /** *

* A condition that must be satisfied in order for a conditional update to succeed. For more information, see * Condition expressions in the Amazon DynamoDB Developer Guide. *

*/ private String conditionExpression; /** *

* One or more substitution tokens for attribute names in an expression. For more information, see Expression attribute names in the Amazon DynamoDB Developer Guide. *

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

* One or more values that can be substituted in an expression. For more information, see Condition expressions in the Amazon DynamoDB Developer Guide. *

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

* Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the valid * values are: NONE and ALL_OLD. *

*/ private String returnValuesOnConditionCheckFailure; /** *

* The primary key of the item to be checked. Each element consists of an attribute name and a value for that * attribute. *

* * @return The primary key of the item to be checked. Each element consists of an attribute name and a value for * that attribute. */ public java.util.Map getKey() { return key; } /** *

* The primary key of the item to be checked. Each element consists of an attribute name and a value for that * attribute. *

* * @param key * The primary key of the item to be checked. Each element consists of an attribute name and a value for that * attribute. */ public void setKey(java.util.Map key) { this.key = key; } /** *

* The primary key of the item to be checked. Each element consists of an attribute name and a value for that * attribute. *

* * @param key * The primary key of the item to be checked. Each element consists of an attribute name and a value for that * attribute. * @return Returns a reference to this object so that method calls can be chained together. */ public ConditionCheck withKey(java.util.Map key) { setKey(key); return this; } /** * Add a single Key entry * * @see ConditionCheck#withKey * @returns a reference to this object so that method calls can be chained together. */ public ConditionCheck 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 ConditionCheck clearKeyEntries() { this.key = null; return this; } /** *

* Name of the table for the check item request. You can also provide the Amazon Resource Name (ARN) of the table in * this parameter. *

* * @param tableName * Name of the table for the check item request. You can also provide the Amazon Resource Name (ARN) of the * table in this parameter. */ public void setTableName(String tableName) { this.tableName = tableName; } /** *

* Name of the table for the check item request. You can also provide the Amazon Resource Name (ARN) of the table in * this parameter. *

* * @return Name of the table for the check item request. You can also provide the Amazon Resource Name (ARN) of the * table in this parameter. */ public String getTableName() { return this.tableName; } /** *

* Name of the table for the check item request. You can also provide the Amazon Resource Name (ARN) of the table in * this parameter. *

* * @param tableName * Name of the table for the check item request. 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 ConditionCheck withTableName(String tableName) { setTableName(tableName); return this; } /** *

* A condition that must be satisfied in order for a conditional update to succeed. For more information, see * Condition expressions in the Amazon DynamoDB Developer Guide. *

* * @param conditionExpression * A condition that must be satisfied in order for a conditional update to succeed. For more information, see * Condition expressions in the Amazon DynamoDB Developer Guide. */ public void setConditionExpression(String conditionExpression) { this.conditionExpression = conditionExpression; } /** *

* A condition that must be satisfied in order for a conditional update to succeed. For more information, see * Condition expressions in the Amazon DynamoDB Developer Guide. *

* * @return A condition that must be satisfied in order for a conditional update to succeed. For more information, * see Condition expressions in the Amazon DynamoDB Developer Guide. */ public String getConditionExpression() { return this.conditionExpression; } /** *

* A condition that must be satisfied in order for a conditional update to succeed. For more information, see * Condition expressions in the Amazon DynamoDB Developer Guide. *

* * @param conditionExpression * A condition that must be satisfied in order for a conditional update to succeed. For more information, see * Condition expressions in the Amazon DynamoDB Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public ConditionCheck withConditionExpression(String conditionExpression) { setConditionExpression(conditionExpression); return this; } /** *

* One or more substitution tokens for attribute names in an expression. For more information, see Expression attribute names in the Amazon DynamoDB Developer Guide. *

* * @return One or more substitution tokens for attribute names in an expression. For more information, see Expression attribute names in the Amazon DynamoDB Developer Guide. */ public java.util.Map getExpressionAttributeNames() { return expressionAttributeNames; } /** *

* One or more substitution tokens for attribute names in an expression. For more information, see Expression attribute names in the Amazon DynamoDB Developer Guide. *

* * @param expressionAttributeNames * One or more substitution tokens for attribute names in an expression. For more information, see Expression attribute names in the Amazon DynamoDB Developer Guide. */ public void setExpressionAttributeNames(java.util.Map expressionAttributeNames) { this.expressionAttributeNames = expressionAttributeNames; } /** *

* One or more substitution tokens for attribute names in an expression. For more information, see Expression attribute names in the Amazon DynamoDB Developer Guide. *

* * @param expressionAttributeNames * One or more substitution tokens for attribute names in an expression. For more information, see Expression attribute names in the Amazon DynamoDB Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public ConditionCheck withExpressionAttributeNames(java.util.Map expressionAttributeNames) { setExpressionAttributeNames(expressionAttributeNames); return this; } /** * Add a single ExpressionAttributeNames entry * * @see ConditionCheck#withExpressionAttributeNames * @returns a reference to this object so that method calls can be chained together. */ public ConditionCheck 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 ConditionCheck clearExpressionAttributeNamesEntries() { this.expressionAttributeNames = null; return this; } /** *

* One or more values that can be substituted in an expression. For more information, see Condition expressions in the Amazon DynamoDB Developer Guide. *

* * @return One or more values that can be substituted in an expression. For more information, see Condition expressions in the Amazon DynamoDB Developer Guide. */ public java.util.Map getExpressionAttributeValues() { return expressionAttributeValues; } /** *

* One or more values that can be substituted in an expression. For more information, see Condition expressions in the Amazon DynamoDB Developer Guide. *

* * @param expressionAttributeValues * One or more values that can be substituted in an expression. For more information, see Condition expressions in the Amazon DynamoDB Developer Guide. */ public void setExpressionAttributeValues(java.util.Map expressionAttributeValues) { this.expressionAttributeValues = expressionAttributeValues; } /** *

* One or more values that can be substituted in an expression. For more information, see Condition expressions in the Amazon DynamoDB Developer Guide. *

* * @param expressionAttributeValues * One or more values that can be substituted in an expression. For more information, see Condition expressions in the Amazon DynamoDB Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ public ConditionCheck withExpressionAttributeValues(java.util.Map expressionAttributeValues) { setExpressionAttributeValues(expressionAttributeValues); return this; } /** * Add a single ExpressionAttributeValues entry * * @see ConditionCheck#withExpressionAttributeValues * @returns a reference to this object so that method calls can be chained together. */ public ConditionCheck addExpressionAttributeValuesEntry(String key, AttributeValue value) { if (null == this.expressionAttributeValues) { this.expressionAttributeValues = new java.util.HashMap(); } if (this.expressionAttributeValues.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.expressionAttributeValues.put(key, value); return this; } /** * Removes all the entries added into ExpressionAttributeValues. * * @return Returns a reference to this object so that method calls can be chained together. */ public ConditionCheck clearExpressionAttributeValuesEntries() { this.expressionAttributeValues = null; return this; } /** *

* Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the valid * values are: NONE and ALL_OLD. *

* * @param returnValuesOnConditionCheckFailure * Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the * valid values are: NONE and ALL_OLD. * @see ReturnValuesOnConditionCheckFailure */ public void setReturnValuesOnConditionCheckFailure(String returnValuesOnConditionCheckFailure) { this.returnValuesOnConditionCheckFailure = returnValuesOnConditionCheckFailure; } /** *

* Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the valid * values are: NONE and ALL_OLD. *

* * @return Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the * valid values are: NONE and ALL_OLD. * @see ReturnValuesOnConditionCheckFailure */ public String getReturnValuesOnConditionCheckFailure() { return this.returnValuesOnConditionCheckFailure; } /** *

* Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the valid * values are: NONE and ALL_OLD. *

* * @param returnValuesOnConditionCheckFailure * Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the * valid values are: NONE and ALL_OLD. * @return Returns a reference to this object so that method calls can be chained together. * @see ReturnValuesOnConditionCheckFailure */ public ConditionCheck withReturnValuesOnConditionCheckFailure(String returnValuesOnConditionCheckFailure) { setReturnValuesOnConditionCheckFailure(returnValuesOnConditionCheckFailure); return this; } /** *

* Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the valid * values are: NONE and ALL_OLD. *

* * @param returnValuesOnConditionCheckFailure * Use ReturnValuesOnConditionCheckFailure to get the item attributes if the * ConditionCheck condition fails. For ReturnValuesOnConditionCheckFailure, the * valid values are: NONE and ALL_OLD. * @return Returns a reference to this object so that method calls can be chained together. * @see ReturnValuesOnConditionCheckFailure */ public ConditionCheck withReturnValuesOnConditionCheckFailure(ReturnValuesOnConditionCheckFailure returnValuesOnConditionCheckFailure) { this.returnValuesOnConditionCheckFailure = returnValuesOnConditionCheckFailure.toString(); 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 (getConditionExpression() != null) sb.append("ConditionExpression: ").append(getConditionExpression()).append(","); if (getExpressionAttributeNames() != null) sb.append("ExpressionAttributeNames: ").append(getExpressionAttributeNames()).append(","); if (getExpressionAttributeValues() != null) sb.append("ExpressionAttributeValues: ").append(getExpressionAttributeValues()).append(","); if (getReturnValuesOnConditionCheckFailure() != null) sb.append("ReturnValuesOnConditionCheckFailure: ").append(getReturnValuesOnConditionCheckFailure()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ConditionCheck == false) return false; ConditionCheck other = (ConditionCheck) 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.getConditionExpression() == null ^ this.getConditionExpression() == null) return false; if (other.getConditionExpression() != null && other.getConditionExpression().equals(this.getConditionExpression()) == false) return false; if (other.getExpressionAttributeNames() == null ^ this.getExpressionAttributeNames() == null) return false; if (other.getExpressionAttributeNames() != null && other.getExpressionAttributeNames().equals(this.getExpressionAttributeNames()) == false) return false; if (other.getExpressionAttributeValues() == null ^ this.getExpressionAttributeValues() == null) return false; if (other.getExpressionAttributeValues() != null && other.getExpressionAttributeValues().equals(this.getExpressionAttributeValues()) == false) return false; if (other.getReturnValuesOnConditionCheckFailure() == null ^ this.getReturnValuesOnConditionCheckFailure() == null) return false; if (other.getReturnValuesOnConditionCheckFailure() != null && other.getReturnValuesOnConditionCheckFailure().equals(this.getReturnValuesOnConditionCheckFailure()) == 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 + ((getConditionExpression() == null) ? 0 : getConditionExpression().hashCode()); hashCode = prime * hashCode + ((getExpressionAttributeNames() == null) ? 0 : getExpressionAttributeNames().hashCode()); hashCode = prime * hashCode + ((getExpressionAttributeValues() == null) ? 0 : getExpressionAttributeValues().hashCode()); hashCode = prime * hashCode + ((getReturnValuesOnConditionCheckFailure() == null) ? 0 : getReturnValuesOnConditionCheckFailure().hashCode()); return hashCode; } @Override public ConditionCheck clone() { try { return (ConditionCheck) 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.ConditionCheckMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy