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.clients != null) {
    oprot.writeFieldBegin(_CLIENTS_FIELD_DESC);
    {
      oprot.writeMapBegin(
          new TMap(TType.I32, TType.LIST, this.clients?.length));
      for (var elem326 in this.clients?.keys ?? <int>[]) {
        oprot.writeI32(elem326);
        {
          oprot.writeListBegin(
              new TList(TType.STRUCT, this.clients?[elem326]?.length));
          for (var elem327 in this.clients?[elem326] ?? <ServiceClient>[]) {
            elem327.write(oprot);
          }
          oprot.writeListEnd();
        }
      }
      oprot.writeMapEnd();
    }
    oprot.writeFieldEnd();
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}