@Test public void testDataModelForReflectType() { Class<String> type = String.class; GenericData result = DataModelUtil.getDataModelForType(type); assertEquals(DataModelUtil.AllowNulls.class, result.getClass()); }
public static <E> GenericData getDataModelForType(Class<E> type) { if (SpecificRecord.class.isAssignableFrom(type)) { return new SpecificData(type.getClassLoader()); } else if (IndexedRecord.class.isAssignableFrom(type)) { return GenericData.get(); } else { return AllowNulls.get(); } }
DataModelUtil { public static <E> GenericData getDataModelForType(Class<E> type) { if (SpecificRecord.class.isAssignableFrom(type)) { return new SpecificData(type.getClassLoader()); } else if (IndexedRecord.class.isAssignableFrom(type)) { return GenericData.get(); } else { return AllowNulls.get(); } } }
DataModelUtil { public static <E> GenericData getDataModelForType(Class<E> type) { if (SpecificRecord.class.isAssignableFrom(type)) { return new SpecificData(type.getClassLoader()); } else if (IndexedRecord.class.isAssignableFrom(type)) { return GenericData.get(); } else { return AllowNulls.get(); } }  }
DataModelUtil { public static <E> GenericData getDataModelForType(Class<E> type) { if (SpecificRecord.class.isAssignableFrom(type)) { return new SpecificData(type.getClassLoader()); } else if (IndexedRecord.class.isAssignableFrom(type)) { return GenericData.get(); } else { return AllowNulls.get(); } }  static GenericData getDataModelForType(Class<E> type); static boolean isGeneric(Class<?> type); @SuppressWarnings("unchecked") static DatumReader<E> getDatumReaderForType(Class<E> type, Schema writerSchema); @SuppressWarnings("unchecked") static Class<E> resolveType(Class<E> type, Schema schema); static Schema getReaderSchema(Class<E> type, Schema schema); static Schema getWriterSchema(Class<E> type, Schema schema); @SuppressWarnings("unchecked") static E createRecord(Class<E> type, Schema schema); static EntityAccessor<E> accessor(Class<E> type, Schema schema); }
DataModelUtil { public static <E> GenericData getDataModelForType(Class<E> type) { if (SpecificRecord.class.isAssignableFrom(type)) { return new SpecificData(type.getClassLoader()); } else if (IndexedRecord.class.isAssignableFrom(type)) { return GenericData.get(); } else { return AllowNulls.get(); } }  static GenericData getDataModelForType(Class<E> type); static boolean isGeneric(Class<?> type); @SuppressWarnings("unchecked") static DatumReader<E> getDatumReaderForType(Class<E> type, Schema writerSchema); @SuppressWarnings("unchecked") static Class<E> resolveType(Class<E> type, Schema schema); static Schema getReaderSchema(Class<E> type, Schema schema); static Schema getWriterSchema(Class<E> type, Schema schema); @SuppressWarnings("unchecked") static E createRecord(Class<E> type, Schema schema); static EntityAccessor<E> accessor(Class<E> type, Schema schema);  }