* @return
*/
private Object getFieldValue(Schema fieldSchema, Type type, Object fieldValue ){
switch(type) {
case RECORD:
Persistent persistent = (Persistent) fieldValue;
Persistent newRecord = (Persistent) SpecificData.get().newRecord(persistent, persistent.getSchema());
for (Field member: fieldSchema.getFields()) {
if (member.pos() == 0 || !persistent.isDirty()) {
continue;
}
Schema memberSchema = member.schema();
Type memberType = memberSchema.getType();
Object memberValue = persistent.get(member.pos());
newRecord.put(member.pos(), getFieldValue(memberSchema, memberType, memberValue));
}
fieldValue = newRecord;
break;
case MAP:
Map<?, ?> map = (Map<?, ?>) fieldValue;