コード例 #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();
    }
コード例 #2
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, UserCrawlState struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(4);
   if (incoming.get(0)) {
     struct.uid = iprot.readString();
     struct.setUidIsSet(true);
   }
   if (incoming.get(1)) {
     struct.sinceID = iprot.readI64();
     struct.setSinceIDIsSet(true);
   }
   if (incoming.get(2)) {
     struct.lastCrawlTime = iprot.readI64();
     struct.setLastCrawlTimeIsSet(true);
   }
   if (incoming.get(3)) {
     struct.lastCrawlNum = iprot.readI16();
     struct.setLastCrawlNumIsSet(true);
   }
 }