com.amazonaws.services.dynamodbv2.model.TransactWriteItem Maven / Gradle / Ivy
Show all versions of aws-java-sdk-dynamodb Show documentation
/*
* Copyright 2014-2019 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;
/**
*
* A list of requests that can perform update, put, delete, or check operations on multiple items in one or more tables
* atomically.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TransactWriteItem implements Serializable, Cloneable, StructuredPojo {
/**
*
* A request to perform a check item operation.
*
*/
private ConditionCheck conditionCheck;
/**
*
* A request to perform a PutItem
operation.
*
*/
private Put put;
/**
*
* A request to perform a DeleteItem
operation.
*
*/
private Delete delete;
/**
*
* A request to perform an UpdateItem
operation.
*
*/
private Update update;
/**
*
* A request to perform a check item operation.
*
*
* @param conditionCheck
* A request to perform a check item operation.
*/
public void setConditionCheck(ConditionCheck conditionCheck) {
this.conditionCheck = conditionCheck;
}
/**
*
* A request to perform a check item operation.
*
*
* @return A request to perform a check item operation.
*/
public ConditionCheck getConditionCheck() {
return this.conditionCheck;
}
/**
*
* A request to perform a check item operation.
*
*
* @param conditionCheck
* A request to perform a check item operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TransactWriteItem withConditionCheck(ConditionCheck conditionCheck) {
setConditionCheck(conditionCheck);
return this;
}
/**
*
* A request to perform a PutItem
operation.
*
*
* @param put
* A request to perform a PutItem
operation.
*/
public void setPut(Put put) {
this.put = put;
}
/**
*
* A request to perform a PutItem
operation.
*
*
* @return A request to perform a PutItem
operation.
*/
public Put getPut() {
return this.put;
}
/**
*
* A request to perform a PutItem
operation.
*
*
* @param put
* A request to perform a PutItem
operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TransactWriteItem withPut(Put put) {
setPut(put);
return this;
}
/**
*
* A request to perform a DeleteItem
operation.
*
*
* @param delete
* A request to perform a DeleteItem
operation.
*/
public void setDelete(Delete delete) {
this.delete = delete;
}
/**
*
* A request to perform a DeleteItem
operation.
*
*
* @return A request to perform a DeleteItem
operation.
*/
public Delete getDelete() {
return this.delete;
}
/**
*
* A request to perform a DeleteItem
operation.
*
*
* @param delete
* A request to perform a DeleteItem
operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TransactWriteItem withDelete(Delete delete) {
setDelete(delete);
return this;
}
/**
*
* A request to perform an UpdateItem
operation.
*
*
* @param update
* A request to perform an UpdateItem
operation.
*/
public void setUpdate(Update update) {
this.update = update;
}
/**
*
* A request to perform an UpdateItem
operation.
*
*
* @return A request to perform an UpdateItem
operation.
*/
public Update getUpdate() {
return this.update;
}
/**
*
* A request to perform an UpdateItem
operation.
*
*
* @param update
* A request to perform an UpdateItem
operation.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TransactWriteItem withUpdate(Update update) {
setUpdate(update);
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 (getConditionCheck() != null)
sb.append("ConditionCheck: ").append(getConditionCheck()).append(",");
if (getPut() != null)
sb.append("Put: ").append(getPut()).append(",");
if (getDelete() != null)
sb.append("Delete: ").append(getDelete()).append(",");
if (getUpdate() != null)
sb.append("Update: ").append(getUpdate());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TransactWriteItem == false)
return false;
TransactWriteItem other = (TransactWriteItem) obj;
if (other.getConditionCheck() == null ^ this.getConditionCheck() == null)
return false;
if (other.getConditionCheck() != null && other.getConditionCheck().equals(this.getConditionCheck()) == false)
return false;
if (other.getPut() == null ^ this.getPut() == null)
return false;
if (other.getPut() != null && other.getPut().equals(this.getPut()) == false)
return false;
if (other.getDelete() == null ^ this.getDelete() == null)
return false;
if (other.getDelete() != null && other.getDelete().equals(this.getDelete()) == false)
return false;
if (other.getUpdate() == null ^ this.getUpdate() == null)
return false;
if (other.getUpdate() != null && other.getUpdate().equals(this.getUpdate()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getConditionCheck() == null) ? 0 : getConditionCheck().hashCode());
hashCode = prime * hashCode + ((getPut() == null) ? 0 : getPut().hashCode());
hashCode = prime * hashCode + ((getDelete() == null) ? 0 : getDelete().hashCode());
hashCode = prime * hashCode + ((getUpdate() == null) ? 0 : getUpdate().hashCode());
return hashCode;
}
@Override
public TransactWriteItem clone() {
try {
return (TransactWriteItem) 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.TransactWriteItemMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}