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 HOST_SERVICES:
        if (field.type == TType.MAP) {
          {
            TMap _map392 = iprot.readMapBegin();
            this.host_services = new Map<String, List<ServiceInfo>>();
            for (int _i393 = 0; _i393 < _map392.length; ++_i393) {
              String _key394;
              List<ServiceInfo> _val395;
              _key394 = iprot.readString();
              {
                TList _list396 = iprot.readListBegin();
                _val395 = <ServiceInfo>[];
                for (int _i397 = 0; _i397 < _list396.length; ++_i397) {
                  ServiceInfo _elem398;
                  _elem398 = new ServiceInfo();
                  _elem398.read(iprot);
                  _val395.add(_elem398);
                }
                iprot.readListEnd();
              }
              this.host_services?[_key394] = _val395;
            }
            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();
}