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(); }
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(); }
public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case BOOLEANFIELD: if (field.type == TType.BOOL) { this.booleanField = iprot.readBool(); this.__isset.booleanField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case BYTEFIELD: if (field.type == TType.BYTE) { this.byteField = iprot.readByte(); this.__isset.byteField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case SHORTFIELD: if (field.type == TType.I16) { this.shortField = iprot.readI16(); this.__isset.shortField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case INTFIELD: if (field.type == TType.I32) { this.intField = iprot.readI32(); this.__isset.intField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case LONGFIELD: if (field.type == TType.I64) { this.longField = iprot.readI64(); this.__isset.longField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case DOUBLEFIELD: if (field.type == TType.DOUBLE) { this.doubleField = iprot.readDouble(); this.__isset.doubleField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case STRINGFIELD: if (field.type == TType.STRING) { this.stringField = iprot.readString(); this.__isset.stringField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case BINARYFIELD: if (field.type == TType.STRING) { this.binaryField = iprot.readBinary(); this.__isset.binaryField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case LISTOFINTSFIELD: if (field.type == TType.LIST) { { TList _list0 = iprot.readListBegin(); this.listOfIntsField = new ArrayList<Integer>(_list0.size); for (int _i1 = 0; _i1 < _list0.size; ++_i1) { int _elem2 = 0; _elem2 = iprot.readI32(); this.listOfIntsField.add(_elem2); } iprot.readListEnd(); } this.__isset.listOfIntsField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case SETOFINTSFIELD: if (field.type == TType.SET) { { TSet _set3 = iprot.readSetBegin(); this.setOfIntsField = new HashSet<Integer>(2 * _set3.size); for (int _i4 = 0; _i4 < _set3.size; ++_i4) { int _elem5; _elem5 = iprot.readI32(); this.setOfIntsField.add(_elem5); } iprot.readSetEnd(); } this.__isset.setOfIntsField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case MAPOFINTSINTSFIELD: if (field.type == TType.MAP) { { TMap _map6 = iprot.readMapBegin(); this.mapOfIntsIntsField = new HashMap<Integer, Integer>(2 * _map6.size); for (int _i7 = 0; _i7 < _map6.size; ++_i7) { int _key8; int _val9; _key8 = iprot.readI32(); _val9 = iprot.readI32(); this.mapOfIntsIntsField.put(_key8, _val9); } iprot.readMapEnd(); } this.__isset.mapOfIntsIntsField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case STRUCTFIELD: if (field.type == TType.STRUCT) { this.structField = new TNestedStruct(); this.structField.read(iprot); this.__isset.structField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case NESTEDLISTOFINTSFIELD: if (field.type == TType.LIST) { { TList _list10 = iprot.readListBegin(); this.nestedListOfIntsField = new ArrayList<List<Integer>>(_list10.size); for (int _i11 = 0; _i11 < _list10.size; ++_i11) { List<Integer> _elem12 = new ArrayList<Integer>(); { TList _list13 = iprot.readListBegin(); _elem12 = new ArrayList<Integer>(_list13.size); for (int _i14 = 0; _i14 < _list13.size; ++_i14) { int _elem15 = 0; _elem15 = iprot.readI32(); _elem12.add(_elem15); } iprot.readListEnd(); } this.nestedListOfIntsField.add(_elem12); } iprot.readListEnd(); } this.__isset.nestedListOfIntsField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case MAPOFINTSSTRINGSFIELD: if (field.type == TType.MAP) { { TMap _map16 = iprot.readMapBegin(); this.mapOfIntsStringsField = new HashMap<Integer, String>(2 * _map16.size); for (int _i17 = 0; _i17 < _map16.size; ++_i17) { int _key18; String _val19; _key18 = iprot.readI32(); _val19 = iprot.readString(); this.mapOfIntsStringsField.put(_key18, _val19); } iprot.readMapEnd(); } this.__isset.mapOfIntsStringsField = true; } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); }
public void read(TProtocol iprot) throws TException { TField field; iprot.readStructBegin(); while (true) { field = iprot.readFieldBegin(); if (field.type == TType.STOP) { break; } switch (field.id) { case 1: if (field.type == TType.STRING) { this.name = iprot.readString(); this.__isset.name = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case 2: if (field.type == TType.MAP) { { TMap _map0 = iprot.readMapBegin(); this.mappings = new HashMap<Long, Map<String, Integer>>(2 * _map0.size); for (int _i1 = 0; _i1 < _map0.size; ++_i1) { long _key2; Map<String, Integer> _val3; _key2 = iprot.readI64(); { TMap _map4 = iprot.readMapBegin(); _val3 = new HashMap<String, Integer>(2 * _map4.size); for (int _i5 = 0; _i5 < _map4.size; ++_i5) { String _key6; int _val7; _key6 = iprot.readString(); _val7 = iprot.readI32(); _val3.put(_key6, _val7); } iprot.readMapEnd(); } this.mappings.put(_key2, _val3); } iprot.readMapEnd(); } this.__isset.mappings = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case 3: if (field.type == TType.LIST) { { TList _list8 = iprot.readListBegin(); this.intList = new ArrayList<Short>(_list8.size); for (int _i9 = 0; _i9 < _list8.size; ++_i9) { short _elem10 = 0; _elem10 = iprot.readI16(); this.intList.add(_elem10); } iprot.readListEnd(); } this.__isset.intList = true; } else { TProtocolUtil.skip(iprot, field.type); } break; case 4: if (field.type == TType.SET) { { TSet _set11 = iprot.readSetBegin(); this.strSet = new HashSet<String>(2 * _set11.size); for (int _i12 = 0; _i12 < _set11.size; ++_i12) { String _elem13; _elem13 = iprot.readString(); this.strSet.add(_elem13); } iprot.readSetEnd(); } this.__isset.strSet = true; } else { TProtocolUtil.skip(iprot, field.type); } break; default: TProtocolUtil.skip(iprot, field.type); break; } iprot.readFieldEnd(); } iprot.readStructEnd(); }