Class GetItemRequest

    • Constructor Detail

      • 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

        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.

        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

        public GetItemRequest​(String tableName,
                              Map<String,​AttributeValue> key,
                              Boolean consistentRead)
        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 to true , then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
    • Method Detail

      • setTableName

        public void setTableName​(String tableName)

        The name of the table containing the requested item.

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

        public String getTableName()

        The name of the table containing the requested item.

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

        public GetItemRequest withTableName​(String tableName)

        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

        public Map<String,​AttributeValue> 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

        public void setKey​(Map<String,​AttributeValue> 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.

        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

        public GetItemRequest withKey​(Map<String,​AttributeValue> 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.

        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.
      • clearKeyEntries

        public GetItemRequest clearKeyEntries()
        Removes all the entries added into Key. <p> Returns a reference to this object so that method calls can be chained together.
      • getAttributesToGet

        public List<String> 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

        public void setAttributesToGet​(Collection<String> 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.

        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

        public GetItemRequest withAttributesToGet​(String... 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.

        NOTE: This method appends the values to the existing list (if any). Use setAttributesToGet(java.util.Collection) or withAttributesToGet(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

        public GetItemRequest withAttributesToGet​(Collection<String> 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.

        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

        public void setConsistentRead​(Boolean consistentRead)

        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 to true , then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
      • getConsistentRead

        public Boolean 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

        public GetItemRequest withConsistentRead​(Boolean consistentRead)

        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 to true , 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

        public Boolean 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

        public void setReturnConsumedCapacity​(String returnConsumedCapacity)
        Parameters:
        returnConsumedCapacity -
        See Also:
        ReturnConsumedCapacity
      • withReturnConsumedCapacity

        public GetItemRequest withReturnConsumedCapacity​(String returnConsumedCapacity)
        Parameters:
        returnConsumedCapacity -
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        ReturnConsumedCapacity
      • withReturnConsumedCapacity

        public GetItemRequest withReturnConsumedCapacity​(ReturnConsumedCapacity returnConsumedCapacity)
        Parameters:
        returnConsumedCapacity -
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        ReturnConsumedCapacity
      • setProjectionExpression

        public void setProjectionExpression​(String 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.

        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

        public String 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

        public GetItemRequest withProjectionExpression​(String 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.

        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

        public Map<String,​String> 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

        public void setExpressionAttributeNames​(Map<String,​String> 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.

        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

        public GetItemRequest withExpressionAttributeNames​(Map<String,​String> 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.

        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.
      • clearExpressionAttributeNamesEntries

        public GetItemRequest 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,​AttributeValue> rangeKey)
                    throws IllegalArgumentException
        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,​AttributeValue> rangeKey)
                               throws IllegalArgumentException
        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

        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