read method

void read(
  1. TProtocol iprot
)
override

Reads the TObject from the given input protocol.

Implementation

read(TProtocol iprot) {
  TField field;
  iprot.readStructBegin();
  while (true) {
    field = iprot.readFieldBegin();
    if (field.type == TType.STOP) {
      break;
    }
    switch (field.id) {
      case CODE:
        if (field.type == TType.I32) {
          this.code = iprot.readI32();
          this.__isset_code = true;
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case LEADER:
        if (field.type == TType.STRUCT) {
          this.leader = new t_nebula.HostAddr();
          this.leader?.read(iprot);
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      case PART_HOSTS:
        if (field.type == TType.MAP) {
          {
            TMap _map304 = iprot.readMapBegin();
            this.part_hosts = new Map<int, List<PartInfo>>();
            for (int _i305 = 0; _i305 < _map304.length; ++_i305) {
              int _key306;
              List<PartInfo> _val307;
              _key306 = iprot.readI32();
              {
                TList _list308 = iprot.readListBegin();
                _val307 = <PartInfo>[];
                for (int _i309 = 0; _i309 < _list308.length; ++_i309) {
                  PartInfo _elem310;
                  _elem310 = new PartInfo();
                  _elem310.read(iprot);
                  _val307.add(_elem310);
                }
                iprot.readListEnd();
              }
              this.part_hosts?[_key306] = _val307;
            }
            iprot.readMapEnd();
          }
        } else {
          TProtocolUtil.skip(iprot, field.type);
        }
        break;
      default:
        TProtocolUtil.skip(iprot, field.type);
        break;
    }
    iprot.readFieldEnd();
  }
  iprot.readStructEnd();

  // check for required fields of primitive type, which can't be checked in the validate method
  validate();
}