protected void finish(NutritionInformationNuggetJSON result) { if (fieldGeneratorNutritionCommandKind.have_value) { result.setNutritionCommandKind(); fieldGeneratorNutritionCommandKind.have_value = false; } else if ((!(result.hasNutritionCommandKind())) && !allow_incomplete) { error("When parsing the object for %what%, the \"NutritionCommandKind\" 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 (fieldGeneratorFoodBlocks.have_value) { result.initFoodBlocks(); int count = fieldGeneratorFoodBlocks.value.Count; for (int num = 0; num < count; ++num) { List <FoodJSON> unwrapped0 = new List <FoodJSON>(); for (int num0 = 0; num0 < fieldGeneratorFoodBlocks.value[num].Count; ++num0) { unwrapped0.Add(fieldGeneratorFoodBlocks.value[num][num0]); } result.appendFoodBlocks(unwrapped0); } fieldGeneratorFoodBlocks.value.Clear(); fieldGeneratorFoodBlocks.have_value = false; } else if ((!(result.hasFoodBlocks())) && !allow_incomplete) { error("When parsing the object for %what%, the \"FoodBlocks\" field was missing."); } base.finish(result); }
protected override void finish() { if (!(getInformationNuggetJSONKey().Equals("Nutrition"))) { throw new Exception("The key field has a value other than `Nutrition'."); } NutritionInformationNuggetJSON result = new NutritionInformationNuggetJSON(); Debug.Assert(result != null); finish(result); int extra_count = unknownFieldGenerator.field_names.Count; Debug.Assert(extra_count == unknownFieldGenerator.field_values.Count); for (int extra_num = 0; extra_num < extra_count; ++extra_num) { result.extraNutritionInformationNuggetAppendPair(unknownFieldGenerator.field_names[extra_num], unknownFieldGenerator.field_values[extra_num]); } unknownFieldGenerator.field_names.Clear(); unknownFieldGenerator.field_values.Clear(); unknownFieldGenerator.index = new Dictionary <string, JSONValue>(); handle_result(result); }
protected override void handle_result(NutritionInformationNuggetJSON result) { top.value.Add(result); }
protected override void handle_result(NutritionInformationNuggetJSON result) { //@@@ Debug.Assert(!have_value); have_value = true; value = result; }
protected abstract void handle_result(NutritionInformationNuggetJSON new_result);