JavaScript is disabled on your browser.
Skip navigation links

AWS SDK for Java 1.x API Reference - 1.12.795

We announced the upcoming end-of-support for AWS SDK for Java (v1). We recommend that you migrate to AWS SDK for Java v2. For dates, additional details, and information on how to migrate, please refer to the linked announcement.
com.amazonaws.services.dynamodbv2.model

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. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
        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. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
        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. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.

        Parameters:
        tableName - The name of the table containing the requested item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
      • getTableName

        public String getTableName()

        The name of the table containing the requested item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.

        Returns:
        The name of the table containing the requested item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
      • withTableName

        public GetItemRequest withTableName(String tableName)

        The name of the table containing the requested item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.

        Parameters:
        tableName - The name of the table containing the requested item. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
        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.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • getAttributesToGet

        public List<String> getAttributesToGet()

        This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.

        Returns:
        This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
      • setAttributesToGet

        public void setAttributesToGet(Collection<String> attributesToGet)

        This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.

        Parameters:
        attributesToGet - This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
      • withAttributesToGet

        public GetItemRequest withAttributesToGet(String... attributesToGet)

        This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.

        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. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
        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. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.

        Parameters:
        attributesToGet - This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide.
        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
      • 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 are returned. If any of the requested attributes are not found, they do not appear in the result.

        For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.

        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 are returned. If any of the requested attributes are not found, they do not appear in the result.

        For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.

      • 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 are returned. If any of the requested attributes are not found, they do not appear in the result.

        For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.

        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 are returned. If any of the requested attributes are not found, they do not appear in the result.

        For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.

      • 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 are returned. If any of the requested attributes are not found, they do not appear in the result.

        For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.

        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 are returned. If any of the requested attributes are not found, they do not appear in the result.

        For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer Guide.

        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 Specifying 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 Specifying 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 Specifying 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 Specifying 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 Specifying 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 Specifying 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.
        Returns:
        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. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this object.
        See Also:
        Object.toString()
Skip navigation links

AltStyle によって変換されたページ (->オリジナル) /