Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: third_party/protobuf/java/core/src/main/java/com/google/protobuf/MessageReflection.java

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 * prototype directly. 357 * prototype directly.
358 */ 358 */
359 MergeTarget newMergeTargetForField( 359 MergeTarget newMergeTargetForField(
360 Descriptors.FieldDescriptor descriptor, 360 Descriptors.FieldDescriptor descriptor,
361 Message defaultInstance); 361 Message defaultInstance);
362 362
363 /** 363 /**
364 * Finishes the merge and returns the underlying object. 364 * Finishes the merge and returns the underlying object.
365 */ 365 */
366 Object finish(); 366 Object finish();
367
368 } 367 }
369 368
370 static class BuilderAdapter implements MergeTarget { 369 static class BuilderAdapter implements MergeTarget {
371 370
372 private final Message.Builder builder; 371 private final Message.Builder builder;
373 372
374 @Override 373 @Override
375 public Descriptors.Descriptor getDescriptorForType() { 374 public Descriptors.Descriptor getDescriptorForType() {
376 return builder.getDescriptorForType(); 375 return builder.getDescriptorForType();
377 } 376 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 && builder instanceof GeneratedMessage.Builder) { 541 && builder instanceof GeneratedMessage.Builder) {
543 return WireFormat.Utf8Validation.LAZY; 542 return WireFormat.Utf8Validation.LAZY;
544 } 543 }
545 return WireFormat.Utf8Validation.LOOSE; 544 return WireFormat.Utf8Validation.LOOSE;
546 } 545 }
547 546
548 @Override 547 @Override
549 public Object finish() { 548 public Object finish() {
550 return builder.buildPartial(); 549 return builder.buildPartial();
551 } 550 }
552
553 } 551 }
554 552
555 553
556 static class ExtensionAdapter implements MergeTarget { 554 static class ExtensionAdapter implements MergeTarget {
557 555
558 private final FieldSet<Descriptors.FieldDescriptor> extensions; 556 private final FieldSet<Descriptors.FieldDescriptor> extensions;
559 557
560 ExtensionAdapter(FieldSet<Descriptors.FieldDescriptor> extensions) { 558 ExtensionAdapter(FieldSet<Descriptors.FieldDescriptor> extensions) {
561 this.extensions = extensions; 559 this.extensions = extensions;
562 } 560 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 } 704 }
707 // TODO(liujisi): support lazy strings for ExtesnsionSet. 705 // TODO(liujisi): support lazy strings for ExtesnsionSet.
708 return WireFormat.Utf8Validation.LOOSE; 706 return WireFormat.Utf8Validation.LOOSE;
709 } 707 }
710 708
711 @Override 709 @Override
712 public Object finish() { 710 public Object finish() {
713 throw new UnsupportedOperationException( 711 throw new UnsupportedOperationException(
714 "finish() called on FieldSet object"); 712 "finish() called on FieldSet object");
715 } 713 }
716
717 } 714 }
718 715
719 /** 716 /**
720 * Parses a single field into MergeTarget. The target can be Message.Builder, 717 * Parses a single field into MergeTarget. The target can be Message.Builder,
721 * FieldSet or MutableMessage. 718 * FieldSet or MutableMessage.
722 * 719 *
723 * Package-private because it is used by GeneratedMessage.ExtendableMessage. 720 * Package-private because it is used by GeneratedMessage.ExtendableMessage.
724 * 721 *
725 * @param tag The tag, which should have already been read. 722 * @param tag The tag, which should have already been read.
726 * @return {@code true} unless the tag is an end-group tag. 723 * @return {@code true} unless the tag is an end-group tag.
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 CodedInputStream input, 981 CodedInputStream input,
985 ExtensionRegistry.ExtensionInfo extension, 982 ExtensionRegistry.ExtensionInfo extension,
986 ExtensionRegistryLite extensionRegistry, 983 ExtensionRegistryLite extensionRegistry,
987 MergeTarget target) throws IOException { 984 MergeTarget target) throws IOException {
988 Descriptors.FieldDescriptor field = extension.descriptor; 985 Descriptors.FieldDescriptor field = extension.descriptor;
989 Object value = target.parseMessage(input, extensionRegistry, field, 986 Object value = target.parseMessage(input, extensionRegistry, field,
990 extension.defaultInstance); 987 extension.defaultInstance);
991 target.setField(field, value); 988 target.setField(field, value);
992 } 989 }
993 } 990 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698