Пример #1
0
 public void write(TProtocol oprot) throws TException {
   TStruct struct = new TStruct("TTestStruct");
   oprot.writeStructBegin(struct);
   TField field = new TField();
   field.name = "booleanField";
   field.type = TType.BOOL;
   field.id = BOOLEANFIELD;
   oprot.writeFieldBegin(field);
   oprot.writeBool(this.booleanField);
   oprot.writeFieldEnd();
   field.name = "byteField";
   field.type = TType.BYTE;
   field.id = BYTEFIELD;
   oprot.writeFieldBegin(field);
   oprot.writeByte(this.byteField);
   oprot.writeFieldEnd();
   field.name = "shortField";
   field.type = TType.I16;
   field.id = SHORTFIELD;
   oprot.writeFieldBegin(field);
   oprot.writeI16(this.shortField);
   oprot.writeFieldEnd();
   field.name = "intField";
   field.type = TType.I32;
   field.id = INTFIELD;
   oprot.writeFieldBegin(field);
   oprot.writeI32(this.intField);
   oprot.writeFieldEnd();
   field.name = "longField";
   field.type = TType.I64;
   field.id = LONGFIELD;
   oprot.writeFieldBegin(field);
   oprot.writeI64(this.longField);
   oprot.writeFieldEnd();
   field.name = "doubleField";
   field.type = TType.DOUBLE;
   field.id = DOUBLEFIELD;
   oprot.writeFieldBegin(field);
   oprot.writeDouble(this.doubleField);
   oprot.writeFieldEnd();
   if (this.stringField != null) {
     field.name = "stringField";
     field.type = TType.STRING;
     field.id = STRINGFIELD;
     oprot.writeFieldBegin(field);
     oprot.writeString(this.stringField);
     oprot.writeFieldEnd();
   }
   if (this.binaryField != null) {
     field.name = "binaryField";
     field.type = TType.STRING;
     field.id = BINARYFIELD;
     oprot.writeFieldBegin(field);
     oprot.writeBinary(this.binaryField);
     oprot.writeFieldEnd();
   }
   if (this.listOfIntsField != null) {
     field.name = "listOfIntsField";
     field.type = TType.LIST;
     field.id = LISTOFINTSFIELD;
     oprot.writeFieldBegin(field);
     {
       oprot.writeListBegin(new TList(TType.I32, this.listOfIntsField.size()));
       for (int _iter20 : this.listOfIntsField) {
         oprot.writeI32(_iter20);
       }
       oprot.writeListEnd();
     }
     oprot.writeFieldEnd();
   }
   if (this.setOfIntsField != null) {
     field.name = "setOfIntsField";
     field.type = TType.SET;
     field.id = SETOFINTSFIELD;
     oprot.writeFieldBegin(field);
     {
       oprot.writeSetBegin(new TSet(TType.I32, this.setOfIntsField.size()));
       for (int _iter21 : this.setOfIntsField) {
         oprot.writeI32(_iter21);
       }
       oprot.writeSetEnd();
     }
     oprot.writeFieldEnd();
   }
   if (this.mapOfIntsIntsField != null) {
     field.name = "mapOfIntsIntsField";
     field.type = TType.MAP;
     field.id = MAPOFINTSINTSFIELD;
     oprot.writeFieldBegin(field);
     {
       oprot.writeMapBegin(new TMap(TType.I32, TType.I32, this.mapOfIntsIntsField.size()));
       for (int _iter22 : this.mapOfIntsIntsField.keySet()) {
         oprot.writeI32(_iter22);
         oprot.writeI32(this.mapOfIntsIntsField.get(_iter22));
       }
       oprot.writeMapEnd();
     }
     oprot.writeFieldEnd();
   }
   if (this.structField != null) {
     field.name = "structField";
     field.type = TType.STRUCT;
     field.id = STRUCTFIELD;
     oprot.writeFieldBegin(field);
     this.structField.write(oprot);
     oprot.writeFieldEnd();
   }
   if (this.nestedListOfIntsField != null) {
     field.name = "nestedListOfIntsField";
     field.type = TType.LIST;
     field.id = NESTEDLISTOFINTSFIELD;
     oprot.writeFieldBegin(field);
     {
       oprot.writeListBegin(new TList(TType.LIST, this.nestedListOfIntsField.size()));
       for (List<Integer> _iter23 : this.nestedListOfIntsField) {
         {
           oprot.writeListBegin(new TList(TType.I32, _iter23.size()));
           for (int _iter24 : _iter23) {
             oprot.writeI32(_iter24);
           }
           oprot.writeListEnd();
         }
       }
       oprot.writeListEnd();
     }
     oprot.writeFieldEnd();
   }
   if (this.mapOfIntsStringsField != null) {
     field.name = "mapOfIntsStringsField";
     field.type = TType.MAP;
     field.id = MAPOFINTSSTRINGSFIELD;
     oprot.writeFieldBegin(field);
     {
       oprot.writeMapBegin(new TMap(TType.I32, TType.STRING, this.mapOfIntsStringsField.size()));
       for (int _iter25 : this.mapOfIntsStringsField.keySet()) {
         oprot.writeI32(_iter25);
         oprot.writeString(this.mapOfIntsStringsField.get(_iter25));
       }
       oprot.writeMapEnd();
     }
     oprot.writeFieldEnd();
   }
   oprot.writeFieldStop();
   oprot.writeStructEnd();
 }
Пример #2
0
 public void write(TProtocol oprot) throws TException {
   TStruct struct = new TStruct("MockMessage");
   oprot.writeStructBegin(struct);
   TField field = new TField();
   if (this.name != null) {
     field.name = "name";
     field.type = TType.STRING;
     field.id = 1;
     oprot.writeFieldBegin(field);
     oprot.writeString(this.name);
     oprot.writeFieldEnd();
   }
   if (this.mappings != null) {
     field.name = "mappings";
     field.type = TType.MAP;
     field.id = 2;
     oprot.writeFieldBegin(field);
     {
       oprot.writeMapBegin(new TMap(TType.I64, TType.MAP, this.mappings.size()));
       for (long _iter14 : this.mappings.keySet()) {
         oprot.writeI64(_iter14);
         {
           oprot.writeMapBegin(
               new TMap(TType.STRING, TType.I32, this.mappings.get(_iter14).size()));
           for (String _iter15 : this.mappings.get(_iter14).keySet()) {
             oprot.writeString(_iter15);
             oprot.writeI32(this.mappings.get(_iter14).get(_iter15));
           }
           oprot.writeMapEnd();
         }
       }
       oprot.writeMapEnd();
     }
     oprot.writeFieldEnd();
   }
   if (this.intList != null) {
     field.name = "intList";
     field.type = TType.LIST;
     field.id = 3;
     oprot.writeFieldBegin(field);
     {
       oprot.writeListBegin(new TList(TType.I16, this.intList.size()));
       for (short _iter16 : this.intList) {
         oprot.writeI16(_iter16);
       }
       oprot.writeListEnd();
     }
     oprot.writeFieldEnd();
   }
   if (this.strSet != null) {
     field.name = "strSet";
     field.type = TType.SET;
     field.id = 4;
     oprot.writeFieldBegin(field);
     {
       oprot.writeSetBegin(new TSet(TType.STRING, this.strSet.size()));
       for (String _iter17 : this.strSet) {
         oprot.writeString(_iter17);
       }
       oprot.writeSetEnd();
     }
     oprot.writeFieldEnd();
   }
   oprot.writeFieldStop();
   oprot.writeStructEnd();
 }