T
- The data item type that the StaticTableSchema
this builder will build is to map to.@NotThreadSafe public static final class StaticTableSchema.Builder<T> extends Object
StaticTableSchema
Modifier and Type | Method and Description |
---|---|
<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.
|
<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.
|
StaticTableSchema.Builder<T> |
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.
|
StaticTableSchema.Builder<T> |
addTag(StaticTableTag staticTableTag)
Associates a
StaticTableTag with this schema. |
StaticTableSchema.Builder<T> |
attributeConverterProviders(AttributeConverterProvider... attributeConverterProviders)
Specifies the
AttributeConverterProvider s to use with the table schema. |
StaticTableSchema.Builder<T> |
attributeConverterProviders(List<AttributeConverterProvider> attributeConverterProviders)
Specifies the
AttributeConverterProvider s to use with the table schema. |
StaticTableSchema.Builder<T> |
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.
|
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.
|
StaticTableSchema<T> |
build()
Builds a
StaticTableSchema based on the values this builder has been configured with |
StaticTableSchema.Builder<T> |
extend(StaticTableSchema<? super T> superTableSchema)
Extends the
StaticTableSchema of a super-class, effectively rolling all the attributes modelled by
the super-class into the StaticTableSchema of the sub-class. |
<R> StaticTableSchema.Builder<T> |
flatten(TableSchema<R> otherTableSchema,
Function<T,R> otherItemGetter,
BiConsumer<T,R> otherItemSetter)
Flattens all the attributes defined in another
StaticTableSchema into the database record this schema
maps to. |
StaticTableSchema.Builder<T> |
newItemSupplier(Supplier<T> newItemSupplier)
A function that can be used to create new instances of the data item class.
|
StaticTableSchema.Builder<T> |
tags(Collection<StaticTableTag> staticTableTags)
Associate one or more
StaticTableTag with this schema. |
StaticTableSchema.Builder<T> |
tags(StaticTableTag... staticTableTags)
Associate one or more
StaticTableTag with this schema. |
public StaticTableSchema.Builder<T> newItemSupplier(Supplier<T> newItemSupplier)
@SafeVarargs public final StaticTableSchema.Builder<T> attributes(StaticAttribute<T,?>... staticAttributes)
public StaticTableSchema.Builder<T> attributes(Collection<StaticAttribute<T,?>> staticAttributes)
public <R> StaticTableSchema.Builder<T> addAttribute(EnhancedType<R> attributeType, Consumer<StaticAttribute.Builder<T,R>> staticAttribute)
public <R> StaticTableSchema.Builder<T> addAttribute(Class<R> attributeClass, Consumer<StaticAttribute.Builder<T,R>> staticAttribute)
public StaticTableSchema.Builder<T> addAttribute(StaticAttribute<T,?> staticAttribute)
public <R> StaticTableSchema.Builder<T> flatten(TableSchema<R> otherTableSchema, Function<T,R> otherItemGetter, BiConsumer<T,R> otherItemSetter)
StaticTableSchema
into the database record this schema
maps to. Functions to get and set an object that the flattened schema maps to is required.public StaticTableSchema.Builder<T> extend(StaticTableSchema<? super T> superTableSchema)
StaticTableSchema
of a super-class, effectively rolling all the attributes modelled by
the super-class into the StaticTableSchema
of the sub-class.public StaticTableSchema.Builder<T> tags(StaticTableTag... staticTableTags)
StaticTableTag
with this schema. See documentation on the tags themselves to
understand what each one does. This method will overwrite any existing table tags.public StaticTableSchema.Builder<T> tags(Collection<StaticTableTag> staticTableTags)
StaticTableTag
with this schema. See documentation on the tags themselves to
understand what each one does. This method will overwrite any existing table tags.public StaticTableSchema.Builder<T> addTag(StaticTableTag staticTableTag)
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.public StaticTableSchema.Builder<T> attributeConverterProviders(AttributeConverterProvider... attributeConverterProviders)
AttributeConverterProvider
s to use with the table schema.
The list of attribute converter providers must provide AttributeConverter
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())
attributeConverterProviders
- a list of attribute converter providers to use with the table schemapublic StaticTableSchema.Builder<T> attributeConverterProviders(List<AttributeConverterProvider> attributeConverterProviders)
AttributeConverterProvider
s to use with the table schema.
The list of attribute converter providers must provide AttributeConverter
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);
attributeConverterProviders
- a list of attribute converter providers to use with the table schemapublic StaticTableSchema<T> build()
StaticTableSchema
based on the values this builder has been configured withCopyright © 2023. All rights reserved.