Package org.apache.flink.formats.avro
Class AvroWriters
java.lang.Object
org.apache.flink.formats.avro.AvroWriters
Convenience builder to create
AvroWriterFactory instances for the different Avro types.-
Method Summary
Modifier and TypeMethodDescriptionstatic AvroWriterFactory<org.apache.avro.generic.GenericRecord>forGenericRecord(org.apache.avro.Schema schema) Creates anAvroWriterFactorythat accepts and writes Avro generic types.static <T> AvroWriterFactory<T>forReflectRecord(Class<T> type) Creates anAvroWriterFactoryfor the given type.static <T extends org.apache.avro.specific.SpecificRecordBase>
AvroWriterFactory<T>forSpecificRecord(Class<T> type) Creates anAvroWriterFactoryfor an Avro specific type.
-
Method Details
-
forSpecificRecord
public static <T extends org.apache.avro.specific.SpecificRecordBase> AvroWriterFactory<T> forSpecificRecord(Class<T> type) Creates anAvroWriterFactoryfor an Avro specific type. The Avro writers will use the schema of that specific type to build and write the records.- Parameters:
type- The class of the type to write.
-
forGenericRecord
public static AvroWriterFactory<org.apache.avro.generic.GenericRecord> forGenericRecord(org.apache.avro.Schema schema) Creates anAvroWriterFactorythat accepts and writes Avro generic types. The Avro writers will use the given schema to build and write the records.- Parameters:
schema- The schema of the generic type.
-
forReflectRecord
Creates anAvroWriterFactoryfor the given type. The Avro writers will use reflection to create the schema for the type and use that schema to write the records.- Parameters:
type- The class of the type to write.
-