Did this page help you?

   Yes   No   Tell us about it...

com.amazonaws.services.dynamodbv2.model
Class GetItemRequest

java.lang.Object
  extended by com.amazonaws.AmazonWebServiceRequest
      extended by com.amazonaws.services.dynamodbv2.model.GetItemRequest
All Implemented Interfaces:
Serializable

public class GetItemRequest
extends AmazonWebServiceRequest
implements Serializable

Container for the parameters to the GetItem operation.

The GetItem operation returns a set of attributes for the item with the given primary key. If there is no matching item, GetItem does not return any data.

GetItem provides an eventually consistent read by default. If your application requires a strongly consistent read, set ConsistentRead to true . Although a strongly consistent read might take more time than an eventually consistent read, it always returns the last updated value.

See Also:
AmazonDynamoDB.getItem(GetItemRequest), Serialized Form

Constructor Summary
GetItemRequest()
          Default constructor for a new GetItemRequest object.
GetItemRequest(String tableName, Map<String,AttributeValue> key)
          Constructs a new GetItemRequest object.
 
Method Summary
 GetItemRequest addKeyEntry(String key, AttributeValue value)
          A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
 GetItemRequest clearKeyEntries()
          Removes all the entries added into Key.
 boolean equals(Object obj)
           
 List<String> getAttributesToGet()
          The names of one or more attributes to retrieve.
 Boolean getConsistentRead()
          If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.
 Map<String,AttributeValue> getKey()
          A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
 String getReturnConsumedCapacity()
          If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
 String getTableName()
          The name of the table containing the requested item.
 int hashCode()
           
 Boolean isConsistentRead()
          If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.
 void setAttributesToGet(Collection<String> attributesToGet)
          The names of one or more attributes to retrieve.
 void setConsistentRead(Boolean consistentRead)
          If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.
 void setKey(Map.Entry<String,AttributeValue> hashKey, Map.Entry<String,AttributeValue> rangeKey)
          A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
 void setKey(Map<String,AttributeValue> key)
          A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
 void setReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
          If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
 void setReturnConsumedCapacity(String returnConsumedCapacity)
          If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
 void setTableName(String tableName)
          The name of the table containing the requested item.
 String toString()
          Returns a string representation of this object; useful for testing and debugging.
 GetItemRequest withAttributesToGet(Collection<String> attributesToGet)
          The names of one or more attributes to retrieve.
 GetItemRequest withAttributesToGet(String... attributesToGet)
          The names of one or more attributes to retrieve.
 GetItemRequest withConsistentRead(Boolean consistentRead)
          If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.
 GetItemRequest withKey(Map.Entry<String,AttributeValue> hashKey, Map.Entry<String,AttributeValue> rangeKey)
          A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
 GetItemRequest withKey(Map<String,AttributeValue> key)
          A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
 GetItemRequest withReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
          If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
 GetItemRequest withReturnConsumedCapacity(String returnConsumedCapacity)
          If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
 GetItemRequest withTableName(String tableName)
          The name of the table containing the requested item.
 
Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyPrivateRequestParameters, getRequestClientOptions, getRequestCredentials, setRequestCredentials
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GetItemRequest

public GetItemRequest()
Default constructor for a new GetItemRequest object. Callers should use the setter or fluent setter (with...) methods to initialize this object after creating it.


GetItemRequest

public GetItemRequest(String tableName,
                      Map<String,AttributeValue> key)
Constructs a new GetItemRequest object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.

Parameters:
tableName - The name of the table containing the requested item.
key - A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
Method Detail

getTableName

public String getTableName()
The name of the table containing the requested item.

Constraints:
Length: 3 - 255
Pattern: [a-zA-Z0-9_.-]+

Returns:
The name of the table containing the requested item.

setTableName

public void setTableName(String tableName)
The name of the table containing the requested item.

Constraints:
Length: 3 - 255
Pattern: [a-zA-Z0-9_.-]+

Parameters:
tableName - The name of the table containing the requested item.

withTableName

public GetItemRequest withTableName(String tableName)
The name of the table containing the requested item.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 3 - 255
Pattern: [a-zA-Z0-9_.-]+

Parameters:
tableName - The name of the table containing the requested item.

getKey

public Map<String,AttributeValue> getKey()
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

Returns:
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

setKey

public void setKey(Map<String,AttributeValue> key)
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

Parameters:
key - A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

withKey

public GetItemRequest withKey(Map<String,AttributeValue> key)
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

