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.hosts != null) {
    oprot.writeFieldBegin(_HOSTS_FIELD_DESC);
    {
      oprot.writeListBegin(new TList(TType.STRUCT, this.hosts?.length));
      for (var elem249 in this.hosts ?? []) {
        elem249.write(oprot);
      }
      oprot.writeListEnd();
    }
    oprot.writeFieldEnd();
  }
  oprot.writeFieldStop();
  oprot.writeStructEnd();
}