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 the StaticImmutableTableSchema 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
  • Method Details

    • 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 more StaticTableTag with this schema. See documentation on the tags themselves to understand what each one does. This method will overwrite any existing table tags.
    • tags

      Associate one or more StaticTableTag 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 a StaticTableTag 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 another TableSchema 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 the StaticImmutableTableSchema of a super-class, effectively rolling all the attributes modelled by the super-class into the StaticImmutableTableSchema 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 the AttributeConverterProviders to use with the table schema. The list of attribute converter providers must provide AttributeConverters 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 the AttributeConverterProviders to use with the table schema. The list of attribute converter providers must provide AttributeConverters 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 a StaticImmutableTableSchema based on the values this builder has been configured with