com.amazonaws.services.dynamodb.model
Class UpdateItemRequest

java.lang.Object
  extended by com.amazonaws.AmazonWebServiceRequest
      extended by com.amazonaws.services.dynamodb.model.UpdateItemRequest

public class UpdateItemRequest
extends AmazonWebServiceRequest

Container for the parameters to the UpdateItem operation.

Edits an existing item's attributes.

You can perform a conditional update (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has certain expected attribute values).

See Also:
AmazonDynamoDB.updateItem(UpdateItemRequest)

Constructor Summary
UpdateItemRequest()
          Default constructor for a new UpdateItemRequest object.
UpdateItemRequest(String tableName, Key key, Map<String,AttributeValueUpdate> attributeUpdates)
          Constructs a new UpdateItemRequest object.
 
Method Summary
 boolean equals(Object obj)
           
 Map<String,AttributeValueUpdate> getAttributeUpdates()
          Map of attribute name to the new value and action for the update.
 Map<String,ExpectedAttributeValue> getExpected()
          Designates an attribute for a conditional modification.
 Key getKey()
          The primary key that uniquely identifies each item in a table.
 String getReturnValues()
          Use this parameter if you want to get the attribute name-value pairs before or after they are modified.
 String getTableName()
          The name of the table in which you want to update an item.
 int hashCode()
           
 void setAttributeUpdates(Map<String,AttributeValueUpdate> attributeUpdates)
          Map of attribute name to the new value and action for the update.
 void setExpected(Map<String,ExpectedAttributeValue> expected)
          Designates an attribute for a conditional modification.
 void setKey(Key key)
          The primary key that uniquely identifies each item in a table.
 void setReturnValues(ReturnValue returnValues)
          Use this parameter if you want to get the attribute name-value pairs before or after they are modified.
 void setReturnValues(String returnValues)
          Use this parameter if you want to get the attribute name-value pairs before or after they are modified.
 void setTableName(String tableName)
          The name of the table in which you want to update an item.
 String toString()
          Returns a string representation of this object; useful for testing and debugging.
 UpdateItemRequest withAttributeUpdates(Map<String,AttributeValueUpdate> attributeUpdates)
          Map of attribute name to the new value and action for the update.
 UpdateItemRequest withExpected(Map<String,ExpectedAttributeValue> expected)
          Designates an attribute for a conditional modification.
 UpdateItemRequest withKey(Key key)
          The primary key that uniquely identifies each item in a table.
 UpdateItemRequest withReturnValues(ReturnValue returnValues)
          Use this parameter if you want to get the attribute name-value pairs before or after they are modified.
 UpdateItemRequest withReturnValues(String returnValues)
          Use this parameter if you want to get the attribute name-value pairs before or after they are modified.
 UpdateItemRequest withTableName(String tableName)
          The name of the table in which you want to update an item.
 
Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyPrivateRequestParameters, getDelegationToken, getRequestClientOptions, getRequestCredentials, setDelegationToken, setRequestCredentials
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UpdateItemRequest

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


UpdateItemRequest

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

Parameters:
tableName - The name of the table in which you want to update an item. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).
key - The primary key that uniquely identifies each item in a table. A primary key can be a one attribute (hash) primary key or a two attribute (hash-and-range) primary key.
attributeUpdates - Map of attribute name to the new value and action for the update. The attribute names specify the attributes to modify, and cannot contain any primary key attributes.
Method Detail

getTableName

public String getTableName()
The name of the table in which you want to update an item. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).

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

Returns:
The name of the table in which you want to update an item. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).

setTableName

public void setTableName(String tableName)
The name of the table in which you want to update an item. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).

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

Parameters:
tableName - The name of the table in which you want to update an item. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).

withTableName

public UpdateItemRequest withTableName(String tableName)
The name of the table in which you want to update an item. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).

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 in which you want to update an item. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).
Returns:
A reference to this updated object so that method calls can be chained together.

getKey

public Key getKey()
The primary key that uniquely identifies each item in a table. A primary key can be a one attribute (hash) primary key or a two attribute (hash-and-range) primary key.

Returns:
The primary key that uniquely identifies each item in a table. A primary key can be a one attribute (hash) primary key or a two attribute (hash-and-range) primary key.

setKey

public void setKey(Key key)
The primary key that uniquely identifies each item in a table. A primary key can be a one attribute (hash) primary key or a two attribute (hash-and-range) primary key.

Parameters:
key - The primary key that uniquely identifies each item in a table. A primary key can be a one attribute (hash) primary key or a two attribute (hash-and-range) primary key.

withKey

public UpdateItemRequest withKey(Key key)
The primary key that uniquely identifies each item in a table. A primary key can be a one attribute (hash) primary key or a two attribute (hash-and-range) primary key.

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

Parameters:
key - The primary key that uniquely identifies each item in a table. A primary key can be a one attribute (hash) primary key or a two attribute (hash-and-range) primary key.
Returns:
A reference to this updated object so that method calls can be chained together.

getAttributeUpdates

public Map<String,AttributeValueUpdate> getAttributeUpdates()
Map of attribute name to the new value and action for the update. The attribute names specify the attributes to modify, and cannot contain any primary key attributes.

Returns:
Map of attribute name to the new value and action for the update. The attribute names specify the attributes to modify, and cannot contain any primary key attributes.

setAttributeUpdates

