Class StaticTableMetadata.Builder
java.lang.Object
software.amazon.awssdk.enhanced.dynamodb.mapper.StaticTableMetadata.Builder
-
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 (backward compatibility).addIndexPartitionKey(String indexName, String attributeName, AttributeValueType attributeValueType, Order order) Adds information about a partition key associated with a specific index.addIndexSortKey(String indexName, String attributeName, AttributeValueType attributeValueType) Adds information about a non-composite sort key associated with a specific index.addIndexSortKey(String indexName, String attributeName, AttributeValueType attributeValueType, Order order) Adds information about a sort key associated with a specific index.addSearchVectorsHashKey(String indexName, String attributeName) Adds a HASH element to the SearchSchema for the named vector index.addSearchVectorsInlineFilterKey(String indexName, String attributeName) Adds an INLINE_FILTER element to the SearchSchema for the named vector index.addVectorIndex(EnhancedVectorIndex enhancedVectorIndex) Adds metadata for a vector index on this table.addVectorIndex(VectorIndexMetadata vectorIndex) Adds metadata for a vector index on this table.build()Builds an immutable instance ofStaticTableMetadatafrom the values supplied to the builder.markAttributeAsKey(String attributeName, AttributeValueType attributeValueType) Declares a 'key-like' attribute that is not an actual DynamoDB key.setVectorAttribute(String indexName, String attributeName, int dimensions, DistanceFunction distanceFunction) Sets the vector attribute, dimensions, and distance function for the named vector index.
-
Method Details
-
build
Builds an immutable instance ofStaticTableMetadatafrom 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, Order order) 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- theAttributeValueTypeof the partition keyorder- the order of this key in composite keys (-1 for implicit, 0-3 for explicit)
-
addIndexPartitionKey
public StaticTableMetadata.Builder addIndexPartitionKey(String indexName, String attributeName, AttributeValueType attributeValueType) Adds information about a partition key associated with a specific index (backward compatibility).- Parameters:
indexName- the name of the index to associate the partition key withattributeName- the name of the attribute that represents the partition keyattributeValueType- theAttributeValueTypeof the partition key
-
addIndexSortKey
public StaticTableMetadata.Builder addIndexSortKey(String indexName, String attributeName, AttributeValueType attributeValueType, Order order) 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- theAttributeValueTypeof the sort keyorder- the order of this key in composite keys (-1 for implicit, 0-3 for explicit)
-
addIndexSortKey
public StaticTableMetadata.Builder addIndexSortKey(String indexName, String attributeName, AttributeValueType attributeValueType) Adds information about a non-composite 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- theAttributeValueTypeof the sort key
-
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- theAttributeValueTypeof the pseudo-key
-
addSearchVectorsHashKey
Adds a HASH element to the SearchSchema for the named vector index. The vector index metadata is built incrementally from annotations and finalized atbuild()time.- Parameters:
indexName- the name of the vector indexattributeName- the attribute to use as the HASH partition key in the search schema
-
addSearchVectorsInlineFilterKey
public StaticTableMetadata.Builder addSearchVectorsInlineFilterKey(String indexName, String attributeName) Adds an INLINE_FILTER element to the SearchSchema for the named vector index. The vector index metadata is built incrementally from annotations and finalized atbuild()time.- Parameters:
indexName- the name of the vector indexattributeName- the attribute to use as an inline filter in the search schema
-
setVectorAttribute
public StaticTableMetadata.Builder setVectorAttribute(String indexName, String attributeName, int dimensions, DistanceFunction distanceFunction) Sets the vector attribute, dimensions, and distance function for the named vector index. The vector index metadata is built incrementally from annotations and finalized atbuild()time.- Parameters:
indexName- the name of the vector indexattributeName- the attribute that stores the vector embeddingdimensions- the number of vector dimensionsdistanceFunction- the distance function for similarity search
-
addVectorIndex
Adds metadata for a vector index on this table. Vector indexes are distinct from global and local secondary indexes and must not be registered throughaddIndexPartitionKey(String, String, AttributeValueType).- Parameters:
vectorIndex- the vector index metadata to add- Throws:
IllegalArgumentException- if a vector index with the same name has already been added
-
addVectorIndex
Adds metadata for a vector index on this table.- Parameters:
enhancedVectorIndex- the enhanced vector index definition to add- Throws:
IllegalArgumentException- if a vector index with the same name has already been added
-