Exemple #1
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, Advert struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   BitSet incoming = iprot.readBitSet(7);
   if (incoming.get(0)) {
     struct.id = iprot.readI32();
     struct.setIdIsSet(true);
   }
   if (incoming.get(1)) {
     struct.issuer = new com.booktion.thrift.User();
     struct.issuer.read(iprot);
     struct.setIssuerIsSet(true);
   }
   if (incoming.get(2)) {
     struct.book = new com.booktion.thrift.Book();
     struct.book.read(iprot);
     struct.setBookIsSet(true);
   }
   if (incoming.get(3)) {
     struct.advertType = com.booktion.thrift.AdvertType.findByValue(iprot.readI32());
     struct.setAdvertTypeIsSet(true);
   }
   if (incoming.get(4)) {
     struct.expires = iprot.readI64();
     struct.setExpiresIsSet(true);
   }
   if (incoming.get(5)) {
     struct.price = iprot.readDouble();
     struct.setPriceIsSet(true);
   }
   if (incoming.get(6)) {
     struct.winner = iprot.readI32();
     struct.setWinnerIsSet(true);
   }
 }
Exemple #2
0
    public void read(org.apache.thrift.protocol.TProtocol iprot, Advert 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: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.id = iprot.readI32();
              struct.setIdIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // ISSUER
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.issuer = new com.booktion.thrift.User();
              struct.issuer.read(iprot);
              struct.setIssuerIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // BOOK
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.book = new com.booktion.thrift.Book();
              struct.book.read(iprot);
              struct.setBookIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // ADVERT_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.advertType = com.booktion.thrift.AdvertType.findByValue(iprot.readI32());
              struct.setAdvertTypeIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // EXPIRES
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.expires = iprot.readI64();
              struct.setExpiresIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // PRICE
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.price = iprot.readDouble();
              struct.setPriceIsSet(true);
            } else {
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // WINNER
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.winner = iprot.readI32();
              struct.setWinnerIsSet(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();
    }