public void MergeFrom(Product other) { if (other == null) { return; } if (other.Name.Length != 0) { Name = other.Name; } if (other.Id.Length != 0) { Id = other.Id; } if (other.Type != global::Google.Cloud.Retail.V2.Product.Types.Type.Unspecified) { Type = other.Type; } if (other.PrimaryProductId.Length != 0) { PrimaryProductId = other.PrimaryProductId; } categories_.Add(other.categories_); if (other.Title.Length != 0) { Title = other.Title; } if (other.Description.Length != 0) { Description = other.Description; } attributes_.Add(other.attributes_); tags_.Add(other.tags_); if (other.priceInfo_ != null) { if (priceInfo_ == null) { PriceInfo = new global::Google.Cloud.Retail.V2.PriceInfo(); } PriceInfo.MergeFrom(other.PriceInfo); } if (other.availableTime_ != null) { if (availableTime_ == null) { AvailableTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } AvailableTime.MergeFrom(other.AvailableTime); } if (other.Availability != global::Google.Cloud.Retail.V2.Product.Types.Availability.Unspecified) { Availability = other.Availability; } if (other.availableQuantity_ != null) { if (availableQuantity_ == null || other.AvailableQuantity != 0) { AvailableQuantity = other.AvailableQuantity; } } if (other.Uri.Length != 0) { Uri = other.Uri; } images_.Add(other.images_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); }
public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch (tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); break; } case 18: { Id = input.ReadString(); break; } case 24: { Type = (global::Google.Cloud.Retail.V2.Product.Types.Type)input.ReadEnum(); break; } case 34: { PrimaryProductId = input.ReadString(); break; } case 58: { categories_.AddEntriesFrom(input, _repeated_categories_codec); break; } case 66: { Title = input.ReadString(); break; } case 82: { Description = input.ReadString(); break; } case 98: { attributes_.AddEntriesFrom(input, _map_attributes_codec); break; } case 106: { tags_.AddEntriesFrom(input, _repeated_tags_codec); break; } case 114: { if (priceInfo_ == null) { PriceInfo = new global::Google.Cloud.Retail.V2.PriceInfo(); } input.ReadMessage(PriceInfo); break; } case 146: { if (availableTime_ == null) { AvailableTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(AvailableTime); break; } case 152: { Availability = (global::Google.Cloud.Retail.V2.Product.Types.Availability)input.ReadEnum(); break; } case 162: { int?value = _single_availableQuantity_codec.Read(input); if (availableQuantity_ == null || value != 0) { AvailableQuantity = value; } break; } case 178: { Uri = input.ReadString(); break; } case 186: { images_.AddEntriesFrom(input, _repeated_images_codec); break; } } } #endif }
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch (tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { Name = input.ReadString(); break; } case 18: { Id = input.ReadString(); break; } case 24: { Type = (global::Google.Cloud.Retail.V2.Product.Types.Type)input.ReadEnum(); break; } case 34: { PrimaryProductId = input.ReadString(); break; } case 58: { categories_.AddEntriesFrom(ref input, _repeated_categories_codec); break; } case 66: { Title = input.ReadString(); break; } case 82: { Description = input.ReadString(); break; } case 98: { attributes_.AddEntriesFrom(ref input, _map_attributes_codec); break; } case 106: { tags_.AddEntriesFrom(ref input, _repeated_tags_codec); break; } case 114: { if (priceInfo_ == null) { PriceInfo = new global::Google.Cloud.Retail.V2.PriceInfo(); } input.ReadMessage(PriceInfo); break; } case 146: { if (availableTime_ == null) { AvailableTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(AvailableTime); break; } case 152: { Availability = (global::Google.Cloud.Retail.V2.Product.Types.Availability)input.ReadEnum(); break; } case 162: { int?value = _single_availableQuantity_codec.Read(ref input); if (availableQuantity_ == null || value != 0) { AvailableQuantity = value; } break; } case 178: { Uri = input.ReadString(); break; } case 186: { images_.AddEntriesFrom(ref input, _repeated_images_codec); break; } } } }