read method
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 CLIENTS:
if (field.type == TType.MAP) {
{
TMap _map318 = iprot.readMapBegin();
this.clients = new Map<int, List<ServiceClient>>();
for (int _i319 = 0; _i319 < _map318.length; ++_i319) {
int _key320;
List<ServiceClient> _val321;
_key320 = iprot.readI32();
{
TList _list322 = iprot.readListBegin();
_val321 = <ServiceClient>[];
for (int _i323 = 0; _i323 < _list322.length; ++_i323) {
ServiceClient _elem324;
_elem324 = new ServiceClient();
_elem324.read(iprot);
_val321.add(_elem324);
}
iprot.readListEnd();
}
this.clients?[_key320] = _val321;
}
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();
}