public final class StaticTableMetadata extends Object implements TableMetadata
TableMetadata
that can be constructed directly using literal values for metadata objects.
This implementation is used by StaticTableSchema
and associated interfaces such as StaticAttributeTag
and StaticTableTag
which permit manipulation of the table metadata.Modifier and Type | Class and Description |
---|---|
static class |
StaticTableMetadata.Builder
Builder for
StaticTableMetadata |
Modifier and Type | Method and Description |
---|---|
Collection<String> |
allKeys()
Returns all the names of attributes associated with any index (primary or secondary) known for this table.
|
static StaticTableMetadata.Builder |
builder()
Create a new builder for this class
|
Map<String,Object> |
customMetadata()
Returns all custom metadata for this table.
|
<T> Optional<T> |
customMetadataObject(String key,
Class<? extends T> objectClass)
Returns a custom metadata object.
|
boolean |
equals(Object o) |
int |
hashCode() |
Collection<String> |
indexKeys(String indexName)
Returns all the names of attributes associated with the keys of a specified index.
|
String |
indexPartitionKey(String indexName)
Returns the attribute name of the partition key for an index.
|
Optional<String> |
indexSortKey(String indexName)
Returns the attribute name of the sort key for an index.
|
Collection<IndexMetadata> |
indices()
Returns metadata about all the known indices for this table.
|
Collection<KeyAttributeMetadata> |
keyAttributes()
Returns metadata about all the known 'key' attributes for this table, such as primary and secondary index keys,
or any other attribute that forms part of the structure of the table.
|
Optional<ScalarAttributeType> |
scalarAttributeType(String keyAttribute)
Returns the DynamoDb scalar attribute type associated with a key attribute if one is applicable.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
primaryIndexName, primaryKeys, primaryPartitionKey, primarySortKey
public static StaticTableMetadata.Builder builder()
StaticTableMetadata.Builder
for building a StaticTableMetadata
object.public <T> Optional<T> customMetadataObject(String key, Class<? extends T> objectClass)
TableMetadata
customMetadataObject
in interface TableMetadata
T
- The flexible type for the object being returned. The compiler will typically infer this.key
- A unique key for the metadata object. This namespace is shared by all extensions, so it is
recommended best practice to qualify it with the name of your extension.objectClass
- The java class that the object will be cast to before returning. An exception will be
thrown if the stored object cannot be cast to this class.public String indexPartitionKey(String indexName)
TableMetadata
indexPartitionKey
in interface TableMetadata
indexName
- The name of the index.public Optional<String> indexSortKey(String indexName)
TableMetadata
indexSortKey
in interface TableMetadata
indexName
- The name of the index.public Collection<String> indexKeys(String indexName)
TableMetadata
indexKeys
in interface TableMetadata
indexName
- The name of the index.public Collection<String> allKeys()
TableMetadata
allKeys
in interface TableMetadata
public Collection<IndexMetadata> indices()
TableMetadata
indices
in interface TableMetadata
IndexMetadata
containing information about the indices.public Map<String,Object> customMetadata()
TableMetadata
Object
.
This method should not be used to inspect individual custom metadata objects, instead use
TableMetadata.customMetadataObject(String, Class)
()} as that will perform a type-safety check on the
retrieved object.
customMetadata
in interface TableMetadata
public Collection<KeyAttributeMetadata> keyAttributes()
TableMetadata
keyAttributes
in interface TableMetadata
KeyAttributeMetadata
containing information about the keys.public Optional<ScalarAttributeType> scalarAttributeType(String keyAttribute)
TableMetadata
scalarAttributeType
in interface TableMetadata
keyAttribute
- The key attribute name to return the scalar attribute type of.ScalarAttributeType
of the attribute, or empty if attribute is a non-scalar type.Copyright © 2021. All rights reserved.