Class StaticTableMetadata.Builder
java.lang.Object
software.amazon.awssdk.enhanced.dynamodb.mapper.StaticTableMetadata.Builder
- Enclosing class:
StaticTableMetadata
Builder for
StaticTableMetadata
-
Method Summary
Modifier and TypeMethodDescriptionaddCustomMetadataObject
(String key, Object object) Adds a single custom object to the metadata, keyed by a string.addCustomMetadataObject
(String key, Collection<Object> objects) Adds collection of custom objects to the custom metadata, keyed by a string.addCustomMetadataObject
(String key, Map<Object, Object> objectMap) Adds map of custom objects to the custom metadata, keyed by a string.addIndexPartitionKey
(String indexName, String attributeName, AttributeValueType attributeValueType) Adds information about a partition key associated with a specific index.addIndexSortKey
(String indexName, String attributeName, AttributeValueType attributeValueType) Adds information about a sort key associated with a specific index.build()
Builds an immutable instance ofStaticTableMetadata
from the values supplied to the builder.markAttributeAsKey
(String attributeName, AttributeValueType attributeValueType) Declares a 'key-like' attribute that is not an actual DynamoDB key.
-
Method Details
-
build
Builds an immutable instance ofStaticTableMetadata
from the values supplied to the builder. -
addCustomMetadataObject
Adds a single custom object to the metadata, keyed by a string. Attempting to add a metadata object with a key that matches one that has already been added will cause an exception to be thrown.- Parameters:
key
- a string key that will be used to retrieve the custom metadataobject
- an object that will be stored in the custom metadata map- Throws:
IllegalArgumentException
- if the custom metadata map already contains an entry with the same key
-
addCustomMetadataObject
Adds collection of custom objects to the custom metadata, keyed by a string. If a collection is already present then it will append the newly added collection to the existing collection.- Parameters:
key
- a string key that will be used to retrieve the custom metadataobjects
- Collection of objects that will be stored in the custom metadata map
-
addCustomMetadataObject
public StaticTableMetadata.Builder addCustomMetadataObject(String key, Map<Object, Object> objectMap) Adds map of custom objects to the custom metadata, keyed by a string. If a map is already present then it will merge the new map with the existing map.- Parameters:
key
- a string key that will be used to retrieve the custom metadataobjectMap
- Map of objects that will be stored in the custom metadata map
-
addIndexPartitionKey
public StaticTableMetadata.Builder addIndexPartitionKey(String indexName, String attributeName, AttributeValueType attributeValueType) Adds information about a partition key associated with a specific index.- Parameters:
indexName
- the name of the index to associate the partition key withattributeName
- the name of the attribute that represents the partition keyattributeValueType
- theAttributeValueType
of the partition key- Throws:
IllegalArgumentException
- if a partition key has already been defined for this index
-
addIndexSortKey
public StaticTableMetadata.Builder addIndexSortKey(String indexName, String attributeName, AttributeValueType attributeValueType) Adds information about a sort key associated with a specific index.- Parameters:
indexName
- the name of the index to associate the sort key withattributeName
- the name of the attribute that represents the sort keyattributeValueType
- theAttributeValueType
of the sort key- Throws:
IllegalArgumentException
- if a sort key has already been defined for this index
-
markAttributeAsKey
public StaticTableMetadata.Builder markAttributeAsKey(String attributeName, AttributeValueType attributeValueType) Declares a 'key-like' attribute that is not an actual DynamoDB key. These pseudo-keys can then be recognized by extensions and treated appropriately, often being protected from manipulations as those would alter the meaning of the record. One example usage of this is a 'versioned record attribute': although the version is not part of the primary key of the record, it effectively serves as such.- Parameters:
attributeName
- the name of the attribute to mark as a pseudo-keyattributeValueType
- theAttributeValueType
of the pseudo-key
-