001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039import org.hl7.fhir.utilities.Utilities;
040
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046
047/**
048 * A request to supply a diet, formula feeding (enteral) or oral nutritional
049 * supplement to a patient/resident.
050 */
051@ResourceDef(name = "NutritionOrder", profile = "http://hl7.org/fhir/StructureDefinition/NutritionOrder")
052public class NutritionOrder extends DomainResource {
053
054  public enum NutritionOrderStatus {
055    /**
056     * The request has been created but is not yet complete or ready for action.
057     */
058    DRAFT,
059    /**
060     * The request is in force and ready to be acted upon.
061     */
062    ACTIVE,
063    /**
064     * The request (and any implicit authorization to act) has been temporarily
065     * withdrawn but is expected to resume in the future.
066     */
067    ONHOLD,
068    /**
069     * The request (and any implicit authorization to act) has been terminated prior
070     * to the known full completion of the intended actions. No further activity
071     * should occur.
072     */
073    REVOKED,
074    /**
075     * The activity described by the request has been fully performed. No further
076     * activity will occur.
077     */
078    COMPLETED,
079    /**
080     * This request should never have existed and should be considered 'void'. (It
081     * is possible that real-world decisions were based on it. If real-world
082     * activity has occurred, the status should be "revoked" rather than
083     * "entered-in-error".).
084     */
085    ENTEREDINERROR,
086    /**
087     * The authoring/source system does not know which of the status values
088     * currently applies for this request. Note: This concept is not to be used for
089     * "other" - one of the listed statuses is presumed to apply, but the
090     * authoring/source system does not know which.
091     */
092    UNKNOWN,
093    /**
094     * added to help the parsers with the generic types
095     */
096    NULL;
097
098    public static NutritionOrderStatus fromCode(String codeString) throws FHIRException {
099      if (codeString == null || "".equals(codeString))
100        return null;
101      if ("draft".equals(codeString))
102        return DRAFT;
103      if ("active".equals(codeString))
104        return ACTIVE;
105      if ("on-hold".equals(codeString))
106        return ONHOLD;
107      if ("revoked".equals(codeString))
108        return REVOKED;
109      if ("completed".equals(codeString))
110        return COMPLETED;
111      if ("entered-in-error".equals(codeString))
112        return ENTEREDINERROR;
113      if ("unknown".equals(codeString))
114        return UNKNOWN;
115      if (Configuration.isAcceptInvalidEnums())
116        return null;
117      else
118        throw new FHIRException("Unknown NutritionOrderStatus code '" + codeString + "'");
119    }
120
121    public String toCode() {
122      switch (this) {
123      case DRAFT:
124        return "draft";
125      case ACTIVE:
126        return "active";
127      case ONHOLD:
128        return "on-hold";
129      case REVOKED:
130        return "revoked";
131      case COMPLETED:
132        return "completed";
133      case ENTEREDINERROR:
134        return "entered-in-error";
135      case UNKNOWN:
136        return "unknown";
137      case NULL:
138        return null;
139      default:
140        return "?";
141      }
142    }
143
144    public String getSystem() {
145      switch (this) {
146      case DRAFT:
147        return "http://hl7.org/fhir/request-status";
148      case ACTIVE:
149        return "http://hl7.org/fhir/request-status";
150      case ONHOLD:
151        return "http://hl7.org/fhir/request-status";
152      case REVOKED:
153        return "http://hl7.org/fhir/request-status";
154      case COMPLETED:
155        return "http://hl7.org/fhir/request-status";
156      case ENTEREDINERROR:
157        return "http://hl7.org/fhir/request-status";
158      case UNKNOWN:
159        return "http://hl7.org/fhir/request-status";
160      case NULL:
161        return null;
162      default:
163        return "?";
164      }
165    }
166
167    public String getDefinition() {
168      switch (this) {
169      case DRAFT:
170        return "The request has been created but is not yet complete or ready for action.";
171      case ACTIVE:
172        return "The request is in force and ready to be acted upon.";
173      case ONHOLD:
174        return "The request (and any implicit authorization to act) has been temporarily withdrawn but is expected to resume in the future.";
175      case REVOKED:
176        return "The request (and any implicit authorization to act) has been terminated prior to the known full completion of the intended actions.  No further activity should occur.";
177      case COMPLETED:
178        return "The activity described by the request has been fully performed.  No further activity will occur.";
179      case ENTEREDINERROR:
180        return "This request should never have existed and should be considered 'void'.  (It is possible that real-world decisions were based on it.  If real-world activity has occurred, the status should be \"revoked\" rather than \"entered-in-error\".).";
181      case UNKNOWN:
182        return "The authoring/source system does not know which of the status values currently applies for this request.  Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply,  but the authoring/source system does not know which.";
183      case NULL:
184        return null;
185      default:
186        return "?";
187      }
188    }
189
190    public String getDisplay() {
191      switch (this) {
192      case DRAFT:
193        return "Draft";
194      case ACTIVE:
195        return "Active";
196      case ONHOLD:
197        return "On Hold";
198      case REVOKED:
199        return "Revoked";
200      case COMPLETED:
201        return "Completed";
202      case ENTEREDINERROR:
203        return "Entered in Error";
204      case UNKNOWN:
205        return "Unknown";
206      case NULL:
207        return null;
208      default:
209        return "?";
210      }
211    }
212  }
213
214  public static class NutritionOrderStatusEnumFactory implements EnumFactory<NutritionOrderStatus> {
215    public NutritionOrderStatus fromCode(String codeString) throws IllegalArgumentException {
216      if (codeString == null || "".equals(codeString))
217        if (codeString == null || "".equals(codeString))
218          return null;
219      if ("draft".equals(codeString))
220        return NutritionOrderStatus.DRAFT;
221      if ("active".equals(codeString))
222        return NutritionOrderStatus.ACTIVE;
223      if ("on-hold".equals(codeString))
224        return NutritionOrderStatus.ONHOLD;
225      if ("revoked".equals(codeString))
226        return NutritionOrderStatus.REVOKED;
227      if ("completed".equals(codeString))
228        return NutritionOrderStatus.COMPLETED;
229      if ("entered-in-error".equals(codeString))
230        return NutritionOrderStatus.ENTEREDINERROR;
231      if ("unknown".equals(codeString))
232        return NutritionOrderStatus.UNKNOWN;
233      throw new IllegalArgumentException("Unknown NutritionOrderStatus code '" + codeString + "'");
234    }
235
236    public Enumeration<NutritionOrderStatus> fromType(PrimitiveType<?> code) throws FHIRException {
237      if (code == null)
238        return null;
239      if (code.isEmpty())
240        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.NULL, code);
241      String codeString = code.asStringValue();
242      if (codeString == null || "".equals(codeString))
243        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.NULL, code);
244      if ("draft".equals(codeString))
245        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.DRAFT, code);
246      if ("active".equals(codeString))
247        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ACTIVE, code);
248      if ("on-hold".equals(codeString))
249        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ONHOLD, code);
250      if ("revoked".equals(codeString))
251        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.REVOKED, code);
252      if ("completed".equals(codeString))
253        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.COMPLETED, code);
254      if ("entered-in-error".equals(codeString))
255        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.ENTEREDINERROR, code);
256      if ("unknown".equals(codeString))
257        return new Enumeration<NutritionOrderStatus>(this, NutritionOrderStatus.UNKNOWN, code);
258      throw new FHIRException("Unknown NutritionOrderStatus code '" + codeString + "'");
259    }
260
261    public String toCode(NutritionOrderStatus code) {
262      if (code == NutritionOrderStatus.DRAFT)
263        return "draft";
264      if (code == NutritionOrderStatus.ACTIVE)
265        return "active";
266      if (code == NutritionOrderStatus.ONHOLD)
267        return "on-hold";
268      if (code == NutritionOrderStatus.REVOKED)
269        return "revoked";
270      if (code == NutritionOrderStatus.COMPLETED)
271        return "completed";
272      if (code == NutritionOrderStatus.ENTEREDINERROR)
273        return "entered-in-error";
274      if (code == NutritionOrderStatus.UNKNOWN)
275        return "unknown";
276      return "?";
277    }
278
279    public String toSystem(NutritionOrderStatus code) {
280      return code.getSystem();
281    }
282  }
283
284  public enum NutritiionOrderIntent {
285    /**
286     * The request is a suggestion made by someone/something that does not have an
287     * intention to ensure it occurs and without providing an authorization to act.
288     */
289    PROPOSAL,
290    /**
291     * The request represents an intention to ensure something occurs without
292     * providing an authorization for others to act.
293     */
294    PLAN,
295    /**
296     * The request represents a legally binding instruction authored by a Patient or
297     * RelatedPerson.
298     */
299    DIRECTIVE,
300    /**
301     * The request represents a request/demand and authorization for action by a
302     * Practitioner.
303     */
304    ORDER,
305    /**
306     * The request represents an original authorization for action.
307     */
308    ORIGINALORDER,
309    /**
310     * The request represents an automatically generated supplemental authorization
311     * for action based on a parent authorization together with initial results of
312     * the action taken against that parent authorization.
313     */
314    REFLEXORDER,
315    /**
316     * The request represents the view of an authorization instantiated by a
317     * fulfilling system representing the details of the fulfiller's intention to
318     * act upon a submitted order.
319     */
320    FILLERORDER,
321    /**
322     * An order created in fulfillment of a broader order that represents the
323     * authorization for a single activity occurrence. E.g. The administration of a
324     * single dose of a drug.
325     */
326    INSTANCEORDER,
327    /**
328     * The request represents a component or option for a RequestGroup that
329     * establishes timing, conditionality and/or other constraints among a set of
330     * requests. Refer to [[[RequestGroup]]] for additional information on how this
331     * status is used.
332     */
333    OPTION,
334    /**
335     * added to help the parsers with the generic types
336     */
337    NULL;
338
339    public static NutritiionOrderIntent fromCode(String codeString) throws FHIRException {
340      if (codeString == null || "".equals(codeString))
341        return null;
342      if ("proposal".equals(codeString))
343        return PROPOSAL;
344      if ("plan".equals(codeString))
345        return PLAN;
346      if ("directive".equals(codeString))
347        return DIRECTIVE;
348      if ("order".equals(codeString))
349        return ORDER;
350      if ("original-order".equals(codeString))
351        return ORIGINALORDER;
352      if ("reflex-order".equals(codeString))
353        return REFLEXORDER;
354      if ("filler-order".equals(codeString))
355        return FILLERORDER;
356      if ("instance-order".equals(codeString))
357        return INSTANCEORDER;
358      if ("option".equals(codeString))
359        return OPTION;
360      if (Configuration.isAcceptInvalidEnums())
361        return null;
362      else
363        throw new FHIRException("Unknown NutritiionOrderIntent code '" + codeString + "'");
364    }
365
366    public String toCode() {
367      switch (this) {
368      case PROPOSAL:
369        return "proposal";
370      case PLAN:
371        return "plan";
372      case DIRECTIVE:
373        return "directive";
374      case ORDER:
375        return "order";
376      case ORIGINALORDER:
377        return "original-order";
378      case REFLEXORDER:
379        return "reflex-order";
380      case FILLERORDER:
381        return "filler-order";
382      case INSTANCEORDER:
383        return "instance-order";
384      case OPTION:
385        return "option";
386      case NULL:
387        return null;
388      default:
389        return "?";
390      }
391    }
392
393    public String getSystem() {
394      switch (this) {
395      case PROPOSAL:
396        return "http://hl7.org/fhir/request-intent";
397      case PLAN:
398        return "http://hl7.org/fhir/request-intent";
399      case DIRECTIVE:
400        return "http://hl7.org/fhir/request-intent";
401      case ORDER:
402        return "http://hl7.org/fhir/request-intent";
403      case ORIGINALORDER:
404        return "http://hl7.org/fhir/request-intent";
405      case REFLEXORDER:
406        return "http://hl7.org/fhir/request-intent";
407      case FILLERORDER:
408        return "http://hl7.org/fhir/request-intent";
409      case INSTANCEORDER:
410        return "http://hl7.org/fhir/request-intent";
411      case OPTION:
412        return "http://hl7.org/fhir/request-intent";
413      case NULL:
414        return null;
415      default:
416        return "?";
417      }
418    }
419
420    public String getDefinition() {
421      switch (this) {
422      case PROPOSAL:
423        return "The request is a suggestion made by someone/something that does not have an intention to ensure it occurs and without providing an authorization to act.";
424      case PLAN:
425        return "The request represents an intention to ensure something occurs without providing an authorization for others to act.";
426      case DIRECTIVE:
427        return "The request represents a legally binding instruction authored by a Patient or RelatedPerson.";
428      case ORDER:
429        return "The request represents a request/demand and authorization for action by a Practitioner.";
430      case ORIGINALORDER:
431        return "The request represents an original authorization for action.";
432      case REFLEXORDER:
433        return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.";
434      case FILLERORDER:
435        return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order.";
436      case INSTANCEORDER:
437        return "An order created in fulfillment of a broader order that represents the authorization for a single activity occurrence.  E.g. The administration of a single dose of a drug.";
438      case OPTION:
439        return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests.  Refer to [[[RequestGroup]]] for additional information on how this status is used.";
440      case NULL:
441        return null;
442      default:
443        return "?";
444      }
445    }
446
447    public String getDisplay() {
448      switch (this) {
449      case PROPOSAL:
450        return "Proposal";
451      case PLAN:
452        return "Plan";
453      case DIRECTIVE:
454        return "Directive";
455      case ORDER:
456        return "Order";
457      case ORIGINALORDER:
458        return "Original Order";
459      case REFLEXORDER:
460        return "Reflex Order";
461      case FILLERORDER:
462        return "Filler Order";
463      case INSTANCEORDER:
464        return "Instance Order";
465      case OPTION:
466        return "Option";
467      case NULL:
468        return null;
469      default:
470        return "?";
471      }
472    }
473  }
474
475  public static class NutritiionOrderIntentEnumFactory implements EnumFactory<NutritiionOrderIntent> {
476    public NutritiionOrderIntent fromCode(String codeString) throws IllegalArgumentException {
477      if (codeString == null || "".equals(codeString))
478        if (codeString == null || "".equals(codeString))
479          return null;
480      if ("proposal".equals(codeString))
481        return NutritiionOrderIntent.PROPOSAL;
482      if ("plan".equals(codeString))
483        return NutritiionOrderIntent.PLAN;
484      if ("directive".equals(codeString))
485        return NutritiionOrderIntent.DIRECTIVE;
486      if ("order".equals(codeString))
487        return NutritiionOrderIntent.ORDER;
488      if ("original-order".equals(codeString))
489        return NutritiionOrderIntent.ORIGINALORDER;
490      if ("reflex-order".equals(codeString))
491        return NutritiionOrderIntent.REFLEXORDER;
492      if ("filler-order".equals(codeString))
493        return NutritiionOrderIntent.FILLERORDER;
494      if ("instance-order".equals(codeString))
495        return NutritiionOrderIntent.INSTANCEORDER;
496      if ("option".equals(codeString))
497        return NutritiionOrderIntent.OPTION;
498      throw new IllegalArgumentException("Unknown NutritiionOrderIntent code '" + codeString + "'");
499    }
500
501    public Enumeration<NutritiionOrderIntent> fromType(PrimitiveType<?> code) throws FHIRException {
502      if (code == null)
503        return null;
504      if (code.isEmpty())
505        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.NULL, code);
506      String codeString = code.asStringValue();
507      if (codeString == null || "".equals(codeString))
508        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.NULL, code);
509      if ("proposal".equals(codeString))
510        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.PROPOSAL, code);
511      if ("plan".equals(codeString))
512        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.PLAN, code);
513      if ("directive".equals(codeString))
514        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.DIRECTIVE, code);
515      if ("order".equals(codeString))
516        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.ORDER, code);
517      if ("original-order".equals(codeString))
518        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.ORIGINALORDER, code);
519      if ("reflex-order".equals(codeString))
520        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.REFLEXORDER, code);
521      if ("filler-order".equals(codeString))
522        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.FILLERORDER, code);
523      if ("instance-order".equals(codeString))
524        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.INSTANCEORDER, code);
525      if ("option".equals(codeString))
526        return new Enumeration<NutritiionOrderIntent>(this, NutritiionOrderIntent.OPTION, code);
527      throw new FHIRException("Unknown NutritiionOrderIntent code '" + codeString + "'");
528    }
529
530    public String toCode(NutritiionOrderIntent code) {
531      if (code == NutritiionOrderIntent.PROPOSAL)
532        return "proposal";
533      if (code == NutritiionOrderIntent.PLAN)
534        return "plan";
535      if (code == NutritiionOrderIntent.DIRECTIVE)
536        return "directive";
537      if (code == NutritiionOrderIntent.ORDER)
538        return "order";
539      if (code == NutritiionOrderIntent.ORIGINALORDER)
540        return "original-order";
541      if (code == NutritiionOrderIntent.REFLEXORDER)
542        return "reflex-order";
543      if (code == NutritiionOrderIntent.FILLERORDER)
544        return "filler-order";
545      if (code == NutritiionOrderIntent.INSTANCEORDER)
546        return "instance-order";
547      if (code == NutritiionOrderIntent.OPTION)
548        return "option";
549      return "?";
550    }
551
552    public String toSystem(NutritiionOrderIntent code) {
553      return code.getSystem();
554    }
555  }
556
557  @Block()
558  public static class NutritionOrderOralDietComponent extends BackboneElement implements IBaseBackboneElement {
559    /**
560     * The kind of diet or dietary restriction such as fiber restricted diet or
561     * diabetic diet.
562     */
563    @Child(name = "type", type = {
564        CodeableConcept.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
565    @Description(shortDefinition = "Type of oral diet or diet restrictions that describe what can be consumed orally", formalDefinition = "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.")
566    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/diet-type")
567    protected List<CodeableConcept> type;
568
569    /**
570     * The time period and frequency at which the diet should be given. The diet
571     * should be given for the combination of all schedules if more than one
572     * schedule is present.
573     */
574    @Child(name = "schedule", type = {
575        Timing.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
576    @Description(shortDefinition = "Scheduled frequency of diet", formalDefinition = "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.")
577    protected List<Timing> schedule;
578
579    /**
580     * Class that defines the quantity and type of nutrient modifications (for
581     * example carbohydrate, fiber or sodium) required for the oral diet.
582     */
583    @Child(name = "nutrient", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
584    @Description(shortDefinition = "Required  nutrient modifications", formalDefinition = "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.")
585    protected List<NutritionOrderOralDietNutrientComponent> nutrient;
586
587    /**
588     * Class that describes any texture modifications required for the patient to
589     * safely consume various types of solid foods.
590     */
591    @Child(name = "texture", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
592    @Description(shortDefinition = "Required  texture modifications", formalDefinition = "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.")
593    protected List<NutritionOrderOralDietTextureComponent> texture;
594
595    /**
596     * The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.)
597     * of liquids or fluids served to the patient.
598     */
599    @Child(name = "fluidConsistencyType", type = {
600        CodeableConcept.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
601    @Description(shortDefinition = "The required consistency of fluids and liquids provided to the patient", formalDefinition = "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.")
602    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/consistency-type")
603    protected List<CodeableConcept> fluidConsistencyType;
604
605    /**
606     * Free text or additional instructions or information pertaining to the oral
607     * diet.
608     */
609    @Child(name = "instruction", type = {
610        StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
611    @Description(shortDefinition = "Instructions or additional information about the oral diet", formalDefinition = "Free text or additional instructions or information pertaining to the oral diet.")
612    protected StringType instruction;
613
614    private static final long serialVersionUID = 973058412L;
615
616    /**
617     * Constructor
618     */
619    public NutritionOrderOralDietComponent() {
620      super();
621    }
622
623    /**
624     * @return {@link #type} (The kind of diet or dietary restriction such as fiber
625     *         restricted diet or diabetic diet.)
626     */
627    public List<CodeableConcept> getType() {
628      if (this.type == null)
629        this.type = new ArrayList<CodeableConcept>();
630      return this.type;
631    }
632
633    /**
634     * @return Returns a reference to <code>this</code> for easy method chaining
635     */
636    public NutritionOrderOralDietComponent setType(List<CodeableConcept> theType) {
637      this.type = theType;
638      return this;
639    }
640
641    public boolean hasType() {
642      if (this.type == null)
643        return false;
644      for (CodeableConcept item : this.type)
645        if (!item.isEmpty())
646          return true;
647      return false;
648    }
649
650    public CodeableConcept addType() { // 3
651      CodeableConcept t = new CodeableConcept();
652      if (this.type == null)
653        this.type = new ArrayList<CodeableConcept>();
654      this.type.add(t);
655      return t;
656    }
657
658    public NutritionOrderOralDietComponent addType(CodeableConcept t) { // 3
659      if (t == null)
660        return this;
661      if (this.type == null)
662        this.type = new ArrayList<CodeableConcept>();
663      this.type.add(t);
664      return this;
665    }
666
667    /**
668     * @return The first repetition of repeating field {@link #type}, creating it if
669     *         it does not already exist
670     */
671    public CodeableConcept getTypeFirstRep() {
672      if (getType().isEmpty()) {
673        addType();
674      }
675      return getType().get(0);
676    }
677
678    /**
679     * @return {@link #schedule} (The time period and frequency at which the diet
680     *         should be given. The diet should be given for the combination of all
681     *         schedules if more than one schedule is present.)
682     */
683    public List<Timing> getSchedule() {
684      if (this.schedule == null)
685        this.schedule = new ArrayList<Timing>();
686      return this.schedule;
687    }
688
689    /**
690     * @return Returns a reference to <code>this</code> for easy method chaining
691     */
692    public NutritionOrderOralDietComponent setSchedule(List<Timing> theSchedule) {
693      this.schedule = theSchedule;
694      return this;
695    }
696
697    public boolean hasSchedule() {
698      if (this.schedule == null)
699        return false;
700      for (Timing item : this.schedule)
701        if (!item.isEmpty())
702          return true;
703      return false;
704    }
705
706    public Timing addSchedule() { // 3
707      Timing t = new Timing();
708      if (this.schedule == null)
709        this.schedule = new ArrayList<Timing>();
710      this.schedule.add(t);
711      return t;
712    }
713
714    public NutritionOrderOralDietComponent addSchedule(Timing t) { // 3
715      if (t == null)
716        return this;
717      if (this.schedule == null)
718        this.schedule = new ArrayList<Timing>();
719      this.schedule.add(t);
720      return this;
721    }
722
723    /**
724     * @return The first repetition of repeating field {@link #schedule}, creating
725     *         it if it does not already exist
726     */
727    public Timing getScheduleFirstRep() {
728      if (getSchedule().isEmpty()) {
729        addSchedule();
730      }
731      return getSchedule().get(0);
732    }
733
734    /**
735     * @return {@link #nutrient} (Class that defines the quantity and type of
736     *         nutrient modifications (for example carbohydrate, fiber or sodium)
737     *         required for the oral diet.)
738     */
739    public List<NutritionOrderOralDietNutrientComponent> getNutrient() {
740      if (this.nutrient == null)
741        this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
742      return this.nutrient;
743    }
744
745    /**
746     * @return Returns a reference to <code>this</code> for easy method chaining
747     */
748    public NutritionOrderOralDietComponent setNutrient(List<NutritionOrderOralDietNutrientComponent> theNutrient) {
749      this.nutrient = theNutrient;
750      return this;
751    }
752
753    public boolean hasNutrient() {
754      if (this.nutrient == null)
755        return false;
756      for (NutritionOrderOralDietNutrientComponent item : this.nutrient)
757        if (!item.isEmpty())
758          return true;
759      return false;
760    }
761
762    public NutritionOrderOralDietNutrientComponent addNutrient() { // 3
763      NutritionOrderOralDietNutrientComponent t = new NutritionOrderOralDietNutrientComponent();
764      if (this.nutrient == null)
765        this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
766      this.nutrient.add(t);
767      return t;
768    }
769
770    public NutritionOrderOralDietComponent addNutrient(NutritionOrderOralDietNutrientComponent t) { // 3
771      if (t == null)
772        return this;
773      if (this.nutrient == null)
774        this.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
775      this.nutrient.add(t);
776      return this;
777    }
778
779    /**
780     * @return The first repetition of repeating field {@link #nutrient}, creating
781     *         it if it does not already exist
782     */
783    public NutritionOrderOralDietNutrientComponent getNutrientFirstRep() {
784      if (getNutrient().isEmpty()) {
785        addNutrient();
786      }
787      return getNutrient().get(0);
788    }
789
790    /**
791     * @return {@link #texture} (Class that describes any texture modifications
792     *         required for the patient to safely consume various types of solid
793     *         foods.)
794     */
795    public List<NutritionOrderOralDietTextureComponent> getTexture() {
796      if (this.texture == null)
797        this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
798      return this.texture;
799    }
800
801    /**
802     * @return Returns a reference to <code>this</code> for easy method chaining
803     */
804    public NutritionOrderOralDietComponent setTexture(List<NutritionOrderOralDietTextureComponent> theTexture) {
805      this.texture = theTexture;
806      return this;
807    }
808
809    public boolean hasTexture() {
810      if (this.texture == null)
811        return false;
812      for (NutritionOrderOralDietTextureComponent item : this.texture)
813        if (!item.isEmpty())
814          return true;
815      return false;
816    }
817
818    public NutritionOrderOralDietTextureComponent addTexture() { // 3
819      NutritionOrderOralDietTextureComponent t = new NutritionOrderOralDietTextureComponent();
820      if (this.texture == null)
821        this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
822      this.texture.add(t);
823      return t;
824    }
825
826    public NutritionOrderOralDietComponent addTexture(NutritionOrderOralDietTextureComponent t) { // 3
827      if (t == null)
828        return this;
829      if (this.texture == null)
830        this.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
831      this.texture.add(t);
832      return this;
833    }
834
835    /**
836     * @return The first repetition of repeating field {@link #texture}, creating it
837     *         if it does not already exist
838     */
839    public NutritionOrderOralDietTextureComponent getTextureFirstRep() {
840      if (getTexture().isEmpty()) {
841        addTexture();
842      }
843      return getTexture().get(0);
844    }
845
846    /**
847     * @return {@link #fluidConsistencyType} (The required consistency (e.g.
848     *         honey-thick, nectar-thick, thin, thickened.) of liquids or fluids
849     *         served to the patient.)
850     */
851    public List<CodeableConcept> getFluidConsistencyType() {
852      if (this.fluidConsistencyType == null)
853        this.fluidConsistencyType = new ArrayList<CodeableConcept>();
854      return this.fluidConsistencyType;
855    }
856
857    /**
858     * @return Returns a reference to <code>this</code> for easy method chaining
859     */
860    public NutritionOrderOralDietComponent setFluidConsistencyType(List<CodeableConcept> theFluidConsistencyType) {
861      this.fluidConsistencyType = theFluidConsistencyType;
862      return this;
863    }
864
865    public boolean hasFluidConsistencyType() {
866      if (this.fluidConsistencyType == null)
867        return false;
868      for (CodeableConcept item : this.fluidConsistencyType)
869        if (!item.isEmpty())
870          return true;
871      return false;
872    }
873
874    public CodeableConcept addFluidConsistencyType() { // 3
875      CodeableConcept t = new CodeableConcept();
876      if (this.fluidConsistencyType == null)
877        this.fluidConsistencyType = new ArrayList<CodeableConcept>();
878      this.fluidConsistencyType.add(t);
879      return t;
880    }
881
882    public NutritionOrderOralDietComponent addFluidConsistencyType(CodeableConcept t) { // 3
883      if (t == null)
884        return this;
885      if (this.fluidConsistencyType == null)
886        this.fluidConsistencyType = new ArrayList<CodeableConcept>();
887      this.fluidConsistencyType.add(t);
888      return this;
889    }
890
891    /**
892     * @return The first repetition of repeating field
893     *         {@link #fluidConsistencyType}, creating it if it does not already
894     *         exist
895     */
896    public CodeableConcept getFluidConsistencyTypeFirstRep() {
897      if (getFluidConsistencyType().isEmpty()) {
898        addFluidConsistencyType();
899      }
900      return getFluidConsistencyType().get(0);
901    }
902
903    /**
904     * @return {@link #instruction} (Free text or additional instructions or
905     *         information pertaining to the oral diet.). This is the underlying
906     *         object with id, value and extensions. The accessor "getInstruction"
907     *         gives direct access to the value
908     */
909    public StringType getInstructionElement() {
910      if (this.instruction == null)
911        if (Configuration.errorOnAutoCreate())
912          throw new Error("Attempt to auto-create NutritionOrderOralDietComponent.instruction");
913        else if (Configuration.doAutoCreate())
914          this.instruction = new StringType(); // bb
915      return this.instruction;
916    }
917
918    public boolean hasInstructionElement() {
919      return this.instruction != null && !this.instruction.isEmpty();
920    }
921
922    public boolean hasInstruction() {
923      return this.instruction != null && !this.instruction.isEmpty();
924    }
925
926    /**
927     * @param value {@link #instruction} (Free text or additional instructions or
928     *              information pertaining to the oral diet.). This is the
929     *              underlying object with id, value and extensions. The accessor
930     *              "getInstruction" gives direct access to the value
931     */
932    public NutritionOrderOralDietComponent setInstructionElement(StringType value) {
933      this.instruction = value;
934      return this;
935    }
936
937    /**
938     * @return Free text or additional instructions or information pertaining to the
939     *         oral diet.
940     */
941    public String getInstruction() {
942      return this.instruction == null ? null : this.instruction.getValue();
943    }
944
945    /**
946     * @param value Free text or additional instructions or information pertaining
947     *              to the oral diet.
948     */
949    public NutritionOrderOralDietComponent setInstruction(String value) {
950      if (Utilities.noString(value))
951        this.instruction = null;
952      else {
953        if (this.instruction == null)
954          this.instruction = new StringType();
955        this.instruction.setValue(value);
956      }
957      return this;
958    }
959
960    protected void listChildren(List<Property> children) {
961      super.listChildren(children);
962      children.add(new Property("type", "CodeableConcept",
963          "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0,
964          java.lang.Integer.MAX_VALUE, type));
965      children.add(new Property("schedule", "Timing",
966          "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.",
967          0, java.lang.Integer.MAX_VALUE, schedule));
968      children.add(new Property("nutrient", "",
969          "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.",
970          0, java.lang.Integer.MAX_VALUE, nutrient));
971      children.add(new Property("texture", "",
972          "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.",
973          0, java.lang.Integer.MAX_VALUE, texture));
974      children.add(new Property("fluidConsistencyType", "CodeableConcept",
975          "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.",
976          0, java.lang.Integer.MAX_VALUE, fluidConsistencyType));
977      children.add(new Property("instruction", "string",
978          "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction));
979    }
980
981    @Override
982    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
983      switch (_hash) {
984      case 3575610:
985        /* type */ return new Property("type", "CodeableConcept",
986            "The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.", 0,
987            java.lang.Integer.MAX_VALUE, type);
988      case -697920873:
989        /* schedule */ return new Property("schedule", "Timing",
990            "The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.",
991            0, java.lang.Integer.MAX_VALUE, schedule);
992      case -1671151641:
993        /* nutrient */ return new Property("nutrient", "",
994            "Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.",
995            0, java.lang.Integer.MAX_VALUE, nutrient);
996      case -1417816805:
997        /* texture */ return new Property("texture", "",
998            "Class that describes any texture modifications required for the patient to safely consume various types of solid foods.",
999            0, java.lang.Integer.MAX_VALUE, texture);
1000      case -525105592:
1001        /* fluidConsistencyType */ return new Property("fluidConsistencyType", "CodeableConcept",
1002            "The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.",
1003            0, java.lang.Integer.MAX_VALUE, fluidConsistencyType);
1004      case 301526158:
1005        /* instruction */ return new Property("instruction", "string",
1006            "Free text or additional instructions or information pertaining to the oral diet.", 0, 1, instruction);
1007      default:
1008        return super.getNamedProperty(_hash, _name, _checkValid);
1009      }
1010
1011    }
1012
1013    @Override
1014    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1015      switch (hash) {
1016      case 3575610:
1017        /* type */ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
1018      case -697920873:
1019        /* schedule */ return this.schedule == null ? new Base[0]
1020            : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
1021      case -1671151641:
1022        /* nutrient */ return this.nutrient == null ? new Base[0]
1023            : this.nutrient.toArray(new Base[this.nutrient.size()]); // NutritionOrderOralDietNutrientComponent
1024      case -1417816805:
1025        /* texture */ return this.texture == null ? new Base[0] : this.texture.toArray(new Base[this.texture.size()]); // NutritionOrderOralDietTextureComponent
1026      case -525105592:
1027        /* fluidConsistencyType */ return this.fluidConsistencyType == null ? new Base[0]
1028            : this.fluidConsistencyType.toArray(new Base[this.fluidConsistencyType.size()]); // CodeableConcept
1029      case 301526158:
1030        /* instruction */ return this.instruction == null ? new Base[0] : new Base[] { this.instruction }; // StringType
1031      default:
1032        return super.getProperty(hash, name, checkValid);
1033      }
1034
1035    }
1036
1037    @Override
1038    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1039      switch (hash) {
1040      case 3575610: // type
1041        this.getType().add(castToCodeableConcept(value)); // CodeableConcept
1042        return value;
1043      case -697920873: // schedule
1044        this.getSchedule().add(castToTiming(value)); // Timing
1045        return value;
1046      case -1671151641: // nutrient
1047        this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value); // NutritionOrderOralDietNutrientComponent
1048        return value;
1049      case -1417816805: // texture
1050        this.getTexture().add((NutritionOrderOralDietTextureComponent) value); // NutritionOrderOralDietTextureComponent
1051        return value;
1052      case -525105592: // fluidConsistencyType
1053        this.getFluidConsistencyType().add(castToCodeableConcept(value)); // CodeableConcept
1054        return value;
1055      case 301526158: // instruction
1056        this.instruction = castToString(value); // StringType
1057        return value;
1058      default:
1059        return super.setProperty(hash, name, value);
1060      }
1061
1062    }
1063
1064    @Override
1065    public Base setProperty(String name, Base value) throws FHIRException {
1066      if (name.equals("type")) {
1067        this.getType().add(castToCodeableConcept(value));
1068      } else if (name.equals("schedule")) {
1069        this.getSchedule().add(castToTiming(value));
1070      } else if (name.equals("nutrient")) {
1071        this.getNutrient().add((NutritionOrderOralDietNutrientComponent) value);
1072      } else if (name.equals("texture")) {
1073        this.getTexture().add((NutritionOrderOralDietTextureComponent) value);
1074      } else if (name.equals("fluidConsistencyType")) {
1075        this.getFluidConsistencyType().add(castToCodeableConcept(value));
1076      } else if (name.equals("instruction")) {
1077        this.instruction = castToString(value); // StringType
1078      } else
1079        return super.setProperty(name, value);
1080      return value;
1081    }
1082
1083    @Override
1084    public Base makeProperty(int hash, String name) throws FHIRException {
1085      switch (hash) {
1086      case 3575610:
1087        return addType();
1088      case -697920873:
1089        return addSchedule();
1090      case -1671151641:
1091        return addNutrient();
1092      case -1417816805:
1093        return addTexture();
1094      case -525105592:
1095        return addFluidConsistencyType();
1096      case 301526158:
1097        return getInstructionElement();
1098      default:
1099        return super.makeProperty(hash, name);
1100      }
1101
1102    }
1103
1104    @Override
1105    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1106      switch (hash) {
1107      case 3575610:
1108        /* type */ return new String[] { "CodeableConcept" };
1109      case -697920873:
1110        /* schedule */ return new String[] { "Timing" };
1111      case -1671151641:
1112        /* nutrient */ return new String[] {};
1113      case -1417816805:
1114        /* texture */ return new String[] {};
1115      case -525105592:
1116        /* fluidConsistencyType */ return new String[] { "CodeableConcept" };
1117      case 301526158:
1118        /* instruction */ return new String[] { "string" };
1119      default:
1120        return super.getTypesForProperty(hash, name);
1121      }
1122
1123    }
1124
1125    @Override
1126    public Base addChild(String name) throws FHIRException {
1127      if (name.equals("type")) {
1128        return addType();
1129      } else if (name.equals("schedule")) {
1130        return addSchedule();
1131      } else if (name.equals("nutrient")) {
1132        return addNutrient();
1133      } else if (name.equals("texture")) {
1134        return addTexture();
1135      } else if (name.equals("fluidConsistencyType")) {
1136        return addFluidConsistencyType();
1137      } else if (name.equals("instruction")) {
1138        throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.instruction");
1139      } else
1140        return super.addChild(name);
1141    }
1142
1143    public NutritionOrderOralDietComponent copy() {
1144      NutritionOrderOralDietComponent dst = new NutritionOrderOralDietComponent();
1145      copyValues(dst);
1146      return dst;
1147    }
1148
1149    public void copyValues(NutritionOrderOralDietComponent dst) {
1150      super.copyValues(dst);
1151      if (type != null) {
1152        dst.type = new ArrayList<CodeableConcept>();
1153        for (CodeableConcept i : type)
1154          dst.type.add(i.copy());
1155      }
1156      ;
1157      if (schedule != null) {
1158        dst.schedule = new ArrayList<Timing>();
1159        for (Timing i : schedule)
1160          dst.schedule.add(i.copy());
1161      }
1162      ;
1163      if (nutrient != null) {
1164        dst.nutrient = new ArrayList<NutritionOrderOralDietNutrientComponent>();
1165        for (NutritionOrderOralDietNutrientComponent i : nutrient)
1166          dst.nutrient.add(i.copy());
1167      }
1168      ;
1169      if (texture != null) {
1170        dst.texture = new ArrayList<NutritionOrderOralDietTextureComponent>();
1171        for (NutritionOrderOralDietTextureComponent i : texture)
1172          dst.texture.add(i.copy());
1173      }
1174      ;
1175      if (fluidConsistencyType != null) {
1176        dst.fluidConsistencyType = new ArrayList<CodeableConcept>();
1177        for (CodeableConcept i : fluidConsistencyType)
1178          dst.fluidConsistencyType.add(i.copy());
1179      }
1180      ;
1181      dst.instruction = instruction == null ? null : instruction.copy();
1182    }
1183
1184    @Override
1185    public boolean equalsDeep(Base other_) {
1186      if (!super.equalsDeep(other_))
1187        return false;
1188      if (!(other_ instanceof NutritionOrderOralDietComponent))
1189        return false;
1190      NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
1191      return compareDeep(type, o.type, true) && compareDeep(schedule, o.schedule, true)
1192          && compareDeep(nutrient, o.nutrient, true) && compareDeep(texture, o.texture, true)
1193          && compareDeep(fluidConsistencyType, o.fluidConsistencyType, true)
1194          && compareDeep(instruction, o.instruction, true);
1195    }
1196
1197    @Override
1198    public boolean equalsShallow(Base other_) {
1199      if (!super.equalsShallow(other_))
1200        return false;
1201      if (!(other_ instanceof NutritionOrderOralDietComponent))
1202        return false;
1203      NutritionOrderOralDietComponent o = (NutritionOrderOralDietComponent) other_;
1204      return compareValues(instruction, o.instruction, true);
1205    }
1206
1207    public boolean isEmpty() {
1208      return super.isEmpty()
1209          && ca.uhn.fhir.util.ElementUtil.isEmpty(type, schedule, nutrient, texture, fluidConsistencyType, instruction);
1210    }
1211
1212    public String fhirType() {
1213      return "NutritionOrder.oralDiet";
1214
1215    }
1216
1217  }
1218
1219  @Block()
1220  public static class NutritionOrderOralDietNutrientComponent extends BackboneElement implements IBaseBackboneElement {
1221    /**
1222     * The nutrient that is being modified such as carbohydrate or sodium.
1223     */
1224    @Child(name = "modifier", type = {
1225        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
1226    @Description(shortDefinition = "Type of nutrient that is being modified", formalDefinition = "The nutrient that is being modified such as carbohydrate or sodium.")
1227    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/nutrient-code")
1228    protected CodeableConcept modifier;
1229
1230    /**
1231     * The quantity of the specified nutrient to include in diet.
1232     */
1233    @Child(name = "amount", type = { Quantity.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1234    @Description(shortDefinition = "Quantity of the specified nutrient", formalDefinition = "The quantity of the specified nutrient to include in diet.")
1235    protected Quantity amount;
1236
1237    private static final long serialVersionUID = 1042462093L;
1238
1239    /**
1240     * Constructor
1241     */
1242    public NutritionOrderOralDietNutrientComponent() {
1243      super();
1244    }
1245
1246    /**
1247     * @return {@link #modifier} (The nutrient that is being modified such as
1248     *         carbohydrate or sodium.)
1249     */
1250    public CodeableConcept getModifier() {
1251      if (this.modifier == null)
1252        if (Configuration.errorOnAutoCreate())
1253          throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.modifier");
1254        else if (Configuration.doAutoCreate())
1255          this.modifier = new CodeableConcept(); // cc
1256      return this.modifier;
1257    }
1258
1259    public boolean hasModifier() {
1260      return this.modifier != null && !this.modifier.isEmpty();
1261    }
1262
1263    /**
1264     * @param value {@link #modifier} (The nutrient that is being modified such as
1265     *              carbohydrate or sodium.)
1266     */
1267    public NutritionOrderOralDietNutrientComponent setModifier(CodeableConcept value) {
1268      this.modifier = value;
1269      return this;
1270    }
1271
1272    /**
1273     * @return {@link #amount} (The quantity of the specified nutrient to include in
1274     *         diet.)
1275     */
1276    public Quantity getAmount() {
1277      if (this.amount == null)
1278        if (Configuration.errorOnAutoCreate())
1279          throw new Error("Attempt to auto-create NutritionOrderOralDietNutrientComponent.amount");
1280        else if (Configuration.doAutoCreate())
1281          this.amount = new Quantity(); // cc
1282      return this.amount;
1283    }
1284
1285    public boolean hasAmount() {
1286      return this.amount != null && !this.amount.isEmpty();
1287    }
1288
1289    /**
1290     * @param value {@link #amount} (The quantity of the specified nutrient to
1291     *              include in diet.)
1292     */
1293    public NutritionOrderOralDietNutrientComponent setAmount(Quantity value) {
1294      this.amount = value;
1295      return this;
1296    }
1297
1298    protected void listChildren(List<Property> children) {
1299      super.listChildren(children);
1300      children.add(new Property("modifier", "CodeableConcept",
1301          "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier));
1302      children.add(new Property("amount", "SimpleQuantity",
1303          "The quantity of the specified nutrient to include in diet.", 0, 1, amount));
1304    }
1305
1306    @Override
1307    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1308      switch (_hash) {
1309      case -615513385:
1310        /* modifier */ return new Property("modifier", "CodeableConcept",
1311            "The nutrient that is being modified such as carbohydrate or sodium.", 0, 1, modifier);
1312      case -1413853096:
1313        /* amount */ return new Property("amount", "SimpleQuantity",
1314            "The quantity of the specified nutrient to include in diet.", 0, 1, amount);
1315      default:
1316        return super.getNamedProperty(_hash, _name, _checkValid);
1317      }
1318
1319    }
1320
1321    @Override
1322    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1323      switch (hash) {
1324      case -615513385:
1325        /* modifier */ return this.modifier == null ? new Base[0] : new Base[] { this.modifier }; // CodeableConcept
1326      case -1413853096:
1327        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Quantity
1328      default:
1329        return super.getProperty(hash, name, checkValid);
1330      }
1331
1332    }
1333
1334    @Override
1335    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1336      switch (hash) {
1337      case -615513385: // modifier
1338        this.modifier = castToCodeableConcept(value); // CodeableConcept
1339        return value;
1340      case -1413853096: // amount
1341        this.amount = castToQuantity(value); // Quantity
1342        return value;
1343      default:
1344        return super.setProperty(hash, name, value);
1345      }
1346
1347    }
1348
1349    @Override
1350    public Base setProperty(String name, Base value) throws FHIRException {
1351      if (name.equals("modifier")) {
1352        this.modifier = castToCodeableConcept(value); // CodeableConcept
1353      } else if (name.equals("amount")) {
1354        this.amount = castToQuantity(value); // Quantity
1355      } else
1356        return super.setProperty(name, value);
1357      return value;
1358    }
1359
1360    @Override
1361    public Base makeProperty(int hash, String name) throws FHIRException {
1362      switch (hash) {
1363      case -615513385:
1364        return getModifier();
1365      case -1413853096:
1366        return getAmount();
1367      default:
1368        return super.makeProperty(hash, name);
1369      }
1370
1371    }
1372
1373    @Override
1374    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1375      switch (hash) {
1376      case -615513385:
1377        /* modifier */ return new String[] { "CodeableConcept" };
1378      case -1413853096:
1379        /* amount */ return new String[] { "SimpleQuantity" };
1380      default:
1381        return super.getTypesForProperty(hash, name);
1382      }
1383
1384    }
1385
1386    @Override
1387    public Base addChild(String name) throws FHIRException {
1388      if (name.equals("modifier")) {
1389        this.modifier = new CodeableConcept();
1390        return this.modifier;
1391      } else if (name.equals("amount")) {
1392        this.amount = new Quantity();
1393        return this.amount;
1394      } else
1395        return super.addChild(name);
1396    }
1397
1398    public NutritionOrderOralDietNutrientComponent copy() {
1399      NutritionOrderOralDietNutrientComponent dst = new NutritionOrderOralDietNutrientComponent();
1400      copyValues(dst);
1401      return dst;
1402    }
1403
1404    public void copyValues(NutritionOrderOralDietNutrientComponent dst) {
1405      super.copyValues(dst);
1406      dst.modifier = modifier == null ? null : modifier.copy();
1407      dst.amount = amount == null ? null : amount.copy();
1408    }
1409
1410    @Override
1411    public boolean equalsDeep(Base other_) {
1412      if (!super.equalsDeep(other_))
1413        return false;
1414      if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
1415        return false;
1416      NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
1417      return compareDeep(modifier, o.modifier, true) && compareDeep(amount, o.amount, true);
1418    }
1419
1420    @Override
1421    public boolean equalsShallow(Base other_) {
1422      if (!super.equalsShallow(other_))
1423        return false;
1424      if (!(other_ instanceof NutritionOrderOralDietNutrientComponent))
1425        return false;
1426      NutritionOrderOralDietNutrientComponent o = (NutritionOrderOralDietNutrientComponent) other_;
1427      return true;
1428    }
1429
1430    public boolean isEmpty() {
1431      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, amount);
1432    }
1433
1434    public String fhirType() {
1435      return "NutritionOrder.oralDiet.nutrient";
1436
1437    }
1438
1439  }
1440
1441  @Block()
1442  public static class NutritionOrderOralDietTextureComponent extends BackboneElement implements IBaseBackboneElement {
1443    /**
1444     * Any texture modifications (for solid foods) that should be made, e.g. easy to
1445     * chew, chopped, ground, and pureed.
1446     */
1447    @Child(name = "modifier", type = {
1448        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
1449    @Description(shortDefinition = "Code to indicate how to alter the texture of the foods, e.g. pureed", formalDefinition = "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.")
1450    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/texture-code")
1451    protected CodeableConcept modifier;
1452
1453    /**
1454     * The food type(s) (e.g. meats, all foods) that the texture modification
1455     * applies to. This could be all foods types.
1456     */
1457    @Child(name = "foodType", type = {
1458        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1459    @Description(shortDefinition = "Concepts that are used to identify an entity that is ingested for nutritional purposes", formalDefinition = "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.")
1460    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/modified-foodtype")
1461    protected CodeableConcept foodType;
1462
1463    private static final long serialVersionUID = -56402817L;
1464
1465    /**
1466     * Constructor
1467     */
1468    public NutritionOrderOralDietTextureComponent() {
1469      super();
1470    }
1471
1472    /**
1473     * @return {@link #modifier} (Any texture modifications (for solid foods) that
1474     *         should be made, e.g. easy to chew, chopped, ground, and pureed.)
1475     */
1476    public CodeableConcept getModifier() {
1477      if (this.modifier == null)
1478        if (Configuration.errorOnAutoCreate())
1479          throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.modifier");
1480        else if (Configuration.doAutoCreate())
1481          this.modifier = new CodeableConcept(); // cc
1482      return this.modifier;
1483    }
1484
1485    public boolean hasModifier() {
1486      return this.modifier != null && !this.modifier.isEmpty();
1487    }
1488
1489    /**
1490     * @param value {@link #modifier} (Any texture modifications (for solid foods)
1491     *              that should be made, e.g. easy to chew, chopped, ground, and
1492     *              pureed.)
1493     */
1494    public NutritionOrderOralDietTextureComponent setModifier(CodeableConcept value) {
1495      this.modifier = value;
1496      return this;
1497    }
1498
1499    /**
1500     * @return {@link #foodType} (The food type(s) (e.g. meats, all foods) that the
1501     *         texture modification applies to. This could be all foods types.)
1502     */
1503    public CodeableConcept getFoodType() {
1504      if (this.foodType == null)
1505        if (Configuration.errorOnAutoCreate())
1506          throw new Error("Attempt to auto-create NutritionOrderOralDietTextureComponent.foodType");
1507        else if (Configuration.doAutoCreate())
1508          this.foodType = new CodeableConcept(); // cc
1509      return this.foodType;
1510    }
1511
1512    public boolean hasFoodType() {
1513      return this.foodType != null && !this.foodType.isEmpty();
1514    }
1515
1516    /**
1517     * @param value {@link #foodType} (The food type(s) (e.g. meats, all foods) that
1518     *              the texture modification applies to. This could be all foods
1519     *              types.)
1520     */
1521    public NutritionOrderOralDietTextureComponent setFoodType(CodeableConcept value) {
1522      this.foodType = value;
1523      return this;
1524    }
1525
1526    protected void listChildren(List<Property> children) {
1527      super.listChildren(children);
1528      children.add(new Property("modifier", "CodeableConcept",
1529          "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.",
1530          0, 1, modifier));
1531      children.add(new Property("foodType", "CodeableConcept",
1532          "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.",
1533          0, 1, foodType));
1534    }
1535
1536    @Override
1537    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1538      switch (_hash) {
1539      case -615513385:
1540        /* modifier */ return new Property("modifier", "CodeableConcept",
1541            "Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.",
1542            0, 1, modifier);
1543      case 379498680:
1544        /* foodType */ return new Property("foodType", "CodeableConcept",
1545            "The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.",
1546            0, 1, foodType);
1547      default:
1548        return super.getNamedProperty(_hash, _name, _checkValid);
1549      }
1550
1551    }
1552
1553    @Override
1554    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1555      switch (hash) {
1556      case -615513385:
1557        /* modifier */ return this.modifier == null ? new Base[0] : new Base[] { this.modifier }; // CodeableConcept
1558      case 379498680:
1559        /* foodType */ return this.foodType == null ? new Base[0] : new Base[] { this.foodType }; // CodeableConcept
1560      default:
1561        return super.getProperty(hash, name, checkValid);
1562      }
1563
1564    }
1565
1566    @Override
1567    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1568      switch (hash) {
1569      case -615513385: // modifier
1570        this.modifier = castToCodeableConcept(value); // CodeableConcept
1571        return value;
1572      case 379498680: // foodType
1573        this.foodType = castToCodeableConcept(value); // CodeableConcept
1574        return value;
1575      default:
1576        return super.setProperty(hash, name, value);
1577      }
1578
1579    }
1580
1581    @Override
1582    public Base setProperty(String name, Base value) throws FHIRException {
1583      if (name.equals("modifier")) {
1584        this.modifier = castToCodeableConcept(value); // CodeableConcept
1585      } else if (name.equals("foodType")) {
1586        this.foodType = castToCodeableConcept(value); // CodeableConcept
1587      } else
1588        return super.setProperty(name, value);
1589      return value;
1590    }
1591
1592    @Override
1593    public Base makeProperty(int hash, String name) throws FHIRException {
1594      switch (hash) {
1595      case -615513385:
1596        return getModifier();
1597      case 379498680:
1598        return getFoodType();
1599      default:
1600        return super.makeProperty(hash, name);
1601      }
1602
1603    }
1604
1605    @Override
1606    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1607      switch (hash) {
1608      case -615513385:
1609        /* modifier */ return new String[] { "CodeableConcept" };
1610      case 379498680:
1611        /* foodType */ return new String[] { "CodeableConcept" };
1612      default:
1613        return super.getTypesForProperty(hash, name);
1614      }
1615
1616    }
1617
1618    @Override
1619    public Base addChild(String name) throws FHIRException {
1620      if (name.equals("modifier")) {
1621        this.modifier = new CodeableConcept();
1622        return this.modifier;
1623      } else if (name.equals("foodType")) {
1624        this.foodType = new CodeableConcept();
1625        return this.foodType;
1626      } else
1627        return super.addChild(name);
1628    }
1629
1630    public NutritionOrderOralDietTextureComponent copy() {
1631      NutritionOrderOralDietTextureComponent dst = new NutritionOrderOralDietTextureComponent();
1632      copyValues(dst);
1633      return dst;
1634    }
1635
1636    public void copyValues(NutritionOrderOralDietTextureComponent dst) {
1637      super.copyValues(dst);
1638      dst.modifier = modifier == null ? null : modifier.copy();
1639      dst.foodType = foodType == null ? null : foodType.copy();
1640    }
1641
1642    @Override
1643    public boolean equalsDeep(Base other_) {
1644      if (!super.equalsDeep(other_))
1645        return false;
1646      if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1647        return false;
1648      NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1649      return compareDeep(modifier, o.modifier, true) && compareDeep(foodType, o.foodType, true);
1650    }
1651
1652    @Override
1653    public boolean equalsShallow(Base other_) {
1654      if (!super.equalsShallow(other_))
1655        return false;
1656      if (!(other_ instanceof NutritionOrderOralDietTextureComponent))
1657        return false;
1658      NutritionOrderOralDietTextureComponent o = (NutritionOrderOralDietTextureComponent) other_;
1659      return true;
1660    }
1661
1662    public boolean isEmpty() {
1663      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifier, foodType);
1664    }
1665
1666    public String fhirType() {
1667      return "NutritionOrder.oralDiet.texture";
1668
1669    }
1670
1671  }
1672
1673  @Block()
1674  public static class NutritionOrderSupplementComponent extends BackboneElement implements IBaseBackboneElement {
1675    /**
1676     * The kind of nutritional supplement product required such as a high protein or
1677     * pediatric clear liquid supplement.
1678     */
1679    @Child(name = "type", type = {
1680        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
1681    @Description(shortDefinition = "Type of supplement product requested", formalDefinition = "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.")
1682    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/supplement-type")
1683    protected CodeableConcept type;
1684
1685    /**
1686     * The product or brand name of the nutritional supplement such as "Acme Protein
1687     * Shake".
1688     */
1689    @Child(name = "productName", type = {
1690        StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1691    @Description(shortDefinition = "Product or brand name of the nutritional supplement", formalDefinition = "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".")
1692    protected StringType productName;
1693
1694    /**
1695     * The time period and frequency at which the supplement(s) should be given. The
1696     * supplement should be given for the combination of all schedules if more than
1697     * one schedule is present.
1698     */
1699    @Child(name = "schedule", type = {
1700        Timing.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1701    @Description(shortDefinition = "Scheduled frequency of supplement", formalDefinition = "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.")
1702    protected List<Timing> schedule;
1703
1704    /**
1705     * The amount of the nutritional supplement to be given.
1706     */
1707    @Child(name = "quantity", type = { Quantity.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1708    @Description(shortDefinition = "Amount of the nutritional supplement", formalDefinition = "The amount of the nutritional supplement to be given.")
1709    protected Quantity quantity;
1710
1711    /**
1712     * Free text or additional instructions or information pertaining to the oral
1713     * supplement.
1714     */
1715    @Child(name = "instruction", type = {
1716        StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1717    @Description(shortDefinition = "Instructions or additional information about the oral supplement", formalDefinition = "Free text or additional instructions or information pertaining to the oral supplement.")
1718    protected StringType instruction;
1719
1720    private static final long serialVersionUID = -37646618L;
1721
1722    /**
1723     * Constructor
1724     */
1725    public NutritionOrderSupplementComponent() {
1726      super();
1727    }
1728
1729    /**
1730     * @return {@link #type} (The kind of nutritional supplement product required
1731     *         such as a high protein or pediatric clear liquid supplement.)
1732     */
1733    public CodeableConcept getType() {
1734      if (this.type == null)
1735        if (Configuration.errorOnAutoCreate())
1736          throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.type");
1737        else if (Configuration.doAutoCreate())
1738          this.type = new CodeableConcept(); // cc
1739      return this.type;
1740    }
1741
1742    public boolean hasType() {
1743      return this.type != null && !this.type.isEmpty();
1744    }
1745
1746    /**
1747     * @param value {@link #type} (The kind of nutritional supplement product
1748     *              required such as a high protein or pediatric clear liquid
1749     *              supplement.)
1750     */
1751    public NutritionOrderSupplementComponent setType(CodeableConcept value) {
1752      this.type = value;
1753      return this;
1754    }
1755
1756    /**
1757     * @return {@link #productName} (The product or brand name of the nutritional
1758     *         supplement such as "Acme Protein Shake".). This is the underlying
1759     *         object with id, value and extensions. The accessor "getProductName"
1760     *         gives direct access to the value
1761     */
1762    public StringType getProductNameElement() {
1763      if (this.productName == null)
1764        if (Configuration.errorOnAutoCreate())
1765          throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.productName");
1766        else if (Configuration.doAutoCreate())
1767          this.productName = new StringType(); // bb
1768      return this.productName;
1769    }
1770
1771    public boolean hasProductNameElement() {
1772      return this.productName != null && !this.productName.isEmpty();
1773    }
1774
1775    public boolean hasProductName() {
1776      return this.productName != null && !this.productName.isEmpty();
1777    }
1778
1779    /**
1780     * @param value {@link #productName} (The product or brand name of the
1781     *              nutritional supplement such as "Acme Protein Shake".). This is
1782     *              the underlying object with id, value and extensions. The
1783     *              accessor "getProductName" gives direct access to the value
1784     */
1785    public NutritionOrderSupplementComponent setProductNameElement(StringType value) {
1786      this.productName = value;
1787      return this;
1788    }
1789
1790    /**
1791     * @return The product or brand name of the nutritional supplement such as "Acme
1792     *         Protein Shake".
1793     */
1794    public String getProductName() {
1795      return this.productName == null ? null : this.productName.getValue();
1796    }
1797
1798    /**
1799     * @param value The product or brand name of the nutritional supplement such as
1800     *              "Acme Protein Shake".
1801     */
1802    public NutritionOrderSupplementComponent setProductName(String value) {
1803      if (Utilities.noString(value))
1804        this.productName = null;
1805      else {
1806        if (this.productName == null)
1807          this.productName = new StringType();
1808        this.productName.setValue(value);
1809      }
1810      return this;
1811    }
1812
1813    /**
1814     * @return {@link #schedule} (The time period and frequency at which the
1815     *         supplement(s) should be given. The supplement should be given for the
1816     *         combination of all schedules if more than one schedule is present.)
1817     */
1818    public List<Timing> getSchedule() {
1819      if (this.schedule == null)
1820        this.schedule = new ArrayList<Timing>();
1821      return this.schedule;
1822    }
1823
1824    /**
1825     * @return Returns a reference to <code>this</code> for easy method chaining
1826     */
1827    public NutritionOrderSupplementComponent setSchedule(List<Timing> theSchedule) {
1828      this.schedule = theSchedule;
1829      return this;
1830    }
1831
1832    public boolean hasSchedule() {
1833      if (this.schedule == null)
1834        return false;
1835      for (Timing item : this.schedule)
1836        if (!item.isEmpty())
1837          return true;
1838      return false;
1839    }
1840
1841    public Timing addSchedule() { // 3
1842      Timing t = new Timing();
1843      if (this.schedule == null)
1844        this.schedule = new ArrayList<Timing>();
1845      this.schedule.add(t);
1846      return t;
1847    }
1848
1849    public NutritionOrderSupplementComponent addSchedule(Timing t) { // 3
1850      if (t == null)
1851        return this;
1852      if (this.schedule == null)
1853        this.schedule = new ArrayList<Timing>();
1854      this.schedule.add(t);
1855      return this;
1856    }
1857
1858    /**
1859     * @return The first repetition of repeating field {@link #schedule}, creating
1860     *         it if it does not already exist
1861     */
1862    public Timing getScheduleFirstRep() {
1863      if (getSchedule().isEmpty()) {
1864        addSchedule();
1865      }
1866      return getSchedule().get(0);
1867    }
1868
1869    /**
1870     * @return {@link #quantity} (The amount of the nutritional supplement to be
1871     *         given.)
1872     */
1873    public Quantity getQuantity() {
1874      if (this.quantity == null)
1875        if (Configuration.errorOnAutoCreate())
1876          throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.quantity");
1877        else if (Configuration.doAutoCreate())
1878          this.quantity = new Quantity(); // cc
1879      return this.quantity;
1880    }
1881
1882    public boolean hasQuantity() {
1883      return this.quantity != null && !this.quantity.isEmpty();
1884    }
1885
1886    /**
1887     * @param value {@link #quantity} (The amount of the nutritional supplement to
1888     *              be given.)
1889     */
1890    public NutritionOrderSupplementComponent setQuantity(Quantity value) {
1891      this.quantity = value;
1892      return this;
1893    }
1894
1895    /**
1896     * @return {@link #instruction} (Free text or additional instructions or
1897     *         information pertaining to the oral supplement.). This is the
1898     *         underlying object with id, value and extensions. The accessor
1899     *         "getInstruction" gives direct access to the value
1900     */
1901    public StringType getInstructionElement() {
1902      if (this.instruction == null)
1903        if (Configuration.errorOnAutoCreate())
1904          throw new Error("Attempt to auto-create NutritionOrderSupplementComponent.instruction");
1905        else if (Configuration.doAutoCreate())
1906          this.instruction = new StringType(); // bb
1907      return this.instruction;
1908    }
1909
1910    public boolean hasInstructionElement() {
1911      return this.instruction != null && !this.instruction.isEmpty();
1912    }
1913
1914    public boolean hasInstruction() {
1915      return this.instruction != null && !this.instruction.isEmpty();
1916    }
1917
1918    /**
1919     * @param value {@link #instruction} (Free text or additional instructions or
1920     *              information pertaining to the oral supplement.). This is the
1921     *              underlying object with id, value and extensions. The accessor
1922     *              "getInstruction" gives direct access to the value
1923     */
1924    public NutritionOrderSupplementComponent setInstructionElement(StringType value) {
1925      this.instruction = value;
1926      return this;
1927    }
1928
1929    /**
1930     * @return Free text or additional instructions or information pertaining to the
1931     *         oral supplement.
1932     */
1933    public String getInstruction() {
1934      return this.instruction == null ? null : this.instruction.getValue();
1935    }
1936
1937    /**
1938     * @param value Free text or additional instructions or information pertaining
1939     *              to the oral supplement.
1940     */
1941    public NutritionOrderSupplementComponent setInstruction(String value) {
1942      if (Utilities.noString(value))
1943        this.instruction = null;
1944      else {
1945        if (this.instruction == null)
1946          this.instruction = new StringType();
1947        this.instruction.setValue(value);
1948      }
1949      return this;
1950    }
1951
1952    protected void listChildren(List<Property> children) {
1953      super.listChildren(children);
1954      children.add(new Property("type", "CodeableConcept",
1955          "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.",
1956          0, 1, type));
1957      children.add(new Property("productName", "string",
1958          "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1,
1959          productName));
1960      children.add(new Property("schedule", "Timing",
1961          "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.",
1962          0, java.lang.Integer.MAX_VALUE, schedule));
1963      children.add(new Property("quantity", "SimpleQuantity", "The amount of the nutritional supplement to be given.",
1964          0, 1, quantity));
1965      children.add(new Property("instruction", "string",
1966          "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1, instruction));
1967    }
1968
1969    @Override
1970    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1971      switch (_hash) {
1972      case 3575610:
1973        /* type */ return new Property("type", "CodeableConcept",
1974            "The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.",
1975            0, 1, type);
1976      case -1491817446:
1977        /* productName */ return new Property("productName", "string",
1978            "The product or brand name of the nutritional supplement such as \"Acme Protein Shake\".", 0, 1,
1979            productName);
1980      case -697920873:
1981        /* schedule */ return new Property("schedule", "Timing",
1982            "The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.",
1983            0, java.lang.Integer.MAX_VALUE, schedule);
1984      case -1285004149:
1985        /* quantity */ return new Property("quantity", "SimpleQuantity",
1986            "The amount of the nutritional supplement to be given.", 0, 1, quantity);
1987      case 301526158:
1988        /* instruction */ return new Property("instruction", "string",
1989            "Free text or additional instructions or information pertaining to the oral supplement.", 0, 1,
1990            instruction);
1991      default:
1992        return super.getNamedProperty(_hash, _name, _checkValid);
1993      }
1994
1995    }
1996
1997    @Override
1998    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1999      switch (hash) {
2000      case 3575610:
2001        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2002      case -1491817446:
2003        /* productName */ return this.productName == null ? new Base[0] : new Base[] { this.productName }; // StringType
2004      case -697920873:
2005        /* schedule */ return this.schedule == null ? new Base[0]
2006            : this.schedule.toArray(new Base[this.schedule.size()]); // Timing
2007      case -1285004149:
2008        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
2009      case 301526158:
2010        /* instruction */ return this.instruction == null ? new Base[0] : new Base[] { this.instruction }; // StringType
2011      default:
2012        return super.getProperty(hash, name, checkValid);
2013      }
2014
2015    }
2016
2017    @Override
2018    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2019      switch (hash) {
2020      case 3575610: // type
2021        this.type = castToCodeableConcept(value); // CodeableConcept
2022        return value;
2023      case -1491817446: // productName
2024        this.productName = castToString(value); // StringType
2025        return value;
2026      case -697920873: // schedule
2027        this.getSchedule().add(castToTiming(value)); // Timing
2028        return value;
2029      case -1285004149: // quantity
2030        this.quantity = castToQuantity(value); // Quantity
2031        return value;
2032      case 301526158: // instruction
2033        this.instruction = castToString(value); // StringType
2034        return value;
2035      default:
2036        return super.setProperty(hash, name, value);
2037      }
2038
2039    }
2040
2041    @Override
2042    public Base setProperty(String name, Base value) throws FHIRException {
2043      if (name.equals("type")) {
2044        this.type = castToCodeableConcept(value); // CodeableConcept
2045      } else if (name.equals("productName")) {
2046        this.productName = castToString(value); // StringType
2047      } else if (name.equals("schedule")) {
2048        this.getSchedule().add(castToTiming(value));
2049      } else if (name.equals("quantity")) {
2050        this.quantity = castToQuantity(value); // Quantity
2051      } else if (name.equals("instruction")) {
2052        this.instruction = castToString(value); // StringType
2053      } else
2054        return super.setProperty(name, value);
2055      return value;
2056    }
2057
2058    @Override
2059    public Base makeProperty(int hash, String name) throws FHIRException {
2060      switch (hash) {
2061      case 3575610:
2062        return getType();
2063      case -1491817446:
2064        return getProductNameElement();
2065      case -697920873:
2066        return addSchedule();
2067      case -1285004149:
2068        return getQuantity();
2069      case 301526158:
2070        return getInstructionElement();
2071      default:
2072        return super.makeProperty(hash, name);
2073      }
2074
2075    }
2076
2077    @Override
2078    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2079      switch (hash) {
2080      case 3575610:
2081        /* type */ return new String[] { "CodeableConcept" };
2082      case -1491817446:
2083        /* productName */ return new String[] { "string" };
2084      case -697920873:
2085        /* schedule */ return new String[] { "Timing" };
2086      case -1285004149:
2087        /* quantity */ return new String[] { "SimpleQuantity" };
2088      case 301526158:
2089        /* instruction */ return new String[] { "string" };
2090      default:
2091        return super.getTypesForProperty(hash, name);
2092      }
2093
2094    }
2095
2096    @Override
2097    public Base addChild(String name) throws FHIRException {
2098      if (name.equals("type")) {
2099        this.type = new CodeableConcept();
2100        return this.type;
2101      } else if (name.equals("productName")) {
2102        throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.productName");
2103      } else if (name.equals("schedule")) {
2104        return addSchedule();
2105      } else if (name.equals("quantity")) {
2106        this.quantity = new Quantity();
2107        return this.quantity;
2108      } else if (name.equals("instruction")) {
2109        throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.instruction");
2110      } else
2111        return super.addChild(name);
2112    }
2113
2114    public NutritionOrderSupplementComponent copy() {
2115      NutritionOrderSupplementComponent dst = new NutritionOrderSupplementComponent();
2116      copyValues(dst);
2117      return dst;
2118    }
2119
2120    public void copyValues(NutritionOrderSupplementComponent dst) {
2121      super.copyValues(dst);
2122      dst.type = type == null ? null : type.copy();
2123      dst.productName = productName == null ? null : productName.copy();
2124      if (schedule != null) {
2125        dst.schedule = new ArrayList<Timing>();
2126        for (Timing i : schedule)
2127          dst.schedule.add(i.copy());
2128      }
2129      ;
2130      dst.quantity = quantity == null ? null : quantity.copy();
2131      dst.instruction = instruction == null ? null : instruction.copy();
2132    }
2133
2134    @Override
2135    public boolean equalsDeep(Base other_) {
2136      if (!super.equalsDeep(other_))
2137        return false;
2138      if (!(other_ instanceof NutritionOrderSupplementComponent))
2139        return false;
2140      NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
2141      return compareDeep(type, o.type, true) && compareDeep(productName, o.productName, true)
2142          && compareDeep(schedule, o.schedule, true) && compareDeep(quantity, o.quantity, true)
2143          && compareDeep(instruction, o.instruction, true);
2144    }
2145
2146    @Override
2147    public boolean equalsShallow(Base other_) {
2148      if (!super.equalsShallow(other_))
2149        return false;
2150      if (!(other_ instanceof NutritionOrderSupplementComponent))
2151        return false;
2152      NutritionOrderSupplementComponent o = (NutritionOrderSupplementComponent) other_;
2153      return compareValues(productName, o.productName, true) && compareValues(instruction, o.instruction, true);
2154    }
2155
2156    public boolean isEmpty() {
2157      return super.isEmpty()
2158          && ca.uhn.fhir.util.ElementUtil.isEmpty(type, productName, schedule, quantity, instruction);
2159    }
2160
2161    public String fhirType() {
2162      return "NutritionOrder.supplement";
2163
2164    }
2165
2166  }
2167
2168  @Block()
2169  public static class NutritionOrderEnteralFormulaComponent extends BackboneElement implements IBaseBackboneElement {
2170    /**
2171     * The type of enteral or infant formula such as an adult standard formula with
2172     * fiber or a soy-based infant formula.
2173     */
2174    @Child(name = "baseFormulaType", type = {
2175        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
2176    @Description(shortDefinition = "Type of enteral or infant formula", formalDefinition = "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.")
2177    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/entformula-type")
2178    protected CodeableConcept baseFormulaType;
2179
2180    /**
2181     * The product or brand name of the enteral or infant formula product such as
2182     * "ACME Adult Standard Formula".
2183     */
2184    @Child(name = "baseFormulaProductName", type = {
2185        StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
2186    @Description(shortDefinition = "Product or brand name of the enteral or infant formula", formalDefinition = "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".")
2187    protected StringType baseFormulaProductName;
2188
2189    /**
2190     * Indicates the type of modular component such as protein, carbohydrate, fat or
2191     * fiber to be provided in addition to or mixed with the base formula.
2192     */
2193    @Child(name = "additiveType", type = {
2194        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2195    @Description(shortDefinition = "Type of modular component to add to the feeding", formalDefinition = "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.")
2196    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/entformula-additive")
2197    protected CodeableConcept additiveType;
2198
2199    /**
2200     * The product or brand name of the type of modular component to be added to the
2201     * formula.
2202     */
2203    @Child(name = "additiveProductName", type = {
2204        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
2205    @Description(shortDefinition = "Product or brand name of the modular additive", formalDefinition = "The product or brand name of the type of modular component to be added to the formula.")
2206    protected StringType additiveProductName;
2207
2208    /**
2209     * The amount of energy (calories) that the formula should provide per specified
2210     * volume, typically per mL or fluid oz. For example, an infant may require a
2211     * formula that provides 24 calories per fluid ounce or an adult may require an
2212     * enteral formula that provides 1.5 calorie/mL.
2213     */
2214    @Child(name = "caloricDensity", type = {
2215        Quantity.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
2216    @Description(shortDefinition = "Amount of energy per specified volume that is required", formalDefinition = "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.")
2217    protected Quantity caloricDensity;
2218
2219    /**
2220     * The route or physiological path of administration into the patient's
2221     * gastrointestinal tract for purposes of providing the formula feeding, e.g.
2222     * nasogastric tube.
2223     */
2224    @Child(name = "routeofAdministration", type = {
2225        CodeableConcept.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
2226    @Description(shortDefinition = "How the formula should enter the patient's gastrointestinal tract", formalDefinition = "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.")
2227    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/enteral-route")
2228    protected CodeableConcept routeofAdministration;
2229
2230    /**
2231     * Formula administration instructions as structured data. This repeating
2232     * structure allows for changing the administration rate or volume over time for
2233     * both bolus and continuous feeding. An example of this would be an instruction
2234     * to increase the rate of continuous feeding every 2 hours.
2235     */
2236    @Child(name = "administration", type = {}, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2237    @Description(shortDefinition = "Formula feeding instruction as structured data", formalDefinition = "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.")
2238    protected List<NutritionOrderEnteralFormulaAdministrationComponent> administration;
2239
2240    /**
2241     * The maximum total quantity of formula that may be administered to a subject
2242     * over the period of time, e.g. 1440 mL over 24 hours.
2243     */
2244    @Child(name = "maxVolumeToDeliver", type = {
2245        Quantity.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
2246    @Description(shortDefinition = "Upper limit on formula volume per unit of time", formalDefinition = "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.")
2247    protected Quantity maxVolumeToDeliver;
2248
2249    /**
2250     * Free text formula administration, feeding instructions or additional
2251     * instructions or information.
2252     */
2253    @Child(name = "administrationInstruction", type = {
2254        StringType.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
2255    @Description(shortDefinition = "Formula feeding instructions expressed as text", formalDefinition = "Free text formula administration, feeding instructions or additional instructions or information.")
2256    protected StringType administrationInstruction;
2257
2258    private static final long serialVersionUID = -124511395L;
2259
2260    /**
2261     * Constructor
2262     */
2263    public NutritionOrderEnteralFormulaComponent() {
2264      super();
2265    }
2266
2267    /**
2268     * @return {@link #baseFormulaType} (The type of enteral or infant formula such
2269     *         as an adult standard formula with fiber or a soy-based infant
2270     *         formula.)
2271     */
2272    public CodeableConcept getBaseFormulaType() {
2273      if (this.baseFormulaType == null)
2274        if (Configuration.errorOnAutoCreate())
2275          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaType");
2276        else if (Configuration.doAutoCreate())
2277          this.baseFormulaType = new CodeableConcept(); // cc
2278      return this.baseFormulaType;
2279    }
2280
2281    public boolean hasBaseFormulaType() {
2282      return this.baseFormulaType != null && !this.baseFormulaType.isEmpty();
2283    }
2284
2285    /**
2286     * @param value {@link #baseFormulaType} (The type of enteral or infant formula
2287     *              such as an adult standard formula with fiber or a soy-based
2288     *              infant formula.)
2289     */
2290    public NutritionOrderEnteralFormulaComponent setBaseFormulaType(CodeableConcept value) {
2291      this.baseFormulaType = value;
2292      return this;
2293    }
2294
2295    /**
2296     * @return {@link #baseFormulaProductName} (The product or brand name of the
2297     *         enteral or infant formula product such as "ACME Adult Standard
2298     *         Formula".). This is the underlying object with id, value and
2299     *         extensions. The accessor "getBaseFormulaProductName" gives direct
2300     *         access to the value
2301     */
2302    public StringType getBaseFormulaProductNameElement() {
2303      if (this.baseFormulaProductName == null)
2304        if (Configuration.errorOnAutoCreate())
2305          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.baseFormulaProductName");
2306        else if (Configuration.doAutoCreate())
2307          this.baseFormulaProductName = new StringType(); // bb
2308      return this.baseFormulaProductName;
2309    }
2310
2311    public boolean hasBaseFormulaProductNameElement() {
2312      return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
2313    }
2314
2315    public boolean hasBaseFormulaProductName() {
2316      return this.baseFormulaProductName != null && !this.baseFormulaProductName.isEmpty();
2317    }
2318
2319    /**
2320     * @param value {@link #baseFormulaProductName} (The product or brand name of
2321     *              the enteral or infant formula product such as "ACME Adult
2322     *              Standard Formula".). This is the underlying object with id,
2323     *              value and extensions. The accessor "getBaseFormulaProductName"
2324     *              gives direct access to the value
2325     */
2326    public NutritionOrderEnteralFormulaComponent setBaseFormulaProductNameElement(StringType value) {
2327      this.baseFormulaProductName = value;
2328      return this;
2329    }
2330
2331    /**
2332     * @return The product or brand name of the enteral or infant formula product
2333     *         such as "ACME Adult Standard Formula".
2334     */
2335    public String getBaseFormulaProductName() {
2336      return this.baseFormulaProductName == null ? null : this.baseFormulaProductName.getValue();
2337    }
2338
2339    /**
2340     * @param value The product or brand name of the enteral or infant formula
2341     *              product such as "ACME Adult Standard Formula".
2342     */
2343    public NutritionOrderEnteralFormulaComponent setBaseFormulaProductName(String value) {
2344      if (Utilities.noString(value))
2345        this.baseFormulaProductName = null;
2346      else {
2347        if (this.baseFormulaProductName == null)
2348          this.baseFormulaProductName = new StringType();
2349        this.baseFormulaProductName.setValue(value);
2350      }
2351      return this;
2352    }
2353
2354    /**
2355     * @return {@link #additiveType} (Indicates the type of modular component such
2356     *         as protein, carbohydrate, fat or fiber to be provided in addition to
2357     *         or mixed with the base formula.)
2358     */
2359    public CodeableConcept getAdditiveType() {
2360      if (this.additiveType == null)
2361        if (Configuration.errorOnAutoCreate())
2362          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveType");
2363        else if (Configuration.doAutoCreate())
2364          this.additiveType = new CodeableConcept(); // cc
2365      return this.additiveType;
2366    }
2367
2368    public boolean hasAdditiveType() {
2369      return this.additiveType != null && !this.additiveType.isEmpty();
2370    }
2371
2372    /**
2373     * @param value {@link #additiveType} (Indicates the type of modular component
2374     *              such as protein, carbohydrate, fat or fiber to be provided in
2375     *              addition to or mixed with the base formula.)
2376     */
2377    public NutritionOrderEnteralFormulaComponent setAdditiveType(CodeableConcept value) {
2378      this.additiveType = value;
2379      return this;
2380    }
2381
2382    /**
2383     * @return {@link #additiveProductName} (The product or brand name of the type
2384     *         of modular component to be added to the formula.). This is the
2385     *         underlying object with id, value and extensions. The accessor
2386     *         "getAdditiveProductName" gives direct access to the value
2387     */
2388    public StringType getAdditiveProductNameElement() {
2389      if (this.additiveProductName == null)
2390        if (Configuration.errorOnAutoCreate())
2391          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.additiveProductName");
2392        else if (Configuration.doAutoCreate())
2393          this.additiveProductName = new StringType(); // bb
2394      return this.additiveProductName;
2395    }
2396
2397    public boolean hasAdditiveProductNameElement() {
2398      return this.additiveProductName != null && !this.additiveProductName.isEmpty();
2399    }
2400
2401    public boolean hasAdditiveProductName() {
2402      return this.additiveProductName != null && !this.additiveProductName.isEmpty();
2403    }
2404
2405    /**
2406     * @param value {@link #additiveProductName} (The product or brand name of the
2407     *              type of modular component to be added to the formula.). This is
2408     *              the underlying object with id, value and extensions. The
2409     *              accessor "getAdditiveProductName" gives direct access to the
2410     *              value
2411     */
2412    public NutritionOrderEnteralFormulaComponent setAdditiveProductNameElement(StringType value) {
2413      this.additiveProductName = value;
2414      return this;
2415    }
2416
2417    /**
2418     * @return The product or brand name of the type of modular component to be
2419     *         added to the formula.
2420     */
2421    public String getAdditiveProductName() {
2422      return this.additiveProductName == null ? null : this.additiveProductName.getValue();
2423    }
2424
2425    /**
2426     * @param value The product or brand name of the type of modular component to be
2427     *              added to the formula.
2428     */
2429    public NutritionOrderEnteralFormulaComponent setAdditiveProductName(String value) {
2430      if (Utilities.noString(value))
2431        this.additiveProductName = null;
2432      else {
2433        if (this.additiveProductName == null)
2434          this.additiveProductName = new StringType();
2435        this.additiveProductName.setValue(value);
2436      }
2437      return this;
2438    }
2439
2440    /**
2441     * @return {@link #caloricDensity} (The amount of energy (calories) that the
2442     *         formula should provide per specified volume, typically per mL or
2443     *         fluid oz. For example, an infant may require a formula that provides
2444     *         24 calories per fluid ounce or an adult may require an enteral
2445     *         formula that provides 1.5 calorie/mL.)
2446     */
2447    public Quantity getCaloricDensity() {
2448      if (this.caloricDensity == null)
2449        if (Configuration.errorOnAutoCreate())
2450          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.caloricDensity");
2451        else if (Configuration.doAutoCreate())
2452          this.caloricDensity = new Quantity(); // cc
2453      return this.caloricDensity;
2454    }
2455
2456    public boolean hasCaloricDensity() {
2457      return this.caloricDensity != null && !this.caloricDensity.isEmpty();
2458    }
2459
2460    /**
2461     * @param value {@link #caloricDensity} (The amount of energy (calories) that
2462     *              the formula should provide per specified volume, typically per
2463     *              mL or fluid oz. For example, an infant may require a formula
2464     *              that provides 24 calories per fluid ounce or an adult may
2465     *              require an enteral formula that provides 1.5 calorie/mL.)
2466     */
2467    public NutritionOrderEnteralFormulaComponent setCaloricDensity(Quantity value) {
2468      this.caloricDensity = value;
2469      return this;
2470    }
2471
2472    /**
2473     * @return {@link #routeofAdministration} (The route or physiological path of
2474     *         administration into the patient's gastrointestinal tract for purposes
2475     *         of providing the formula feeding, e.g. nasogastric tube.)
2476     */
2477    public CodeableConcept getRouteofAdministration() {
2478      if (this.routeofAdministration == null)
2479        if (Configuration.errorOnAutoCreate())
2480          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.routeofAdministration");
2481        else if (Configuration.doAutoCreate())
2482          this.routeofAdministration = new CodeableConcept(); // cc
2483      return this.routeofAdministration;
2484    }
2485
2486    public boolean hasRouteofAdministration() {
2487      return this.routeofAdministration != null && !this.routeofAdministration.isEmpty();
2488    }
2489
2490    /**
2491     * @param value {@link #routeofAdministration} (The route or physiological path
2492     *              of administration into the patient's gastrointestinal tract for
2493     *              purposes of providing the formula feeding, e.g. nasogastric
2494     *              tube.)
2495     */
2496    public NutritionOrderEnteralFormulaComponent setRouteofAdministration(CodeableConcept value) {
2497      this.routeofAdministration = value;
2498      return this;
2499    }
2500
2501    /**
2502     * @return {@link #administration} (Formula administration instructions as
2503     *         structured data. This repeating structure allows for changing the
2504     *         administration rate or volume over time for both bolus and continuous
2505     *         feeding. An example of this would be an instruction to increase the
2506     *         rate of continuous feeding every 2 hours.)
2507     */
2508    public List<NutritionOrderEnteralFormulaAdministrationComponent> getAdministration() {
2509      if (this.administration == null)
2510        this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2511      return this.administration;
2512    }
2513
2514    /**
2515     * @return Returns a reference to <code>this</code> for easy method chaining
2516     */
2517    public NutritionOrderEnteralFormulaComponent setAdministration(
2518        List<NutritionOrderEnteralFormulaAdministrationComponent> theAdministration) {
2519      this.administration = theAdministration;
2520      return this;
2521    }
2522
2523    public boolean hasAdministration() {
2524      if (this.administration == null)
2525        return false;
2526      for (NutritionOrderEnteralFormulaAdministrationComponent item : this.administration)
2527        if (!item.isEmpty())
2528          return true;
2529      return false;
2530    }
2531
2532    public NutritionOrderEnteralFormulaAdministrationComponent addAdministration() { // 3
2533      NutritionOrderEnteralFormulaAdministrationComponent t = new NutritionOrderEnteralFormulaAdministrationComponent();
2534      if (this.administration == null)
2535        this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2536      this.administration.add(t);
2537      return t;
2538    }
2539
2540    public NutritionOrderEnteralFormulaComponent addAdministration(
2541        NutritionOrderEnteralFormulaAdministrationComponent t) { // 3
2542      if (t == null)
2543        return this;
2544      if (this.administration == null)
2545        this.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2546      this.administration.add(t);
2547      return this;
2548    }
2549
2550    /**
2551     * @return The first repetition of repeating field {@link #administration},
2552     *         creating it if it does not already exist
2553     */
2554    public NutritionOrderEnteralFormulaAdministrationComponent getAdministrationFirstRep() {
2555      if (getAdministration().isEmpty()) {
2556        addAdministration();
2557      }
2558      return getAdministration().get(0);
2559    }
2560
2561    /**
2562     * @return {@link #maxVolumeToDeliver} (The maximum total quantity of formula
2563     *         that may be administered to a subject over the period of time, e.g.
2564     *         1440 mL over 24 hours.)
2565     */
2566    public Quantity getMaxVolumeToDeliver() {
2567      if (this.maxVolumeToDeliver == null)
2568        if (Configuration.errorOnAutoCreate())
2569          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.maxVolumeToDeliver");
2570        else if (Configuration.doAutoCreate())
2571          this.maxVolumeToDeliver = new Quantity(); // cc
2572      return this.maxVolumeToDeliver;
2573    }
2574
2575    public boolean hasMaxVolumeToDeliver() {
2576      return this.maxVolumeToDeliver != null && !this.maxVolumeToDeliver.isEmpty();
2577    }
2578
2579    /**
2580     * @param value {@link #maxVolumeToDeliver} (The maximum total quantity of
2581     *              formula that may be administered to a subject over the period of
2582     *              time, e.g. 1440 mL over 24 hours.)
2583     */
2584    public NutritionOrderEnteralFormulaComponent setMaxVolumeToDeliver(Quantity value) {
2585      this.maxVolumeToDeliver = value;
2586      return this;
2587    }
2588
2589    /**
2590     * @return {@link #administrationInstruction} (Free text formula administration,
2591     *         feeding instructions or additional instructions or information.).
2592     *         This is the underlying object with id, value and extensions. The
2593     *         accessor "getAdministrationInstruction" gives direct access to the
2594     *         value
2595     */
2596    public StringType getAdministrationInstructionElement() {
2597      if (this.administrationInstruction == null)
2598        if (Configuration.errorOnAutoCreate())
2599          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaComponent.administrationInstruction");
2600        else if (Configuration.doAutoCreate())
2601          this.administrationInstruction = new StringType(); // bb
2602      return this.administrationInstruction;
2603    }
2604
2605    public boolean hasAdministrationInstructionElement() {
2606      return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
2607    }
2608
2609    public boolean hasAdministrationInstruction() {
2610      return this.administrationInstruction != null && !this.administrationInstruction.isEmpty();
2611    }
2612
2613    /**
2614     * @param value {@link #administrationInstruction} (Free text formula
2615     *              administration, feeding instructions or additional instructions
2616     *              or information.). This is the underlying object with id, value
2617     *              and extensions. The accessor "getAdministrationInstruction"
2618     *              gives direct access to the value
2619     */
2620    public NutritionOrderEnteralFormulaComponent setAdministrationInstructionElement(StringType value) {
2621      this.administrationInstruction = value;
2622      return this;
2623    }
2624
2625    /**
2626     * @return Free text formula administration, feeding instructions or additional
2627     *         instructions or information.
2628     */
2629    public String getAdministrationInstruction() {
2630      return this.administrationInstruction == null ? null : this.administrationInstruction.getValue();
2631    }
2632
2633    /**
2634     * @param value Free text formula administration, feeding instructions or
2635     *              additional instructions or information.
2636     */
2637    public NutritionOrderEnteralFormulaComponent setAdministrationInstruction(String value) {
2638      if (Utilities.noString(value))
2639        this.administrationInstruction = null;
2640      else {
2641        if (this.administrationInstruction == null)
2642          this.administrationInstruction = new StringType();
2643        this.administrationInstruction.setValue(value);
2644      }
2645      return this;
2646    }
2647
2648    protected void listChildren(List<Property> children) {
2649      super.listChildren(children);
2650      children.add(new Property("baseFormulaType", "CodeableConcept",
2651          "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.",
2652          0, 1, baseFormulaType));
2653      children.add(new Property("baseFormulaProductName", "string",
2654          "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".",
2655          0, 1, baseFormulaProductName));
2656      children.add(new Property("additiveType", "CodeableConcept",
2657          "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.",
2658          0, 1, additiveType));
2659      children.add(new Property("additiveProductName", "string",
2660          "The product or brand name of the type of modular component to be added to the formula.", 0, 1,
2661          additiveProductName));
2662      children.add(new Property("caloricDensity", "SimpleQuantity",
2663          "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.",
2664          0, 1, caloricDensity));
2665      children.add(new Property("routeofAdministration", "CodeableConcept",
2666          "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.",
2667          0, 1, routeofAdministration));
2668      children.add(new Property("administration", "",
2669          "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.",
2670          0, java.lang.Integer.MAX_VALUE, administration));
2671      children.add(new Property("maxVolumeToDeliver", "SimpleQuantity",
2672          "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.",
2673          0, 1, maxVolumeToDeliver));
2674      children.add(new Property("administrationInstruction", "string",
2675          "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1,
2676          administrationInstruction));
2677    }
2678
2679    @Override
2680    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2681      switch (_hash) {
2682      case -138930641:
2683        /* baseFormulaType */ return new Property("baseFormulaType", "CodeableConcept",
2684            "The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.",
2685            0, 1, baseFormulaType);
2686      case -1267705979:
2687        /* baseFormulaProductName */ return new Property("baseFormulaProductName", "string",
2688            "The product or brand name of the enteral or infant formula product such as \"ACME Adult Standard Formula\".",
2689            0, 1, baseFormulaProductName);
2690      case -470746842:
2691        /* additiveType */ return new Property("additiveType", "CodeableConcept",
2692            "Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.",
2693            0, 1, additiveType);
2694      case 488079534:
2695        /* additiveProductName */ return new Property("additiveProductName", "string",
2696            "The product or brand name of the type of modular component to be added to the formula.", 0, 1,
2697            additiveProductName);
2698      case 186983261:
2699        /* caloricDensity */ return new Property("caloricDensity", "SimpleQuantity",
2700            "The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.",
2701            0, 1, caloricDensity);
2702      case -1710107042:
2703        /* routeofAdministration */ return new Property("routeofAdministration", "CodeableConcept",
2704            "The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.",
2705            0, 1, routeofAdministration);
2706      case 1255702622:
2707        /* administration */ return new Property("administration", "",
2708            "Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.",
2709            0, java.lang.Integer.MAX_VALUE, administration);
2710      case 2017924652:
2711        /* maxVolumeToDeliver */ return new Property("maxVolumeToDeliver", "SimpleQuantity",
2712            "The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.",
2713            0, 1, maxVolumeToDeliver);
2714      case 427085136:
2715        /* administrationInstruction */ return new Property("administrationInstruction", "string",
2716            "Free text formula administration, feeding instructions or additional instructions or information.", 0, 1,
2717            administrationInstruction);
2718      default:
2719        return super.getNamedProperty(_hash, _name, _checkValid);
2720      }
2721
2722    }
2723
2724    @Override
2725    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2726      switch (hash) {
2727      case -138930641:
2728        /* baseFormulaType */ return this.baseFormulaType == null ? new Base[0] : new Base[] { this.baseFormulaType }; // CodeableConcept
2729      case -1267705979:
2730        /* baseFormulaProductName */ return this.baseFormulaProductName == null ? new Base[0]
2731            : new Base[] { this.baseFormulaProductName }; // StringType
2732      case -470746842:
2733        /* additiveType */ return this.additiveType == null ? new Base[0] : new Base[] { this.additiveType }; // CodeableConcept
2734      case 488079534:
2735        /* additiveProductName */ return this.additiveProductName == null ? new Base[0]
2736            : new Base[] { this.additiveProductName }; // StringType
2737      case 186983261:
2738        /* caloricDensity */ return this.caloricDensity == null ? new Base[0] : new Base[] { this.caloricDensity }; // Quantity
2739      case -1710107042:
2740        /* routeofAdministration */ return this.routeofAdministration == null ? new Base[0]
2741            : new Base[] { this.routeofAdministration }; // CodeableConcept
2742      case 1255702622:
2743        /* administration */ return this.administration == null ? new Base[0]
2744            : this.administration.toArray(new Base[this.administration.size()]); // NutritionOrderEnteralFormulaAdministrationComponent
2745      case 2017924652:
2746        /* maxVolumeToDeliver */ return this.maxVolumeToDeliver == null ? new Base[0]
2747            : new Base[] { this.maxVolumeToDeliver }; // Quantity
2748      case 427085136:
2749        /* administrationInstruction */ return this.administrationInstruction == null ? new Base[0]
2750            : new Base[] { this.administrationInstruction }; // StringType
2751      default:
2752        return super.getProperty(hash, name, checkValid);
2753      }
2754
2755    }
2756
2757    @Override
2758    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2759      switch (hash) {
2760      case -138930641: // baseFormulaType
2761        this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
2762        return value;
2763      case -1267705979: // baseFormulaProductName
2764        this.baseFormulaProductName = castToString(value); // StringType
2765        return value;
2766      case -470746842: // additiveType
2767        this.additiveType = castToCodeableConcept(value); // CodeableConcept
2768        return value;
2769      case 488079534: // additiveProductName
2770        this.additiveProductName = castToString(value); // StringType
2771        return value;
2772      case 186983261: // caloricDensity
2773        this.caloricDensity = castToQuantity(value); // Quantity
2774        return value;
2775      case -1710107042: // routeofAdministration
2776        this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
2777        return value;
2778      case 1255702622: // administration
2779        this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value); // NutritionOrderEnteralFormulaAdministrationComponent
2780        return value;
2781      case 2017924652: // maxVolumeToDeliver
2782        this.maxVolumeToDeliver = castToQuantity(value); // Quantity
2783        return value;
2784      case 427085136: // administrationInstruction
2785        this.administrationInstruction = castToString(value); // StringType
2786        return value;
2787      default:
2788        return super.setProperty(hash, name, value);
2789      }
2790
2791    }
2792
2793    @Override
2794    public Base setProperty(String name, Base value) throws FHIRException {
2795      if (name.equals("baseFormulaType")) {
2796        this.baseFormulaType = castToCodeableConcept(value); // CodeableConcept
2797      } else if (name.equals("baseFormulaProductName")) {
2798        this.baseFormulaProductName = castToString(value); // StringType
2799      } else if (name.equals("additiveType")) {
2800        this.additiveType = castToCodeableConcept(value); // CodeableConcept
2801      } else if (name.equals("additiveProductName")) {
2802        this.additiveProductName = castToString(value); // StringType
2803      } else if (name.equals("caloricDensity")) {
2804        this.caloricDensity = castToQuantity(value); // Quantity
2805      } else if (name.equals("routeofAdministration")) {
2806        this.routeofAdministration = castToCodeableConcept(value); // CodeableConcept
2807      } else if (name.equals("administration")) {
2808        this.getAdministration().add((NutritionOrderEnteralFormulaAdministrationComponent) value);
2809      } else if (name.equals("maxVolumeToDeliver")) {
2810        this.maxVolumeToDeliver = castToQuantity(value); // Quantity
2811      } else if (name.equals("administrationInstruction")) {
2812        this.administrationInstruction = castToString(value); // StringType
2813      } else
2814        return super.setProperty(name, value);
2815      return value;
2816    }
2817
2818    @Override
2819    public Base makeProperty(int hash, String name) throws FHIRException {
2820      switch (hash) {
2821      case -138930641:
2822        return getBaseFormulaType();
2823      case -1267705979:
2824        return getBaseFormulaProductNameElement();
2825      case -470746842:
2826        return getAdditiveType();
2827      case 488079534:
2828        return getAdditiveProductNameElement();
2829      case 186983261:
2830        return getCaloricDensity();
2831      case -1710107042:
2832        return getRouteofAdministration();
2833      case 1255702622:
2834        return addAdministration();
2835      case 2017924652:
2836        return getMaxVolumeToDeliver();
2837      case 427085136:
2838        return getAdministrationInstructionElement();
2839      default:
2840        return super.makeProperty(hash, name);
2841      }
2842
2843    }
2844
2845    @Override
2846    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2847      switch (hash) {
2848      case -138930641:
2849        /* baseFormulaType */ return new String[] { "CodeableConcept" };
2850      case -1267705979:
2851        /* baseFormulaProductName */ return new String[] { "string" };
2852      case -470746842:
2853        /* additiveType */ return new String[] { "CodeableConcept" };
2854      case 488079534:
2855        /* additiveProductName */ return new String[] { "string" };
2856      case 186983261:
2857        /* caloricDensity */ return new String[] { "SimpleQuantity" };
2858      case -1710107042:
2859        /* routeofAdministration */ return new String[] { "CodeableConcept" };
2860      case 1255702622:
2861        /* administration */ return new String[] {};
2862      case 2017924652:
2863        /* maxVolumeToDeliver */ return new String[] { "SimpleQuantity" };
2864      case 427085136:
2865        /* administrationInstruction */ return new String[] { "string" };
2866      default:
2867        return super.getTypesForProperty(hash, name);
2868      }
2869
2870    }
2871
2872    @Override
2873    public Base addChild(String name) throws FHIRException {
2874      if (name.equals("baseFormulaType")) {
2875        this.baseFormulaType = new CodeableConcept();
2876        return this.baseFormulaType;
2877      } else if (name.equals("baseFormulaProductName")) {
2878        throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.baseFormulaProductName");
2879      } else if (name.equals("additiveType")) {
2880        this.additiveType = new CodeableConcept();
2881        return this.additiveType;
2882      } else if (name.equals("additiveProductName")) {
2883        throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.additiveProductName");
2884      } else if (name.equals("caloricDensity")) {
2885        this.caloricDensity = new Quantity();
2886        return this.caloricDensity;
2887      } else if (name.equals("routeofAdministration")) {
2888        this.routeofAdministration = new CodeableConcept();
2889        return this.routeofAdministration;
2890      } else if (name.equals("administration")) {
2891        return addAdministration();
2892      } else if (name.equals("maxVolumeToDeliver")) {
2893        this.maxVolumeToDeliver = new Quantity();
2894        return this.maxVolumeToDeliver;
2895      } else if (name.equals("administrationInstruction")) {
2896        throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.administrationInstruction");
2897      } else
2898        return super.addChild(name);
2899    }
2900
2901    public NutritionOrderEnteralFormulaComponent copy() {
2902      NutritionOrderEnteralFormulaComponent dst = new NutritionOrderEnteralFormulaComponent();
2903      copyValues(dst);
2904      return dst;
2905    }
2906
2907    public void copyValues(NutritionOrderEnteralFormulaComponent dst) {
2908      super.copyValues(dst);
2909      dst.baseFormulaType = baseFormulaType == null ? null : baseFormulaType.copy();
2910      dst.baseFormulaProductName = baseFormulaProductName == null ? null : baseFormulaProductName.copy();
2911      dst.additiveType = additiveType == null ? null : additiveType.copy();
2912      dst.additiveProductName = additiveProductName == null ? null : additiveProductName.copy();
2913      dst.caloricDensity = caloricDensity == null ? null : caloricDensity.copy();
2914      dst.routeofAdministration = routeofAdministration == null ? null : routeofAdministration.copy();
2915      if (administration != null) {
2916        dst.administration = new ArrayList<NutritionOrderEnteralFormulaAdministrationComponent>();
2917        for (NutritionOrderEnteralFormulaAdministrationComponent i : administration)
2918          dst.administration.add(i.copy());
2919      }
2920      ;
2921      dst.maxVolumeToDeliver = maxVolumeToDeliver == null ? null : maxVolumeToDeliver.copy();
2922      dst.administrationInstruction = administrationInstruction == null ? null : administrationInstruction.copy();
2923    }
2924
2925    @Override
2926    public boolean equalsDeep(Base other_) {
2927      if (!super.equalsDeep(other_))
2928        return false;
2929      if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2930        return false;
2931      NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2932      return compareDeep(baseFormulaType, o.baseFormulaType, true)
2933          && compareDeep(baseFormulaProductName, o.baseFormulaProductName, true)
2934          && compareDeep(additiveType, o.additiveType, true)
2935          && compareDeep(additiveProductName, o.additiveProductName, true)
2936          && compareDeep(caloricDensity, o.caloricDensity, true)
2937          && compareDeep(routeofAdministration, o.routeofAdministration, true)
2938          && compareDeep(administration, o.administration, true)
2939          && compareDeep(maxVolumeToDeliver, o.maxVolumeToDeliver, true)
2940          && compareDeep(administrationInstruction, o.administrationInstruction, true);
2941    }
2942
2943    @Override
2944    public boolean equalsShallow(Base other_) {
2945      if (!super.equalsShallow(other_))
2946        return false;
2947      if (!(other_ instanceof NutritionOrderEnteralFormulaComponent))
2948        return false;
2949      NutritionOrderEnteralFormulaComponent o = (NutritionOrderEnteralFormulaComponent) other_;
2950      return compareValues(baseFormulaProductName, o.baseFormulaProductName, true)
2951          && compareValues(additiveProductName, o.additiveProductName, true)
2952          && compareValues(administrationInstruction, o.administrationInstruction, true);
2953    }
2954
2955    public boolean isEmpty() {
2956      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(baseFormulaType, baseFormulaProductName,
2957          additiveType, additiveProductName, caloricDensity, routeofAdministration, administration, maxVolumeToDeliver,
2958          administrationInstruction);
2959    }
2960
2961    public String fhirType() {
2962      return "NutritionOrder.enteralFormula";
2963
2964    }
2965
2966  }
2967
2968  @Block()
2969  public static class NutritionOrderEnteralFormulaAdministrationComponent extends BackboneElement
2970      implements IBaseBackboneElement {
2971    /**
2972     * The time period and frequency at which the enteral formula should be
2973     * delivered to the patient.
2974     */
2975    @Child(name = "schedule", type = { Timing.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
2976    @Description(shortDefinition = "Scheduled frequency of enteral feeding", formalDefinition = "The time period and frequency at which the enteral formula should be delivered to the patient.")
2977    protected Timing schedule;
2978
2979    /**
2980     * The volume of formula to provide to the patient per the specified
2981     * administration schedule.
2982     */
2983    @Child(name = "quantity", type = { Quantity.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
2984    @Description(shortDefinition = "The volume of formula to provide", formalDefinition = "The volume of formula to provide to the patient per the specified administration schedule.")
2985    protected Quantity quantity;
2986
2987    /**
2988     * The rate of administration of formula via a feeding pump, e.g. 60 mL per
2989     * hour, according to the specified schedule.
2990     */
2991    @Child(name = "rate", type = { Quantity.class,
2992        Ratio.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2993    @Description(shortDefinition = "Speed with which the formula is provided per period of time", formalDefinition = "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.")
2994    protected Type rate;
2995
2996    private static final long serialVersionUID = 673093291L;
2997
2998    /**
2999     * Constructor
3000     */
3001    public NutritionOrderEnteralFormulaAdministrationComponent() {
3002      super();
3003    }
3004
3005    /**
3006     * @return {@link #schedule} (The time period and frequency at which the enteral
3007     *         formula should be delivered to the patient.)
3008     */
3009    public Timing getSchedule() {
3010      if (this.schedule == null)
3011        if (Configuration.errorOnAutoCreate())
3012          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.schedule");
3013        else if (Configuration.doAutoCreate())
3014          this.schedule = new Timing(); // cc
3015      return this.schedule;
3016    }
3017
3018    public boolean hasSchedule() {
3019      return this.schedule != null && !this.schedule.isEmpty();
3020    }
3021
3022    /**
3023     * @param value {@link #schedule} (The time period and frequency at which the
3024     *              enteral formula should be delivered to the patient.)
3025     */
3026    public NutritionOrderEnteralFormulaAdministrationComponent setSchedule(Timing value) {
3027      this.schedule = value;
3028      return this;
3029    }
3030
3031    /**
3032     * @return {@link #quantity} (The volume of formula to provide to the patient
3033     *         per the specified administration schedule.)
3034     */
3035    public Quantity getQuantity() {
3036      if (this.quantity == null)
3037        if (Configuration.errorOnAutoCreate())
3038          throw new Error("Attempt to auto-create NutritionOrderEnteralFormulaAdministrationComponent.quantity");
3039        else if (Configuration.doAutoCreate())
3040          this.quantity = new Quantity(); // cc
3041      return this.quantity;
3042    }
3043
3044    public boolean hasQuantity() {
3045      return this.quantity != null && !this.quantity.isEmpty();
3046    }
3047
3048    /**
3049     * @param value {@link #quantity} (The volume of formula to provide to the
3050     *              patient per the specified administration schedule.)
3051     */
3052    public NutritionOrderEnteralFormulaAdministrationComponent setQuantity(Quantity value) {
3053      this.quantity = value;
3054      return this;
3055    }
3056
3057    /**
3058     * @return {@link #rate} (The rate of administration of formula via a feeding
3059     *         pump, e.g. 60 mL per hour, according to the specified schedule.)
3060     */
3061    public Type getRate() {
3062      return this.rate;
3063    }
3064
3065    /**
3066     * @return {@link #rate} (The rate of administration of formula via a feeding
3067     *         pump, e.g. 60 mL per hour, according to the specified schedule.)
3068     */
3069    public Quantity getRateQuantity() throws FHIRException {
3070      if (this.rate == null)
3071        this.rate = new Quantity();
3072      if (!(this.rate instanceof Quantity))
3073        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.rate.getClass().getName()
3074            + " was encountered");
3075      return (Quantity) this.rate;
3076    }
3077
3078    public boolean hasRateQuantity() {
3079      return this != null && this.rate instanceof Quantity;
3080    }
3081
3082    /**
3083     * @return {@link #rate} (The rate of administration of formula via a feeding
3084     *         pump, e.g. 60 mL per hour, according to the specified schedule.)
3085     */
3086    public Ratio getRateRatio() throws FHIRException {
3087      if (this.rate == null)
3088        this.rate = new Ratio();
3089      if (!(this.rate instanceof Ratio))
3090        throw new FHIRException(
3091            "Type mismatch: the type Ratio was expected, but " + this.rate.getClass().getName() + " was encountered");
3092      return (Ratio) this.rate;
3093    }
3094
3095    public boolean hasRateRatio() {
3096      return this != null && this.rate instanceof Ratio;
3097    }
3098
3099    public boolean hasRate() {
3100      return this.rate != null && !this.rate.isEmpty();
3101    }
3102
3103    /**
3104     * @param value {@link #rate} (The rate of administration of formula via a
3105     *              feeding pump, e.g. 60 mL per hour, according to the specified
3106     *              schedule.)
3107     */
3108    public NutritionOrderEnteralFormulaAdministrationComponent setRate(Type value) {
3109      if (value != null && !(value instanceof Quantity || value instanceof Ratio))
3110        throw new Error(
3111            "Not the right type for NutritionOrder.enteralFormula.administration.rate[x]: " + value.fhirType());
3112      this.rate = value;
3113      return this;
3114    }
3115
3116    protected void listChildren(List<Property> children) {
3117      super.listChildren(children);
3118      children.add(new Property("schedule", "Timing",
3119          "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, 1,
3120          schedule));
3121      children.add(new Property("quantity", "SimpleQuantity",
3122          "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1,
3123          quantity));
3124      children.add(new Property("rate[x]", "SimpleQuantity|Ratio",
3125          "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.",
3126          0, 1, rate));
3127    }
3128
3129    @Override
3130    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3131      switch (_hash) {
3132      case -697920873:
3133        /* schedule */ return new Property("schedule", "Timing",
3134            "The time period and frequency at which the enteral formula should be delivered to the patient.", 0, 1,
3135            schedule);
3136      case -1285004149:
3137        /* quantity */ return new Property("quantity", "SimpleQuantity",
3138            "The volume of formula to provide to the patient per the specified administration schedule.", 0, 1,
3139            quantity);
3140      case 983460768:
3141        /* rate[x] */ return new Property("rate[x]", "SimpleQuantity|Ratio",
3142            "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.",
3143            0, 1, rate);
3144      case 3493088:
3145        /* rate */ return new Property("rate[x]", "SimpleQuantity|Ratio",
3146            "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.",
3147            0, 1, rate);
3148      case -1085459061:
3149        /* rateQuantity */ return new Property("rate[x]", "SimpleQuantity|Ratio",
3150            "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.",
3151            0, 1, rate);
3152      case 204021515:
3153        /* rateRatio */ return new Property("rate[x]", "SimpleQuantity|Ratio",
3154            "The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.",
3155            0, 1, rate);
3156      default:
3157        return super.getNamedProperty(_hash, _name, _checkValid);
3158      }
3159
3160    }
3161
3162    @Override
3163    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3164      switch (hash) {
3165      case -697920873:
3166        /* schedule */ return this.schedule == null ? new Base[0] : new Base[] { this.schedule }; // Timing
3167      case -1285004149:
3168        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
3169      case 3493088:
3170        /* rate */ return this.rate == null ? new Base[0] : new Base[] { this.rate }; // Type
3171      default:
3172        return super.getProperty(hash, name, checkValid);
3173      }
3174
3175    }
3176
3177    @Override
3178    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3179      switch (hash) {
3180      case -697920873: // schedule
3181        this.schedule = castToTiming(value); // Timing
3182        return value;
3183      case -1285004149: // quantity
3184        this.quantity = castToQuantity(value); // Quantity
3185        return value;
3186      case 3493088: // rate
3187        this.rate = castToType(value); // Type
3188        return value;
3189      default:
3190        return super.setProperty(hash, name, value);
3191      }
3192
3193    }
3194
3195    @Override
3196    public Base setProperty(String name, Base value) throws FHIRException {
3197      if (name.equals("schedule")) {
3198        this.schedule = castToTiming(value); // Timing
3199      } else if (name.equals("quantity")) {
3200        this.quantity = castToQuantity(value); // Quantity
3201      } else if (name.equals("rate[x]")) {
3202        this.rate = castToType(value); // Type
3203      } else
3204        return super.setProperty(name, value);
3205      return value;
3206    }
3207
3208    @Override
3209    public Base makeProperty(int hash, String name) throws FHIRException {
3210      switch (hash) {
3211      case -697920873:
3212        return getSchedule();
3213      case -1285004149:
3214        return getQuantity();
3215      case 983460768:
3216        return getRate();
3217      case 3493088:
3218        return getRate();
3219      default:
3220        return super.makeProperty(hash, name);
3221      }
3222
3223    }
3224
3225    @Override
3226    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3227      switch (hash) {
3228      case -697920873:
3229        /* schedule */ return new String[] { "Timing" };
3230      case -1285004149:
3231        /* quantity */ return new String[] { "SimpleQuantity" };
3232      case 3493088:
3233        /* rate */ return new String[] { "SimpleQuantity", "Ratio" };
3234      default:
3235        return super.getTypesForProperty(hash, name);
3236      }
3237
3238    }
3239
3240    @Override
3241    public Base addChild(String name) throws FHIRException {
3242      if (name.equals("schedule")) {
3243        this.schedule = new Timing();
3244        return this.schedule;
3245      } else if (name.equals("quantity")) {
3246        this.quantity = new Quantity();
3247        return this.quantity;
3248      } else if (name.equals("rateQuantity")) {
3249        this.rate = new Quantity();
3250        return this.rate;
3251      } else if (name.equals("rateRatio")) {
3252        this.rate = new Ratio();
3253        return this.rate;
3254      } else
3255        return super.addChild(name);
3256    }
3257
3258    public NutritionOrderEnteralFormulaAdministrationComponent copy() {
3259      NutritionOrderEnteralFormulaAdministrationComponent dst = new NutritionOrderEnteralFormulaAdministrationComponent();
3260      copyValues(dst);
3261      return dst;
3262    }
3263
3264    public void copyValues(NutritionOrderEnteralFormulaAdministrationComponent dst) {
3265      super.copyValues(dst);
3266      dst.schedule = schedule == null ? null : schedule.copy();
3267      dst.quantity = quantity == null ? null : quantity.copy();
3268      dst.rate = rate == null ? null : rate.copy();
3269    }
3270
3271    @Override
3272    public boolean equalsDeep(Base other_) {
3273      if (!super.equalsDeep(other_))
3274        return false;
3275      if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
3276        return false;
3277      NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
3278      return compareDeep(schedule, o.schedule, true) && compareDeep(quantity, o.quantity, true)
3279          && compareDeep(rate, o.rate, true);
3280    }
3281
3282    @Override
3283    public boolean equalsShallow(Base other_) {
3284      if (!super.equalsShallow(other_))
3285        return false;
3286      if (!(other_ instanceof NutritionOrderEnteralFormulaAdministrationComponent))
3287        return false;
3288      NutritionOrderEnteralFormulaAdministrationComponent o = (NutritionOrderEnteralFormulaAdministrationComponent) other_;
3289      return true;
3290    }
3291
3292    public boolean isEmpty() {
3293      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(schedule, quantity, rate);
3294    }
3295
3296    public String fhirType() {
3297      return "NutritionOrder.enteralFormula.administration";
3298
3299    }
3300
3301  }
3302
3303  /**
3304   * Identifiers assigned to this order by the order sender or by the order
3305   * receiver.
3306   */
3307  @Child(name = "identifier", type = {
3308      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3309  @Description(shortDefinition = "Identifiers assigned to this order", formalDefinition = "Identifiers assigned to this order by the order sender or by the order receiver.")
3310  protected List<Identifier> identifier;
3311
3312  /**
3313   * The URL pointing to a FHIR-defined protocol, guideline, orderset or other
3314   * definition that is adhered to in whole or in part by this NutritionOrder.
3315   */
3316  @Child(name = "instantiatesCanonical", type = {
3317      CanonicalType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3318  @Description(shortDefinition = "Instantiates FHIR protocol or definition", formalDefinition = "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.")
3319  protected List<CanonicalType> instantiatesCanonical;
3320
3321  /**
3322   * The URL pointing to an externally maintained protocol, guideline, orderset or
3323   * other definition that is adhered to in whole or in part by this
3324   * NutritionOrder.
3325   */
3326  @Child(name = "instantiatesUri", type = {
3327      UriType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
3328  @Description(shortDefinition = "Instantiates external protocol or definition", formalDefinition = "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.")
3329  protected List<UriType> instantiatesUri;
3330
3331  /**
3332   * The URL pointing to a protocol, guideline, orderset or other definition that
3333   * is adhered to in whole or in part by this NutritionOrder.
3334   */
3335  @Child(name = "instantiates", type = {
3336      UriType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3337  @Description(shortDefinition = "Instantiates protocol or definition", formalDefinition = "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.")
3338  protected List<UriType> instantiates;
3339
3340  /**
3341   * The workflow status of the nutrition order/request.
3342   */
3343  @Child(name = "status", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = true, summary = true)
3344  @Description(shortDefinition = "draft | active | on-hold | revoked | completed | entered-in-error | unknown", formalDefinition = "The workflow status of the nutrition order/request.")
3345  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-status")
3346  protected Enumeration<NutritionOrderStatus> status;
3347
3348  /**
3349   * Indicates the level of authority/intentionality associated with the
3350   * NutrionOrder and where the request fits into the workflow chain.
3351   */
3352  @Child(name = "intent", type = { CodeType.class }, order = 5, min = 1, max = 1, modifier = true, summary = true)
3353  @Description(shortDefinition = "proposal | plan | directive | order | original-order | reflex-order | filler-order | instance-order | option", formalDefinition = "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.")
3354  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-intent")
3355  protected Enumeration<NutritiionOrderIntent> intent;
3356
3357  /**
3358   * The person (patient) who needs the nutrition order for an oral diet,
3359   * nutritional supplement and/or enteral or formula feeding.
3360   */
3361  @Child(name = "patient", type = { Patient.class }, order = 6, min = 1, max = 1, modifier = false, summary = true)
3362  @Description(shortDefinition = "The person who requires the diet, formula or nutritional supplement", formalDefinition = "The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.")
3363  protected Reference patient;
3364
3365  /**
3366   * The actual object that is the target of the reference (The person (patient)
3367   * who needs the nutrition order for an oral diet, nutritional supplement and/or
3368   * enteral or formula feeding.)
3369   */
3370  protected Patient patientTarget;
3371
3372  /**
3373   * An encounter that provides additional information about the healthcare
3374   * context in which this request is made.
3375   */
3376  @Child(name = "encounter", type = { Encounter.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
3377  @Description(shortDefinition = "The encounter associated with this nutrition order", formalDefinition = "An encounter that provides additional information about the healthcare context in which this request is made.")
3378  protected Reference encounter;
3379
3380  /**
3381   * The actual object that is the target of the reference (An encounter that
3382   * provides additional information about the healthcare context in which this
3383   * request is made.)
3384   */
3385  protected Encounter encounterTarget;
3386
3387  /**
3388   * The date and time that this nutrition order was requested.
3389   */
3390  @Child(name = "dateTime", type = {
3391      DateTimeType.class }, order = 8, min = 1, max = 1, modifier = false, summary = true)
3392  @Description(shortDefinition = "Date and time the nutrition order was requested", formalDefinition = "The date and time that this nutrition order was requested.")
3393  protected DateTimeType dateTime;
3394
3395  /**
3396   * The practitioner that holds legal responsibility for ordering the diet,
3397   * nutritional supplement, or formula feedings.
3398   */
3399  @Child(name = "orderer", type = { Practitioner.class,
3400      PractitionerRole.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
3401  @Description(shortDefinition = "Who ordered the diet, formula or nutritional supplement", formalDefinition = "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.")
3402  protected Reference orderer;
3403
3404  /**
3405   * The actual object that is the target of the reference (The practitioner that
3406   * holds legal responsibility for ordering the diet, nutritional supplement, or
3407   * formula feedings.)
3408   */
3409  protected Resource ordererTarget;
3410
3411  /**
3412   * A link to a record of allergies or intolerances which should be included in
3413   * the nutrition order.
3414   */
3415  @Child(name = "allergyIntolerance", type = {
3416      AllergyIntolerance.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3417  @Description(shortDefinition = "List of the patient's food and nutrition-related allergies and intolerances", formalDefinition = "A link to a record of allergies or intolerances  which should be included in the nutrition order.")
3418  protected List<Reference> allergyIntolerance;
3419  /**
3420   * The actual objects that are the target of the reference (A link to a record
3421   * of allergies or intolerances which should be included in the nutrition
3422   * order.)
3423   */
3424  protected List<AllergyIntolerance> allergyIntoleranceTarget;
3425
3426  /**
3427   * This modifier is used to convey order-specific modifiers about the type of
3428   * food that should be given. These can be derived from patient allergies,
3429   * intolerances, or preferences such as Halal, Vegan or Kosher. This modifier
3430   * applies to the entire nutrition order inclusive of the oral diet, nutritional
3431   * supplements and enteral formula feedings.
3432   */
3433  @Child(name = "foodPreferenceModifier", type = {
3434      CodeableConcept.class }, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3435  @Description(shortDefinition = "Order-specific modifier about the type of food that should be given", formalDefinition = "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.")
3436  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/encounter-diet")
3437  protected List<CodeableConcept> foodPreferenceModifier;
3438
3439  /**
3440   * This modifier is used to convey Order-specific modifier about the type of
3441   * oral food or oral fluids that should not be given. These can be derived from
3442   * patient allergies, intolerances, or preferences such as No Red Meat, No Soy
3443   * or No Wheat or Gluten-Free. While it should not be necessary to repeat
3444   * allergy or intolerance information captured in the referenced
3445   * AllergyIntolerance resource in the excludeFoodModifier, this element may be
3446   * used to convey additional specificity related to foods that should be
3447   * eliminated from the patient?s diet for any reason. This modifier applies to
3448   * the entire nutrition order inclusive of the oral diet, nutritional
3449   * supplements and enteral formula feedings.
3450   */
3451  @Child(name = "excludeFoodModifier", type = {
3452      CodeableConcept.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3453  @Description(shortDefinition = "Order-specific modifier about the type of food that should not be given", formalDefinition = "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.")
3454  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/food-type")
3455  protected List<CodeableConcept> excludeFoodModifier;
3456
3457  /**
3458   * Diet given orally in contrast to enteral (tube) feeding.
3459   */
3460  @Child(name = "oralDiet", type = {}, order = 13, min = 0, max = 1, modifier = false, summary = false)
3461  @Description(shortDefinition = "Oral diet components", formalDefinition = "Diet given orally in contrast to enteral (tube) feeding.")
3462  protected NutritionOrderOralDietComponent oralDiet;
3463
3464  /**
3465   * Oral nutritional products given in order to add further nutritional value to
3466   * the patient's diet.
3467   */
3468  @Child(name = "supplement", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3469  @Description(shortDefinition = "Supplement components", formalDefinition = "Oral nutritional products given in order to add further nutritional value to the patient's diet.")
3470  protected List<NutritionOrderSupplementComponent> supplement;
3471
3472  /**
3473   * Feeding provided through the gastrointestinal tract via a tube, catheter, or
3474   * stoma that delivers nutrition distal to the oral cavity.
3475   */
3476  @Child(name = "enteralFormula", type = {}, order = 15, min = 0, max = 1, modifier = false, summary = false)
3477  @Description(shortDefinition = "Enteral formula components", formalDefinition = "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.")
3478  protected NutritionOrderEnteralFormulaComponent enteralFormula;
3479
3480  /**
3481   * Comments made about the {{title}} by the requester, performer, subject or
3482   * other participants.
3483   */
3484  @Child(name = "note", type = {
3485      Annotation.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3486  @Description(shortDefinition = "Comments", formalDefinition = "Comments made about the {{title}} by the requester, performer, subject or other participants.")
3487  protected List<Annotation> note;
3488
3489  private static final long serialVersionUID = 1746744267L;
3490
3491  /**
3492   * Constructor
3493   */
3494  public NutritionOrder() {
3495    super();
3496  }
3497
3498  /**
3499   * Constructor
3500   */
3501  public NutritionOrder(Enumeration<NutritionOrderStatus> status, Enumeration<NutritiionOrderIntent> intent,
3502      Reference patient, DateTimeType dateTime) {
3503    super();
3504    this.status = status;
3505    this.intent = intent;
3506    this.patient = patient;
3507    this.dateTime = dateTime;
3508  }
3509
3510  /**
3511   * @return {@link #identifier} (Identifiers assigned to this order by the order
3512   *         sender or by the order receiver.)
3513   */
3514  public List<Identifier> getIdentifier() {
3515    if (this.identifier == null)
3516      this.identifier = new ArrayList<Identifier>();
3517    return this.identifier;
3518  }
3519
3520  /**
3521   * @return Returns a reference to <code>this</code> for easy method chaining
3522   */
3523  public NutritionOrder setIdentifier(List<Identifier> theIdentifier) {
3524    this.identifier = theIdentifier;
3525    return this;
3526  }
3527
3528  public boolean hasIdentifier() {
3529    if (this.identifier == null)
3530      return false;
3531    for (Identifier item : this.identifier)
3532      if (!item.isEmpty())
3533        return true;
3534    return false;
3535  }
3536
3537  public Identifier addIdentifier() { // 3
3538    Identifier t = new Identifier();
3539    if (this.identifier == null)
3540      this.identifier = new ArrayList<Identifier>();
3541    this.identifier.add(t);
3542    return t;
3543  }
3544
3545  public NutritionOrder addIdentifier(Identifier t) { // 3
3546    if (t == null)
3547      return this;
3548    if (this.identifier == null)
3549      this.identifier = new ArrayList<Identifier>();
3550    this.identifier.add(t);
3551    return this;
3552  }
3553
3554  /**
3555   * @return The first repetition of repeating field {@link #identifier}, creating
3556   *         it if it does not already exist
3557   */
3558  public Identifier getIdentifierFirstRep() {
3559    if (getIdentifier().isEmpty()) {
3560      addIdentifier();
3561    }
3562    return getIdentifier().get(0);
3563  }
3564
3565  /**
3566   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
3567   *         protocol, guideline, orderset or other definition that is adhered to
3568   *         in whole or in part by this NutritionOrder.)
3569   */
3570  public List<CanonicalType> getInstantiatesCanonical() {
3571    if (this.instantiatesCanonical == null)
3572      this.instantiatesCanonical = new ArrayList<CanonicalType>();
3573    return this.instantiatesCanonical;
3574  }
3575
3576  /**
3577   * @return Returns a reference to <code>this</code> for easy method chaining
3578   */
3579  public NutritionOrder setInstantiatesCanonical(List<CanonicalType> theInstantiatesCanonical) {
3580    this.instantiatesCanonical = theInstantiatesCanonical;
3581    return this;
3582  }
3583
3584  public boolean hasInstantiatesCanonical() {
3585    if (this.instantiatesCanonical == null)
3586      return false;
3587    for (CanonicalType item : this.instantiatesCanonical)
3588      if (!item.isEmpty())
3589        return true;
3590    return false;
3591  }
3592
3593  /**
3594   * @return {@link #instantiatesCanonical} (The URL pointing to a FHIR-defined
3595   *         protocol, guideline, orderset or other definition that is adhered to
3596   *         in whole or in part by this NutritionOrder.)
3597   */
3598  public CanonicalType addInstantiatesCanonicalElement() {// 2
3599    CanonicalType t = new CanonicalType();
3600    if (this.instantiatesCanonical == null)
3601      this.instantiatesCanonical = new ArrayList<CanonicalType>();
3602    this.instantiatesCanonical.add(t);
3603    return t;
3604  }
3605
3606  /**
3607   * @param value {@link #instantiatesCanonical} (The URL pointing to a
3608   *              FHIR-defined protocol, guideline, orderset or other definition
3609   *              that is adhered to in whole or in part by this NutritionOrder.)
3610   */
3611  public NutritionOrder addInstantiatesCanonical(String value) { // 1
3612    CanonicalType t = new CanonicalType();
3613    t.setValue(value);
3614    if (this.instantiatesCanonical == null)
3615      this.instantiatesCanonical = new ArrayList<CanonicalType>();
3616    this.instantiatesCanonical.add(t);
3617    return this;
3618  }
3619
3620  /**
3621   * @param value {@link #instantiatesCanonical} (The URL pointing to a
3622   *              FHIR-defined protocol, guideline, orderset or other definition
3623   *              that is adhered to in whole or in part by this NutritionOrder.)
3624   */
3625  public boolean hasInstantiatesCanonical(String value) {
3626    if (this.instantiatesCanonical == null)
3627      return false;
3628    for (CanonicalType v : this.instantiatesCanonical)
3629      if (v.getValue().equals(value)) // canonical(ActivityDefinition|PlanDefinition)
3630        return true;
3631    return false;
3632  }
3633
3634  /**
3635   * @return {@link #instantiatesUri} (The URL pointing to an externally
3636   *         maintained protocol, guideline, orderset or other definition that is
3637   *         adhered to in whole or in part by this NutritionOrder.)
3638   */
3639  public List<UriType> getInstantiatesUri() {
3640    if (this.instantiatesUri == null)
3641      this.instantiatesUri = new ArrayList<UriType>();
3642    return this.instantiatesUri;
3643  }
3644
3645  /**
3646   * @return Returns a reference to <code>this</code> for easy method chaining
3647   */
3648  public NutritionOrder setInstantiatesUri(List<UriType> theInstantiatesUri) {
3649    this.instantiatesUri = theInstantiatesUri;
3650    return this;
3651  }
3652
3653  public boolean hasInstantiatesUri() {
3654    if (this.instantiatesUri == null)
3655      return false;
3656    for (UriType item : this.instantiatesUri)
3657      if (!item.isEmpty())
3658        return true;
3659    return false;
3660  }
3661
3662  /**
3663   * @return {@link #instantiatesUri} (The URL pointing to an externally
3664   *         maintained protocol, guideline, orderset or other definition that is
3665   *         adhered to in whole or in part by this NutritionOrder.)
3666   */
3667  public UriType addInstantiatesUriElement() {// 2
3668    UriType t = new UriType();
3669    if (this.instantiatesUri == null)
3670      this.instantiatesUri = new ArrayList<UriType>();
3671    this.instantiatesUri.add(t);
3672    return t;
3673  }
3674
3675  /**
3676   * @param value {@link #instantiatesUri} (The URL pointing to an externally
3677   *              maintained protocol, guideline, orderset or other definition
3678   *              that is adhered to in whole or in part by this NutritionOrder.)
3679   */
3680  public NutritionOrder addInstantiatesUri(String value) { // 1
3681    UriType t = new UriType();
3682    t.setValue(value);
3683    if (this.instantiatesUri == null)
3684      this.instantiatesUri = new ArrayList<UriType>();
3685    this.instantiatesUri.add(t);
3686    return this;
3687  }
3688
3689  /**
3690   * @param value {@link #instantiatesUri} (The URL pointing to an externally
3691   *              maintained protocol, guideline, orderset or other definition
3692   *              that is adhered to in whole or in part by this NutritionOrder.)
3693   */
3694  public boolean hasInstantiatesUri(String value) {
3695    if (this.instantiatesUri == null)
3696      return false;
3697    for (UriType v : this.instantiatesUri)
3698      if (v.getValue().equals(value)) // uri
3699        return true;
3700    return false;
3701  }
3702
3703  /**
3704   * @return {@link #instantiates} (The URL pointing to a protocol, guideline,
3705   *         orderset or other definition that is adhered to in whole or in part
3706   *         by this NutritionOrder.)
3707   */
3708  public List<UriType> getInstantiates() {
3709    if (this.instantiates == null)
3710      this.instantiates = new ArrayList<UriType>();
3711    return this.instantiates;
3712  }
3713
3714  /**
3715   * @return Returns a reference to <code>this</code> for easy method chaining
3716   */
3717  public NutritionOrder setInstantiates(List<UriType> theInstantiates) {
3718    this.instantiates = theInstantiates;
3719    return this;
3720  }
3721
3722  public boolean hasInstantiates() {
3723    if (this.instantiates == null)
3724      return false;
3725    for (UriType item : this.instantiates)
3726      if (!item.isEmpty())
3727        return true;
3728    return false;
3729  }
3730
3731  /**
3732   * @return {@link #instantiates} (The URL pointing to a protocol, guideline,
3733   *         orderset or other definition that is adhered to in whole or in part
3734   *         by this NutritionOrder.)
3735   */
3736  public UriType addInstantiatesElement() {// 2
3737    UriType t = new UriType();
3738    if (this.instantiates == null)
3739      this.instantiates = new ArrayList<UriType>();
3740    this.instantiates.add(t);
3741    return t;
3742  }
3743
3744  /**
3745   * @param value {@link #instantiates} (The URL pointing to a protocol,
3746   *              guideline, orderset or other definition that is adhered to in
3747   *              whole or in part by this NutritionOrder.)
3748   */
3749  public NutritionOrder addInstantiates(String value) { // 1
3750    UriType t = new UriType();
3751    t.setValue(value);
3752    if (this.instantiates == null)
3753      this.instantiates = new ArrayList<UriType>();
3754    this.instantiates.add(t);
3755    return this;
3756  }
3757
3758  /**
3759   * @param value {@link #instantiates} (The URL pointing to a protocol,
3760   *              guideline, orderset or other definition that is adhered to in
3761   *              whole or in part by this NutritionOrder.)
3762   */
3763  public boolean hasInstantiates(String value) {
3764    if (this.instantiates == null)
3765      return false;
3766    for (UriType v : this.instantiates)
3767      if (v.getValue().equals(value)) // uri
3768        return true;
3769    return false;
3770  }
3771
3772  /**
3773   * @return {@link #status} (The workflow status of the nutrition
3774   *         order/request.). This is the underlying object with id, value and
3775   *         extensions. The accessor "getStatus" gives direct access to the value
3776   */
3777  public Enumeration<NutritionOrderStatus> getStatusElement() {
3778    if (this.status == null)
3779      if (Configuration.errorOnAutoCreate())
3780        throw new Error("Attempt to auto-create NutritionOrder.status");
3781      else if (Configuration.doAutoCreate())
3782        this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory()); // bb
3783    return this.status;
3784  }
3785
3786  public boolean hasStatusElement() {
3787    return this.status != null && !this.status.isEmpty();
3788  }
3789
3790  public boolean hasStatus() {
3791    return this.status != null && !this.status.isEmpty();
3792  }
3793
3794  /**
3795   * @param value {@link #status} (The workflow status of the nutrition
3796   *              order/request.). This is the underlying object with id, value
3797   *              and extensions. The accessor "getStatus" gives direct access to
3798   *              the value
3799   */
3800  public NutritionOrder setStatusElement(Enumeration<NutritionOrderStatus> value) {
3801    this.status = value;
3802    return this;
3803  }
3804
3805  /**
3806   * @return The workflow status of the nutrition order/request.
3807   */
3808  public NutritionOrderStatus getStatus() {
3809    return this.status == null ? null : this.status.getValue();
3810  }
3811
3812  /**
3813   * @param value The workflow status of the nutrition order/request.
3814   */
3815  public NutritionOrder setStatus(NutritionOrderStatus value) {
3816    if (this.status == null)
3817      this.status = new Enumeration<NutritionOrderStatus>(new NutritionOrderStatusEnumFactory());
3818    this.status.setValue(value);
3819    return this;
3820  }
3821
3822  /**
3823   * @return {@link #intent} (Indicates the level of authority/intentionality
3824   *         associated with the NutrionOrder and where the request fits into the
3825   *         workflow chain.). This is the underlying object with id, value and
3826   *         extensions. The accessor "getIntent" gives direct access to the value
3827   */
3828  public Enumeration<NutritiionOrderIntent> getIntentElement() {
3829    if (this.intent == null)
3830      if (Configuration.errorOnAutoCreate())
3831        throw new Error("Attempt to auto-create NutritionOrder.intent");
3832      else if (Configuration.doAutoCreate())
3833        this.intent = new Enumeration<NutritiionOrderIntent>(new NutritiionOrderIntentEnumFactory()); // bb
3834    return this.intent;
3835  }
3836
3837  public boolean hasIntentElement() {
3838    return this.intent != null && !this.intent.isEmpty();
3839  }
3840
3841  public boolean hasIntent() {
3842    return this.intent != null && !this.intent.isEmpty();
3843  }
3844
3845  /**
3846   * @param value {@link #intent} (Indicates the level of authority/intentionality
3847   *              associated with the NutrionOrder and where the request fits into
3848   *              the workflow chain.). This is the underlying object with id,
3849   *              value and extensions. The accessor "getIntent" gives direct
3850   *              access to the value
3851   */
3852  public NutritionOrder setIntentElement(Enumeration<NutritiionOrderIntent> value) {
3853    this.intent = value;
3854    return this;
3855  }
3856
3857  /**
3858   * @return Indicates the level of authority/intentionality associated with the
3859   *         NutrionOrder and where the request fits into the workflow chain.
3860   */
3861  public NutritiionOrderIntent getIntent() {
3862    return this.intent == null ? null : this.intent.getValue();
3863  }
3864
3865  /**
3866   * @param value Indicates the level of authority/intentionality associated with
3867   *              the NutrionOrder and where the request fits into the workflow
3868   *              chain.
3869   */
3870  public NutritionOrder setIntent(NutritiionOrderIntent value) {
3871    if (this.intent == null)
3872      this.intent = new Enumeration<NutritiionOrderIntent>(new NutritiionOrderIntentEnumFactory());
3873    this.intent.setValue(value);
3874    return this;
3875  }
3876
3877  /**
3878   * @return {@link #patient} (The person (patient) who needs the nutrition order
3879   *         for an oral diet, nutritional supplement and/or enteral or formula
3880   *         feeding.)
3881   */
3882  public Reference getPatient() {
3883    if (this.patient == null)
3884      if (Configuration.errorOnAutoCreate())
3885        throw new Error("Attempt to auto-create NutritionOrder.patient");
3886      else if (Configuration.doAutoCreate())
3887        this.patient = new Reference(); // cc
3888    return this.patient;
3889  }
3890
3891  public boolean hasPatient() {
3892    return this.patient != null && !this.patient.isEmpty();
3893  }
3894
3895  /**
3896   * @param value {@link #patient} (The person (patient) who needs the nutrition
3897   *              order for an oral diet, nutritional supplement and/or enteral or
3898   *              formula feeding.)
3899   */
3900  public NutritionOrder setPatient(Reference value) {
3901    this.patient = value;
3902    return this;
3903  }
3904
3905  /**
3906   * @return {@link #patient} The actual object that is the target of the
3907   *         reference. The reference library doesn't populate this, but you can
3908   *         use it to hold the resource if you resolve it. (The person (patient)
3909   *         who needs the nutrition order for an oral diet, nutritional
3910   *         supplement and/or enteral or formula feeding.)
3911   */
3912  public Patient getPatientTarget() {
3913    if (this.patientTarget == null)
3914      if (Configuration.errorOnAutoCreate())
3915        throw new Error("Attempt to auto-create NutritionOrder.patient");
3916      else if (Configuration.doAutoCreate())
3917        this.patientTarget = new Patient(); // aa
3918    return this.patientTarget;
3919  }
3920
3921  /**
3922   * @param value {@link #patient} The actual object that is the target of the
3923   *              reference. The reference library doesn't use these, but you can
3924   *              use it to hold the resource if you resolve it. (The person
3925   *              (patient) who needs the nutrition order for an oral diet,
3926   *              nutritional supplement and/or enteral or formula feeding.)
3927   */
3928  public NutritionOrder setPatientTarget(Patient value) {
3929    this.patientTarget = value;
3930    return this;
3931  }
3932
3933  /**
3934   * @return {@link #encounter} (An encounter that provides additional information
3935   *         about the healthcare context in which this request is made.)
3936   */
3937  public Reference getEncounter() {
3938    if (this.encounter == null)
3939      if (Configuration.errorOnAutoCreate())
3940        throw new Error("Attempt to auto-create NutritionOrder.encounter");
3941      else if (Configuration.doAutoCreate())
3942        this.encounter = new Reference(); // cc
3943    return this.encounter;
3944  }
3945
3946  public boolean hasEncounter() {
3947    return this.encounter != null && !this.encounter.isEmpty();
3948  }
3949
3950  /**
3951   * @param value {@link #encounter} (An encounter that provides additional
3952   *              information about the healthcare context in which this request
3953   *              is made.)
3954   */
3955  public NutritionOrder setEncounter(Reference value) {
3956    this.encounter = value;
3957    return this;
3958  }
3959
3960  /**
3961   * @return {@link #encounter} The actual object that is the target of the
3962   *         reference. The reference library doesn't populate this, but you can
3963   *         use it to hold the resource if you resolve it. (An encounter that
3964   *         provides additional information about the healthcare context in which
3965   *         this request is made.)
3966   */
3967  public Encounter getEncounterTarget() {
3968    if (this.encounterTarget == null)
3969      if (Configuration.errorOnAutoCreate())
3970        throw new Error("Attempt to auto-create NutritionOrder.encounter");
3971      else if (Configuration.doAutoCreate())
3972        this.encounterTarget = new Encounter(); // aa
3973    return this.encounterTarget;
3974  }
3975
3976  /**
3977   * @param value {@link #encounter} The actual object that is the target of the
3978   *              reference. The reference library doesn't use these, but you can
3979   *              use it to hold the resource if you resolve it. (An encounter
3980   *              that provides additional information about the healthcare
3981   *              context in which this request is made.)
3982   */
3983  public NutritionOrder setEncounterTarget(Encounter value) {
3984    this.encounterTarget = value;
3985    return this;
3986  }
3987
3988  /**
3989   * @return {@link #dateTime} (The date and time that this nutrition order was
3990   *         requested.). This is the underlying object with id, value and
3991   *         extensions. The accessor "getDateTime" gives direct access to the
3992   *         value
3993   */
3994  public DateTimeType getDateTimeElement() {
3995    if (this.dateTime == null)
3996      if (Configuration.errorOnAutoCreate())
3997        throw new Error("Attempt to auto-create NutritionOrder.dateTime");
3998      else if (Configuration.doAutoCreate())
3999        this.dateTime = new DateTimeType(); // bb
4000    return this.dateTime;
4001  }
4002
4003  public boolean hasDateTimeElement() {
4004    return this.dateTime != null && !this.dateTime.isEmpty();
4005  }
4006
4007  public boolean hasDateTime() {
4008    return this.dateTime != null && !this.dateTime.isEmpty();
4009  }
4010
4011  /**
4012   * @param value {@link #dateTime} (The date and time that this nutrition order
4013   *              was requested.). This is the underlying object with id, value
4014   *              and extensions. The accessor "getDateTime" gives direct access
4015   *              to the value
4016   */
4017  public NutritionOrder setDateTimeElement(DateTimeType value) {
4018    this.dateTime = value;
4019    return this;
4020  }
4021
4022  /**
4023   * @return The date and time that this nutrition order was requested.
4024   */
4025  public Date getDateTime() {
4026    return this.dateTime == null ? null : this.dateTime.getValue();
4027  }
4028
4029  /**
4030   * @param value The date and time that this nutrition order was requested.
4031   */
4032  public NutritionOrder setDateTime(Date value) {
4033    if (this.dateTime == null)
4034      this.dateTime = new DateTimeType();
4035    this.dateTime.setValue(value);
4036    return this;
4037  }
4038
4039  /**
4040   * @return {@link #orderer} (The practitioner that holds legal responsibility
4041   *         for ordering the diet, nutritional supplement, or formula feedings.)
4042   */
4043  public Reference getOrderer() {
4044    if (this.orderer == null)
4045      if (Configuration.errorOnAutoCreate())
4046        throw new Error("Attempt to auto-create NutritionOrder.orderer");
4047      else if (Configuration.doAutoCreate())
4048        this.orderer = new Reference(); // cc
4049    return this.orderer;
4050  }
4051
4052  public boolean hasOrderer() {
4053    return this.orderer != null && !this.orderer.isEmpty();
4054  }
4055
4056  /**
4057   * @param value {@link #orderer} (The practitioner that holds legal
4058   *              responsibility for ordering the diet, nutritional supplement, or
4059   *              formula feedings.)
4060   */
4061  public NutritionOrder setOrderer(Reference value) {
4062    this.orderer = value;
4063    return this;
4064  }
4065
4066  /**
4067   * @return {@link #orderer} The actual object that is the target of the
4068   *         reference. The reference library doesn't populate this, but you can
4069   *         use it to hold the resource if you resolve it. (The practitioner that
4070   *         holds legal responsibility for ordering the diet, nutritional
4071   *         supplement, or formula feedings.)
4072   */
4073  public Resource getOrdererTarget() {
4074    return this.ordererTarget;
4075  }
4076
4077  /**
4078   * @param value {@link #orderer} The actual object that is the target of the
4079   *              reference. The reference library doesn't use these, but you can
4080   *              use it to hold the resource if you resolve it. (The practitioner
4081   *              that holds legal responsibility for ordering the diet,
4082   *              nutritional supplement, or formula feedings.)
4083   */
4084  public NutritionOrder setOrdererTarget(Resource value) {
4085    this.ordererTarget = value;
4086    return this;
4087  }
4088
4089  /**
4090   * @return {@link #allergyIntolerance} (A link to a record of allergies or
4091   *         intolerances which should be included in the nutrition order.)
4092   */
4093  public List<Reference> getAllergyIntolerance() {
4094    if (this.allergyIntolerance == null)
4095      this.allergyIntolerance = new ArrayList<Reference>();
4096    return this.allergyIntolerance;
4097  }
4098
4099  /**
4100   * @return Returns a reference to <code>this</code> for easy method chaining
4101   */
4102  public NutritionOrder setAllergyIntolerance(List<Reference> theAllergyIntolerance) {
4103    this.allergyIntolerance = theAllergyIntolerance;
4104    return this;
4105  }
4106
4107  public boolean hasAllergyIntolerance() {
4108    if (this.allergyIntolerance == null)
4109      return false;
4110    for (Reference item : this.allergyIntolerance)
4111      if (!item.isEmpty())
4112        return true;
4113    return false;
4114  }
4115
4116  public Reference addAllergyIntolerance() { // 3
4117    Reference t = new Reference();
4118    if (this.allergyIntolerance == null)
4119      this.allergyIntolerance = new ArrayList<Reference>();
4120    this.allergyIntolerance.add(t);
4121    return t;
4122  }
4123
4124  public NutritionOrder addAllergyIntolerance(Reference t) { // 3
4125    if (t == null)
4126      return this;
4127    if (this.allergyIntolerance == null)
4128      this.allergyIntolerance = new ArrayList<Reference>();
4129    this.allergyIntolerance.add(t);
4130    return this;
4131  }
4132
4133  /**
4134   * @return The first repetition of repeating field {@link #allergyIntolerance},
4135   *         creating it if it does not already exist
4136   */
4137  public Reference getAllergyIntoleranceFirstRep() {
4138    if (getAllergyIntolerance().isEmpty()) {
4139      addAllergyIntolerance();
4140    }
4141    return getAllergyIntolerance().get(0);
4142  }
4143
4144  /**
4145   * @deprecated Use Reference#setResource(IBaseResource) instead
4146   */
4147  @Deprecated
4148  public List<AllergyIntolerance> getAllergyIntoleranceTarget() {
4149    if (this.allergyIntoleranceTarget == null)
4150      this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
4151    return this.allergyIntoleranceTarget;
4152  }
4153
4154  /**
4155   * @deprecated Use Reference#setResource(IBaseResource) instead
4156   */
4157  @Deprecated
4158  public AllergyIntolerance addAllergyIntoleranceTarget() {
4159    AllergyIntolerance r = new AllergyIntolerance();
4160    if (this.allergyIntoleranceTarget == null)
4161      this.allergyIntoleranceTarget = new ArrayList<AllergyIntolerance>();
4162    this.allergyIntoleranceTarget.add(r);
4163    return r;
4164  }
4165
4166  /**
4167   * @return {@link #foodPreferenceModifier} (This modifier is used to convey
4168   *         order-specific modifiers about the type of food that should be given.
4169   *         These can be derived from patient allergies, intolerances, or
4170   *         preferences such as Halal, Vegan or Kosher. This modifier applies to
4171   *         the entire nutrition order inclusive of the oral diet, nutritional
4172   *         supplements and enteral formula feedings.)
4173   */
4174  public List<CodeableConcept> getFoodPreferenceModifier() {
4175    if (this.foodPreferenceModifier == null)
4176      this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4177    return this.foodPreferenceModifier;
4178  }
4179
4180  /**
4181   * @return Returns a reference to <code>this</code> for easy method chaining
4182   */
4183  public NutritionOrder setFoodPreferenceModifier(List<CodeableConcept> theFoodPreferenceModifier) {
4184    this.foodPreferenceModifier = theFoodPreferenceModifier;
4185    return this;
4186  }
4187
4188  public boolean hasFoodPreferenceModifier() {
4189    if (this.foodPreferenceModifier == null)
4190      return false;
4191    for (CodeableConcept item : this.foodPreferenceModifier)
4192      if (!item.isEmpty())
4193        return true;
4194    return false;
4195  }
4196
4197  public CodeableConcept addFoodPreferenceModifier() { // 3
4198    CodeableConcept t = new CodeableConcept();
4199    if (this.foodPreferenceModifier == null)
4200      this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4201    this.foodPreferenceModifier.add(t);
4202    return t;
4203  }
4204
4205  public NutritionOrder addFoodPreferenceModifier(CodeableConcept t) { // 3
4206    if (t == null)
4207      return this;
4208    if (this.foodPreferenceModifier == null)
4209      this.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4210    this.foodPreferenceModifier.add(t);
4211    return this;
4212  }
4213
4214  /**
4215   * @return The first repetition of repeating field
4216   *         {@link #foodPreferenceModifier}, creating it if it does not already
4217   *         exist
4218   */
4219  public CodeableConcept getFoodPreferenceModifierFirstRep() {
4220    if (getFoodPreferenceModifier().isEmpty()) {
4221      addFoodPreferenceModifier();
4222    }
4223    return getFoodPreferenceModifier().get(0);
4224  }
4225
4226  /**
4227   * @return {@link #excludeFoodModifier} (This modifier is used to convey
4228   *         Order-specific modifier about the type of oral food or oral fluids
4229   *         that should not be given. These can be derived from patient
4230   *         allergies, intolerances, or preferences such as No Red Meat, No Soy
4231   *         or No Wheat or Gluten-Free. While it should not be necessary to
4232   *         repeat allergy or intolerance information captured in the referenced
4233   *         AllergyIntolerance resource in the excludeFoodModifier, this element
4234   *         may be used to convey additional specificity related to foods that
4235   *         should be eliminated from the patient?s diet for any reason. This
4236   *         modifier applies to the entire nutrition order inclusive of the oral
4237   *         diet, nutritional supplements and enteral formula feedings.)
4238   */
4239  public List<CodeableConcept> getExcludeFoodModifier() {
4240    if (this.excludeFoodModifier == null)
4241      this.excludeFoodModifier = new ArrayList<CodeableConcept>();
4242    return this.excludeFoodModifier;
4243  }
4244
4245  /**
4246   * @return Returns a reference to <code>this</code> for easy method chaining
4247   */
4248  public NutritionOrder setExcludeFoodModifier(List<CodeableConcept> theExcludeFoodModifier) {
4249    this.excludeFoodModifier = theExcludeFoodModifier;
4250    return this;
4251  }
4252
4253  public boolean hasExcludeFoodModifier() {
4254    if (this.excludeFoodModifier == null)
4255      return false;
4256    for (CodeableConcept item : this.excludeFoodModifier)
4257      if (!item.isEmpty())
4258        return true;
4259    return false;
4260  }
4261
4262  public CodeableConcept addExcludeFoodModifier() { // 3
4263    CodeableConcept t = new CodeableConcept();
4264    if (this.excludeFoodModifier == null)
4265      this.excludeFoodModifier = new ArrayList<CodeableConcept>();
4266    this.excludeFoodModifier.add(t);
4267    return t;
4268  }
4269
4270  public NutritionOrder addExcludeFoodModifier(CodeableConcept t) { // 3
4271    if (t == null)
4272      return this;
4273    if (this.excludeFoodModifier == null)
4274      this.excludeFoodModifier = new ArrayList<CodeableConcept>();
4275    this.excludeFoodModifier.add(t);
4276    return this;
4277  }
4278
4279  /**
4280   * @return The first repetition of repeating field {@link #excludeFoodModifier},
4281   *         creating it if it does not already exist
4282   */
4283  public CodeableConcept getExcludeFoodModifierFirstRep() {
4284    if (getExcludeFoodModifier().isEmpty()) {
4285      addExcludeFoodModifier();
4286    }
4287    return getExcludeFoodModifier().get(0);
4288  }
4289
4290  /**
4291   * @return {@link #oralDiet} (Diet given orally in contrast to enteral (tube)
4292   *         feeding.)
4293   */
4294  public NutritionOrderOralDietComponent getOralDiet() {
4295    if (this.oralDiet == null)
4296      if (Configuration.errorOnAutoCreate())
4297        throw new Error("Attempt to auto-create NutritionOrder.oralDiet");
4298      else if (Configuration.doAutoCreate())
4299        this.oralDiet = new NutritionOrderOralDietComponent(); // cc
4300    return this.oralDiet;
4301  }
4302
4303  public boolean hasOralDiet() {
4304    return this.oralDiet != null && !this.oralDiet.isEmpty();
4305  }
4306
4307  /**
4308   * @param value {@link #oralDiet} (Diet given orally in contrast to enteral
4309   *              (tube) feeding.)
4310   */
4311  public NutritionOrder setOralDiet(NutritionOrderOralDietComponent value) {
4312    this.oralDiet = value;
4313    return this;
4314  }
4315
4316  /**
4317   * @return {@link #supplement} (Oral nutritional products given in order to add
4318   *         further nutritional value to the patient's diet.)
4319   */
4320  public List<NutritionOrderSupplementComponent> getSupplement() {
4321    if (this.supplement == null)
4322      this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4323    return this.supplement;
4324  }
4325
4326  /**
4327   * @return Returns a reference to <code>this</code> for easy method chaining
4328   */
4329  public NutritionOrder setSupplement(List<NutritionOrderSupplementComponent> theSupplement) {
4330    this.supplement = theSupplement;
4331    return this;
4332  }
4333
4334  public boolean hasSupplement() {
4335    if (this.supplement == null)
4336      return false;
4337    for (NutritionOrderSupplementComponent item : this.supplement)
4338      if (!item.isEmpty())
4339        return true;
4340    return false;
4341  }
4342
4343  public NutritionOrderSupplementComponent addSupplement() { // 3
4344    NutritionOrderSupplementComponent t = new NutritionOrderSupplementComponent();
4345    if (this.supplement == null)
4346      this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4347    this.supplement.add(t);
4348    return t;
4349  }
4350
4351  public NutritionOrder addSupplement(NutritionOrderSupplementComponent t) { // 3
4352    if (t == null)
4353      return this;
4354    if (this.supplement == null)
4355      this.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4356    this.supplement.add(t);
4357    return this;
4358  }
4359
4360  /**
4361   * @return The first repetition of repeating field {@link #supplement}, creating
4362   *         it if it does not already exist
4363   */
4364  public NutritionOrderSupplementComponent getSupplementFirstRep() {
4365    if (getSupplement().isEmpty()) {
4366      addSupplement();
4367    }
4368    return getSupplement().get(0);
4369  }
4370
4371  /**
4372   * @return {@link #enteralFormula} (Feeding provided through the
4373   *         gastrointestinal tract via a tube, catheter, or stoma that delivers
4374   *         nutrition distal to the oral cavity.)
4375   */
4376  public NutritionOrderEnteralFormulaComponent getEnteralFormula() {
4377    if (this.enteralFormula == null)
4378      if (Configuration.errorOnAutoCreate())
4379        throw new Error("Attempt to auto-create NutritionOrder.enteralFormula");
4380      else if (Configuration.doAutoCreate())
4381        this.enteralFormula = new NutritionOrderEnteralFormulaComponent(); // cc
4382    return this.enteralFormula;
4383  }
4384
4385  public boolean hasEnteralFormula() {
4386    return this.enteralFormula != null && !this.enteralFormula.isEmpty();
4387  }
4388
4389  /**
4390   * @param value {@link #enteralFormula} (Feeding provided through the
4391   *              gastrointestinal tract via a tube, catheter, or stoma that
4392   *              delivers nutrition distal to the oral cavity.)
4393   */
4394  public NutritionOrder setEnteralFormula(NutritionOrderEnteralFormulaComponent value) {
4395    this.enteralFormula = value;
4396    return this;
4397  }
4398
4399  /**
4400   * @return {@link #note} (Comments made about the {{title}} by the requester,
4401   *         performer, subject or other participants.)
4402   */
4403  public List<Annotation> getNote() {
4404    if (this.note == null)
4405      this.note = new ArrayList<Annotation>();
4406    return this.note;
4407  }
4408
4409  /**
4410   * @return Returns a reference to <code>this</code> for easy method chaining
4411   */
4412  public NutritionOrder setNote(List<Annotation> theNote) {
4413    this.note = theNote;
4414    return this;
4415  }
4416
4417  public boolean hasNote() {
4418    if (this.note == null)
4419      return false;
4420    for (Annotation item : this.note)
4421      if (!item.isEmpty())
4422        return true;
4423    return false;
4424  }
4425
4426  public Annotation addNote() { // 3
4427    Annotation t = new Annotation();
4428    if (this.note == null)
4429      this.note = new ArrayList<Annotation>();
4430    this.note.add(t);
4431    return t;
4432  }
4433
4434  public NutritionOrder addNote(Annotation t) { // 3
4435    if (t == null)
4436      return this;
4437    if (this.note == null)
4438      this.note = new ArrayList<Annotation>();
4439    this.note.add(t);
4440    return this;
4441  }
4442
4443  /**
4444   * @return The first repetition of repeating field {@link #note}, creating it if
4445   *         it does not already exist
4446   */
4447  public Annotation getNoteFirstRep() {
4448    if (getNote().isEmpty()) {
4449      addNote();
4450    }
4451    return getNote().get(0);
4452  }
4453
4454  protected void listChildren(List<Property> children) {
4455    super.listChildren(children);
4456    children.add(new Property("identifier", "Identifier",
4457        "Identifiers assigned to this order by the order sender or by the order receiver.", 0,
4458        java.lang.Integer.MAX_VALUE, identifier));
4459    children.add(new Property("instantiatesCanonical", "canonical(ActivityDefinition|PlanDefinition)",
4460        "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.",
4461        0, java.lang.Integer.MAX_VALUE, instantiatesCanonical));
4462    children.add(new Property("instantiatesUri", "uri",
4463        "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.",
4464        0, java.lang.Integer.MAX_VALUE, instantiatesUri));
4465    children.add(new Property("instantiates", "uri",
4466        "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.",
4467        0, java.lang.Integer.MAX_VALUE, instantiates));
4468    children.add(new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1, status));
4469    children.add(new Property("intent", "code",
4470        "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.",
4471        0, 1, intent));
4472    children.add(new Property("patient", "Reference(Patient)",
4473        "The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.",
4474        0, 1, patient));
4475    children.add(new Property("encounter", "Reference(Encounter)",
4476        "An encounter that provides additional information about the healthcare context in which this request is made.",
4477        0, 1, encounter));
4478    children.add(new Property("dateTime", "dateTime", "The date and time that this nutrition order was requested.", 0,
4479        1, dateTime));
4480    children.add(new Property("orderer", "Reference(Practitioner|PractitionerRole)",
4481        "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.",
4482        0, 1, orderer));
4483    children.add(new Property("allergyIntolerance", "Reference(AllergyIntolerance)",
4484        "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0,
4485        java.lang.Integer.MAX_VALUE, allergyIntolerance));
4486    children.add(new Property("foodPreferenceModifier", "CodeableConcept",
4487        "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.",
4488        0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier));
4489    children.add(new Property("excludeFoodModifier", "CodeableConcept",
4490        "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.",
4491        0, java.lang.Integer.MAX_VALUE, excludeFoodModifier));
4492    children
4493        .add(new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0, 1, oralDiet));
4494    children.add(new Property("supplement", "",
4495        "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0,
4496        java.lang.Integer.MAX_VALUE, supplement));
4497    children.add(new Property("enteralFormula", "",
4498        "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.",
4499        0, 1, enteralFormula));
4500    children.add(new Property("note", "Annotation",
4501        "Comments made about the {{title}} by the requester, performer, subject or other participants.", 0,
4502        java.lang.Integer.MAX_VALUE, note));
4503  }
4504
4505  @Override
4506  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4507    switch (_hash) {
4508    case -1618432855:
4509      /* identifier */ return new Property("identifier", "Identifier",
4510          "Identifiers assigned to this order by the order sender or by the order receiver.", 0,
4511          java.lang.Integer.MAX_VALUE, identifier);
4512    case 8911915:
4513      /* instantiatesCanonical */ return new Property("instantiatesCanonical",
4514          "canonical(ActivityDefinition|PlanDefinition)",
4515          "The URL pointing to a FHIR-defined protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.",
4516          0, java.lang.Integer.MAX_VALUE, instantiatesCanonical);
4517    case -1926393373:
4518      /* instantiatesUri */ return new Property("instantiatesUri", "uri",
4519          "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.",
4520          0, java.lang.Integer.MAX_VALUE, instantiatesUri);
4521    case -246883639:
4522      /* instantiates */ return new Property("instantiates", "uri",
4523          "The URL pointing to a protocol, guideline, orderset or other definition that is adhered to in whole or in part by this NutritionOrder.",
4524          0, java.lang.Integer.MAX_VALUE, instantiates);
4525    case -892481550:
4526      /* status */ return new Property("status", "code", "The workflow status of the nutrition order/request.", 0, 1,
4527          status);
4528    case -1183762788:
4529      /* intent */ return new Property("intent", "code",
4530          "Indicates the level of authority/intentionality associated with the NutrionOrder and where the request fits into the workflow chain.",
4531          0, 1, intent);
4532    case -791418107:
4533      /* patient */ return new Property("patient", "Reference(Patient)",
4534          "The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.",
4535          0, 1, patient);
4536    case 1524132147:
4537      /* encounter */ return new Property("encounter", "Reference(Encounter)",
4538          "An encounter that provides additional information about the healthcare context in which this request is made.",
4539          0, 1, encounter);
4540    case 1792749467:
4541      /* dateTime */ return new Property("dateTime", "dateTime",
4542          "The date and time that this nutrition order was requested.", 0, 1, dateTime);
4543    case -1207109509:
4544      /* orderer */ return new Property("orderer", "Reference(Practitioner|PractitionerRole)",
4545          "The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.",
4546          0, 1, orderer);
4547    case -120164120:
4548      /* allergyIntolerance */ return new Property("allergyIntolerance", "Reference(AllergyIntolerance)",
4549          "A link to a record of allergies or intolerances  which should be included in the nutrition order.", 0,
4550          java.lang.Integer.MAX_VALUE, allergyIntolerance);
4551    case 659473872:
4552      /* foodPreferenceModifier */ return new Property("foodPreferenceModifier", "CodeableConcept",
4553          "This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.",
4554          0, java.lang.Integer.MAX_VALUE, foodPreferenceModifier);
4555    case 1760260175:
4556      /* excludeFoodModifier */ return new Property("excludeFoodModifier", "CodeableConcept",
4557          "This modifier is used to convey Order-specific modifier about the type of oral food or oral fluids that should not be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient?s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.",
4558          0, java.lang.Integer.MAX_VALUE, excludeFoodModifier);
4559    case 1153521250:
4560      /* oralDiet */ return new Property("oralDiet", "", "Diet given orally in contrast to enteral (tube) feeding.", 0,
4561          1, oralDiet);
4562    case -711993159:
4563      /* supplement */ return new Property("supplement", "",
4564          "Oral nutritional products given in order to add further nutritional value to the patient's diet.", 0,
4565          java.lang.Integer.MAX_VALUE, supplement);
4566    case -671083805:
4567      /* enteralFormula */ return new Property("enteralFormula", "",
4568          "Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.",
4569          0, 1, enteralFormula);
4570    case 3387378:
4571      /* note */ return new Property("note", "Annotation",
4572          "Comments made about the {{title}} by the requester, performer, subject or other participants.", 0,
4573          java.lang.Integer.MAX_VALUE, note);
4574    default:
4575      return super.getNamedProperty(_hash, _name, _checkValid);
4576    }
4577
4578  }
4579
4580  @Override
4581  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4582    switch (hash) {
4583    case -1618432855:
4584      /* identifier */ return this.identifier == null ? new Base[0]
4585          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4586    case 8911915:
4587      /* instantiatesCanonical */ return this.instantiatesCanonical == null ? new Base[0]
4588          : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType
4589    case -1926393373:
4590      /* instantiatesUri */ return this.instantiatesUri == null ? new Base[0]
4591          : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType
4592    case -246883639:
4593      /* instantiates */ return this.instantiates == null ? new Base[0]
4594          : this.instantiates.toArray(new Base[this.instantiates.size()]); // UriType
4595    case -892481550:
4596      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<NutritionOrderStatus>
4597    case -1183762788:
4598      /* intent */ return this.intent == null ? new Base[0] : new Base[] { this.intent }; // Enumeration<NutritiionOrderIntent>
4599    case -791418107:
4600      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
4601    case 1524132147:
4602      /* encounter */ return this.encounter == null ? new Base[0] : new Base[] { this.encounter }; // Reference
4603    case 1792749467:
4604      /* dateTime */ return this.dateTime == null ? new Base[0] : new Base[] { this.dateTime }; // DateTimeType
4605    case -1207109509:
4606      /* orderer */ return this.orderer == null ? new Base[0] : new Base[] { this.orderer }; // Reference
4607    case -120164120:
4608      /* allergyIntolerance */ return this.allergyIntolerance == null ? new Base[0]
4609          : this.allergyIntolerance.toArray(new Base[this.allergyIntolerance.size()]); // Reference
4610    case 659473872:
4611      /* foodPreferenceModifier */ return this.foodPreferenceModifier == null ? new Base[0]
4612          : this.foodPreferenceModifier.toArray(new Base[this.foodPreferenceModifier.size()]); // CodeableConcept
4613    case 1760260175:
4614      /* excludeFoodModifier */ return this.excludeFoodModifier == null ? new Base[0]
4615          : this.excludeFoodModifier.toArray(new Base[this.excludeFoodModifier.size()]); // CodeableConcept
4616    case 1153521250:
4617      /* oralDiet */ return this.oralDiet == null ? new Base[0] : new Base[] { this.oralDiet }; // NutritionOrderOralDietComponent
4618    case -711993159:
4619      /* supplement */ return this.supplement == null ? new Base[0]
4620          : this.supplement.toArray(new Base[this.supplement.size()]); // NutritionOrderSupplementComponent
4621    case -671083805:
4622      /* enteralFormula */ return this.enteralFormula == null ? new Base[0] : new Base[] { this.enteralFormula }; // NutritionOrderEnteralFormulaComponent
4623    case 3387378:
4624      /* note */ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
4625    default:
4626      return super.getProperty(hash, name, checkValid);
4627    }
4628
4629  }
4630
4631  @Override
4632  public Base setProperty(int hash, String name, Base value) throws FHIRException {
4633    switch (hash) {
4634    case -1618432855: // identifier
4635      this.getIdentifier().add(castToIdentifier(value)); // Identifier
4636      return value;
4637    case 8911915: // instantiatesCanonical
4638      this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType
4639      return value;
4640    case -1926393373: // instantiatesUri
4641      this.getInstantiatesUri().add(castToUri(value)); // UriType
4642      return value;
4643    case -246883639: // instantiates
4644      this.getInstantiates().add(castToUri(value)); // UriType
4645      return value;
4646    case -892481550: // status
4647      value = new NutritionOrderStatusEnumFactory().fromType(castToCode(value));
4648      this.status = (Enumeration) value; // Enumeration<NutritionOrderStatus>
4649      return value;
4650    case -1183762788: // intent
4651      value = new NutritiionOrderIntentEnumFactory().fromType(castToCode(value));
4652      this.intent = (Enumeration) value; // Enumeration<NutritiionOrderIntent>
4653      return value;
4654    case -791418107: // patient
4655      this.patient = castToReference(value); // Reference
4656      return value;
4657    case 1524132147: // encounter
4658      this.encounter = castToReference(value); // Reference
4659      return value;
4660    case 1792749467: // dateTime
4661      this.dateTime = castToDateTime(value); // DateTimeType
4662      return value;
4663    case -1207109509: // orderer
4664      this.orderer = castToReference(value); // Reference
4665      return value;
4666    case -120164120: // allergyIntolerance
4667      this.getAllergyIntolerance().add(castToReference(value)); // Reference
4668      return value;
4669    case 659473872: // foodPreferenceModifier
4670      this.getFoodPreferenceModifier().add(castToCodeableConcept(value)); // CodeableConcept
4671      return value;
4672    case 1760260175: // excludeFoodModifier
4673      this.getExcludeFoodModifier().add(castToCodeableConcept(value)); // CodeableConcept
4674      return value;
4675    case 1153521250: // oralDiet
4676      this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
4677      return value;
4678    case -711993159: // supplement
4679      this.getSupplement().add((NutritionOrderSupplementComponent) value); // NutritionOrderSupplementComponent
4680      return value;
4681    case -671083805: // enteralFormula
4682      this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
4683      return value;
4684    case 3387378: // note
4685      this.getNote().add(castToAnnotation(value)); // Annotation
4686      return value;
4687    default:
4688      return super.setProperty(hash, name, value);
4689    }
4690
4691  }
4692
4693  @Override
4694  public Base setProperty(String name, Base value) throws FHIRException {
4695    if (name.equals("identifier")) {
4696      this.getIdentifier().add(castToIdentifier(value));
4697    } else if (name.equals("instantiatesCanonical")) {
4698      this.getInstantiatesCanonical().add(castToCanonical(value));
4699    } else if (name.equals("instantiatesUri")) {
4700      this.getInstantiatesUri().add(castToUri(value));
4701    } else if (name.equals("instantiates")) {
4702      this.getInstantiates().add(castToUri(value));
4703    } else if (name.equals("status")) {
4704      value = new NutritionOrderStatusEnumFactory().fromType(castToCode(value));
4705      this.status = (Enumeration) value; // Enumeration<NutritionOrderStatus>
4706    } else if (name.equals("intent")) {
4707      value = new NutritiionOrderIntentEnumFactory().fromType(castToCode(value));
4708      this.intent = (Enumeration) value; // Enumeration<NutritiionOrderIntent>
4709    } else if (name.equals("patient")) {
4710      this.patient = castToReference(value); // Reference
4711    } else if (name.equals("encounter")) {
4712      this.encounter = castToReference(value); // Reference
4713    } else if (name.equals("dateTime")) {
4714      this.dateTime = castToDateTime(value); // DateTimeType
4715    } else if (name.equals("orderer")) {
4716      this.orderer = castToReference(value); // Reference
4717    } else if (name.equals("allergyIntolerance")) {
4718      this.getAllergyIntolerance().add(castToReference(value));
4719    } else if (name.equals("foodPreferenceModifier")) {
4720      this.getFoodPreferenceModifier().add(castToCodeableConcept(value));
4721    } else if (name.equals("excludeFoodModifier")) {
4722      this.getExcludeFoodModifier().add(castToCodeableConcept(value));
4723    } else if (name.equals("oralDiet")) {
4724      this.oralDiet = (NutritionOrderOralDietComponent) value; // NutritionOrderOralDietComponent
4725    } else if (name.equals("supplement")) {
4726      this.getSupplement().add((NutritionOrderSupplementComponent) value);
4727    } else if (name.equals("enteralFormula")) {
4728      this.enteralFormula = (NutritionOrderEnteralFormulaComponent) value; // NutritionOrderEnteralFormulaComponent
4729    } else if (name.equals("note")) {
4730      this.getNote().add(castToAnnotation(value));
4731    } else
4732      return super.setProperty(name, value);
4733    return value;
4734  }
4735
4736  @Override
4737  public Base makeProperty(int hash, String name) throws FHIRException {
4738    switch (hash) {
4739    case -1618432855:
4740      return addIdentifier();
4741    case 8911915:
4742      return addInstantiatesCanonicalElement();
4743    case -1926393373:
4744      return addInstantiatesUriElement();
4745    case -246883639:
4746      return addInstantiatesElement();
4747    case -892481550:
4748      return getStatusElement();
4749    case -1183762788:
4750      return getIntentElement();
4751    case -791418107:
4752      return getPatient();
4753    case 1524132147:
4754      return getEncounter();
4755    case 1792749467:
4756      return getDateTimeElement();
4757    case -1207109509:
4758      return getOrderer();
4759    case -120164120:
4760      return addAllergyIntolerance();
4761    case 659473872:
4762      return addFoodPreferenceModifier();
4763    case 1760260175:
4764      return addExcludeFoodModifier();
4765    case 1153521250:
4766      return getOralDiet();
4767    case -711993159:
4768      return addSupplement();
4769    case -671083805:
4770      return getEnteralFormula();
4771    case 3387378:
4772      return addNote();
4773    default:
4774      return super.makeProperty(hash, name);
4775    }
4776
4777  }
4778
4779  @Override
4780  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4781    switch (hash) {
4782    case -1618432855:
4783      /* identifier */ return new String[] { "Identifier" };
4784    case 8911915:
4785      /* instantiatesCanonical */ return new String[] { "canonical" };
4786    case -1926393373:
4787      /* instantiatesUri */ return new String[] { "uri" };
4788    case -246883639:
4789      /* instantiates */ return new String[] { "uri" };
4790    case -892481550:
4791      /* status */ return new String[] { "code" };
4792    case -1183762788:
4793      /* intent */ return new String[] { "code" };
4794    case -791418107:
4795      /* patient */ return new String[] { "Reference" };
4796    case 1524132147:
4797      /* encounter */ return new String[] { "Reference" };
4798    case 1792749467:
4799      /* dateTime */ return new String[] { "dateTime" };
4800    case -1207109509:
4801      /* orderer */ return new String[] { "Reference" };
4802    case -120164120:
4803      /* allergyIntolerance */ return new String[] { "Reference" };
4804    case 659473872:
4805      /* foodPreferenceModifier */ return new String[] { "CodeableConcept" };
4806    case 1760260175:
4807      /* excludeFoodModifier */ return new String[] { "CodeableConcept" };
4808    case 1153521250:
4809      /* oralDiet */ return new String[] {};
4810    case -711993159:
4811      /* supplement */ return new String[] {};
4812    case -671083805:
4813      /* enteralFormula */ return new String[] {};
4814    case 3387378:
4815      /* note */ return new String[] { "Annotation" };
4816    default:
4817      return super.getTypesForProperty(hash, name);
4818    }
4819
4820  }
4821
4822  @Override
4823  public Base addChild(String name) throws FHIRException {
4824    if (name.equals("identifier")) {
4825      return addIdentifier();
4826    } else if (name.equals("instantiatesCanonical")) {
4827      throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.instantiatesCanonical");
4828    } else if (name.equals("instantiatesUri")) {
4829      throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.instantiatesUri");
4830    } else if (name.equals("instantiates")) {
4831      throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.instantiates");
4832    } else if (name.equals("status")) {
4833      throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.status");
4834    } else if (name.equals("intent")) {
4835      throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.intent");
4836    } else if (name.equals("patient")) {
4837      this.patient = new Reference();
4838      return this.patient;
4839    } else if (name.equals("encounter")) {
4840      this.encounter = new Reference();
4841      return this.encounter;
4842    } else if (name.equals("dateTime")) {
4843      throw new FHIRException("Cannot call addChild on a singleton property NutritionOrder.dateTime");
4844    } else if (name.equals("orderer")) {
4845      this.orderer = new Reference();
4846      return this.orderer;
4847    } else if (name.equals("allergyIntolerance")) {
4848      return addAllergyIntolerance();
4849    } else if (name.equals("foodPreferenceModifier")) {
4850      return addFoodPreferenceModifier();
4851    } else if (name.equals("excludeFoodModifier")) {
4852      return addExcludeFoodModifier();
4853    } else if (name.equals("oralDiet")) {
4854      this.oralDiet = new NutritionOrderOralDietComponent();
4855      return this.oralDiet;
4856    } else if (name.equals("supplement")) {
4857      return addSupplement();
4858    } else if (name.equals("enteralFormula")) {
4859      this.enteralFormula = new NutritionOrderEnteralFormulaComponent();
4860      return this.enteralFormula;
4861    } else if (name.equals("note")) {
4862      return addNote();
4863    } else
4864      return super.addChild(name);
4865  }
4866
4867  public String fhirType() {
4868    return "NutritionOrder";
4869
4870  }
4871
4872  public NutritionOrder copy() {
4873    NutritionOrder dst = new NutritionOrder();
4874    copyValues(dst);
4875    return dst;
4876  }
4877
4878  public void copyValues(NutritionOrder dst) {
4879    super.copyValues(dst);
4880    if (identifier != null) {
4881      dst.identifier = new ArrayList<Identifier>();
4882      for (Identifier i : identifier)
4883        dst.identifier.add(i.copy());
4884    }
4885    ;
4886    if (instantiatesCanonical != null) {
4887      dst.instantiatesCanonical = new ArrayList<CanonicalType>();
4888      for (CanonicalType i : instantiatesCanonical)
4889        dst.instantiatesCanonical.add(i.copy());
4890    }
4891    ;
4892    if (instantiatesUri != null) {
4893      dst.instantiatesUri = new ArrayList<UriType>();
4894      for (UriType i : instantiatesUri)
4895        dst.instantiatesUri.add(i.copy());
4896    }
4897    ;
4898    if (instantiates != null) {
4899      dst.instantiates = new ArrayList<UriType>();
4900      for (UriType i : instantiates)
4901        dst.instantiates.add(i.copy());
4902    }
4903    ;
4904    dst.status = status == null ? null : status.copy();
4905    dst.intent = intent == null ? null : intent.copy();
4906    dst.patient = patient == null ? null : patient.copy();
4907    dst.encounter = encounter == null ? null : encounter.copy();
4908    dst.dateTime = dateTime == null ? null : dateTime.copy();
4909    dst.orderer = orderer == null ? null : orderer.copy();
4910    if (allergyIntolerance != null) {
4911      dst.allergyIntolerance = new ArrayList<Reference>();
4912      for (Reference i : allergyIntolerance)
4913        dst.allergyIntolerance.add(i.copy());
4914    }
4915    ;
4916    if (foodPreferenceModifier != null) {
4917      dst.foodPreferenceModifier = new ArrayList<CodeableConcept>();
4918      for (CodeableConcept i : foodPreferenceModifier)
4919        dst.foodPreferenceModifier.add(i.copy());
4920    }
4921    ;
4922    if (excludeFoodModifier != null) {
4923      dst.excludeFoodModifier = new ArrayList<CodeableConcept>();
4924      for (CodeableConcept i : excludeFoodModifier)
4925        dst.excludeFoodModifier.add(i.copy());
4926    }
4927    ;
4928    dst.oralDiet = oralDiet == null ? null : oralDiet.copy();
4929    if (supplement != null) {
4930      dst.supplement = new ArrayList<NutritionOrderSupplementComponent>();
4931      for (NutritionOrderSupplementComponent i : supplement)
4932        dst.supplement.add(i.copy());
4933    }
4934    ;
4935    dst.enteralFormula = enteralFormula == null ? null : enteralFormula.copy();
4936    if (note != null) {
4937      dst.note = new ArrayList<Annotation>();
4938      for (Annotation i : note)
4939        dst.note.add(i.copy());
4940    }
4941    ;
4942  }
4943
4944  protected NutritionOrder typedCopy() {
4945    return copy();
4946  }
4947
4948  @Override
4949  public boolean equalsDeep(Base other_) {
4950    if (!super.equalsDeep(other_))
4951      return false;
4952    if (!(other_ instanceof NutritionOrder))
4953      return false;
4954    NutritionOrder o = (NutritionOrder) other_;
4955    return compareDeep(identifier, o.identifier, true)
4956        && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true)
4957        && compareDeep(instantiatesUri, o.instantiatesUri, true) && compareDeep(instantiates, o.instantiates, true)
4958        && compareDeep(status, o.status, true) && compareDeep(intent, o.intent, true)
4959        && compareDeep(patient, o.patient, true) && compareDeep(encounter, o.encounter, true)
4960        && compareDeep(dateTime, o.dateTime, true) && compareDeep(orderer, o.orderer, true)
4961        && compareDeep(allergyIntolerance, o.allergyIntolerance, true)
4962        && compareDeep(foodPreferenceModifier, o.foodPreferenceModifier, true)
4963        && compareDeep(excludeFoodModifier, o.excludeFoodModifier, true) && compareDeep(oralDiet, o.oralDiet, true)
4964        && compareDeep(supplement, o.supplement, true) && compareDeep(enteralFormula, o.enteralFormula, true)
4965        && compareDeep(note, o.note, true);
4966  }
4967
4968  @Override
4969  public boolean equalsShallow(Base other_) {
4970    if (!super.equalsShallow(other_))
4971      return false;
4972    if (!(other_ instanceof NutritionOrder))
4973      return false;
4974    NutritionOrder o = (NutritionOrder) other_;
4975    return compareValues(instantiatesUri, o.instantiatesUri, true) && compareValues(instantiates, o.instantiates, true)
4976        && compareValues(status, o.status, true) && compareValues(intent, o.intent, true)
4977        && compareValues(dateTime, o.dateTime, true);
4978  }
4979
4980  public boolean isEmpty() {
4981    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, instantiatesCanonical, instantiatesUri,
4982        instantiates, status, intent, patient, encounter, dateTime, orderer, allergyIntolerance, foodPreferenceModifier,
4983        excludeFoodModifier, oralDiet, supplement, enteralFormula, note);
4984  }
4985
4986  @Override
4987  public ResourceType getResourceType() {
4988    return ResourceType.NutritionOrder;
4989  }
4990
4991  /**
4992   * Search parameter: <b>identifier</b>
4993   * <p>
4994   * Description: <b>Return nutrition orders with this external identifier</b><br>
4995   * Type: <b>token</b><br>
4996   * Path: <b>NutritionOrder.identifier</b><br>
4997   * </p>
4998   */
4999  @SearchParamDefinition(name = "identifier", path = "NutritionOrder.identifier", description = "Return nutrition orders with this external identifier", type = "token")
5000  public static final String SP_IDENTIFIER = "identifier";
5001  /**
5002   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
5003   * <p>
5004   * Description: <b>Return nutrition orders with this external identifier</b><br>
5005   * Type: <b>token</b><br>
5006   * Path: <b>NutritionOrder.identifier</b><br>
5007   * </p>
5008   */
5009  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5010      SP_IDENTIFIER);
5011
5012  /**
5013   * Search parameter: <b>datetime</b>
5014   * <p>
5015   * Description: <b>Return nutrition orders requested on this date</b><br>
5016   * Type: <b>date</b><br>
5017   * Path: <b>NutritionOrder.dateTime</b><br>
5018   * </p>
5019   */
5020  @SearchParamDefinition(name = "datetime", path = "NutritionOrder.dateTime", description = "Return nutrition orders requested on this date", type = "date")
5021  public static final String SP_DATETIME = "datetime";
5022  /**
5023   * <b>Fluent Client</b> search parameter constant for <b>datetime</b>
5024   * <p>
5025   * Description: <b>Return nutrition orders requested on this date</b><br>
5026   * Type: <b>date</b><br>
5027   * Path: <b>NutritionOrder.dateTime</b><br>
5028   * </p>
5029   */
5030  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATETIME = new ca.uhn.fhir.rest.gclient.DateClientParam(
5031      SP_DATETIME);
5032
5033  /**
5034   * Search parameter: <b>provider</b>
5035   * <p>
5036   * Description: <b>The identity of the provider who placed the nutrition
5037   * order</b><br>
5038   * Type: <b>reference</b><br>
5039   * Path: <b>NutritionOrder.orderer</b><br>
5040   * </p>
5041   */
5042  @SearchParamDefinition(name = "provider", path = "NutritionOrder.orderer", description = "The identity of the provider who placed the nutrition order", type = "reference", providesMembershipIn = {
5043      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class,
5044          PractitionerRole.class })
5045  public static final String SP_PROVIDER = "provider";
5046  /**
5047   * <b>Fluent Client</b> search parameter constant for <b>provider</b>
5048   * <p>
5049   * Description: <b>The identity of the provider who placed the nutrition
5050   * order</b><br>
5051   * Type: <b>reference</b><br>
5052   * Path: <b>NutritionOrder.orderer</b><br>
5053   * </p>
5054   */
5055  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
5056      SP_PROVIDER);
5057
5058  /**
5059   * Constant for fluent queries to be used to add include statements. Specifies
5060   * the path value of "<b>NutritionOrder:provider</b>".
5061   */
5062  public static final ca.uhn.fhir.model.api.Include INCLUDE_PROVIDER = new ca.uhn.fhir.model.api.Include(
5063      "NutritionOrder:provider").toLocked();
5064
5065  /**
5066   * Search parameter: <b>patient</b>
5067   * <p>
5068   * Description: <b>The identity of the person who requires the diet, formula or
5069   * nutritional supplement</b><br>
5070   * Type: <b>reference</b><br>
5071   * Path: <b>NutritionOrder.patient</b><br>
5072   * </p>
5073   */
5074  @SearchParamDefinition(name = "patient", path = "NutritionOrder.patient", description = "The identity of the person who requires the diet, formula or nutritional supplement", type = "reference", providesMembershipIn = {
5075      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
5076  public static final String SP_PATIENT = "patient";
5077  /**
5078   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
5079   * <p>
5080   * Description: <b>The identity of the person who requires the diet, formula or
5081   * nutritional supplement</b><br>
5082   * Type: <b>reference</b><br>
5083   * Path: <b>NutritionOrder.patient</b><br>
5084   * </p>
5085   */
5086  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
5087      SP_PATIENT);
5088
5089  /**
5090   * Constant for fluent queries to be used to add include statements. Specifies
5091   * the path value of "<b>NutritionOrder:patient</b>".
5092   */
5093  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
5094      "NutritionOrder:patient").toLocked();
5095
5096  /**
5097   * Search parameter: <b>supplement</b>
5098   * <p>
5099   * Description: <b>Type of supplement product requested</b><br>
5100   * Type: <b>token</b><br>
5101   * Path: <b>NutritionOrder.supplement.type</b><br>
5102   * </p>
5103   */
5104  @SearchParamDefinition(name = "supplement", path = "NutritionOrder.supplement.type", description = "Type of supplement product requested", type = "token")
5105  public static final String SP_SUPPLEMENT = "supplement";
5106  /**
5107   * <b>Fluent Client</b> search parameter constant for <b>supplement</b>
5108   * <p>
5109   * Description: <b>Type of supplement product requested</b><br>
5110   * Type: <b>token</b><br>
5111   * Path: <b>NutritionOrder.supplement.type</b><br>
5112   * </p>
5113   */
5114  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SUPPLEMENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5115      SP_SUPPLEMENT);
5116
5117  /**
5118   * Search parameter: <b>formula</b>
5119   * <p>
5120   * Description: <b>Type of enteral or infant formula</b><br>
5121   * Type: <b>token</b><br>
5122   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
5123   * </p>
5124   */
5125  @SearchParamDefinition(name = "formula", path = "NutritionOrder.enteralFormula.baseFormulaType", description = "Type of enteral or infant formula", type = "token")
5126  public static final String SP_FORMULA = "formula";
5127  /**
5128   * <b>Fluent Client</b> search parameter constant for <b>formula</b>
5129   * <p>
5130   * Description: <b>Type of enteral or infant formula</b><br>
5131   * Type: <b>token</b><br>
5132   * Path: <b>NutritionOrder.enteralFormula.baseFormulaType</b><br>
5133   * </p>
5134   */
5135  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FORMULA = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5136      SP_FORMULA);
5137
5138  /**
5139   * Search parameter: <b>instantiates-canonical</b>
5140   * <p>
5141   * Description: <b>Instantiates FHIR protocol or definition</b><br>
5142   * Type: <b>reference</b><br>
5143   * Path: <b>NutritionOrder.instantiatesCanonical</b><br>
5144   * </p>
5145   */
5146  @SearchParamDefinition(name = "instantiates-canonical", path = "NutritionOrder.instantiatesCanonical", description = "Instantiates FHIR protocol or definition", type = "reference", target = {
5147      ActivityDefinition.class, PlanDefinition.class })
5148  public static final String SP_INSTANTIATES_CANONICAL = "instantiates-canonical";
5149  /**
5150   * <b>Fluent Client</b> search parameter constant for
5151   * <b>instantiates-canonical</b>
5152   * <p>
5153   * Description: <b>Instantiates FHIR protocol or definition</b><br>
5154   * Type: <b>reference</b><br>
5155   * Path: <b>NutritionOrder.instantiatesCanonical</b><br>
5156   * </p>
5157   */
5158  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSTANTIATES_CANONICAL = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
5159      SP_INSTANTIATES_CANONICAL);
5160
5161  /**
5162   * Constant for fluent queries to be used to add include statements. Specifies
5163   * the path value of "<b>NutritionOrder:instantiates-canonical</b>".
5164   */
5165  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSTANTIATES_CANONICAL = new ca.uhn.fhir.model.api.Include(
5166      "NutritionOrder:instantiates-canonical").toLocked();
5167
5168  /**
5169   * Search parameter: <b>instantiates-uri</b>
5170   * <p>
5171   * Description: <b>Instantiates external protocol or definition</b><br>
5172   * Type: <b>uri</b><br>
5173   * Path: <b>NutritionOrder.instantiatesUri</b><br>
5174   * </p>
5175   */
5176  @SearchParamDefinition(name = "instantiates-uri", path = "NutritionOrder.instantiatesUri", description = "Instantiates external protocol or definition", type = "uri")
5177  public static final String SP_INSTANTIATES_URI = "instantiates-uri";
5178  /**
5179   * <b>Fluent Client</b> search parameter constant for <b>instantiates-uri</b>
5180   * <p>
5181   * Description: <b>Instantiates external protocol or definition</b><br>
5182   * Type: <b>uri</b><br>
5183   * Path: <b>NutritionOrder.instantiatesUri</b><br>
5184   * </p>
5185   */
5186  public static final ca.uhn.fhir.rest.gclient.UriClientParam INSTANTIATES_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(
5187      SP_INSTANTIATES_URI);
5188
5189  /**
5190   * Search parameter: <b>encounter</b>
5191   * <p>
5192   * Description: <b>Return nutrition orders with this encounter
5193   * identifier</b><br>
5194   * Type: <b>reference</b><br>
5195   * Path: <b>NutritionOrder.encounter</b><br>
5196   * </p>
5197   */
5198  @SearchParamDefinition(name = "encounter", path = "NutritionOrder.encounter", description = "Return nutrition orders with this encounter identifier", type = "reference", providesMembershipIn = {
5199      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter") }, target = { Encounter.class })
5200  public static final String SP_ENCOUNTER = "encounter";
5201  /**
5202   * <b>Fluent Client</b> search parameter constant for <b>encounter</b>
5203   * <p>
5204   * Description: <b>Return nutrition orders with this encounter
5205   * identifier</b><br>
5206   * Type: <b>reference</b><br>
5207   * Path: <b>NutritionOrder.encounter</b><br>
5208   * </p>
5209   */
5210  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
5211      SP_ENCOUNTER);
5212
5213  /**
5214   * Constant for fluent queries to be used to add include statements. Specifies
5215   * the path value of "<b>NutritionOrder:encounter</b>".
5216   */
5217  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include(
5218      "NutritionOrder:encounter").toLocked();
5219
5220  /**
5221   * Search parameter: <b>oraldiet</b>
5222   * <p>
5223   * Description: <b>Type of diet that can be consumed orally (i.e., take via the
5224   * mouth).</b><br>
5225   * Type: <b>token</b><br>
5226   * Path: <b>NutritionOrder.oralDiet.type</b><br>
5227   * </p>
5228   */
5229  @SearchParamDefinition(name = "oraldiet", path = "NutritionOrder.oralDiet.type", description = "Type of diet that can be consumed orally (i.e., take via the mouth).", type = "token")
5230  public static final String SP_ORALDIET = "oraldiet";
5231  /**
5232   * <b>Fluent Client</b> search parameter constant for <b>oraldiet</b>
5233   * <p>
5234   * Description: <b>Type of diet that can be consumed orally (i.e., take via the
5235   * mouth).</b><br>
5236   * Type: <b>token</b><br>
5237   * Path: <b>NutritionOrder.oralDiet.type</b><br>
5238   * </p>
5239   */
5240  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ORALDIET = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5241      SP_ORALDIET);
5242
5243  /**
5244   * Search parameter: <b>status</b>
5245   * <p>
5246   * Description: <b>Status of the nutrition order.</b><br>
5247   * Type: <b>token</b><br>
5248   * Path: <b>NutritionOrder.status</b><br>
5249   * </p>
5250   */
5251  @SearchParamDefinition(name = "status", path = "NutritionOrder.status", description = "Status of the nutrition order.", type = "token")
5252  public static final String SP_STATUS = "status";
5253  /**
5254   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5255   * <p>
5256   * Description: <b>Status of the nutrition order.</b><br>
5257   * Type: <b>token</b><br>
5258   * Path: <b>NutritionOrder.status</b><br>
5259   * </p>
5260   */
5261  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5262      SP_STATUS);
5263
5264  /**
5265   * Search parameter: <b>additive</b>
5266   * <p>
5267   * Description: <b>Type of module component to add to the feeding</b><br>
5268   * Type: <b>token</b><br>
5269   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
5270   * </p>
5271   */
5272  @SearchParamDefinition(name = "additive", path = "NutritionOrder.enteralFormula.additiveType", description = "Type of module component to add to the feeding", type = "token")
5273  public static final String SP_ADDITIVE = "additive";
5274  /**
5275   * <b>Fluent Client</b> search parameter constant for <b>additive</b>
5276   * <p>
5277   * Description: <b>Type of module component to add to the feeding</b><br>
5278   * Type: <b>token</b><br>
5279   * Path: <b>NutritionOrder.enteralFormula.additiveType</b><br>
5280   * </p>
5281   */
5282  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDITIVE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
5283      SP_ADDITIVE);
5284
5285}