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;
  }