Returns a reference to this object so that method calls can be chained together.

Parameters:
key - A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

setKey

public void setKey(Map.Entry<String,AttributeValue> hashKey,
                   Map.Entry<String,AttributeValue> rangeKey)
            throws IllegalArgumentException
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

This method accepts the hashKey, rangeKey of Key as java.util.Map.Entry objects.

Parameters:
hashKey - Primary hash key.
rangeKey - Primary range key. (null if it a hash-only table)
Throws:
IllegalArgumentException

withKey

public GetItemRequest withKey(Map.Entry<String,AttributeValue> hashKey,
                              Map.Entry<String,AttributeValue> rangeKey)
                       throws IllegalArgumentException
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

This method accepts the hashKey, rangeKey of Key as java.util.Map.Entry objects.

Returns a reference to this object so that method calls can be chained together.

Parameters:
hashKey - Primary hash key.
rangeKey - Primary range key. (null if it a hash-only table)
Throws:
IllegalArgumentException

addKeyEntry

public GetItemRequest addKeyEntry(String key,
                                  AttributeValue value)
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.

The method adds a new key-value pair into Key parameter, and returns a reference to this object so that method calls can be chained together.

Parameters:
key - The key of the entry to be added into Key.
value - The corresponding value of the entry to be added into Key.

clearKeyEntries

public GetItemRequest clearKeyEntries()
Removes all the entries added into Key.

Returns a reference to this object so that method calls can be chained together.


getAttributesToGet

public List<String> getAttributesToGet()
The names of one or more attributes to retrieve. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

Constraints:
Length: 1 -

Returns:
The names of one or more attributes to retrieve. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

setAttributesToGet

public void setAttributesToGet(Collection<String> attributesToGet)
The names of one or more attributes to retrieve. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

Constraints:
Length: 1 -

Parameters:
attributesToGet - The names of one or more attributes to retrieve. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

withAttributesToGet

public GetItemRequest withAttributesToGet(String... attributesToGet)
The names of one or more attributes to retrieve. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 -

Parameters:
attributesToGet - The names of one or more attributes to retrieve. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

withAttributesToGet

public GetItemRequest withAttributesToGet(Collection<String> attributesToGet)
The names of one or more attributes to retrieve. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Length: 1 -

Parameters:
attributesToGet - The names of one or more attributes to retrieve. If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.

isConsistentRead

public Boolean isConsistentRead()
If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.

Returns:
If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.

setConsistentRead

public void setConsistentRead(Boolean consistentRead)
If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.

Parameters:
consistentRead - If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.

withConsistentRead

public GetItemRequest withConsistentRead(Boolean consistentRead)
If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.

Returns a reference to this object so that method calls can be chained together.

Parameters:
consistentRead - If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.

getConsistentRead

public Boolean getConsistentRead()
If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.

Returns:
If set to true, then the operation uses strongly consistent reads; otherwise, eventually consistent reads are used.

getReturnConsumedCapacity

public String getReturnConsumedCapacity()
If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.

Constraints:
Allowed Values: TOTAL, NONE

Returns:
If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
See Also:
ReturnConsumedCapacity

setReturnConsumedCapacity

public void setReturnConsumedCapacity(String returnConsumedCapacity)
If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.

Constraints:
Allowed Values: TOTAL, NONE

Parameters:
returnConsumedCapacity - If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
See Also:
ReturnConsumedCapacity

withReturnConsumedCapacity

public GetItemRequest withReturnConsumedCapacity(String returnConsumedCapacity)
If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: TOTAL, NONE

Parameters:
returnConsumedCapacity - If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
See Also:
ReturnConsumedCapacity

setReturnConsumedCapacity

public void setReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.

Constraints:
Allowed Values: TOTAL, NONE

Parameters:
returnConsumedCapacity - If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
See Also:
ReturnConsumedCapacity

withReturnConsumedCapacity

public GetItemRequest withReturnConsumedCapacity(ReturnConsumedCapacity returnConsumedCapacity)
If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.

Returns a reference to this object so that method calls can be chained together.

Constraints:
Allowed Values: TOTAL, NONE

Parameters:
returnConsumedCapacity - If set to TOTAL, ConsumedCapacity is included in the response; if set to NONE (the default), ConsumedCapacity is not included.
See Also:
ReturnConsumedCapacity

toString

public String toString()
Returns a string representation of this object; useful for testing and debugging.

Overrides:
toString in class Object
Returns:
A string representation of this object.
See Also:
Object.toString()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.