Ejemplo n.º 1
0
 public void mergeFrom(Input input, Foo message) throws IOException {
   for (int number = input.readFieldNumber(this); ; number = input.readFieldNumber(this)) {
     switch (number) {
       case 0:
         return;
       case 1:
         if (message.someInt == null) message.someInt = new ArrayList<Integer>();
         message.someInt.add(input.readInt32());
         break;
       case 2:
         if (message.someString == null) message.someString = new ArrayList<String>();
         message.someString.add(input.readString());
         break;
       case 3:
         if (message.someBar == null) message.someBar = new ArrayList<Bar>();
         message.someBar.add(input.mergeObject(null, Bar.getSchema()));
         break;
       case 4:
         if (message.someEnum == null) message.someEnum = new ArrayList<EnumSample>();
         message.someEnum.add(EnumSample.valueOf(input.readEnum()));
         break;
       case 5:
         if (message.someBytes == null) message.someBytes = new ArrayList<ByteString>();
         message.someBytes.add(input.readBytes());
         break;
       case 6:
         if (message.someBoolean == null) message.someBoolean = new ArrayList<Boolean>();
         message.someBoolean.add(input.readBool());
         break;
       case 7:
         if (message.someFloat == null) message.someFloat = new ArrayList<Float>();
         message.someFloat.add(input.readFloat());
         break;
       case 8:
         if (message.someDouble == null) message.someDouble = new ArrayList<Double>();
         message.someDouble.add(input.readDouble());
         break;
       case 9:
         if (message.someLong == null) message.someLong = new ArrayList<Long>();
         message.someLong.add(input.readInt64());
         break;
       default:
         input.handleUnknownField(number, this);
     }
   }
 }
Ejemplo n.º 2
0
 protected void transfer(Pipe pipe, Input input, Output output) throws IOException {
   for (int number = input.readFieldNumber(wrappedSchema);
       ;
       number = input.readFieldNumber(wrappedSchema)) {
     switch (number) {
       case 0:
         return;
       case 1:
         output.writeInt32(number, input.readInt32(), true);
         break;
       case 2:
         input.transferByteRangeTo(output, true, number, true);
         break;
       case 3:
         output.writeObject(number, pipe, Bar.getPipeSchema(), true);
         break;
       case 4:
         output.writeEnum(number, input.readEnum(), true);
         break;
       case 5:
         input.transferByteRangeTo(output, false, number, true);
         break;
       case 6:
         output.writeBool(number, input.readBool(), true);
         break;
       case 7:
         output.writeFloat(number, input.readFloat(), true);
         break;
       case 8:
         output.writeDouble(number, input.readDouble(), true);
         break;
       case 9:
         output.writeInt64(number, input.readInt64(), true);
         break;
       default:
         input.handleUnknownField(number, wrappedSchema);
     }
   }
 }