SpecificRecordBase implements IndexedRecord, so that fields can be
accessed by number, but not directly by name. However Implementing
#set(String,Object) and #get(String) is easy:
public static Object get(SpecificRecordBase record, String fieldName) {
return record.get(record.getSchema().getField(fieldName).pos());
}
public static void set(SpecificRecordBase record, String fieldName,
Object value) {
record.set(record.getSchema().getField(fieldName).pos(), value);
}
Doug
On Mon, Apr 15, 2013 at 11:23 AM, Christophe Taton <[email protected]> wrote:
> Hi,
> Is there a reason for specific records to not implement the generic API?
> I didn't find any obvious technical reason, but maybe I missed something.
> Thanks,
> C.