Class AvroWriters


  • public class AvroWriters
    extends Object
    Convenience builder to create AvroWriterFactory instances for the different Avro types.
    • Method Detail

      • forSpecificRecord

        public static <T extends org.apache.avro.specific.SpecificRecordBase> AvroWriterFactory<T> forSpecificRecord​(Class<T> type)
        Creates an AvroWriterFactory for 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 an AvroWriterFactory that 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

        public static <T> AvroWriterFactory<T> forReflectRecord​(Class<T> type)
        Creates an AvroWriterFactory for 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.