public void setAttributeUpdates(Map<String,AttributeValueUpdate> attributeUpdates)
Map of attribute name to the new value and action for the update. The attribute names specify the attributes to modify, and cannot contain any primary key attributes.

Parameters:
attributeUpdates - Map of attribute name to the new value and action for the update. The attribute names specify the attributes to modify, and cannot contain any primary key attributes.

withAttributeUpdates

public UpdateItemRequest withAttributeUpdates(Map<String,AttributeValueUpdate> attributeUpdates)
Map of attribute name to the new value and action for the update. The attribute names specify the attributes to modify, and cannot contain any primary key attributes.

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

Parameters:
attributeUpdates - Map of attribute name to the new value and action for the update. The attribute names specify the attributes to modify, and cannot contain any primary key attributes.
Returns:
A reference to this updated object so that method calls can be chained together.

getExpected

public Map<String,ExpectedAttributeValue> getExpected()
Designates an attribute for a conditional modification. The Expected parameter allows you to provide an attribute name, and whether or not Amazon DynamoDB should check to see if the attribute has a particular value before modifying it.

Returns:
Designates an attribute for a conditional modification. The Expected parameter allows you to provide an attribute name, and whether or not Amazon DynamoDB should check to see if the attribute has a particular value before modifying it.

setExpected

public void setExpected(Map<String,ExpectedAttributeValue> expected)
Designates an attribute for a conditional modification. The Expected parameter allows you to provide an attribute name, and whether or not Amazon DynamoDB should check to see if the attribute has a particular value before modifying it.

Parameters:
expected - Designates an attribute for a conditional modification. The Expected parameter allows you to provide an attribute name, and whether or not Amazon DynamoDB should check to see if the attribute has a particular value before modifying it.

withExpected

public UpdateItemRequest withExpected(Map<String,ExpectedAttributeValue> expected)
Designates an attribute for a conditional modification. The Expected parameter allows you to provide an attribute name, and whether or not Amazon DynamoDB should check to see if the attribute has a particular value before modifying it.

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

Parameters:
expected - Designates an attribute for a conditional modification. The Expected parameter allows you to provide an attribute name, and whether or not Amazon DynamoDB should check to see if the attribute has a particular value before modifying it.
Returns:
A reference to this updated object so that method calls can be chained together.

getReturnValues

public String getReturnValues()
Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.

Constraints:
Allowed Values: NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW

Returns:
Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.
  • NONE: Nothing is returned.
  • ALL_OLD: Returns the attributes of the item as they were before the operation.
  • UPDATED_OLD: Returns the values of the updated attributes, only, as they were before the operation.
  • ALL_NEW: Returns all the attributes and their new values after the operation.
  • UPDATED_NEW: Returns the values of the updated attributes, only, as they are after the operation.
See Also:
ReturnValue

setReturnValues

public void setReturnValues(String returnValues)
Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.

Constraints:
Allowed Values: NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW

Parameters:
returnValues - Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.
  • NONE: Nothing is returned.
  • ALL_OLD: Returns the attributes of the item as they were before the operation.
  • UPDATED_OLD: Returns the values of the updated attributes, only, as they were before the operation.
  • ALL_NEW: Returns all the attributes and their new values after the operation.
  • UPDATED_NEW: Returns the values of the updated attributes, only, as they are after the operation.
See Also:
ReturnValue

withReturnValues

public UpdateItemRequest withReturnValues(String returnValues)
Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.

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

Constraints:
Allowed Values: NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW

Parameters:
returnValues - Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.
  • NONE: Nothing is returned.
  • ALL_OLD: Returns the attributes of the item as they were before the operation.
  • UPDATED_OLD: Returns the values of the updated attributes, only, as they were before the operation.
  • ALL_NEW: Returns all the attributes and their new values after the operation.
  • UPDATED_NEW: Returns the values of the updated attributes, only, as they are after the operation.
Returns:
A reference to this updated object so that method calls can be chained together.
See Also:
ReturnValue

setReturnValues

public void setReturnValues(ReturnValue returnValues)
Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.

Constraints:
Allowed Values: NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW

Parameters:
returnValues - Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.
  • NONE: Nothing is returned.
  • ALL_OLD: Returns the attributes of the item as they were before the operation.
  • UPDATED_OLD: Returns the values of the updated attributes, only, as they were before the operation.
  • ALL_NEW: Returns all the attributes and their new values after the operation.
  • UPDATED_NEW: Returns the values of the updated attributes, only, as they are after the operation.
See Also:
ReturnValue

withReturnValues

public UpdateItemRequest withReturnValues(ReturnValue returnValues)
Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.

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

Constraints:
Allowed Values: NONE, ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW

Parameters:
returnValues - Use this parameter if you want to get the attribute name-value pairs before or after they are modified. For PUT operations, the possible parameter values are NONE (default) or ALL_OLD. For update operations, the possible parameter values are NONE (default) or ALL_OLD, UPDATED_OLD, ALL_NEW or UPDATED_NEW.
  • NONE: Nothing is returned.
  • ALL_OLD: Returns the attributes of the item as they were before the operation.
  • UPDATED_OLD: Returns the values of the updated attributes, only, as they were before the operation.
  • ALL_NEW: Returns all the attributes and their new values after the operation.
  • UPDATED_NEW: Returns the values of the updated attributes, only, as they are after the operation.
Returns:
A reference to this updated object so that method calls can be chained together.
See Also:
ReturnValue

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.