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.@NotThreadSafe public static final class StaticImmutableTableSchema.Builder<T,B> extends Object
StaticImmutableTableSchema
Modifier and Type | Method and 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 a
StaticTableTag with this schema. |
StaticImmutableTableSchema.Builder<T,B> |
attributeConverterProviders(AttributeConverterProvider... attributeConverterProviders)
Specifies the
AttributeConverterProvider s to use with the table schema. |
StaticImmutableTableSchema.Builder<T,B> |
attributeConverterProviders(List<AttributeConverterProvider> attributeConverterProviders)
Specifies the
AttributeConverterProvider 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 a
StaticImmutableTableSchema based on the values this builder has been configured with |
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. |
<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. |
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 more
StaticTableTag with this schema. |
StaticImmutableTableSchema.Builder<T,B> |
tags(StaticTableTag... staticTableTags)
Associate one or more
StaticTableTag with this schema. |
public StaticImmutableTableSchema.Builder<T,B> newItemBuilder(Supplier<B> newBuilderMethod, Function<B,T> buildMethod)
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.@SafeVarargs public final StaticImmutableTableSchema.Builder<T,B> attributes(ImmutableAttribute<T,B,?>... immutableAttributes)
public StaticImmutableTableSchema.Builder<T,B> attributes(Collection<ImmutableAttribute<T,B,?>> immutableAttributes)
public <R> StaticImmutableTableSchema.Builder<T,B> addAttribute(EnhancedType<R> attributeType, Consumer<ImmutableAttribute.Builder<T,B,R>> immutableAttribute)
public <R> StaticImmutableTableSchema.Builder<T,B> addAttribute(Class<R> attributeClass, Consumer<ImmutableAttribute.Builder<T,B,R>> immutableAttribute)
public StaticImmutableTableSchema.Builder<T,B> addAttribute(ImmutableAttribute<T,B,?> immutableAttribute)
public StaticImmutableTableSchema.Builder<T,B> 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 StaticImmutableTableSchema.Builder<T,B> 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 StaticImmutableTableSchema.Builder<T,B> 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 <T1> StaticImmutableTableSchema.Builder<T,B> flatten(TableSchema<T1> otherTableSchema, Function<T,T1> otherItemGetter, BiConsumer<B,T1> otherItemSetter)
TableSchema
into the database record this schema
maps to. Functions to get and set an object that the flattened schema maps to is required.public StaticImmutableTableSchema.Builder<T,B> extend(StaticImmutableTableSchema<? super T,? super B> superTableSchema)
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.public StaticImmutableTableSchema.Builder<T,B> 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 StaticImmutableTableSchema.Builder<T,B> 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 StaticImmutableTableSchema<T,B> build()
StaticImmutableTableSchema
based on the values this builder has been configured withCopyright © 2022. All rights reserved.