Skip to content

Commit

Permalink
Simplify #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Constantin Muraru committed Apr 29, 2017
1 parent d77a28a commit 1b21f35
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,12 @@ class MessageWriter extends FieldWriter {
}

writer.setFieldName(name);
writer.setIndex(getFieldIndex(schema, name));
writer.setIndex(schema.getFieldIndex(name));

fieldWriters[fieldDescriptor.getIndex()] = writer;
}
}

private int getFieldIndex(GroupType schema, String name) {
if (schema.getFieldCount() > 0 && schema.getFields().get(0).getOriginalType() == OriginalType.MAP_KEY_VALUE) {
return schema.getFields().get(0).asGroupType().getFieldIndex(name);
}
return schema.getFieldIndex(name);
}

private FieldWriter createWriter(Descriptors.FieldDescriptor fieldDescriptor, Type type) {

if (fieldDescriptor.getJavaType() == Descriptors.FieldDescriptor.JavaType.MESSAGE) {
Expand Down

0 comments on commit 1b21f35

Please sign in to comment.