Exemplo n.º 1
0
  public boolean equals(ChosenMenuItem that) {
    if (that == null) return false;

    boolean this_present_menuItemId = true;
    boolean that_present_menuItemId = true;
    if (this_present_menuItemId || that_present_menuItemId) {
      if (!(this_present_menuItemId && that_present_menuItemId)) return false;
      if (this.menuItemId != that.menuItemId) return false;
    }

    boolean this_present_singleChoiceOptions = true && this.isSetSingleChoiceOptions();
    boolean that_present_singleChoiceOptions = true && that.isSetSingleChoiceOptions();
    if (this_present_singleChoiceOptions || that_present_singleChoiceOptions) {
      if (!(this_present_singleChoiceOptions && that_present_singleChoiceOptions)) return false;
      if (!this.singleChoiceOptions.equals(that.singleChoiceOptions)) return false;
    }

    boolean this_present_multiChoiceOptions = true && this.isSetMultiChoiceOptions();
    boolean that_present_multiChoiceOptions = true && that.isSetMultiChoiceOptions();
    if (this_present_multiChoiceOptions || that_present_multiChoiceOptions) {
      if (!(this_present_multiChoiceOptions && that_present_multiChoiceOptions)) return false;
      if (!this.multiChoiceOptions.equals(that.multiChoiceOptions)) return false;
    }

    boolean this_present_comments = true && this.isSetComments();
    boolean that_present_comments = true && that.isSetComments();
    if (this_present_comments || that_present_comments) {
      if (!(this_present_comments && that_present_comments)) return false;
      if (!this.comments.equals(that.comments)) return false;
    }

    return true;
  }
Exemplo n.º 2
0
 /** Performs a deep copy on <i>other</i>. */
 public ChosenMenuItem(ChosenMenuItem other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   this.menuItemId = other.menuItemId;
   if (other.isSetSingleChoiceOptions()) {
     List<org.pocketcampus.platform.sdk.shared.common.ChosenSingleChoiceOption>
         __this__singleChoiceOptions =
             new ArrayList<org.pocketcampus.platform.sdk.shared.common.ChosenSingleChoiceOption>();
     for (org.pocketcampus.platform.sdk.shared.common.ChosenSingleChoiceOption other_element :
         other.singleChoiceOptions) {
       __this__singleChoiceOptions.add(
           new org.pocketcampus.platform.sdk.shared.common.ChosenSingleChoiceOption(
               other_element));
     }
     this.singleChoiceOptions = __this__singleChoiceOptions;
   }
   if (other.isSetMultiChoiceOptions()) {
     List<org.pocketcampus.platform.sdk.shared.common.ChosenMultiChoiceOption>
         __this__multiChoiceOptions =
             new ArrayList<org.pocketcampus.platform.sdk.shared.common.ChosenMultiChoiceOption>();
     for (org.pocketcampus.platform.sdk.shared.common.ChosenMultiChoiceOption other_element :
         other.multiChoiceOptions) {
       __this__multiChoiceOptions.add(
           new org.pocketcampus.platform.sdk.shared.common.ChosenMultiChoiceOption(other_element));
     }
     this.multiChoiceOptions = __this__multiChoiceOptions;
   }
   if (other.isSetComments()) {
     this.comments = other.comments;
   }
 }
Exemplo n.º 3
0
  public int compareTo(ChosenMenuItem other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;
    ChosenMenuItem typedOther = (ChosenMenuItem) other;

    lastComparison = Boolean.valueOf(isSetMenuItemId()).compareTo(typedOther.isSetMenuItemId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMenuItemId()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.menuItemId, typedOther.menuItemId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetSingleChoiceOptions())
            .compareTo(typedOther.isSetSingleChoiceOptions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetSingleChoiceOptions()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(
              this.singleChoiceOptions, typedOther.singleChoiceOptions);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(isSetMultiChoiceOptions()).compareTo(typedOther.isSetMultiChoiceOptions());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetMultiChoiceOptions()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(
              this.multiChoiceOptions, typedOther.multiChoiceOptions);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetComments()).compareTo(typedOther.isSetComments());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetComments()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.comments, typedOther.comments);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
  public void write(org.apache.thrift.protocol.TProtocol oprot)
      throws org.apache.thrift.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.chosenItems != null) {
      oprot.writeFieldBegin(CHOSEN_ITEMS_FIELD_DESC);
      {
        oprot.writeListBegin(
            new org.apache.thrift.protocol.TList(
                org.apache.thrift.protocol.TType.STRUCT, this.chosenItems.size()));
        for (ChosenMenuItem _iter27 : this.chosenItems) {
          _iter27.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(EXPECTED_PRICE_FIELD_DESC);
    oprot.writeDouble(this.expectedPrice);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.userId);
    oprot.writeFieldEnd();
    if (this.howWillPay != null) {
      oprot.writeFieldBegin(HOW_WILL_PAY_FIELD_DESC);
      oprot.writeI32(this.howWillPay.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(PICK_UP_FIELD_DESC);
    oprot.writeBool(this.pickUp);
    oprot.writeFieldEnd();
    if (this.address != null) {
      if (isSetAddress()) {
        oprot.writeFieldBegin(ADDRESS_FIELD_DESC);
        oprot.writeString(this.address);
        oprot.writeFieldEnd();
      }
    }
    if (this.phoneNumber != null) {
      if (isSetPhoneNumber()) {
        oprot.writeFieldBegin(PHONE_NUMBER_FIELD_DESC);
        oprot.writeString(this.phoneNumber);
        oprot.writeFieldEnd();
      }
    }
    oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.timestamp);
    oprot.writeFieldEnd();
    if (isSetTableId()) {
      oprot.writeFieldBegin(TABLE_ID_FIELD_DESC);
      oprot.writeI64(this.tableId);
      oprot.writeFieldEnd();
    }
    if (this.phoneId != null) {
      oprot.writeFieldBegin(PHONE_ID_FIELD_DESC);
      oprot.writeString(this.phoneId);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ORDER_ID_FIELD_DESC);
    oprot.writeI64(this.orderId);
    oprot.writeFieldEnd();
    if (this.username != null) {
      oprot.writeFieldBegin(USERNAME_FIELD_DESC);
      oprot.writeString(this.username);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }
  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();
  }