Class StaticImmutableTableSchema.Builder<T,B>
- java.lang.Object
-
- software.amazon.awssdk.enhanced.dynamodb.mapper.StaticImmutableTableSchema.Builder<T,B>
-
- Type Parameters:
T
- The immutable data item class object that theStaticImmutableTableSchema
is to map to.B
- The builder class object that can be used to construct instances of the immutable data item.
- Enclosing class:
- StaticImmutableTableSchema<T,B>
@NotThreadSafe public static final class StaticImmutableTableSchema.Builder<T,B> extends Object
Builder for aStaticImmutableTableSchema
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> StaticImmutableTableSchema.Builder<T,B>
addAttribute(Class<R> attributeClass, Consumer<ImmutableAttribute.Builder<T,B,R>> immutableAttribute)
Adds a single attribute to the table schema that can be mapped between the data item object and the database record.<R> StaticImmutableTableSchema.Builder<T,B>
addAttribute(EnhancedType<R> attributeType, Consumer<ImmutableAttribute.Builder<T,B,R>> immutableAttribute)
Adds a single attribute to the table schema that can be mapped between the data item object and the database record.StaticImmutableTableSchema.Builder<T,B>
addAttribute(ImmutableAttribute<T,B,?> immutableAttribute)
Adds a single attribute to the table schema that can be mapped between the data item object and the database record.StaticImmutableTableSchema.Builder<T,B>
addTag(StaticTableTag staticTableTag)
Associates aStaticTableTag
with this schema.StaticImmutableTableSchema.Builder<T,B>
attributeConverterProviders(List<AttributeConverterProvider> attributeConverterProviders)
Specifies theAttributeConverterProvider
s to use with the table schema.StaticImmutableTableSchema.Builder<T,B>
attributeConverterProviders(AttributeConverterProvider... attributeConverterProviders)
Specifies theAttributeConverterProvider
s to use with the table schema.StaticImmutableTableSchema.Builder<T,B>
attributes(Collection<ImmutableAttribute<T,B,?>> immutableAttributes)
A list of attributes that can be mapped between the data item object and the database record that are to be associated with the schema.StaticImmutableTableSchema.Builder<T,B>
attributes(ImmutableAttribute<T,B,?>... immutableAttributes)
A list of attributes that can be mapped between the data item object and the database record that are to be associated with the schema.StaticImmutableTableSchema<T,B>
build()
Builds aStaticImmutableTableSchema
based on the values this builder has been configured withStaticImmutableTableSchema.Builder<T,B>
extend(StaticImmutableTableSchema<? super T,? super B> superTableSchema)
Extends theStaticImmutableTableSchema
of a super-class, effectively rolling all the attributes modelled by the super-class into theStaticImmutableTableSchema
of the sub-class.<T1> StaticImmutableTableSchema.Builder<T,B>
flatten(TableSchema<T1> otherTableSchema, Function<T,T1> otherItemGetter, BiConsumer<B,T1> otherItemSetter)
Flattens all the attributes defined in anotherTableSchema
into the database record this schema maps to.StaticImmutableTableSchema.Builder<T,B>
newItemBuilder(Supplier<B> newBuilderMethod, Function<B,T> buildMethod)
Methods used to construct a new instance of the immutable data object.StaticImmutableTableSchema.Builder<T,B>
tags(Collection<StaticTableTag> staticTableTags)
Associate one or moreStaticTableTag
with this schema.StaticImmutableTableSchema.Builder<T,B>
tags(StaticTableTag... staticTableTags)
Associate one or moreStaticTableTag
with this schema.
-
-
-
Method Detail
-
newItemBuilder
public StaticImmutableTableSchema.Builder<T,B> newItemBuilder(Supplier<B> newBuilderMethod, Function<B,T> buildMethod)
Methods used to construct a new instance of the immutable data object.- Parameters:
newBuilderMethod
- A method to create a new builder for the immutable data object.buildMethod
- A method on the builder to build a new instance of the immutable data object.
-
attributes
@SafeVarargs public final StaticImmutableTableSchema.Builder<T,B> attributes(ImmutableAttribute<T,B,?>... immutableAttributes)
A list of attributes that can be mapped between the data item object and the database record that are to be associated with the schema. Will overwrite any existing attributes.
-
attributes
public StaticImmutableTableSchema.Builder<T,B> attributes(Collection<ImmutableAttribute<T,B,?>> immutableAttributes)
A list of attributes that can be mapped between the data item object and the database record that are to be associated with the schema. Will overwrite any existing attributes.
-
addAttribute
public <R> StaticImmutableTableSchema.Builder<T,B> addAttribute(EnhancedType<R> attributeType, Consumer<ImmutableAttribute.Builder<T,B,R>> immutableAttribute)
Adds a single attribute to the table schema that can be mapped between the data item object and the database record.
-
addAttribute
public <R> StaticImmutableTableSchema.Builder<T,B> addAttribute(Class<R> attributeClass, Consumer<ImmutableAttribute.Builder<T,B,R>> immutableAttribute)
Adds a single attribute to the table schema that can be mapped between the data item object and the database record.
-
addAttribute
public StaticImmutableTableSchema.Builder<T,B> addAttribute(ImmutableAttribute<T,B,?> immutableAttribute)
Adds a single attribute to the table schema that can be mapped between the data item object and the database record.
-
tags
public StaticImmutableTableSchema.Builder<T,B> tags(StaticTableTag... staticTableTags)
Associate one or moreStaticTableTag
with this schema. See documentation on the tags themselves to understand what each one does. This method will overwrite any existing table tags.
-
tags
public StaticImmutableTableSchema.Builder<T,B> tags(Collection<StaticTableTag> staticTableTags)
Associate one or moreStaticTableTag
with this schema. See documentation on the tags themselves to understand what each one does. This method will overwrite any existing table tags.
-
addTag
public StaticImmutableTableSchema.Builder<T,B> addTag(StaticTableTag staticTableTag)
Associates aStaticTableTag
with this schema. See documentation on the tags themselves to understand what each one does. This method will add the tag to the list of existing table tags.
-
flatten
public <T1> StaticImmutableTableSchema.Builder<T,B> flatten(TableSchema<T1> otherTableSchema, Function<T,T1> otherItemGetter, BiConsumer<B,T1> otherItemSetter)
Flattens all the attributes defined in anotherTableSchema
into the database record this schema maps to. Functions to get and set an object that the flattened schema maps to is required.
-
extend
public StaticImmutableTableSchema.Builder<T,B> extend(StaticImmutableTableSchema<? super T,? super B> superTableSchema)
Extends theStaticImmutableTableSchema
of a super-class, effectively rolling all the attributes modelled by the super-class into theStaticImmutableTableSchema
of the sub-class. The extended immutable table schema must be using a builder class that is also a super-class of the builder being used for the current immutable table schema.
-
attributeConverterProviders
public StaticImmutableTableSchema.Builder<T,B> attributeConverterProviders(AttributeConverterProvider... attributeConverterProviders)
Specifies theAttributeConverterProvider
s to use with the table schema. The list of attribute converter providers must provideAttributeConverter
s for all types used in the schema. The attribute converter providers will be loaded in the strict order they are supplied here.Calling this method will override the default attribute converter provider
DefaultAttributeConverterProvider
, which provides standard converters for most primitive and common Java types, so that provider must included in the supplied list if it is to be used. Providing an empty list here will cause no providers to get loaded.Adding one custom attribute converter provider and using the default as fallback:
builder.attributeConverterProviders(customAttributeConverter, AttributeConverterProvider.defaultProvider())
- Parameters:
attributeConverterProviders
- a list of attribute converter providers to use with the table schema
-
attributeConverterProviders
public StaticImmutableTableSchema.Builder<T,B> attributeConverterProviders(List<AttributeConverterProvider> attributeConverterProviders)
Specifies theAttributeConverterProvider
s to use with the table schema. The list of attribute converter providers must provideAttributeConverter
s for all types used in the schema. The attribute converter providers will be loaded in the strict order they are supplied here.Calling this method will override the default attribute converter provider
DefaultAttributeConverterProvider
, which provides standard converters for most primitive and common Java types, so that provider must included in the supplied list if it is to be used. Providing an empty list here will cause no providers to get loaded.Adding one custom attribute converter provider and using the default as fallback:
List<AttributeConverterProvider> providers = new ArrayList<>( customAttributeConverter, AttributeConverterProvider.defaultProvider()); builder.attributeConverterProviders(providers);
- Parameters:
attributeConverterProviders
- a list of attribute converter providers to use with the table schema
-
build
public StaticImmutableTableSchema<T,B> build()
Builds aStaticImmutableTableSchema
based on the values this builder has been configured with
-
-