/* * Copyright 2018-2023 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 an UpdateItem
operation.
*
* The primary key of the item to be updated. Each element consists of an attribute name and a value for that * attribute. *
*/ private java.util.Map* An expression that defines one or more attributes to be updated, the action to be performed on them, and new * value(s) for them. *
*/ private String updateExpression; /** *
* Name of the table for the UpdateItem
request.
*
* A condition that must be satisfied in order for a conditional update to succeed. *
*/ private String conditionExpression; /** ** One or more substitution tokens for attribute names in an expression. *
*/ private java.util.Map* One or more values that can be substituted in an expression. *
*/ private java.util.Map
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Update
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
* The primary key of the item to be updated. Each element consists of an attribute name and a value for that * attribute. *
* * @return The primary key of the item to be updated. Each element consists of an attribute name and a value for * that attribute. */ public java.util.Map* The primary key of the item to be updated. Each element consists of an attribute name and a value for that * attribute. *
* * @param key * The primary key of the item to be updated. Each element consists of an attribute name and a value for that * attribute. */ public void setKey(java.util.Map* The primary key of the item to be updated. Each element consists of an attribute name and a value for that * attribute. *
* * @param key * The primary key of the item to be updated. 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 Update withKey(java.util.Map* An expression that defines one or more attributes to be updated, the action to be performed on them, and new * value(s) for them. *
* * @param updateExpression * An expression that defines one or more attributes to be updated, the action to be performed on them, and * new value(s) for them. */ public void setUpdateExpression(String updateExpression) { this.updateExpression = updateExpression; } /** ** An expression that defines one or more attributes to be updated, the action to be performed on them, and new * value(s) for them. *
* * @return An expression that defines one or more attributes to be updated, the action to be performed on them, and * new value(s) for them. */ public String getUpdateExpression() { return this.updateExpression; } /** ** An expression that defines one or more attributes to be updated, the action to be performed on them, and new * value(s) for them. *
* * @param updateExpression * An expression that defines one or more attributes to be updated, the action to be performed on them, and * new value(s) for them. * @return Returns a reference to this object so that method calls can be chained together. */ public Update withUpdateExpression(String updateExpression) { setUpdateExpression(updateExpression); return this; } /** *
* Name of the table for the UpdateItem
request.
*
UpdateItem
request.
*/
public void setTableName(String tableName) {
this.tableName = tableName;
}
/**
*
* Name of the table for the UpdateItem
request.
*
UpdateItem
request.
*/
public String getTableName() {
return this.tableName;
}
/**
*
* Name of the table for the UpdateItem
request.
*
UpdateItem
request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Update withTableName(String tableName) {
setTableName(tableName);
return this;
}
/**
* * A condition that must be satisfied in order for a conditional update to succeed. *
* * @param conditionExpression * A condition that must be satisfied in order for a conditional update to succeed. */ public void setConditionExpression(String conditionExpression) { this.conditionExpression = conditionExpression; } /** ** A condition that must be satisfied in order for a conditional update to succeed. *
* * @return A condition that must be satisfied in order for a conditional update to succeed. */ public String getConditionExpression() { return this.conditionExpression; } /** ** A condition that must be satisfied in order for a conditional update to succeed. *
* * @param conditionExpression * A condition that must be satisfied in order for a conditional update to succeed. * @return Returns a reference to this object so that method calls can be chained together. */ public Update 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* 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* 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 Update withExpressionAttributeNames(java.util.Map* 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* 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* 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 Update withExpressionAttributeValues(java.util.Map
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Update
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
ReturnValuesOnConditionCheckFailure
to get the item attributes if the Update
* 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 Update
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
ReturnValuesOnConditionCheckFailure
to get the item attributes if the
* Update
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 Update
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
ReturnValuesOnConditionCheckFailure
to get the item attributes if the Update
* 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 Update withReturnValuesOnConditionCheckFailure(String returnValuesOnConditionCheckFailure) {
setReturnValuesOnConditionCheckFailure(returnValuesOnConditionCheckFailure);
return this;
}
/**
*
* Use ReturnValuesOnConditionCheckFailure
to get the item attributes if the Update
* condition fails. For ReturnValuesOnConditionCheckFailure
, the valid values are: NONE and ALL_OLD.
*
ReturnValuesOnConditionCheckFailure
to get the item attributes if the Update
* 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 Update 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 (getUpdateExpression() != null)
sb.append("UpdateExpression: ").append(getUpdateExpression()).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 Update == false)
return false;
Update other = (Update) obj;
if (other.getKey() == null ^ this.getKey() == null)
return false;
if (other.getKey() != null && other.getKey().equals(this.getKey()) == false)
return false;
if (other.getUpdateExpression() == null ^ this.getUpdateExpression() == null)
return false;
if (other.getUpdateExpression() != null && other.getUpdateExpression().equals(this.getUpdateExpression()) == 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 + ((getUpdateExpression() == null) ? 0 : getUpdateExpression().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 Update clone() {
try {
return (Update) 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.UpdateMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}