Example #1
0
 @Override
 public boolean equals(Object other) {
   if (other == this) return true;
   if (!(other instanceof FieldDescriptorProto)) return false;
   FieldDescriptorProto o = (FieldDescriptorProto) other;
   return equals(unknownFields(), o.unknownFields())
       && equals(name, o.name)
       && equals(doc, o.doc)
       && equals(number, o.number)
       && equals(label, o.label)
       && equals(type, o.type)
       && equals(type_name, o.type_name)
       && equals(extendee, o.extendee)
       && equals(default_value, o.default_value)
       && equals(options, o.options);
 }
Example #2
0
 @Override
 public FieldDescriptorProto redact(FieldDescriptorProto value) {
   Builder builder = value.newBuilder();
   if (builder.options != null)
     builder.options = FieldOptions.ADAPTER.redact(builder.options);
   builder.clearUnknownFields();
   return builder.build();
 }
Example #3
0
 @Override
 public void encode(ProtoWriter writer, FieldDescriptorProto value) throws IOException {
   if (value.name != null) ProtoAdapter.STRING.encodeTagged(writer, 1, value.name);
   if (value.doc != null) ProtoAdapter.STRING.encodeTagged(writer, 9, value.doc);
   if (value.number != null) ProtoAdapter.INT32.encodeTagged(writer, 3, value.number);
   if (value.label != null) Label.ADAPTER.encodeTagged(writer, 4, value.label);
   if (value.type != null) Type.ADAPTER.encodeTagged(writer, 5, value.type);
   if (value.type_name != null) ProtoAdapter.STRING.encodeTagged(writer, 6, value.type_name);
   if (value.extendee != null) ProtoAdapter.STRING.encodeTagged(writer, 2, value.extendee);
   if (value.default_value != null)
     ProtoAdapter.STRING.encodeTagged(writer, 7, value.default_value);
   if (value.options != null) FieldOptions.ADAPTER.encodeTagged(writer, 8, value.options);
   writer.writeBytes(value.unknownFields());
 }
Example #4
0
 @Override
 public int encodedSize(FieldDescriptorProto value) {
   return (value.name != null ? ProtoAdapter.STRING.encodedSize(1, value.name) : 0)
       + (value.doc != null ? ProtoAdapter.STRING.encodedSize(9, value.doc) : 0)
       + (value.number != null ? ProtoAdapter.INT32.encodedSize(3, value.number) : 0)
       + (value.label != null ? Label.ADAPTER.encodedSize(4, value.label) : 0)
       + (value.type != null ? Type.ADAPTER.encodedSize(5, value.type) : 0)
       + (value.type_name != null ? ProtoAdapter.STRING.encodedSize(6, value.type_name) : 0)
       + (value.extendee != null ? ProtoAdapter.STRING.encodedSize(2, value.extendee) : 0)
       + (value.default_value != null
           ? ProtoAdapter.STRING.encodedSize(7, value.default_value)
           : 0)
       + (value.options != null ? FieldOptions.ADAPTER.encodedSize(8, value.options) : 0)
       + value.unknownFields().size();
 }