* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return This is a legacy parameter. Use attributesToGet() {
return attributesToGet;
}
/**
*
* The consistency of a read operation. If set to true
, then a strongly consistent read is used;
* otherwise, an eventually consistent read is used.
*
*
* @return The consistency of a read operation. If set to true
, then a strongly consistent read is
* used; otherwise, an eventually consistent read is used.
*/
public Boolean consistentRead() {
return consistentRead;
}
/**
*
* 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 ProjectionExpression
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.
*
*
* @return 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 ProjectionExpression
* 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.
*/
public String projectionExpression() {
return projectionExpression;
}
/**
*
* 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:
*
*
*
* 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:
*
*
*
*
* 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.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return 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:
*
*
*
* 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:
*
*
*
*
* 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.
*/
public Map expressionAttributeNames() {
return expressionAttributeNames;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(keys());
hashCode = 31 * hashCode + Objects.hashCode(attributesToGet());
hashCode = 31 * hashCode + Objects.hashCode(consistentRead());
hashCode = 31 * hashCode + Objects.hashCode(projectionExpression());
hashCode = 31 * hashCode + Objects.hashCode(expressionAttributeNames());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof KeysAndAttributes)) {
return false;
}
KeysAndAttributes other = (KeysAndAttributes) obj;
return Objects.equals(keys(), other.keys()) && Objects.equals(attributesToGet(), other.attributesToGet())
&& Objects.equals(consistentRead(), other.consistentRead())
&& Objects.equals(projectionExpression(), other.projectionExpression())
&& Objects.equals(expressionAttributeNames(), other.expressionAttributeNames());
}
@Override
public String toString() {
return ToString.builder("KeysAndAttributes").add("Keys", keys()).add("AttributesToGet", attributesToGet())
.add("ConsistentRead", consistentRead()).add("ProjectionExpression", projectionExpression())
.add("ExpressionAttributeNames", expressionAttributeNames()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Keys":
return Optional.ofNullable(clazz.cast(keys()));
case "AttributesToGet":
return Optional.ofNullable(clazz.cast(attributesToGet()));
case "ConsistentRead":
return Optional.ofNullable(clazz.cast(consistentRead()));
case "ProjectionExpression":
return Optional.ofNullable(clazz.cast(projectionExpression()));
case "ExpressionAttributeNames":
return Optional.ofNullable(clazz.cast(expressionAttributeNames()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
KeysAndAttributesMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The primary key attribute values that define the items and the attributes associated with the items.
*
*
* @param keys
* The primary key attribute values that define the items and the attributes associated with the items.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder keys(Collection
*
* 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder projectionExpression(String projectionExpression);
/**
*
* 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:
*
*
*
* 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:
*
*
*
*
* 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.
*
*
* @param 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:
*
*
*
* 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:
*
*
*
*
* 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.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder expressionAttributeNames(Map expressionAttributeNames);
}
static final class BuilderImpl implements Builder {
private List