Antti Ahonen
04/18/2024, 10:24 AMAntti Ahonen
04/18/2024, 10:26 AMstatic <T> AvroFactory<T> create(Class<T> type, @Nullable Schema currentSchema, @Nullable Schema previousSchema) {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
// this returns false because SpecificRecord is the shaded one
if (SpecificRecord.class.isAssignableFrom(type)) {
return fromSpecific(type, cl, Optional.ofNullable(previousSchema));
} else {
return GenericRecord.class.isAssignableFrom(type) ? fromGeneric(cl, currentSchema) : fromReflective(type, cl, Optional.ofNullable(previousSchema));
}
}