@Internal public class RowFactory extends java.lang.Object implements java.io.Serializable
Generates the code to create Schema
s and Row
s based on pojos.
Generated record types are cached in the instance of this factory.
At the moment single pojo class corresponds to single Schema
.
Supported pojo getter types depend on types supported by the SchemaFactory
. See DefaultSchemaFactory
for default implementation.
Modifier and Type | Method and Description |
---|---|
<T> Row |
create(T pojo)
Create a
Row of the pojo. |
static RowFactory |
createDefault()
|
<T> Schema |
getSchema(java.lang.Class<T> elementType) |
static RowFactory |
of(SchemaFactory schemaFactory,
org.apache.beam.sdk.values.reflect.GetterFactory getterFactory)
|
static RowFactory |
withSchemaFactory(SchemaFactory schemaFactory)
|
public static RowFactory createDefault()
public static RowFactory withSchemaFactory(SchemaFactory schemaFactory)
public static RowFactory of(SchemaFactory schemaFactory, org.apache.beam.sdk.values.reflect.GetterFactory getterFactory)
public <T> Schema getSchema(java.lang.Class<T> elementType)
public <T> Row create(T pojo)
Row
of the pojo.
This implementation copies the return values of the pojo getters into the record fields on creation.
Currently all public getters are used to populate the record type and instance.
Field names for getters are stripped of the 'get' prefix. For example record field 'name' will be generated for 'getName()' pojo method.