An object that represents a key that can be used to either identify a specific record or form part of a query
conditional. Keys are literal and hence not typed, and can be re-used in commands for different modelled types if
the literal values are to be the same.
A key will always have partition key values associated with it, and optionally will have sort key values.
Supports up to 4 partition keys and 4 sort keys.
The names of the keys themselves are not part of this object.
Nested Class Summary
Nested Classes
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
Returns a new builder that can be used to construct an instance of this class.
boolean
int
Return a map of the key elements that can be passed directly to DynamoDb.
Get the literal value of the single partition key stored in this object.
Get the literal values of all composite partition keys stored in this object.
Return a map of the key elements that form the primary key of a table that can be passed directly to DynamoDb.
Get the literal value of the single sort key stored in this object if available.
Get the literal values of all composite sort keys stored in this object.
Converts an existing key into a builder object that can be used to modify its values and then create a new key.
Field Details
MAX_KEYS
public static final int MAX_KEYS
See Also:
Method Details
builder
Returns a new builder that can be used to construct an instance of this class.
Returns:
A newly initialized Key.Builder object.
keyMap
Return a map of the key elements that can be passed directly to DynamoDb.
Parameters:
tableSchema - A table schema to determine the key attribute names from.
index - The name of the index to use when determining the key attribute names.
Returns:
A map of attribute names to AttributeValue .
partitionKeyValues
Get the literal values of all composite partition keys stored in this object.
Returns:
A list of AttributeValue representing the literal values of the partition keys.
sortKeyValues
Get the literal values of all composite sort keys stored in this object.
Returns:
A list of AttributeValue representing the literal values of the sort keys.
partitionKeyValue
Get the literal value of the single partition key stored in this object.
Use partitionKeyValues() for composite key support
Returns:
An AttributeValue representing the literal value of the first partition key.
sortKeyValue
Get the literal value of the single sort key stored in this object if available.
Use sortKeyValues() for composite key support
Returns:
An optional AttributeValue representing the literal value of the first sort key, or empty if there is no
sort key value in this Key.
primaryKeyMap
Return a map of the key elements that form the primary key of a table that can be passed directly to DynamoDb.
Parameters:
tableSchema - A table schema to determine the key attribute names from.
Returns:
A map of attribute names to AttributeValue .
toBuilder
Converts an existing key into a builder object that can be used to modify its values and then create a new key.
Returns:
A Key.Builder initialized with the values of this key.