@Override public int encodedSize(DescriptorProto value) { return (value.name != null ? ProtoAdapter.STRING.encodedSize(1, value.name) : 0) + (value.doc != null ? ProtoAdapter.STRING.encodedSize(8, value.doc) : 0) + FieldDescriptorProto.ADAPTER.asRepeated().encodedSize(2, value.field) + FieldDescriptorProto.ADAPTER.asRepeated().encodedSize(6, value.extension) + DescriptorProto.ADAPTER.asRepeated().encodedSize(3, value.nested_type) + EnumDescriptorProto.ADAPTER.asRepeated().encodedSize(4, value.enum_type) + ExtensionRange.ADAPTER.asRepeated().encodedSize(5, value.extension_range) + (value.options != null ? MessageOptions.ADAPTER.encodedSize(7, value.options) : 0) + value.unknownFields().size(); }
@Override public void encode(ProtoWriter writer, DescriptorProto value) throws IOException { if (value.name != null) ProtoAdapter.STRING.encodeTagged(writer, 1, value.name); if (value.doc != null) ProtoAdapter.STRING.encodeTagged(writer, 8, value.doc); if (value.field != null) FieldDescriptorProto.ADAPTER.asRepeated().encodeTagged(writer, 2, value.field); if (value.extension != null) FieldDescriptorProto.ADAPTER.asRepeated().encodeTagged(writer, 6, value.extension); if (value.nested_type != null) DescriptorProto.ADAPTER.asRepeated().encodeTagged(writer, 3, value.nested_type); if (value.enum_type != null) EnumDescriptorProto.ADAPTER.asRepeated().encodeTagged(writer, 4, value.enum_type); if (value.extension_range != null) ExtensionRange.ADAPTER.asRepeated().encodeTagged(writer, 5, value.extension_range); if (value.options != null) MessageOptions.ADAPTER.encodeTagged(writer, 7, value.options); writer.writeBytes(value.unknownFields()); }