Esempio n. 1
0
 /** Get a {@code DynamicMessage} representing the default instance of the given type. */
 public static DynamicMessage getDefaultInstance(Descriptor type) {
   int oneofDeclCount = type.toProto().getOneofDeclCount();
   FieldDescriptor[] oneofCases = new FieldDescriptor[oneofDeclCount];
   return new DynamicMessage(
       type,
       FieldSet.<FieldDescriptor>emptySet(),
       oneofCases,
       UnknownFieldSet.getDefaultInstance());
 }
Esempio n. 2
0
 /** Construct a {@code Builder} for the given type. */
 private Builder(Descriptor type) {
   this.type = type;
   this.fields = FieldSet.newFieldSet();
   this.unknownFields = UnknownFieldSet.getDefaultInstance();
   this.oneofCases = new FieldDescriptor[type.toProto().getOneofDeclCount()];
 }