public final class Key extends Object
A key will always have a single partition key value associated with it, and optionally will have a sort key value. The names of the keys themselves are not part of this object.
Modifier and Type | Class and Description |
---|---|
static class |
Key.Builder
Builder for
Key |
Modifier and Type | Method and Description |
---|---|
static Key.Builder |
builder()
Returns a new builder that can be used to construct an instance of this class.
|
boolean |
equals(Object o) |
int |
hashCode() |
Map<String,AttributeValue> |
keyMap(TableSchema<?> tableSchema,
String index)
Return a map of the key elements that can be passed directly to DynamoDb.
|
AttributeValue |
partitionKeyValue()
Get the literal value of the partition key stored in this object.
|
Map<String,AttributeValue> |
primaryKeyMap(TableSchema<?> tableSchema)
Return a map of the key elements that form the primary key of a table that can be passed directly to DynamoDb.
|
Optional<AttributeValue> |
sortKeyValue()
Get the literal value of the sort key stored in this object if available.
|
Key.Builder |
toBuilder()
Converts an existing key into a builder object that can be used to modify its values and then create a new key.
|
public static Key.Builder builder()
Key.Builder
object.public Map<String,AttributeValue> keyMap(TableSchema<?> tableSchema, String index)
tableSchema
- A tableschema to determine the key attribute names from.index
- The name of the index to use when determining the key attribute names.AttributeValue
.public AttributeValue partitionKeyValue()
AttributeValue
representing the literal value of the partition key.public Optional<AttributeValue> sortKeyValue()
AttributeValue
representing the literal value of the sort key, or empty if there
is no sort key value in this Key.public Map<String,AttributeValue> primaryKeyMap(TableSchema<?> tableSchema)
tableSchema
- A tableschema to determine the key attribute names from.AttributeValue
.public Key.Builder toBuilder()
Key.Builder
initialized with the values of this key.Copyright © 2021. All rights reserved.