Class AvroFactory<T>

  • Type Parameters:
    T - The type to be serialized.

    @Internal
    public final class AvroFactory<T>
    extends Object
    Creates Avro DatumReader and DatumWriter.
    • Method Detail

      • extractAvroSpecificSchema

        public static <T> org.apache.avro.Schema extractAvroSpecificSchema​(Class<T> type,
                                                                           org.apache.avro.specific.SpecificData specificData)
        Extracts an Avro Schema from a SpecificRecord. We do this either via SpecificData or by instantiating a record and extracting the schema from the instance.
      • getSpecificDataForClass

        public static <T extends org.apache.avro.specific.SpecificData> org.apache.avro.specific.SpecificData getSpecificDataForClass​(Class<T> type,
                                                                                                                                      ClassLoader cl)
        Creates a SpecificData object for a given class. Possibly uses the specific data from the generated class with logical conversions applied (avro >= 1.9.x).

        Copied over from SpecificData#getForClass(Class<T> c) we do not use the method directly, because we want to be API backwards compatible with older Avro versions which did not have this method