write method

void write(
  1. TProtocol oprot
)
override

Writes the objects out to the oprot protocol.

Implementation

write(TProtocol oprot) {
  validate();

  oprot.writeStructBegin(_STRUCT_DESC);
  oprot.writeFieldBegin(_CODE_FIELD_DESC);
  oprot.writeI32(this.code);
  oprot.writeFieldEnd();
  if (this.leader != null) {
    oprot.writeFieldBegin(_LEADER_FIELD_DESC);
    this.leader?.write(oprot);
    oprot.writeFieldEnd();
  }
  if (this.part_hosts != null) {
    oprot.writeFieldBegin(_PART_HOSTS_FIELD_DESC);
    {
      oprot.writeMapBegin(
          new TMap(TType.I32, TType.LIST, this.part_hosts?.length));
      for (var elem312 in this.part_hosts?.keys ?? <int>[]) {
        oprot.writeI32(elem312);
        {
          oprot.writeListBegin(
              new TList(TType.STRUCT, this.part_hosts?[elem312]?.length));
          for (var elem313 in this.part_hosts?[elem312] ?? <PartInfo>[]) {
            elem313.write(oprot);
          }
          oprot.writeListEnd();
        }
      }
      oprot.writeMapEnd();
    }
    oprot.writeFieldEnd();
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}