com.amazonaws.services.dynamodbv2.model.BatchGetItemResult Maven / Gradle / Ivy
Show all versions of aws-java-sdk-dynamodb Show documentation
/*
* Copyright 2012-2017 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;
/**
*
* Represents the output of a BatchGetItem
operation.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class BatchGetItemResult extends com.amazonaws.AmazonWebServiceResult implements Serializable, Cloneable {
/**
*
* A map of table name to a list of items. Each object in Responses
consists of a table name, along
* with a map of attribute data consisting of the data type and attribute value.
*
*/
private java.util.Map>> responses;
/**
*
* A map of tables and their respective keys that were not processed with the current response. The
* UnprocessedKeys
value is in the same form as RequestItems
, so the value can be provided
* directly to a subsequent BatchGetItem
operation. For more information, see RequestItems
* in the Request Parameters section.
*
*
* Each element consists of:
*
*
* -
*
* Keys
- An array of primary key attribute values that define specific items in the table.
*
*
* -
*
* ProjectionExpression
- One or more attributes to be retrieved from the table or index. By default,
* all attributes are returned. If a requested attribute is not found, it does not appear in the result.
*
*
* -
*
* ConsistentRead
- The consistency of a read operation. If set to true
, then a strongly
* consistent read is used; otherwise, an eventually consistent read is used.
*
*
*
*
* If there are no unprocessed keys remaining, the response contains an empty UnprocessedKeys
map.
*
*/
private java.util.Map unprocessedKeys;
/**
*
* The read capacity units consumed by the entire BatchGetItem
operation.
*
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
*
*/
private java.util.List consumedCapacity;
/**
*
* A map of table name to a list of items. Each object in Responses
consists of a table name, along
* with a map of attribute data consisting of the data type and attribute value.
*
*
* @return A map of table name to a list of items. Each object in Responses
consists of a table name,
* along with a map of attribute data consisting of the data type and attribute value.
*/
public java.util.Map>> getResponses() {
return responses;
}
/**
*
* A map of table name to a list of items. Each object in Responses
consists of a table name, along
* with a map of attribute data consisting of the data type and attribute value.
*
*
* @param responses
* A map of table name to a list of items. Each object in Responses
consists of a table name,
* along with a map of attribute data consisting of the data type and attribute value.
*/
public void setResponses(java.util.Map>> responses) {
this.responses = responses;
}
/**
*
* A map of table name to a list of items. Each object in Responses
consists of a table name, along
* with a map of attribute data consisting of the data type and attribute value.
*
*
* @param responses
* A map of table name to a list of items. Each object in Responses
consists of a table name,
* along with a map of attribute data consisting of the data type and attribute value.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BatchGetItemResult withResponses(java.util.Map>> responses) {
setResponses(responses);
return this;
}
public BatchGetItemResult addResponsesEntry(String key, java.util.List> value) {
if (null == this.responses) {
this.responses = new java.util.HashMap>>();
}
if (this.responses.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.responses.put(key, value);
return this;
}
/**
* Removes all the entries added into Responses.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BatchGetItemResult clearResponsesEntries() {
this.responses = null;
return this;
}
/**
*
* A map of tables and their respective keys that were not processed with the current response. The
* UnprocessedKeys
value is in the same form as RequestItems
, so the value can be provided
* directly to a subsequent BatchGetItem
operation. For more information, see RequestItems
* in the Request Parameters section.
*
*
* Each element consists of:
*
*
* -
*
* Keys
- An array of primary key attribute values that define specific items in the table.
*
*
* -
*
* ProjectionExpression
- One or more attributes to be retrieved from the table or index. By default,
* all attributes are returned. If a requested attribute is not found, it does not appear in the result.
*
*
* -
*
* ConsistentRead
- The consistency of a read operation. If set to true
, then a strongly
* consistent read is used; otherwise, an eventually consistent read is used.
*
*
*
*
* If there are no unprocessed keys remaining, the response contains an empty UnprocessedKeys
map.
*
*
* @return A map of tables and their respective keys that were not processed with the current response. The
* UnprocessedKeys
value is in the same form as RequestItems
, so the value can be
* provided directly to a subsequent BatchGetItem
operation. For more information, see
* RequestItems
in the Request Parameters section.
*
* Each element consists of:
*
*
* -
*
* Keys
- An array of primary key attribute values that define specific items in the table.
*
*
* -
*
* ProjectionExpression
- One or more attributes to be retrieved from the table or index. By
* default, all attributes are returned. If a requested attribute is not found, it does not appear in the
* result.
*
*
* -
*
* ConsistentRead
- The consistency of a read operation. If set to true
, then a
* strongly consistent read is used; otherwise, an eventually consistent read is used.
*
*
*
*
* If there are no unprocessed keys remaining, the response contains an empty UnprocessedKeys
* map.
*/
public java.util.Map getUnprocessedKeys() {
return unprocessedKeys;
}
/**
*
* A map of tables and their respective keys that were not processed with the current response. The
* UnprocessedKeys
value is in the same form as RequestItems
, so the value can be provided
* directly to a subsequent BatchGetItem
operation. For more information, see RequestItems
* in the Request Parameters section.
*
*
* Each element consists of:
*
*
* -
*
* Keys
- An array of primary key attribute values that define specific items in the table.
*
*
* -
*
* ProjectionExpression
- One or more attributes to be retrieved from the table or index. By default,
* all attributes are returned. If a requested attribute is not found, it does not appear in the result.
*
*
* -
*
* ConsistentRead
- The consistency of a read operation. If set to true
, then a strongly
* consistent read is used; otherwise, an eventually consistent read is used.
*
*
*
*
* If there are no unprocessed keys remaining, the response contains an empty UnprocessedKeys
map.
*
*
* @param unprocessedKeys
* A map of tables and their respective keys that were not processed with the current response. The
* UnprocessedKeys
value is in the same form as RequestItems
, so the value can be
* provided directly to a subsequent BatchGetItem
operation. For more information, see
* RequestItems
in the Request Parameters section.
*
* Each element consists of:
*
*
* -
*
* Keys
- An array of primary key attribute values that define specific items in the table.
*
*
* -
*
* ProjectionExpression
- One or more attributes to be retrieved from the table or index. By
* default, all attributes are returned. If a requested attribute is not found, it does not appear in the
* result.
*
*
* -
*
* ConsistentRead
- The consistency of a read operation. If set to true
, then a
* strongly consistent read is used; otherwise, an eventually consistent read is used.
*
*
*
*
* If there are no unprocessed keys remaining, the response contains an empty UnprocessedKeys
* map.
*/
public void setUnprocessedKeys(java.util.Map unprocessedKeys) {
this.unprocessedKeys = unprocessedKeys;
}
/**
*
* A map of tables and their respective keys that were not processed with the current response. The
* UnprocessedKeys
value is in the same form as RequestItems
, so the value can be provided
* directly to a subsequent BatchGetItem
operation. For more information, see RequestItems
* in the Request Parameters section.
*
*
* Each element consists of:
*
*
* -
*
* Keys
- An array of primary key attribute values that define specific items in the table.
*
*
* -
*
* ProjectionExpression
- One or more attributes to be retrieved from the table or index. By default,
* all attributes are returned. If a requested attribute is not found, it does not appear in the result.
*
*
* -
*
* ConsistentRead
- The consistency of a read operation. If set to true
, then a strongly
* consistent read is used; otherwise, an eventually consistent read is used.
*
*
*
*
* If there are no unprocessed keys remaining, the response contains an empty UnprocessedKeys
map.
*
*
* @param unprocessedKeys
* A map of tables and their respective keys that were not processed with the current response. The
* UnprocessedKeys
value is in the same form as RequestItems
, so the value can be
* provided directly to a subsequent BatchGetItem
operation. For more information, see
* RequestItems
in the Request Parameters section.
*
* Each element consists of:
*
*
* -
*
* Keys
- An array of primary key attribute values that define specific items in the table.
*
*
* -
*
* ProjectionExpression
- One or more attributes to be retrieved from the table or index. By
* default, all attributes are returned. If a requested attribute is not found, it does not appear in the
* result.
*
*
* -
*
* ConsistentRead
- The consistency of a read operation. If set to true
, then a
* strongly consistent read is used; otherwise, an eventually consistent read is used.
*
*
*
*
* If there are no unprocessed keys remaining, the response contains an empty UnprocessedKeys
* map.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BatchGetItemResult withUnprocessedKeys(java.util.Map unprocessedKeys) {
setUnprocessedKeys(unprocessedKeys);
return this;
}
public BatchGetItemResult addUnprocessedKeysEntry(String key, KeysAndAttributes value) {
if (null == this.unprocessedKeys) {
this.unprocessedKeys = new java.util.HashMap();
}
if (this.unprocessedKeys.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.unprocessedKeys.put(key, value);
return this;
}
/**
* Removes all the entries added into UnprocessedKeys.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BatchGetItemResult clearUnprocessedKeysEntries() {
this.unprocessedKeys = null;
return this;
}
/**
*
* The read capacity units consumed by the entire BatchGetItem
operation.
*
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
*
*
* @return The read capacity units consumed by the entire BatchGetItem
operation.
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
*/
public java.util.List getConsumedCapacity() {
return consumedCapacity;
}
/**
*
* The read capacity units consumed by the entire BatchGetItem
operation.
*
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
*
*
* @param consumedCapacity
* The read capacity units consumed by the entire BatchGetItem
operation.
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
*/
public void setConsumedCapacity(java.util.Collection consumedCapacity) {
if (consumedCapacity == null) {
this.consumedCapacity = null;
return;
}
this.consumedCapacity = new java.util.ArrayList(consumedCapacity);
}
/**
*
* The read capacity units consumed by the entire BatchGetItem
operation.
*
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setConsumedCapacity(java.util.Collection)} or {@link #withConsumedCapacity(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param consumedCapacity
* The read capacity units consumed by the entire BatchGetItem
operation.
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BatchGetItemResult withConsumedCapacity(ConsumedCapacity... consumedCapacity) {
if (this.consumedCapacity == null) {
setConsumedCapacity(new java.util.ArrayList(consumedCapacity.length));
}
for (ConsumedCapacity ele : consumedCapacity) {
this.consumedCapacity.add(ele);
}
return this;
}
/**
*
* The read capacity units consumed by the entire BatchGetItem
operation.
*
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
*
*
* @param consumedCapacity
* The read capacity units consumed by the entire BatchGetItem
operation.
*
* Each element consists of:
*
*
* -
*
* TableName
- The table that consumed the provisioned throughput.
*
*
* -
*
* CapacityUnits
- The total number of capacity units consumed.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public BatchGetItemResult withConsumedCapacity(java.util.Collection consumedCapacity) {
setConsumedCapacity(consumedCapacity);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getResponses() != null)
sb.append("Responses: ").append(getResponses()).append(",");
if (getUnprocessedKeys() != null)
sb.append("UnprocessedKeys: ").append(getUnprocessedKeys()).append(",");
if (getConsumedCapacity() != null)
sb.append("ConsumedCapacity: ").append(getConsumedCapacity());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof BatchGetItemResult == false)
return false;
BatchGetItemResult other = (BatchGetItemResult) obj;
if (other.getResponses() == null ^ this.getResponses() == null)
return false;
if (other.getResponses() != null && other.getResponses().equals(this.getResponses()) == false)
return false;
if (other.getUnprocessedKeys() == null ^ this.getUnprocessedKeys() == null)
return false;
if (other.getUnprocessedKeys() != null && other.getUnprocessedKeys().equals(this.getUnprocessedKeys()) == false)
return false;
if (other.getConsumedCapacity() == null ^ this.getConsumedCapacity() == null)
return false;
if (other.getConsumedCapacity() != null && other.getConsumedCapacity().equals(this.getConsumedCapacity()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getResponses() == null) ? 0 : getResponses().hashCode());
hashCode = prime * hashCode + ((getUnprocessedKeys() == null) ? 0 : getUnprocessedKeys().hashCode());
hashCode = prime * hashCode + ((getConsumedCapacity() == null) ? 0 : getConsumedCapacity().hashCode());
return hashCode;
}
@Override
public BatchGetItemResult clone() {
try {
return (BatchGetItemResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}