Example #1
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, UserCrawlState 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: // UID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.uid = iprot.readString();
              struct.setUidIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // SINCE_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.sinceID = iprot.readI64();
              struct.setSinceIDIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // LAST_CRAWL_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.lastCrawlTime = iprot.readI64();
              struct.setLastCrawlTimeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // LAST_CRAWL_NUM
            if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
              struct.lastCrawlNum = iprot.readI16();
              struct.setLastCrawlNumIsSet(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();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }
Example #2
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, UserCrawlState struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.uid != null) {
        oprot.writeFieldBegin(UID_FIELD_DESC);
        oprot.writeString(struct.uid);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(SINCE_ID_FIELD_DESC);
      oprot.writeI64(struct.sinceID);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(LAST_CRAWL_TIME_FIELD_DESC);
      oprot.writeI64(struct.lastCrawlTime);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(LAST_CRAWL_NUM_FIELD_DESC);
      oprot.writeI16(struct.lastCrawlNum);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }