Class GetItemRequest
- All Implemented Interfaces:
ReadLimitInfo
,Serializable
,Cloneable
Represents the input of a GetItem operation.
- See Also:
-
Field Summary
Fields inherited from class com.amazonaws.AmazonWebServiceRequest
NOOP
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for GetItemRequest object.GetItemRequest
(String tableName, Map<String, AttributeValue> key) Constructs a new GetItemRequest object.GetItemRequest
(String tableName, Map<String, AttributeValue> key, Boolean consistentRead) Constructs a new GetItemRequest object. -
Method Summary
Modifier and TypeMethodDescriptionaddExpressionAttributeNamesEntry
(String key, String value) addKeyEntry
(String key, AttributeValue value) Removes all the entries added into ExpressionAttributeNames.Removes all the entries added into Key.clone()
Creates a shallow clone of this request.boolean
Determines the read consistency model: If set totrue
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.One or more substitution tokens for attribute names in an expression.getKey()
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.A string that identifies one or more attributes to retrieve from the table.The name of the table containing the requested item.int
hashCode()
Determines the read consistency model: If set totrue
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.void
setAttributesToGet
(Collection<String> attributesToGet) void
setConsistentRead
(Boolean consistentRead) Determines the read consistency model: If set totrue
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.void
setExpressionAttributeNames
(Map<String, String> expressionAttributeNames) One or more substitution tokens for attribute names in an expression.void
setKey
(Map.Entry<String, AttributeValue> hashKey, Map.Entry<String, AttributeValue> rangeKey) Set the hash and range key attributes of the item.void
setKey
(Map<String, AttributeValue> key) A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.void
setProjectionExpression
(String projectionExpression) A string that identifies one or more attributes to retrieve from the table.void
setReturnConsumedCapacity
(ReturnConsumedCapacity returnConsumedCapacity) void
setReturnConsumedCapacity
(String returnConsumedCapacity) void
setTableName
(String tableName) The name of the table containing the requested item.toString()
Returns a string representation of this object; useful for testing and debugging.withAttributesToGet
(String... attributesToGet) withAttributesToGet
(Collection<String> attributesToGet) withConsistentRead
(Boolean consistentRead) Determines the read consistency model: If set totrue
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.withExpressionAttributeNames
(Map<String, String> expressionAttributeNames) One or more substitution tokens for attribute names in an expression.withKey
(Map.Entry<String, AttributeValue> hashKey, Map.Entry<String, AttributeValue> rangeKey) Set the hash and range key attributes of the item.withKey
(Map<String, AttributeValue> key) A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.withProjectionExpression
(String projectionExpression) A string that identifies one or more attributes to retrieve from the table.withReturnConsumedCapacity
(ReturnConsumedCapacity returnConsumedCapacity) withReturnConsumedCapacity
(String returnConsumedCapacity) withTableName
(String tableName) The name of the table containing the requested item.Methods inherited from class com.amazonaws.AmazonWebServiceRequest
copyBaseTo, getCloneRoot, getCloneSource, getCustomQueryParameters, getCustomRequestHeaders, getGeneralProgressListener, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestCredentialsProvider, getRequestMetricCollector, getSdkClientExecutionTimeout, getSdkRequestTimeout, putCustomQueryParameter, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestCredentialsProvider, setRequestMetricCollector, setSdkClientExecutionTimeout, setSdkRequestTimeout, withGeneralProgressListener, withRequestMetricCollector, withSdkClientExecutionTimeout, withSdkRequestTimeout
-
Constructor Details
-
GetItemRequest
public GetItemRequest()Default constructor for GetItemRequest object. Callers should use the setter or fluent setter (with...) methods to initialize the object after creating it. -
GetItemRequest
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.For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
-
GetItemRequest
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.For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
consistentRead
- Determines the read consistency model: If set totrue
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
-
-
Method Details
-
setTableName
The name of the table containing the requested item.
- Parameters:
tableName
- The name of the table containing the requested item.
-
getTableName
The name of the table containing the requested item.
- Returns:
- The name of the table containing the requested item.
-
withTableName
The name of the table containing the requested item.
- Parameters:
tableName
- The name of the table containing the requested item.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
getKey
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
- Returns:
- A map of attribute names to AttributeValue objects,
representing the primary key of the item to retrieve.
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
-
setKey
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
- Parameters:
key
- A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
-
withKey
A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
- Parameters:
key
- A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve.For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
addKeyEntry
-
clearKeyEntries
Removes all the entries added into Key. <p> Returns a reference to this object so that method calls can be chained together. -
getAttributesToGet
This is a legacy parameter, for backward compatibility. New applications should use ProjectionExpression instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a ValidationException exception.
This parameter allows you to retrieve attributes of type List or Map; however, it cannot retrieve individual elements within a List or a Map.
The names of one or more attributes to retrieve. If no attribute names are provided, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.
- Returns:
This is a legacy parameter, for backward compatibility. New applications should use ProjectionExpression instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a ValidationException exception.
This parameter allows you to retrieve attributes of type List or Map; however, it cannot retrieve individual elements within a List or a Map.
The names of one or more attributes to retrieve. If no attribute names are provided, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.
-
setAttributesToGet
This is a legacy parameter, for backward compatibility. New applications should use ProjectionExpression instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a ValidationException exception.
This parameter allows you to retrieve attributes of type List or Map; however, it cannot retrieve individual elements within a List or a Map.
The names of one or more attributes to retrieve. If no attribute names are provided, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.
- Parameters:
attributesToGet
-This is a legacy parameter, for backward compatibility. New applications should use ProjectionExpression instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a ValidationException exception.
This parameter allows you to retrieve attributes of type List or Map; however, it cannot retrieve individual elements within a List or a Map.
The names of one or more attributes to retrieve. If no attribute names are provided, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.
-
withAttributesToGet
This is a legacy parameter, for backward compatibility. New applications should use ProjectionExpression instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a ValidationException exception.
This parameter allows you to retrieve attributes of type List or Map; however, it cannot retrieve individual elements within a List or a Map.
The names of one or more attributes to retrieve. If no attribute names are provided, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.
NOTE: This method appends the values to the existing list (if any). Use
setAttributesToGet(java.util.Collection)
orwithAttributesToGet(java.util.Collection)
if you want to override the existing values.- Parameters:
attributesToGet
-This is a legacy parameter, for backward compatibility. New applications should use ProjectionExpression instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a ValidationException exception.
This parameter allows you to retrieve attributes of type List or Map; however, it cannot retrieve individual elements within a List or a Map.
The names of one or more attributes to retrieve. If no attribute names are provided, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
withAttributesToGet
This is a legacy parameter, for backward compatibility. New applications should use ProjectionExpression instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a ValidationException exception.
This parameter allows you to retrieve attributes of type List or Map; however, it cannot retrieve individual elements within a List or a Map.
The names of one or more attributes to retrieve. If no attribute names are provided, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.
- Parameters:
attributesToGet
-This is a legacy parameter, for backward compatibility. New applications should use ProjectionExpression instead. Do not combine legacy parameters and expression parameters in a single API call; otherwise, DynamoDB will return a ValidationException exception.
This parameter allows you to retrieve attributes of type List or Map; however, it cannot retrieve individual elements within a List or a Map.
The names of one or more attributes to retrieve. If no attribute names are provided, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
Note that AttributesToGet has no effect on provisioned throughput consumption. DynamoDB determines capacity units consumed based on item size, not on the amount of data that is returned to an application.
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
setConsistentRead
Determines the read consistency model: If set to
true
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.- Parameters:
consistentRead
- Determines the read consistency model: If set totrue
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
-
getConsistentRead
Determines the read consistency model: If set to
true
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.- Returns:
- Determines the read consistency model: If set to
true
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
-
withConsistentRead
Determines the read consistency model: If set to
true
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.- Parameters:
consistentRead
- Determines the read consistency model: If set totrue
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
isConsistentRead
Determines the read consistency model: If set to
true
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.- Returns:
- Determines the read consistency model: If set to
true
, then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
-
setReturnConsumedCapacity
- Parameters:
returnConsumedCapacity
-- See Also:
-
getReturnConsumedCapacity
- Returns:
- See Also:
-
withReturnConsumedCapacity
- Parameters:
returnConsumedCapacity
-- Returns:
- Returns a reference to this object so that method calls can be chained together.
- See Also:
-
setReturnConsumedCapacity
- Parameters:
returnConsumedCapacity
-- See Also:
-
withReturnConsumedCapacity
- Parameters:
returnConsumedCapacity
-- Returns:
- Returns a reference to this object so that method calls can be chained together.
- See Also:
-
setProjectionExpression
A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
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.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
ProjectionExpression replaces the legacy AttributesToGet parameter.
- Parameters:
projectionExpression
- A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.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.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
ProjectionExpression replaces the legacy AttributesToGet parameter.
-
getProjectionExpression
A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
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.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
ProjectionExpression replaces the legacy AttributesToGet parameter.
- Returns:
- A string that identifies one or more attributes to retrieve from
the table. These attributes can include scalars, sets, or
elements of a JSON document. The attributes in the expression
must be separated by commas.
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.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
ProjectionExpression replaces the legacy AttributesToGet parameter.
-
withProjectionExpression
A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
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.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
ProjectionExpression replaces the legacy AttributesToGet parameter.
- Parameters:
projectionExpression
- A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.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.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
ProjectionExpression replaces the legacy AttributesToGet parameter.
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
getExpressionAttributeNames
One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames:
-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
-
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames:
-
{"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
-
#P = :val
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
- Returns:
- One or more substitution tokens for attribute names in an
expression. The following are some use cases for using
ExpressionAttributeNames:
-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
-
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames:
-
{"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
-
#P = :val
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
-
-
-
setExpressionAttributeNames
One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames:
-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
-
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames:
-
{"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
-
#P = :val
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
- Parameters:
expressionAttributeNames
- One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames:-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
-
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames:
-
{"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
-
#P = :val
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
-
-
-
withExpressionAttributeNames
One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames:
-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
-
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames:
-
{"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
-
#P = :val
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
- Parameters:
expressionAttributeNames
- One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames:-
To access an attribute whose name conflicts with a DynamoDB reserved word.
-
To create a placeholder for repeating occurrences of an attribute name in an expression.
-
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
-
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide). To work around this, you could specify the following for ExpressionAttributeNames:
-
{"#P":"Percentile"}
You could then use this substitution in an expression, as in this example:
-
#P = :val
Tokens that begin with the : character are expression attribute values, which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide.
-
- Returns:
- Returns a reference to this object so that method calls can be chained together.
-
-
addExpressionAttributeNamesEntry
-
clearExpressionAttributeNamesEntries
Removes all the entries added into ExpressionAttributeNames. <p> Returns a reference to this object so that method calls can be chained together. -
setKey
public void setKey(Map.Entry<String, AttributeValue> hashKey, Map.Entry<String, throws IllegalArgumentExceptionAttributeValue> rangeKey) Set the hash and range key attributes of the item.For a hash-only table, you only need to provide the hash attribute. For a hash-and-range table, you must provide both.
- Parameters:
hashKey
- a map entry including the name and value of the primary hash key.rangeKey
- a map entry including the name and value of the primary range key, or null if it is a hash-only table.- Throws:
IllegalArgumentException
-
withKey
public GetItemRequest withKey(Map.Entry<String, AttributeValue> hashKey, Map.Entry<String, throws IllegalArgumentExceptionAttributeValue> rangeKey) Set the hash and range key attributes of the item.For a hash-only table, you only need to provide the hash attribute. For a hash-and-range table, you must provide both.
Returns a reference to this object so that method calls can be chained together.
- Parameters:
hashKey
- a map entry including the name and value of the primary hash key.rangeKey
- a map entry including the name and value of the primary range key, or null if it is a hash-only table.- Throws:
IllegalArgumentException
-
toString
Returns a string representation of this object; useful for testing and debugging. -
equals
-
hashCode
public int hashCode() -
clone
Description copied from class:AmazonWebServiceRequest
Creates a shallow clone of this request. Explicitly does not clone the deep structure of the request object.- Overrides:
clone
in classAmazonWebServiceRequest
- See Also:
-