Esempio n. 1
0
 @Override
 public void write(org.apache.thrift.protocol.TProtocol prot, Advert struct)
     throws org.apache.thrift.TException {
   TTupleProtocol oprot = (TTupleProtocol) prot;
   BitSet optionals = new BitSet();
   if (struct.isSetId()) {
     optionals.set(0);
   }
   if (struct.isSetIssuer()) {
     optionals.set(1);
   }
   if (struct.isSetBook()) {
     optionals.set(2);
   }
   if (struct.isSetAdvertType()) {
     optionals.set(3);
   }
   if (struct.isSetExpires()) {
     optionals.set(4);
   }
   if (struct.isSetPrice()) {
     optionals.set(5);
   }
   if (struct.isSetWinner()) {
     optionals.set(6);
   }
   oprot.writeBitSet(optionals, 7);
   if (struct.isSetId()) {
     oprot.writeI32(struct.id);
   }
   if (struct.isSetIssuer()) {
     struct.issuer.write(oprot);
   }
   if (struct.isSetBook()) {
     struct.book.write(oprot);
   }
   if (struct.isSetAdvertType()) {
     oprot.writeI32(struct.advertType.getValue());
   }
   if (struct.isSetExpires()) {
     oprot.writeI64(struct.expires);
   }
   if (struct.isSetPrice()) {
     oprot.writeDouble(struct.price);
   }
   if (struct.isSetWinner()) {
     oprot.writeI32(struct.winner);
   }
 }
Esempio n. 2
0
  @Override
  public int compareTo(Advert other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetIssuer()).compareTo(other.isSetIssuer());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIssuer()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.issuer, other.issuer);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetBook()).compareTo(other.isSetBook());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBook()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.book, other.book);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAdvertType()).compareTo(other.isSetAdvertType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAdvertType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.advertType, other.advertType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetExpires()).compareTo(other.isSetExpires());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetExpires()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.expires, other.expires);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPrice()).compareTo(other.isSetPrice());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPrice()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.price, other.price);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetWinner()).compareTo(other.isSetWinner());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetWinner()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.winner, other.winner);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }