protected void finish(FoodJSON result) { if (fieldGeneratorID.have_value) { result.setID(fieldGeneratorID.value); fieldGeneratorID.have_value = false; } else if ((!(result.hasID())) && !allow_incomplete) { error("When parsing the object for %what%, the \"ID\" field was missing."); } if (fieldGeneratorQuantity.have_value) { result.setQuantityText(fieldGeneratorQuantity.value); fieldGeneratorQuantity.have_value = false; } else if ((!(result.hasQuantity())) && !allow_incomplete) { error("When parsing the object for %what%, the \"Quantity\" field was missing."); } if (fieldGeneratorNDB_No.have_value) { result.setNDB_No(fieldGeneratorNDB_No.value); fieldGeneratorNDB_No.have_value = false; } else if ((!(result.hasNDB_No())) && !allow_incomplete) { error("When parsing the object for %what%, the \"NDB_No\" field was missing."); } if (fieldGeneratorSizeIndex.have_value) { result.setSizeIndex(fieldGeneratorSizeIndex.value); fieldGeneratorSizeIndex.have_value = false; } else if ((!(result.hasSizeIndex())) && !allow_incomplete) { error("When parsing the object for %what%, the \"SizeIndex\" field was missing."); } if (fieldGeneratorNameIncludesUnits.have_value) { result.setNameIncludesUnits(fieldGeneratorNameIncludesUnits.value); fieldGeneratorNameIncludesUnits.have_value = false; } else if ((!(result.hasNameIncludesUnits())) && !allow_incomplete) { error("When parsing the object for %what%, the \"NameIncludesUnits\" field was missing."); } if (fieldGeneratorExclude.have_value) { result.setExclude(fieldGeneratorExclude.value); fieldGeneratorExclude.have_value = false; } else if ((!(result.hasExclude())) && !allow_incomplete) { error("When parsing the object for %what%, the \"Exclude\" field was missing."); } if (fieldGeneratorSpokenNoSize.have_value) { result.setSpokenNoSize(fieldGeneratorSpokenNoSize.value); fieldGeneratorSpokenNoSize.have_value = false; } else if ((!(result.hasSpokenNoSize())) && !allow_incomplete) { error("When parsing the object for %what%, the \"SpokenNoSize\" field was missing."); } if (fieldGeneratorWrittenNoSize.have_value) { result.setWrittenNoSize(fieldGeneratorWrittenNoSize.value); fieldGeneratorWrittenNoSize.have_value = false; } else if ((!(result.hasWrittenNoSize())) && !allow_incomplete) { error("When parsing the object for %what%, the \"WrittenNoSize\" field was missing."); } if (fieldGeneratorWikiUrl.have_value) { result.setWikiUrl(fieldGeneratorWikiUrl.value); fieldGeneratorWikiUrl.have_value = false; } else if ((!(result.hasWikiUrl())) && !allow_incomplete) { error("When parsing the object for %what%, the \"WikiUrl\" field was missing."); } if (fieldGeneratorImageUrl.have_value) { result.setImageUrl(fieldGeneratorImageUrl.value); fieldGeneratorImageUrl.have_value = false; } else if ((!(result.hasImageUrl())) && !allow_incomplete) { error("When parsing the object for %what%, the \"ImageUrl\" field was missing."); } if (fieldGeneratorAllSizes.have_value) { result.initAllSizes(); int count = fieldGeneratorAllSizes.value.Count; for (int num = 0; num < count; ++num) { result.appendAllSizes(fieldGeneratorAllSizes.value[num]); } fieldGeneratorAllSizes.value.Clear(); fieldGeneratorAllSizes.have_value = false; } else if ((!(result.hasAllSizes())) && !allow_incomplete) { error("When parsing the object for %what%, the \"AllSizes\" field was missing."); } if (fieldGeneratorNutrients.have_value) { result.initNutrients(); int count = fieldGeneratorNutrients.value.Count; for (int num = 0; num < count; ++num) { result.appendNutrients(fieldGeneratorNutrients.value[num]); } fieldGeneratorNutrients.value.Clear(); fieldGeneratorNutrients.have_value = false; } else if ((!(result.hasNutrients())) && !allow_incomplete) { error("When parsing the object for %what%, the \"Nutrients\" field was missing."); } if (fieldGeneratorNutrientNameToID.have_value) { result.setNutrientNameToID(fieldGeneratorNutrientNameToID.value); fieldGeneratorNutrientNameToID.have_value = false; } else if ((!(result.hasNutrientNameToID())) && !allow_incomplete) { error("When parsing the object for %what%, the \"NutrientNameToID\" field was missing."); } }