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 PARTS:
if (field.type == TType.MAP) {
{
TMap _map132 = iprot.readMapBegin();
this.parts = new Map<int, List<t_nebula.HostAddr>>();
for (int _i133 = 0; _i133 < _map132.length; ++_i133) {
int _key134;
List<t_nebula.HostAddr> _val135;
_key134 = iprot.readI32();
{
TList _list136 = iprot.readListBegin();
_val135 = <t_nebula.HostAddr>[];
for (int _i137 = 0; _i137 < _list136.length; ++_i137) {
t_nebula.HostAddr _elem138;
_elem138 = new t_nebula.HostAddr();
_elem138.read(iprot);
_val135.add(_elem138);
}
iprot.readListEnd();
}
this.parts?[_key134] = _val135;
}
iprot.readMapEnd();
}
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case TERMS:
if (field.type == TType.MAP) {
{
TMap _map139 = iprot.readMapBegin();
this.terms = new Map<int, int>();
for (int _i140 = 0; _i140 < _map139.length; ++_i140) {
int _key141;
int _val142;
_key141 = iprot.readI32();
_val142 = iprot.readI64();
this.terms?[_key141] = _val142;
}
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();
}