Ejemplo n.º 1
0
 @Override
 public boolean equals(Object other) {
   if (other == this) return true;
   if (!(other instanceof DescriptorProto)) return false;
   DescriptorProto o = (DescriptorProto) other;
   return equals(unknownFields(), o.unknownFields())
       && equals(name, o.name)
       && equals(doc, o.doc)
       && equals(field, o.field)
       && equals(extension, o.extension)
       && equals(nested_type, o.nested_type)
       && equals(enum_type, o.enum_type)
       && equals(extension_range, o.extension_range)
       && equals(options, o.options);
 }
Ejemplo n.º 2
0
 @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();
 }
Ejemplo n.º 3
0
 @Override
 public DescriptorProto redact(DescriptorProto value) {
   Builder builder = value.newBuilder();
   redactElements(builder.field, FieldDescriptorProto.ADAPTER);
   redactElements(builder.extension, FieldDescriptorProto.ADAPTER);
   redactElements(builder.nested_type, DescriptorProto.ADAPTER);
   redactElements(builder.enum_type, EnumDescriptorProto.ADAPTER);
   redactElements(builder.extension_range, ExtensionRange.ADAPTER);
   if (builder.options != null)
     builder.options = MessageOptions.ADAPTER.redact(builder.options);
   builder.clearUnknownFields();
   return builder.build();
 }
Ejemplo n.º 4
0
 @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());
 }