Class StaticTableSchema.Builder<T>
- Type Parameters:
T
- The data item type that theStaticTableSchema
this builder will build is to map to.
- Enclosing class:
StaticTableSchema<T>
StaticTableSchema
-
Method Summary
Modifier and TypeMethodDescriptionaddAttribute
(Class<R> attributeClass, Consumer<StaticAttribute.Builder<T, R>> staticAttribute) Adds a single attribute to the table schema that can be mapped between the data item object and the database record.addAttribute
(EnhancedType<R> attributeType, Consumer<StaticAttribute.Builder<T, R>> staticAttribute) Adds a single attribute to the table schema that can be mapped between the data item object and the database record.addAttribute
(StaticAttribute<T, ?> staticAttribute) Adds a single attribute to the table schema that can be mapped between the data item object and the database record.addTag
(StaticTableTag staticTableTag) Associates aStaticTableTag
with this schema.attributeConverterProviders
(List<AttributeConverterProvider> attributeConverterProviders) Specifies theAttributeConverterProvider
s to use with the table schema.attributeConverterProviders
(AttributeConverterProvider... attributeConverterProviders) Specifies theAttributeConverterProvider
s to use with the table schema.attributes
(Collection<StaticAttribute<T, ?>> staticAttributes) 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.final StaticTableSchema.Builder
<T> attributes
(StaticAttribute<T, ?>... staticAttributes) 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.build()
Builds aStaticTableSchema
based on the values this builder has been configured withextend
(StaticTableSchema<? super T> superTableSchema) Extends theStaticTableSchema
of a super-class, effectively rolling all the attributes modelled by the super-class into theStaticTableSchema
of the sub-class.flatten
(TableSchema<R> otherTableSchema, Function<T, R> otherItemGetter, BiConsumer<T, R> otherItemSetter) Flattens all the attributes defined in anotherStaticTableSchema
into the database record this schema maps to.newItemSupplier
(Supplier<T> newItemSupplier) A function that can be used to create new instances of the data item class.tags
(Collection<StaticTableTag> staticTableTags) Associate one or moreStaticTableTag
with this schema.tags
(StaticTableTag... staticTableTags) Associate one or moreStaticTableTag
with this schema.
-
Method Details
-
newItemSupplier
A function that can be used to create new instances of the data item class. -
attributes
@SafeVarargs public final StaticTableSchema.Builder<T> attributes(StaticAttribute<T, ?>... staticAttributes) 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
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> StaticTableSchema.Builder<T> addAttribute(EnhancedType<R> attributeType, Consumer<StaticAttribute.Builder<T, R>> staticAttribute) Adds a single attribute to the table schema that can be mapped between the data item object and the database record. -
addAttribute
public <R> StaticTableSchema.Builder<T> addAttribute(Class<R> attributeClass, Consumer<StaticAttribute.Builder<T, R>> staticAttribute) Adds a single attribute to the table schema that can be mapped between the data item object and the database record. -
addAttribute
Adds a single attribute to the table schema that can be mapped between the data item object and the database record. -
flatten
public <R> StaticTableSchema.Builder<T> flatten(TableSchema<R> otherTableSchema, Function<T, R> otherItemGetter, BiConsumer<T, R> otherItemSetter) Flattens all the attributes defined in anotherStaticTableSchema
into the database record this schema maps to. Functions to get and set an object that the flattened schema maps to is required. -
extend
Extends theStaticTableSchema
of a super-class, effectively rolling all the attributes modelled by the super-class into theStaticTableSchema
of the sub-class. -
tags
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
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
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. -
attributeConverterProviders
public StaticTableSchema.Builder<T> 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 StaticTableSchema.Builder<T> 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
Builds aStaticTableSchema
based on the values this builder has been configured with
-