code: public static <E> GenericData getDataModelForType(Class<E> type) {
      // Need to check if SpecificRecord first because specific records also
      // implement GenericRecord
      if (SpecificRecord.class.isAssignableFrom(type)) {
        return new SpecificData(type.getClassLoader());
      } else if (IndexedRecord.class.isAssignableFrom(type)) {
        return GenericData.get();
      } else {
        return AllowNulls.get();
      }
    }
docs: Get the data model for the given type.
  
  @param <E> The entity type
  @param type The Java class of the entity type
  @return The appropriate data model for the given type