com.amazonaws.services.dynamodbv2.model.Delete Maven / Gradle / Ivy
Show all versions of aws-java-sdk-dynamodb Show documentation
/*
* Copyright 2016-2021 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 DeleteItem
operation.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Delete implements Serializable, Cloneable, StructuredPojo {
/**
*
* The primary key of the item to be deleted. Each element consists of an attribute name and a value for that
* attribute.
*
*/
private java.util.Map key;
/**
*
* Name of the table in which the item to be deleted resides.
*
*/
private String tableName;
/**
*
* A condition that must be satisfied in order for a conditional delete to succeed.
*
*/
private String conditionExpression;
/**
*
* One or more substitution tokens for attribute names in an expression.
*
*/
private java.util.Map expressionAttributeNames;
/**
*
* One or more values that can be substituted in an expression.
*
*/
private java.util.Map expressionAttributeValues;
/**
*
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Delete
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
*/
private String returnValuesOnConditionCheckFailure;
/**
*
* The primary key of the item to be deleted. Each element consists of an attribute name and a value for that
* attribute.
*
*
* @return The primary key of the item to be deleted. 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 deleted. Each element consists of an attribute name and a value for that
* attribute.
*
*
* @param key
* The primary key of the item to be deleted. 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 deleted. Each element consists of an attribute name and a value for that
* attribute.
*
*
* @param key
* The primary key of the item to be deleted. 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 Delete withKey(java.util.Map key) {
setKey(key);
return this;
}
/**
* Add a single Key entry
*
* @see Delete#withKey
* @returns a reference to this object so that method calls can be chained together.
*/
public Delete 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 Delete clearKeyEntries() {
this.key = null;
return this;
}
/**
*
* Name of the table in which the item to be deleted resides.
*
*
* @param tableName
* Name of the table in which the item to be deleted resides.
*/
public void setTableName(String tableName) {
this.tableName = tableName;
}
/**
*
* Name of the table in which the item to be deleted resides.
*
*
* @return Name of the table in which the item to be deleted resides.
*/
public String getTableName() {
return this.tableName;
}
/**
*
* Name of the table in which the item to be deleted resides.
*
*
* @param tableName
* Name of the table in which the item to be deleted resides.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Delete withTableName(String tableName) {
setTableName(tableName);
return this;
}
/**
*
* A condition that must be satisfied in order for a conditional delete to succeed.
*
*
* @param conditionExpression
* A condition that must be satisfied in order for a conditional delete to succeed.
*/
public void setConditionExpression(String conditionExpression) {
this.conditionExpression = conditionExpression;
}
/**
*
* A condition that must be satisfied in order for a conditional delete to succeed.
*
*
* @return A condition that must be satisfied in order for a conditional delete to succeed.
*/
public String getConditionExpression() {
return this.conditionExpression;
}
/**
*
* A condition that must be satisfied in order for a conditional delete to succeed.
*
*
* @param conditionExpression
* A condition that must be satisfied in order for a conditional delete to succeed.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Delete withConditionExpression(String conditionExpression) {
setConditionExpression(conditionExpression);
return this;
}
/**
*
* One or more substitution tokens for attribute names in an expression.
*
*
* @return One or more substitution tokens for attribute names in an expression.
*/
public java.util.Map getExpressionAttributeNames() {
return expressionAttributeNames;
}
/**
*
* One or more substitution tokens for attribute names in an expression.
*
*
* @param expressionAttributeNames
* One or more substitution tokens for attribute names in an expression.
*/
public void setExpressionAttributeNames(java.util.Map expressionAttributeNames) {
this.expressionAttributeNames = expressionAttributeNames;
}
/**
*
* One or more substitution tokens for attribute names in an expression.
*
*
* @param expressionAttributeNames
* One or more substitution tokens for attribute names in an expression.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Delete withExpressionAttributeNames(java.util.Map expressionAttributeNames) {
setExpressionAttributeNames(expressionAttributeNames);
return this;
}
/**
* Add a single ExpressionAttributeNames entry
*
* @see Delete#withExpressionAttributeNames
* @returns a reference to this object so that method calls can be chained together.
*/
public Delete 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 Delete clearExpressionAttributeNamesEntries() {
this.expressionAttributeNames = null;
return this;
}
/**
*
* One or more values that can be substituted in an expression.
*
*
* @return One or more values that can be substituted in an expression.
*/
public java.util.Map getExpressionAttributeValues() {
return expressionAttributeValues;
}
/**
*
* One or more values that can be substituted in an expression.
*
*
* @param expressionAttributeValues
* One or more values that can be substituted in an expression.
*/
public void setExpressionAttributeValues(java.util.Map expressionAttributeValues) {
this.expressionAttributeValues = expressionAttributeValues;
}
/**
*
* One or more values that can be substituted in an expression.
*
*
* @param expressionAttributeValues
* One or more values that can be substituted in an expression.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Delete withExpressionAttributeValues(java.util.Map expressionAttributeValues) {
setExpressionAttributeValues(expressionAttributeValues);
return this;
}
/**
* Add a single ExpressionAttributeValues entry
*
* @see Delete#withExpressionAttributeValues
* @returns a reference to this object so that method calls can be chained together.
*/
public Delete 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 Delete clearExpressionAttributeValuesEntries() {
this.expressionAttributeValues = null;
return this;
}
/**
*
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Delete
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
*
* @param returnValuesOnConditionCheckFailure
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Delete
* 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 Delete
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
*
* @return Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the
* Delete
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 Delete
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
*
* @param returnValuesOnConditionCheckFailure
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Delete
* 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 Delete withReturnValuesOnConditionCheckFailure(String returnValuesOnConditionCheckFailure) {
setReturnValuesOnConditionCheckFailure(returnValuesOnConditionCheckFailure);
return this;
}
/**
*
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Delete
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
*
* @param returnValuesOnConditionCheckFailure
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Delete
* 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 Delete 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 Delete == false)
return false;
Delete other = (Delete) 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 Delete clone() {
try {
return (Delete) 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.DeleteMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}