public void write(org.apache.thrift.protocol.TProtocol oprot, Location struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct.city != null) { if (struct.is_set_city()) { oprot.writeFieldBegin(CITY_FIELD_DESC); oprot.writeString(struct.city); oprot.writeFieldEnd(); } } if (struct.state != null) { if (struct.is_set_state()) { oprot.writeFieldBegin(STATE_FIELD_DESC); oprot.writeString(struct.state); oprot.writeFieldEnd(); } } if (struct.country != null) { if (struct.is_set_country()) { oprot.writeFieldBegin(COUNTRY_FIELD_DESC); oprot.writeString(struct.country); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
public void read(org.apache.thrift.protocol.TProtocol iprot, Location struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // CITY if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.city = iprot.readString(); struct.set_city_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // STATE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.state = iprot.readString(); struct.set_state_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // COUNTRY if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.country = iprot.readString(); struct.set_country_isSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); struct.validate(); }