public class DefaultSchemaFactory extends java.lang.Object implements SchemaFactory
SchemaFactory
interface. The purpose of
the factory is to create a row types given a list of getters.
Row type is represented by Schema
which essentially is a
List<Pair<FieldName, Coder>>
.
Getters (e.g. pojo field getters) are represented by FieldValueGetter
interface,
which exposes the field's name (see FieldValueGetter.name()
)
and java type (see FieldValueGetter.type()
).
This is the default factory implementation used in RowFactory
.
In other cases, when mapping requires extra logic, another implentation of the
SchemaFactory
should be used instead of this class.
Constructor and Description |
---|
DefaultSchemaFactory() |
Modifier and Type | Method and Description |
---|---|
Schema |
createSchema(java.lang.Iterable<FieldValueGetter> fieldValueGetters)
Uses
FieldValueGetter.name() as field names. |
public Schema createSchema(java.lang.Iterable<FieldValueGetter> fieldValueGetters)
FieldValueGetter.name()
as field names.
Uses CoderRegistry.createDefault()
to get coders for FieldValueGetter.type()
.createSchema
in interface SchemaFactory