Exemplo n.º 1
0
 private void readObject(java.io.ObjectInputStream in)
     throws java.io.IOException, ClassNotFoundException {
   try {
     // it doesn't seem like you should have to do this, but java serialization is wacky, and
     // doesn't call the default constructor.
     __isset_bit_vector = new BitSet(1);
     read(
         new org.apache.thrift.protocol.TCompactProtocol(
             new org.apache.thrift.transport.TIOStreamTransport(in)));
   } catch (org.apache.thrift.TException te) {
     throw new java.io.IOException(te);
   }
 }
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true) {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) {
        break;
      }
      switch (field.id) {
        case 1: // CHOSEN_ITEMS
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list24 = iprot.readListBegin();
              this.chosenItems = new ArrayList<ChosenMenuItem>(_list24.size);
              for (int _i25 = 0; _i25 < _list24.size; ++_i25) {
                ChosenMenuItem _elem26; // required
                _elem26 = new ChosenMenuItem();
                _elem26.read(iprot);
                this.chosenItems.add(_elem26);
              }
              iprot.readListEnd();
            }
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // EXPECTED_PRICE
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.expectedPrice = iprot.readDouble();
            setExpectedPriceIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // USER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.userId = iprot.readI64();
            setUserIdIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // HOW_WILL_PAY
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.howWillPay = PaymentMethod.findByValue(iprot.readI32());
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // PICK_UP
          if (field.type == org.apache.thrift.protocol.TType.BOOL) {
            this.pickUp = iprot.readBool();
            setPickUpIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // ADDRESS
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.address = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // PHONE_NUMBER
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.phoneNumber = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // TIMESTAMP
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.timestamp = iprot.readI64();
            setTimestampIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // TABLE_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.tableId = iprot.readI64();
            setTableIdIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // PHONE_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.phoneId = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 11: // ORDER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.orderId = iprot.readI64();
            setOrderIdIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 12: // USERNAME
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.username = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    if (!isSetExpectedPrice()) {
      throw new org.apache.thrift.protocol.TProtocolException(
          "Required field 'expectedPrice' was not found in serialized data! Struct: " + toString());
    }
    if (!isSetUserId()) {
      throw new org.apache.thrift.protocol.TProtocolException(
          "Required field 'userId' was not found in serialized data! Struct: " + toString());
    }
    if (!isSetPickUp()) {
      throw new org.apache.thrift.protocol.TProtocolException(
          "Required field 'pickUp' was not found in serialized data! Struct: " + toString());
    }
    if (!isSetTimestamp()) {
      throw new org.apache.thrift.protocol.TProtocolException(
          "Required field 'timestamp' was not found in serialized data! Struct: " + toString());
    }
    if (!isSetOrderId()) {
      throw new org.apache.thrift.protocol.TProtocolException(
          "Required field 'orderId' was not found in serialized data! Struct: " + toString());
    }
    validate();
  }