Class StaticTableMetadata.Builder

java.lang.Object
software.amazon.awssdk.enhanced.dynamodb.mapper.StaticTableMetadata.Builder
Enclosing class:
StaticTableMetadata

@NotThreadSafe public static class StaticTableMetadata.Builder extends Object
  • Method Details

    • build

      public StaticTableMetadata build()
      Builds an immutable instance of StaticTableMetadata from the values supplied to the builder.
    • addCustomMetadataObject

      public StaticTableMetadata.Builder addCustomMetadataObject(String key, Object object)
      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 metadata
      object - 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

      public StaticTableMetadata.Builder addCustomMetadataObject(String key, Collection<Object> objects)
      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 metadata
      objects - 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 metadata
      objectMap - 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 with
      attributeName - the name of the attribute that represents the partition key
      attributeValueType - the AttributeValueType of the partition key
      order - 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 with
      attributeName - the name of the attribute that represents the partition key
      attributeValueType - the AttributeValueType of 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 with
      attributeName - the name of the attribute that represents the sort key
      attributeValueType - the AttributeValueType of the sort key
      order - 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 with
      attributeName - the name of the attribute that represents the sort key
      attributeValueType - the AttributeValueType of 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-key
      attributeValueType - the AttributeValueType of the pseudo-key
    • addSearchVectorsHashKey

      public StaticTableMetadata.Builder addSearchVectorsHashKey(String indexName, String attributeName)
      Adds a HASH element to the SearchSchema for the named vector index. The vector index metadata is built incrementally from annotations and finalized at build() time.
      Parameters:
      indexName - the name of the vector index
      attributeName - 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 at build() time.
      Parameters:
      indexName - the name of the vector index
      attributeName - 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 at build() time.
      Parameters:
      indexName - the name of the vector index
      attributeName - the attribute that stores the vector embedding
      dimensions - the number of vector dimensions
      distanceFunction - the distance function for similarity search
    • addVectorIndex

      public StaticTableMetadata.Builder addVectorIndex(VectorIndexMetadata vectorIndex)
      Adds metadata for a vector index on this table. Vector indexes are distinct from global and local secondary indexes and must not be registered through addIndexPartitionKey(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

      public StaticTableMetadata.Builder addVectorIndex(EnhancedVectorIndex enhancedVectorIndex)
      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