@Test public void testGetCopy() throws Exception { String id = "id1"; Identifier.Builder idBuilder = Identifier.newBuilder(); idBuilder.setId(id); Identifier result = AvroUtils.getCopy(idBuilder.build(), Identifier.SCHEMA$, Identifier.class); assertNotNull(result); assertEquals(id, result.getId().toString()); }
public static <T> T getCopy(T object, Schema schema, Class<T> type) { if (!(object instanceof IndexedRecord)) { throw new RuntimeException("Object is not an IndexedRecord instance!"); } IndexedRecord record = (IndexedRecord) object; return JsonUtils.convertToListFromString(record.toString(), schema, type).get(0); }
AvroUtils { public static <T> T getCopy(T object, Schema schema, Class<T> type) { if (!(object instanceof IndexedRecord)) { throw new RuntimeException("Object is not an IndexedRecord instance!"); } IndexedRecord record = (IndexedRecord) object; return JsonUtils.convertToListFromString(record.toString(), schema, type).get(0); } }
AvroUtils { public static <T> T getCopy(T object, Schema schema, Class<T> type) { if (!(object instanceof IndexedRecord)) { throw new RuntimeException("Object is not an IndexedRecord instance!"); } IndexedRecord record = (IndexedRecord) object; return JsonUtils.convertToListFromString(record.toString(), schema, type).get(0); } private  AvroUtils(); }
AvroUtils { public static <T> T getCopy(T object, Schema schema, Class<T> type) { if (!(object instanceof IndexedRecord)) { throw new RuntimeException("Object is not an IndexedRecord instance!"); } IndexedRecord record = (IndexedRecord) object; return JsonUtils.convertToListFromString(record.toString(), schema, type).get(0); } private  AvroUtils(); static Schema toSchema(String typeName); static T getCopy(T object, Schema schema, Class<T> type); }
AvroUtils { public static <T> T getCopy(T object, Schema schema, Class<T> type) { if (!(object instanceof IndexedRecord)) { throw new RuntimeException("Object is not an IndexedRecord instance!"); } IndexedRecord record = (IndexedRecord) object; return JsonUtils.convertToListFromString(record.toString(), schema, type).get(0); } private  AvroUtils(); static Schema toSchema(String typeName); static T getCopy(T object, Schema schema, Class<T> type); final static String primitiveTypePrefix; }