Class AvroFactory<T>
java.lang.Object
org.apache.flink.formats.avro.typeutils.AvroFactory<T>
- Type Parameters:
T- The type to be serialized.
Creates Avro
DatumReader and DatumWriter.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> org.apache.avro.SchemaextractAvroSpecificSchema(Class<T> type, org.apache.avro.specific.SpecificData specificData) Extracts an AvroSchemafrom aSpecificRecord.static <T extends org.apache.avro.specific.SpecificData>
org.apache.avro.specific.SpecificDatagetSpecificDataForClass(Class<T> type, ClassLoader cl) Creates aSpecificDataobject for a given class.
-
Method Details
-
extractAvroSpecificSchema
public static <T> org.apache.avro.Schema extractAvroSpecificSchema(Class<T> type, org.apache.avro.specific.SpecificData specificData) Extracts an AvroSchemafrom aSpecificRecord. We do this either viaSpecificDataor 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 aSpecificDataobject 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
-