@ThreadSafe public final class StaticTableSchema<T> extends WrappedTableSchema<T,StaticImmutableTableSchema<T,T>>
TableSchema that builds a schema based on directly declared attributes and methods to
get and set those attributes. Just like StaticImmutableTableSchema which is the equivalent implementation for
immutable objects, this is the most direct, and thus fastest, implementation of TableSchema.
Example using a fictional 'Customer' data item class:-
static final TableSchema<Customer> CUSTOMER_TABLE_SCHEMA =
StaticTableSchema.builder(Customer.class)
.newItemSupplier(Customer::new)
.addAttribute(String.class, a -> a.name("account_id")
.getter(Customer::getAccountId)
.setter(Customer::setAccountId)
.tags(primaryPartitionKey()))
.addAttribute(Integer.class, a -> a.name("sub_id")
.getter(Customer::getSubId)
.setter(Customer::setSubId)
.tags(primarySortKey()))
.addAttribute(String.class, a -> a.name("name")
.getter(Customer::getName)
.setter(Customer::setName)
.tags(secondaryPartitionKey("customers_by_name")))
.addAttribute(Instant.class, a -> a.name("created_date")
.getter(Customer::getCreatedDate)
.setter(Customer::setCreatedDate)
.tags(secondarySortKey("customers_by_date"),
secondarySortKey("customers_by_name")))
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
StaticTableSchema.Builder<T>
Builder for a
StaticTableSchema |
| Modifier and Type | Method and Description |
|---|---|
AttributeConverterProvider |
attributeConverterProvider()
The table schema
AttributeConverterProvider. |
static <T> StaticTableSchema.Builder<T> |
builder(Class<T> itemClass)
Creates a builder for a
StaticTableSchema typed to specific data item class. |
static <T> StaticTableSchema.Builder<T> |
builder(EnhancedType<T> itemType)
Creates a builder for a
StaticTableSchema typed to specific data item class. |
attributeNames, attributeValue, converterForAttribute, delegateTableSchema, isAbstract, itemToMap, itemToMap, itemType, mapToItem, mapToItem, tableMetadataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuilder, builder, documentSchemaBuilder, fromBean, fromClass, fromImmutableClasspublic static <T> StaticTableSchema.Builder<T> builder(Class<T> itemClass)
StaticTableSchema typed to specific data item class.T - The type of the item this TableSchema will map records to.itemClass - The data item class object that the StaticTableSchema is to map to.public static <T> StaticTableSchema.Builder<T> builder(EnhancedType<T> itemType)
StaticTableSchema typed to specific data item class.T - The type of the item this TableSchema will map records to.itemType - The EnhancedType of the data item class object that the StaticTableSchema is to map to.public AttributeConverterProvider attributeConverterProvider()
AttributeConverterProvider.attributeConverterProvider()Copyright © 2023. All rights reserved.