@Test void stringGetObject() { final GenericData.Record avro = new GenericData.Record(org.apache.avro.Schema .createRecord(getClass().getName() + ".StringTest", null, null, false, singletonList(new org.apache.avro.Schema.Field("str", org.apache.avro.Schema.create(org.apache.avro.Schema.Type.STRING), null, null)))); avro.put(0, new Utf8("test")); final Record record = new AvroRecord(avro); final Object str = record.get(Object.class, "str"); assertFalse(str.getClass().getName(), Utf8.class.isInstance(str)); assertEquals("test", str); }
@Override public <T> T get(final Class<T> expectedType, final String name) { if (expectedType == Collection.class) { return expectedType.cast(getArray(Object.class, name)); } return doGet(expectedType, name); }
AvroRecord implements Record, AvroPropertyMapper, Unwrappable { @Override public <T> T get(final Class<T> expectedType, final String name) { if (expectedType == Collection.class) { return expectedType.cast(getArray(Object.class, name)); } return doGet(expectedType, name); } }
AvroRecord implements Record, AvroPropertyMapper, Unwrappable { @Override public <T> T get(final Class<T> expectedType, final String name) { if (expectedType == Collection.class) { return expectedType.cast(getArray(Object.class, name)); } return doGet(expectedType, name); } AvroRecord(final IndexedRecord record);  AvroRecord(final Record record); }
AvroRecord implements Record, AvroPropertyMapper, Unwrappable { @Override public <T> T get(final Class<T> expectedType, final String name) { if (expectedType == Collection.class) { return expectedType.cast(getArray(Object.class, name)); } return doGet(expectedType, name); } AvroRecord(final IndexedRecord record);  AvroRecord(final Record record); @Override Schema getSchema(); @Override T get(final Class<T> expectedType, final String name); @Override Collection<T> getArray(final Class<T> type, final String name); @Override T unwrap(final Class<T> type); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
AvroRecord implements Record, AvroPropertyMapper, Unwrappable { @Override public <T> T get(final Class<T> expectedType, final String name) { if (expectedType == Collection.class) { return expectedType.cast(getArray(Object.class, name)); } return doGet(expectedType, name); } AvroRecord(final IndexedRecord record);  AvroRecord(final Record record); @Override Schema getSchema(); @Override T get(final Class<T> expectedType, final String name); @Override Collection<T> getArray(final Class<T> type, final String name); @Override T unwrap(final Class<T> type); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }