Class Key.Builder
-
Method Summary
Modifier and TypeMethodDescriptionaddPartitionValue(Object value) Adds a partition key value to this key builder for composite partition keys.addSortValue(Object value) Adds a sort key value to this key builder for composite sort keys.build()Construct aKeyfrom this builder.partitionValue(Number partitionValue) Numeric value to be used for the single partition key.partitionValue(String partitionValue) String value to be used for the single partition key.partitionValue(SdkBytes partitionValue) Binary value to be used for the single partition key.partitionValue(AttributeValue partitionValue) Value to be used for the single partition keypartitionValues(List<AttributeValue> partitionValues) Values to be used for composite partition keysNumeric value to be used for the single sort key.String value to be used for the single sort key.Binary value to be used for the single sort key.sortValue(AttributeValue sortValue) Value to be used for the single sort keysortValues(List<AttributeValue> sortValues) Values to be used for composite sort keys
-
Method Details
-
partitionValues
Values to be used for composite partition keys- Parameters:
partitionValues- list of partition key values (max 4)
-
sortValues
Values to be used for composite sort keys- Parameters:
sortValues- list of sort key values (max 4)
-
addPartitionValue
Adds a partition key value to this key builder for composite partition keys.The value will be automatically converted to a DynamoDB
AttributeValueusing the default attribute converter. Supported types include primitives, strings, numbers, binary data, and other standard Java types that can be mapped to DynamoDB attribute values.For composite partition keys, values are added in order (0, 1, 2, 3) and must match the order defined in the table schema.
- Parameters:
value- the partition key value to add. Must not be null.- Returns:
- this builder instance for method chaining
- Throws:
IllegalArgumentException- if value is null or the value type cannot be converted to an AttributeValue
-
addSortValue
Adds a sort key value to this key builder for composite sort keys.The value will be automatically converted to a DynamoDB
AttributeValueusing the default attribute converter. Supported types include primitives, strings, numbers, binary data, and other standard Java types that can be mapped to DynamoDB attribute values.For composite sort keys, values are added in order (0, 1, 2, 3) and must match the order defined in the table schema.
- Parameters:
value- the sort key value to add. Must not be null.- Returns:
- this builder instance for method chaining
- Throws:
IllegalArgumentException- if value is null or the value type cannot be converted to an AttributeValue
-
partitionValue
Value to be used for the single partition keyUse
partitionValues(List)oraddPartitionValue(Object)for composite key support- Parameters:
partitionValue- partition key value
-
partitionValue
String value to be used for the single partition key. The string will be converted into an AttributeValue of type S.Use
partitionValues(List)oraddPartitionValue(Object)for composite key support- Parameters:
partitionValue- partition key value
-
partitionValue
Numeric value to be used for the single partition key. The number will be converted into an AttributeValue of type N.Use
partitionValues(List)oraddPartitionValue(Object)for composite key support- Parameters:
partitionValue- partition key value
-
partitionValue
Binary value to be used for the single partition key. The input will be converted into an AttributeValue of type B.Use
partitionValues(List)oraddPartitionValue(Object)for composite key support- Parameters:
partitionValue- the bytes to be used for the binary key value.
-
sortValue
Value to be used for the single sort keyUse
sortValues(List)oraddSortValue(Object)for composite key support- Parameters:
sortValue- sort key value
-
sortValue
String value to be used for the single sort key. The string will be converted into an AttributeValue of type S.Use
sortValues(List)oraddSortValue(Object)for composite key support- Parameters:
sortValue- sort key value
-
sortValue
Numeric value to be used for the single sort key. The number will be converted into an AttributeValue of type N.Use
sortValues(List)oraddSortValue(Object)for composite key support- Parameters:
sortValue- sort key value
-
sortValue
Binary value to be used for the single sort key. The input will be converted into an AttributeValue of type B.Use
sortValues(List)oraddSortValue(Object)for composite key support- Parameters:
sortValue- the bytes to be used for the binary key value.
-
build
-