@Override public void encode(ProtoWriter writer, MethodOptions value) throws IOException { if (value.deprecated != null) ProtoAdapter.BOOL.encodeWithTag(writer, 33, value.deprecated); if (value.uninterpreted_option != null) UninterpretedOption.ADAPTER .asRepeated() .encodeWithTag(writer, 999, value.uninterpreted_option); writer.writeBytes(value.unknownFields()); }
@Override public int encodedSize(MethodOptions value) { return (value.deprecated != null ? ProtoAdapter.BOOL.encodedSizeWithTag(33, value.deprecated) : 0) + UninterpretedOption.ADAPTER .asRepeated() .encodedSizeWithTag(999, value.uninterpreted_option) + value.unknownFields().size(); }
@Override public MethodOptions decode(ProtoReader reader) throws IOException { Builder builder = new Builder(); long token = reader.beginMessage(); for (int tag; (tag = reader.nextTag()) != -1; ) { switch (tag) { case 33: builder.deprecated(ProtoAdapter.BOOL.decode(reader)); break; case 999: builder.uninterpreted_option.add(UninterpretedOption.ADAPTER.decode(reader)); break; default: { FieldEncoding fieldEncoding = reader.peekFieldEncoding(); Object value = fieldEncoding.rawProtoAdapter().decode(reader); builder.addUnknownField(tag, fieldEncoding, value); } } } reader.endMessage(token); return builder.build(); }