001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * A medicinal product in the final form which is suitable for administering to a patient (after any mixing of multiple components, dissolution etc. has been performed).
052 */
053@ResourceDef(name="AdministrableProductDefinition", profile="http://hl7.org/fhir/StructureDefinition/AdministrableProductDefinition")
054public class AdministrableProductDefinition extends DomainResource {
055
056    @Block()
057    public static class AdministrableProductDefinitionPropertyComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * A code expressing the type of characteristic.
060         */
061        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
062        @Description(shortDefinition="A code expressing the type of characteristic", formalDefinition="A code expressing the type of characteristic." )
063        protected CodeableConcept type;
064
065        /**
066         * A value for the characteristic.
067         */
068        @Child(name = "value", type = {CodeableConcept.class, Quantity.class, DateType.class, BooleanType.class, Attachment.class}, order=2, min=0, max=1, modifier=false, summary=true)
069        @Description(shortDefinition="A value for the characteristic", formalDefinition="A value for the characteristic." )
070        protected DataType value;
071
072        /**
073         * The status of characteristic e.g. assigned or pending.
074         */
075        @Child(name = "status", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
076        @Description(shortDefinition="The status of characteristic e.g. assigned or pending", formalDefinition="The status of characteristic e.g. assigned or pending." )
077        protected CodeableConcept status;
078
079        private static final long serialVersionUID = -872048207L;
080
081    /**
082     * Constructor
083     */
084      public AdministrableProductDefinitionPropertyComponent() {
085        super();
086      }
087
088    /**
089     * Constructor
090     */
091      public AdministrableProductDefinitionPropertyComponent(CodeableConcept type) {
092        super();
093        this.setType(type);
094      }
095
096        /**
097         * @return {@link #type} (A code expressing the type of characteristic.)
098         */
099        public CodeableConcept getType() { 
100          if (this.type == null)
101            if (Configuration.errorOnAutoCreate())
102              throw new Error("Attempt to auto-create AdministrableProductDefinitionPropertyComponent.type");
103            else if (Configuration.doAutoCreate())
104              this.type = new CodeableConcept(); // cc
105          return this.type;
106        }
107
108        public boolean hasType() { 
109          return this.type != null && !this.type.isEmpty();
110        }
111
112        /**
113         * @param value {@link #type} (A code expressing the type of characteristic.)
114         */
115        public AdministrableProductDefinitionPropertyComponent setType(CodeableConcept value) { 
116          this.type = value;
117          return this;
118        }
119
120        /**
121         * @return {@link #value} (A value for the characteristic.)
122         */
123        public DataType getValue() { 
124          return this.value;
125        }
126
127        /**
128         * @return {@link #value} (A value for the characteristic.)
129         */
130        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
131          if (this.value == null)
132            this.value = new CodeableConcept();
133          if (!(this.value instanceof CodeableConcept))
134            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
135          return (CodeableConcept) this.value;
136        }
137
138        public boolean hasValueCodeableConcept() { 
139          return this != null && this.value instanceof CodeableConcept;
140        }
141
142        /**
143         * @return {@link #value} (A value for the characteristic.)
144         */
145        public Quantity getValueQuantity() throws FHIRException { 
146          if (this.value == null)
147            this.value = new Quantity();
148          if (!(this.value instanceof Quantity))
149            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
150          return (Quantity) this.value;
151        }
152
153        public boolean hasValueQuantity() { 
154          return this != null && this.value instanceof Quantity;
155        }
156
157        /**
158         * @return {@link #value} (A value for the characteristic.)
159         */
160        public DateType getValueDateType() throws FHIRException { 
161          if (this.value == null)
162            this.value = new DateType();
163          if (!(this.value instanceof DateType))
164            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
165          return (DateType) this.value;
166        }
167
168        public boolean hasValueDateType() { 
169          return this != null && this.value instanceof DateType;
170        }
171
172        /**
173         * @return {@link #value} (A value for the characteristic.)
174         */
175        public BooleanType getValueBooleanType() throws FHIRException { 
176          if (this.value == null)
177            this.value = new BooleanType();
178          if (!(this.value instanceof BooleanType))
179            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
180          return (BooleanType) this.value;
181        }
182
183        public boolean hasValueBooleanType() { 
184          return this != null && this.value instanceof BooleanType;
185        }
186
187        /**
188         * @return {@link #value} (A value for the characteristic.)
189         */
190        public Attachment getValueAttachment() throws FHIRException { 
191          if (this.value == null)
192            this.value = new Attachment();
193          if (!(this.value instanceof Attachment))
194            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
195          return (Attachment) this.value;
196        }
197
198        public boolean hasValueAttachment() { 
199          return this != null && this.value instanceof Attachment;
200        }
201
202        public boolean hasValue() { 
203          return this.value != null && !this.value.isEmpty();
204        }
205
206        /**
207         * @param value {@link #value} (A value for the characteristic.)
208         */
209        public AdministrableProductDefinitionPropertyComponent setValue(DataType value) { 
210          if (value != null && !(value instanceof CodeableConcept || value instanceof Quantity || value instanceof DateType || value instanceof BooleanType || value instanceof Attachment))
211            throw new Error("Not the right type for AdministrableProductDefinition.property.value[x]: "+value.fhirType());
212          this.value = value;
213          return this;
214        }
215
216        /**
217         * @return {@link #status} (The status of characteristic e.g. assigned or pending.)
218         */
219        public CodeableConcept getStatus() { 
220          if (this.status == null)
221            if (Configuration.errorOnAutoCreate())
222              throw new Error("Attempt to auto-create AdministrableProductDefinitionPropertyComponent.status");
223            else if (Configuration.doAutoCreate())
224              this.status = new CodeableConcept(); // cc
225          return this.status;
226        }
227
228        public boolean hasStatus() { 
229          return this.status != null && !this.status.isEmpty();
230        }
231
232        /**
233         * @param value {@link #status} (The status of characteristic e.g. assigned or pending.)
234         */
235        public AdministrableProductDefinitionPropertyComponent setStatus(CodeableConcept value) { 
236          this.status = value;
237          return this;
238        }
239
240        protected void listChildren(List<Property> children) {
241          super.listChildren(children);
242          children.add(new Property("type", "CodeableConcept", "A code expressing the type of characteristic.", 0, 1, type));
243          children.add(new Property("value[x]", "CodeableConcept|Quantity|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value));
244          children.add(new Property("status", "CodeableConcept", "The status of characteristic e.g. assigned or pending.", 0, 1, status));
245        }
246
247        @Override
248        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
249          switch (_hash) {
250          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A code expressing the type of characteristic.", 0, 1, type);
251          case -1410166417: /*value[x]*/  return new Property("value[x]", "CodeableConcept|Quantity|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value);
252          case 111972721: /*value*/  return new Property("value[x]", "CodeableConcept|Quantity|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value);
253          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "A value for the characteristic.", 0, 1, value);
254          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "A value for the characteristic.", 0, 1, value);
255          case -766192449: /*valueDate*/  return new Property("value[x]", "date", "A value for the characteristic.", 0, 1, value);
256          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "A value for the characteristic.", 0, 1, value);
257          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "A value for the characteristic.", 0, 1, value);
258          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status of characteristic e.g. assigned or pending.", 0, 1, status);
259          default: return super.getNamedProperty(_hash, _name, _checkValid);
260          }
261
262        }
263
264      @Override
265      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
266        switch (hash) {
267        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
268        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
269        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
270        default: return super.getProperty(hash, name, checkValid);
271        }
272
273      }
274
275      @Override
276      public Base setProperty(int hash, String name, Base value) throws FHIRException {
277        switch (hash) {
278        case 3575610: // type
279          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
280          return value;
281        case 111972721: // value
282          this.value = TypeConvertor.castToType(value); // DataType
283          return value;
284        case -892481550: // status
285          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
286          return value;
287        default: return super.setProperty(hash, name, value);
288        }
289
290      }
291
292      @Override
293      public Base setProperty(String name, Base value) throws FHIRException {
294        if (name.equals("type")) {
295          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
296        } else if (name.equals("value[x]")) {
297          this.value = TypeConvertor.castToType(value); // DataType
298        } else if (name.equals("status")) {
299          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
300        } else
301          return super.setProperty(name, value);
302        return value;
303      }
304
305      @Override
306      public Base makeProperty(int hash, String name) throws FHIRException {
307        switch (hash) {
308        case 3575610:  return getType();
309        case -1410166417:  return getValue();
310        case 111972721:  return getValue();
311        case -892481550:  return getStatus();
312        default: return super.makeProperty(hash, name);
313        }
314
315      }
316
317      @Override
318      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
319        switch (hash) {
320        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
321        case 111972721: /*value*/ return new String[] {"CodeableConcept", "Quantity", "date", "boolean", "Attachment"};
322        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
323        default: return super.getTypesForProperty(hash, name);
324        }
325
326      }
327
328      @Override
329      public Base addChild(String name) throws FHIRException {
330        if (name.equals("type")) {
331          this.type = new CodeableConcept();
332          return this.type;
333        }
334        else if (name.equals("valueCodeableConcept")) {
335          this.value = new CodeableConcept();
336          return this.value;
337        }
338        else if (name.equals("valueQuantity")) {
339          this.value = new Quantity();
340          return this.value;
341        }
342        else if (name.equals("valueDate")) {
343          this.value = new DateType();
344          return this.value;
345        }
346        else if (name.equals("valueBoolean")) {
347          this.value = new BooleanType();
348          return this.value;
349        }
350        else if (name.equals("valueAttachment")) {
351          this.value = new Attachment();
352          return this.value;
353        }
354        else if (name.equals("status")) {
355          this.status = new CodeableConcept();
356          return this.status;
357        }
358        else
359          return super.addChild(name);
360      }
361
362      public AdministrableProductDefinitionPropertyComponent copy() {
363        AdministrableProductDefinitionPropertyComponent dst = new AdministrableProductDefinitionPropertyComponent();
364        copyValues(dst);
365        return dst;
366      }
367
368      public void copyValues(AdministrableProductDefinitionPropertyComponent dst) {
369        super.copyValues(dst);
370        dst.type = type == null ? null : type.copy();
371        dst.value = value == null ? null : value.copy();
372        dst.status = status == null ? null : status.copy();
373      }
374
375      @Override
376      public boolean equalsDeep(Base other_) {
377        if (!super.equalsDeep(other_))
378          return false;
379        if (!(other_ instanceof AdministrableProductDefinitionPropertyComponent))
380          return false;
381        AdministrableProductDefinitionPropertyComponent o = (AdministrableProductDefinitionPropertyComponent) other_;
382        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true) && compareDeep(status, o.status, true)
383          ;
384      }
385
386      @Override
387      public boolean equalsShallow(Base other_) {
388        if (!super.equalsShallow(other_))
389          return false;
390        if (!(other_ instanceof AdministrableProductDefinitionPropertyComponent))
391          return false;
392        AdministrableProductDefinitionPropertyComponent o = (AdministrableProductDefinitionPropertyComponent) other_;
393        return true;
394      }
395
396      public boolean isEmpty() {
397        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value, status);
398      }
399
400  public String fhirType() {
401    return "AdministrableProductDefinition.property";
402
403  }
404
405  }
406
407    @Block()
408    public static class AdministrableProductDefinitionRouteOfAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
409        /**
410         * Coded expression for the route.
411         */
412        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
413        @Description(shortDefinition="Coded expression for the route", formalDefinition="Coded expression for the route." )
414        protected CodeableConcept code;
415
416        /**
417         * The first dose (dose quantity) administered can be specified for the product, using a numerical value and its unit of measurement.
418         */
419        @Child(name = "firstDose", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=true)
420        @Description(shortDefinition="The first dose (dose quantity) administered can be specified for the product, using a numerical value and its unit of measurement", formalDefinition="The first dose (dose quantity) administered can be specified for the product, using a numerical value and its unit of measurement." )
421        protected Quantity firstDose;
422
423        /**
424         * The maximum single dose that can be administered, can be specified using a numerical value and its unit of measurement.
425         */
426        @Child(name = "maxSingleDose", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true)
427        @Description(shortDefinition="The maximum single dose that can be administered, can be specified using a numerical value and its unit of measurement", formalDefinition="The maximum single dose that can be administered, can be specified using a numerical value and its unit of measurement." )
428        protected Quantity maxSingleDose;
429
430        /**
431         * The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered.
432         */
433        @Child(name = "maxDosePerDay", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=true)
434        @Description(shortDefinition="The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered", formalDefinition="The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered." )
435        protected Quantity maxDosePerDay;
436
437        /**
438         * The maximum dose per treatment period that can be administered.
439         */
440        @Child(name = "maxDosePerTreatmentPeriod", type = {Ratio.class}, order=5, min=0, max=1, modifier=false, summary=true)
441        @Description(shortDefinition="The maximum dose per treatment period that can be administered", formalDefinition="The maximum dose per treatment period that can be administered." )
442        protected Ratio maxDosePerTreatmentPeriod;
443
444        /**
445         * The maximum treatment period during which an Investigational Medicinal Product can be administered.
446         */
447        @Child(name = "maxTreatmentPeriod", type = {Duration.class}, order=6, min=0, max=1, modifier=false, summary=true)
448        @Description(shortDefinition="The maximum treatment period during which an Investigational Medicinal Product can be administered", formalDefinition="The maximum treatment period during which an Investigational Medicinal Product can be administered." )
449        protected Duration maxTreatmentPeriod;
450
451        /**
452         * A species for which this route applies.
453         */
454        @Child(name = "targetSpecies", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
455        @Description(shortDefinition="A species for which this route applies", formalDefinition="A species for which this route applies." )
456        protected List<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent> targetSpecies;
457
458        private static final long serialVersionUID = 322274730L;
459
460    /**
461     * Constructor
462     */
463      public AdministrableProductDefinitionRouteOfAdministrationComponent() {
464        super();
465      }
466
467    /**
468     * Constructor
469     */
470      public AdministrableProductDefinitionRouteOfAdministrationComponent(CodeableConcept code) {
471        super();
472        this.setCode(code);
473      }
474
475        /**
476         * @return {@link #code} (Coded expression for the route.)
477         */
478        public CodeableConcept getCode() { 
479          if (this.code == null)
480            if (Configuration.errorOnAutoCreate())
481              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationComponent.code");
482            else if (Configuration.doAutoCreate())
483              this.code = new CodeableConcept(); // cc
484          return this.code;
485        }
486
487        public boolean hasCode() { 
488          return this.code != null && !this.code.isEmpty();
489        }
490
491        /**
492         * @param value {@link #code} (Coded expression for the route.)
493         */
494        public AdministrableProductDefinitionRouteOfAdministrationComponent setCode(CodeableConcept value) { 
495          this.code = value;
496          return this;
497        }
498
499        /**
500         * @return {@link #firstDose} (The first dose (dose quantity) administered can be specified for the product, using a numerical value and its unit of measurement.)
501         */
502        public Quantity getFirstDose() { 
503          if (this.firstDose == null)
504            if (Configuration.errorOnAutoCreate())
505              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationComponent.firstDose");
506            else if (Configuration.doAutoCreate())
507              this.firstDose = new Quantity(); // cc
508          return this.firstDose;
509        }
510
511        public boolean hasFirstDose() { 
512          return this.firstDose != null && !this.firstDose.isEmpty();
513        }
514
515        /**
516         * @param value {@link #firstDose} (The first dose (dose quantity) administered can be specified for the product, using a numerical value and its unit of measurement.)
517         */
518        public AdministrableProductDefinitionRouteOfAdministrationComponent setFirstDose(Quantity value) { 
519          this.firstDose = value;
520          return this;
521        }
522
523        /**
524         * @return {@link #maxSingleDose} (The maximum single dose that can be administered, can be specified using a numerical value and its unit of measurement.)
525         */
526        public Quantity getMaxSingleDose() { 
527          if (this.maxSingleDose == null)
528            if (Configuration.errorOnAutoCreate())
529              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationComponent.maxSingleDose");
530            else if (Configuration.doAutoCreate())
531              this.maxSingleDose = new Quantity(); // cc
532          return this.maxSingleDose;
533        }
534
535        public boolean hasMaxSingleDose() { 
536          return this.maxSingleDose != null && !this.maxSingleDose.isEmpty();
537        }
538
539        /**
540         * @param value {@link #maxSingleDose} (The maximum single dose that can be administered, can be specified using a numerical value and its unit of measurement.)
541         */
542        public AdministrableProductDefinitionRouteOfAdministrationComponent setMaxSingleDose(Quantity value) { 
543          this.maxSingleDose = value;
544          return this;
545        }
546
547        /**
548         * @return {@link #maxDosePerDay} (The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered.)
549         */
550        public Quantity getMaxDosePerDay() { 
551          if (this.maxDosePerDay == null)
552            if (Configuration.errorOnAutoCreate())
553              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationComponent.maxDosePerDay");
554            else if (Configuration.doAutoCreate())
555              this.maxDosePerDay = new Quantity(); // cc
556          return this.maxDosePerDay;
557        }
558
559        public boolean hasMaxDosePerDay() { 
560          return this.maxDosePerDay != null && !this.maxDosePerDay.isEmpty();
561        }
562
563        /**
564         * @param value {@link #maxDosePerDay} (The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered.)
565         */
566        public AdministrableProductDefinitionRouteOfAdministrationComponent setMaxDosePerDay(Quantity value) { 
567          this.maxDosePerDay = value;
568          return this;
569        }
570
571        /**
572         * @return {@link #maxDosePerTreatmentPeriod} (The maximum dose per treatment period that can be administered.)
573         */
574        public Ratio getMaxDosePerTreatmentPeriod() { 
575          if (this.maxDosePerTreatmentPeriod == null)
576            if (Configuration.errorOnAutoCreate())
577              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationComponent.maxDosePerTreatmentPeriod");
578            else if (Configuration.doAutoCreate())
579              this.maxDosePerTreatmentPeriod = new Ratio(); // cc
580          return this.maxDosePerTreatmentPeriod;
581        }
582
583        public boolean hasMaxDosePerTreatmentPeriod() { 
584          return this.maxDosePerTreatmentPeriod != null && !this.maxDosePerTreatmentPeriod.isEmpty();
585        }
586
587        /**
588         * @param value {@link #maxDosePerTreatmentPeriod} (The maximum dose per treatment period that can be administered.)
589         */
590        public AdministrableProductDefinitionRouteOfAdministrationComponent setMaxDosePerTreatmentPeriod(Ratio value) { 
591          this.maxDosePerTreatmentPeriod = value;
592          return this;
593        }
594
595        /**
596         * @return {@link #maxTreatmentPeriod} (The maximum treatment period during which an Investigational Medicinal Product can be administered.)
597         */
598        public Duration getMaxTreatmentPeriod() { 
599          if (this.maxTreatmentPeriod == null)
600            if (Configuration.errorOnAutoCreate())
601              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationComponent.maxTreatmentPeriod");
602            else if (Configuration.doAutoCreate())
603              this.maxTreatmentPeriod = new Duration(); // cc
604          return this.maxTreatmentPeriod;
605        }
606
607        public boolean hasMaxTreatmentPeriod() { 
608          return this.maxTreatmentPeriod != null && !this.maxTreatmentPeriod.isEmpty();
609        }
610
611        /**
612         * @param value {@link #maxTreatmentPeriod} (The maximum treatment period during which an Investigational Medicinal Product can be administered.)
613         */
614        public AdministrableProductDefinitionRouteOfAdministrationComponent setMaxTreatmentPeriod(Duration value) { 
615          this.maxTreatmentPeriod = value;
616          return this;
617        }
618
619        /**
620         * @return {@link #targetSpecies} (A species for which this route applies.)
621         */
622        public List<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent> getTargetSpecies() { 
623          if (this.targetSpecies == null)
624            this.targetSpecies = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent>();
625          return this.targetSpecies;
626        }
627
628        /**
629         * @return Returns a reference to <code>this</code> for easy method chaining
630         */
631        public AdministrableProductDefinitionRouteOfAdministrationComponent setTargetSpecies(List<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent> theTargetSpecies) { 
632          this.targetSpecies = theTargetSpecies;
633          return this;
634        }
635
636        public boolean hasTargetSpecies() { 
637          if (this.targetSpecies == null)
638            return false;
639          for (AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent item : this.targetSpecies)
640            if (!item.isEmpty())
641              return true;
642          return false;
643        }
644
645        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent addTargetSpecies() { //3
646          AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent t = new AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
647          if (this.targetSpecies == null)
648            this.targetSpecies = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent>();
649          this.targetSpecies.add(t);
650          return t;
651        }
652
653        public AdministrableProductDefinitionRouteOfAdministrationComponent addTargetSpecies(AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent t) { //3
654          if (t == null)
655            return this;
656          if (this.targetSpecies == null)
657            this.targetSpecies = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent>();
658          this.targetSpecies.add(t);
659          return this;
660        }
661
662        /**
663         * @return The first repetition of repeating field {@link #targetSpecies}, creating it if it does not already exist {3}
664         */
665        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent getTargetSpeciesFirstRep() { 
666          if (getTargetSpecies().isEmpty()) {
667            addTargetSpecies();
668          }
669          return getTargetSpecies().get(0);
670        }
671
672        protected void listChildren(List<Property> children) {
673          super.listChildren(children);
674          children.add(new Property("code", "CodeableConcept", "Coded expression for the route.", 0, 1, code));
675          children.add(new Property("firstDose", "Quantity", "The first dose (dose quantity) administered can be specified for the product, using a numerical value and its unit of measurement.", 0, 1, firstDose));
676          children.add(new Property("maxSingleDose", "Quantity", "The maximum single dose that can be administered, can be specified using a numerical value and its unit of measurement.", 0, 1, maxSingleDose));
677          children.add(new Property("maxDosePerDay", "Quantity", "The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered.", 0, 1, maxDosePerDay));
678          children.add(new Property("maxDosePerTreatmentPeriod", "Ratio", "The maximum dose per treatment period that can be administered.", 0, 1, maxDosePerTreatmentPeriod));
679          children.add(new Property("maxTreatmentPeriod", "Duration", "The maximum treatment period during which an Investigational Medicinal Product can be administered.", 0, 1, maxTreatmentPeriod));
680          children.add(new Property("targetSpecies", "", "A species for which this route applies.", 0, java.lang.Integer.MAX_VALUE, targetSpecies));
681        }
682
683        @Override
684        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
685          switch (_hash) {
686          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded expression for the route.", 0, 1, code);
687          case 132551405: /*firstDose*/  return new Property("firstDose", "Quantity", "The first dose (dose quantity) administered can be specified for the product, using a numerical value and its unit of measurement.", 0, 1, firstDose);
688          case -259207927: /*maxSingleDose*/  return new Property("maxSingleDose", "Quantity", "The maximum single dose that can be administered, can be specified using a numerical value and its unit of measurement.", 0, 1, maxSingleDose);
689          case -2017475520: /*maxDosePerDay*/  return new Property("maxDosePerDay", "Quantity", "The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered.", 0, 1, maxDosePerDay);
690          case -608040195: /*maxDosePerTreatmentPeriod*/  return new Property("maxDosePerTreatmentPeriod", "Ratio", "The maximum dose per treatment period that can be administered.", 0, 1, maxDosePerTreatmentPeriod);
691          case 920698453: /*maxTreatmentPeriod*/  return new Property("maxTreatmentPeriod", "Duration", "The maximum treatment period during which an Investigational Medicinal Product can be administered.", 0, 1, maxTreatmentPeriod);
692          case 295481963: /*targetSpecies*/  return new Property("targetSpecies", "", "A species for which this route applies.", 0, java.lang.Integer.MAX_VALUE, targetSpecies);
693          default: return super.getNamedProperty(_hash, _name, _checkValid);
694          }
695
696        }
697
698      @Override
699      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
700        switch (hash) {
701        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
702        case 132551405: /*firstDose*/ return this.firstDose == null ? new Base[0] : new Base[] {this.firstDose}; // Quantity
703        case -259207927: /*maxSingleDose*/ return this.maxSingleDose == null ? new Base[0] : new Base[] {this.maxSingleDose}; // Quantity
704        case -2017475520: /*maxDosePerDay*/ return this.maxDosePerDay == null ? new Base[0] : new Base[] {this.maxDosePerDay}; // Quantity
705        case -608040195: /*maxDosePerTreatmentPeriod*/ return this.maxDosePerTreatmentPeriod == null ? new Base[0] : new Base[] {this.maxDosePerTreatmentPeriod}; // Ratio
706        case 920698453: /*maxTreatmentPeriod*/ return this.maxTreatmentPeriod == null ? new Base[0] : new Base[] {this.maxTreatmentPeriod}; // Duration
707        case 295481963: /*targetSpecies*/ return this.targetSpecies == null ? new Base[0] : this.targetSpecies.toArray(new Base[this.targetSpecies.size()]); // AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent
708        default: return super.getProperty(hash, name, checkValid);
709        }
710
711      }
712
713      @Override
714      public Base setProperty(int hash, String name, Base value) throws FHIRException {
715        switch (hash) {
716        case 3059181: // code
717          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
718          return value;
719        case 132551405: // firstDose
720          this.firstDose = TypeConvertor.castToQuantity(value); // Quantity
721          return value;
722        case -259207927: // maxSingleDose
723          this.maxSingleDose = TypeConvertor.castToQuantity(value); // Quantity
724          return value;
725        case -2017475520: // maxDosePerDay
726          this.maxDosePerDay = TypeConvertor.castToQuantity(value); // Quantity
727          return value;
728        case -608040195: // maxDosePerTreatmentPeriod
729          this.maxDosePerTreatmentPeriod = TypeConvertor.castToRatio(value); // Ratio
730          return value;
731        case 920698453: // maxTreatmentPeriod
732          this.maxTreatmentPeriod = TypeConvertor.castToDuration(value); // Duration
733          return value;
734        case 295481963: // targetSpecies
735          this.getTargetSpecies().add((AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent) value); // AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent
736          return value;
737        default: return super.setProperty(hash, name, value);
738        }
739
740      }
741
742      @Override
743      public Base setProperty(String name, Base value) throws FHIRException {
744        if (name.equals("code")) {
745          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
746        } else if (name.equals("firstDose")) {
747          this.firstDose = TypeConvertor.castToQuantity(value); // Quantity
748        } else if (name.equals("maxSingleDose")) {
749          this.maxSingleDose = TypeConvertor.castToQuantity(value); // Quantity
750        } else if (name.equals("maxDosePerDay")) {
751          this.maxDosePerDay = TypeConvertor.castToQuantity(value); // Quantity
752        } else if (name.equals("maxDosePerTreatmentPeriod")) {
753          this.maxDosePerTreatmentPeriod = TypeConvertor.castToRatio(value); // Ratio
754        } else if (name.equals("maxTreatmentPeriod")) {
755          this.maxTreatmentPeriod = TypeConvertor.castToDuration(value); // Duration
756        } else if (name.equals("targetSpecies")) {
757          this.getTargetSpecies().add((AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent) value);
758        } else
759          return super.setProperty(name, value);
760        return value;
761      }
762
763      @Override
764      public Base makeProperty(int hash, String name) throws FHIRException {
765        switch (hash) {
766        case 3059181:  return getCode();
767        case 132551405:  return getFirstDose();
768        case -259207927:  return getMaxSingleDose();
769        case -2017475520:  return getMaxDosePerDay();
770        case -608040195:  return getMaxDosePerTreatmentPeriod();
771        case 920698453:  return getMaxTreatmentPeriod();
772        case 295481963:  return addTargetSpecies(); 
773        default: return super.makeProperty(hash, name);
774        }
775
776      }
777
778      @Override
779      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
780        switch (hash) {
781        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
782        case 132551405: /*firstDose*/ return new String[] {"Quantity"};
783        case -259207927: /*maxSingleDose*/ return new String[] {"Quantity"};
784        case -2017475520: /*maxDosePerDay*/ return new String[] {"Quantity"};
785        case -608040195: /*maxDosePerTreatmentPeriod*/ return new String[] {"Ratio"};
786        case 920698453: /*maxTreatmentPeriod*/ return new String[] {"Duration"};
787        case 295481963: /*targetSpecies*/ return new String[] {};
788        default: return super.getTypesForProperty(hash, name);
789        }
790
791      }
792
793      @Override
794      public Base addChild(String name) throws FHIRException {
795        if (name.equals("code")) {
796          this.code = new CodeableConcept();
797          return this.code;
798        }
799        else if (name.equals("firstDose")) {
800          this.firstDose = new Quantity();
801          return this.firstDose;
802        }
803        else if (name.equals("maxSingleDose")) {
804          this.maxSingleDose = new Quantity();
805          return this.maxSingleDose;
806        }
807        else if (name.equals("maxDosePerDay")) {
808          this.maxDosePerDay = new Quantity();
809          return this.maxDosePerDay;
810        }
811        else if (name.equals("maxDosePerTreatmentPeriod")) {
812          this.maxDosePerTreatmentPeriod = new Ratio();
813          return this.maxDosePerTreatmentPeriod;
814        }
815        else if (name.equals("maxTreatmentPeriod")) {
816          this.maxTreatmentPeriod = new Duration();
817          return this.maxTreatmentPeriod;
818        }
819        else if (name.equals("targetSpecies")) {
820          return addTargetSpecies();
821        }
822        else
823          return super.addChild(name);
824      }
825
826      public AdministrableProductDefinitionRouteOfAdministrationComponent copy() {
827        AdministrableProductDefinitionRouteOfAdministrationComponent dst = new AdministrableProductDefinitionRouteOfAdministrationComponent();
828        copyValues(dst);
829        return dst;
830      }
831
832      public void copyValues(AdministrableProductDefinitionRouteOfAdministrationComponent dst) {
833        super.copyValues(dst);
834        dst.code = code == null ? null : code.copy();
835        dst.firstDose = firstDose == null ? null : firstDose.copy();
836        dst.maxSingleDose = maxSingleDose == null ? null : maxSingleDose.copy();
837        dst.maxDosePerDay = maxDosePerDay == null ? null : maxDosePerDay.copy();
838        dst.maxDosePerTreatmentPeriod = maxDosePerTreatmentPeriod == null ? null : maxDosePerTreatmentPeriod.copy();
839        dst.maxTreatmentPeriod = maxTreatmentPeriod == null ? null : maxTreatmentPeriod.copy();
840        if (targetSpecies != null) {
841          dst.targetSpecies = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent>();
842          for (AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent i : targetSpecies)
843            dst.targetSpecies.add(i.copy());
844        };
845      }
846
847      @Override
848      public boolean equalsDeep(Base other_) {
849        if (!super.equalsDeep(other_))
850          return false;
851        if (!(other_ instanceof AdministrableProductDefinitionRouteOfAdministrationComponent))
852          return false;
853        AdministrableProductDefinitionRouteOfAdministrationComponent o = (AdministrableProductDefinitionRouteOfAdministrationComponent) other_;
854        return compareDeep(code, o.code, true) && compareDeep(firstDose, o.firstDose, true) && compareDeep(maxSingleDose, o.maxSingleDose, true)
855           && compareDeep(maxDosePerDay, o.maxDosePerDay, true) && compareDeep(maxDosePerTreatmentPeriod, o.maxDosePerTreatmentPeriod, true)
856           && compareDeep(maxTreatmentPeriod, o.maxTreatmentPeriod, true) && compareDeep(targetSpecies, o.targetSpecies, true)
857          ;
858      }
859
860      @Override
861      public boolean equalsShallow(Base other_) {
862        if (!super.equalsShallow(other_))
863          return false;
864        if (!(other_ instanceof AdministrableProductDefinitionRouteOfAdministrationComponent))
865          return false;
866        AdministrableProductDefinitionRouteOfAdministrationComponent o = (AdministrableProductDefinitionRouteOfAdministrationComponent) other_;
867        return true;
868      }
869
870      public boolean isEmpty() {
871        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, firstDose, maxSingleDose
872          , maxDosePerDay, maxDosePerTreatmentPeriod, maxTreatmentPeriod, targetSpecies);
873      }
874
875  public String fhirType() {
876    return "AdministrableProductDefinition.routeOfAdministration";
877
878  }
879
880  }
881
882    @Block()
883    public static class AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent extends BackboneElement implements IBaseBackboneElement {
884        /**
885         * Coded expression for the species.
886         */
887        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
888        @Description(shortDefinition="Coded expression for the species", formalDefinition="Coded expression for the species." )
889        protected CodeableConcept code;
890
891        /**
892         * A species specific time during which consumption of animal product is not appropriate.
893         */
894        @Child(name = "withdrawalPeriod", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
895        @Description(shortDefinition="A species specific time during which consumption of animal product is not appropriate", formalDefinition="A species specific time during which consumption of animal product is not appropriate." )
896        protected List<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> withdrawalPeriod;
897
898        private static final long serialVersionUID = -560311351L;
899
900    /**
901     * Constructor
902     */
903      public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent() {
904        super();
905      }
906
907    /**
908     * Constructor
909     */
910      public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent(CodeableConcept code) {
911        super();
912        this.setCode(code);
913      }
914
915        /**
916         * @return {@link #code} (Coded expression for the species.)
917         */
918        public CodeableConcept getCode() { 
919          if (this.code == null)
920            if (Configuration.errorOnAutoCreate())
921              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent.code");
922            else if (Configuration.doAutoCreate())
923              this.code = new CodeableConcept(); // cc
924          return this.code;
925        }
926
927        public boolean hasCode() { 
928          return this.code != null && !this.code.isEmpty();
929        }
930
931        /**
932         * @param value {@link #code} (Coded expression for the species.)
933         */
934        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent setCode(CodeableConcept value) { 
935          this.code = value;
936          return this;
937        }
938
939        /**
940         * @return {@link #withdrawalPeriod} (A species specific time during which consumption of animal product is not appropriate.)
941         */
942        public List<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> getWithdrawalPeriod() { 
943          if (this.withdrawalPeriod == null)
944            this.withdrawalPeriod = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
945          return this.withdrawalPeriod;
946        }
947
948        /**
949         * @return Returns a reference to <code>this</code> for easy method chaining
950         */
951        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent setWithdrawalPeriod(List<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> theWithdrawalPeriod) { 
952          this.withdrawalPeriod = theWithdrawalPeriod;
953          return this;
954        }
955
956        public boolean hasWithdrawalPeriod() { 
957          if (this.withdrawalPeriod == null)
958            return false;
959          for (AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent item : this.withdrawalPeriod)
960            if (!item.isEmpty())
961              return true;
962          return false;
963        }
964
965        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent addWithdrawalPeriod() { //3
966          AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent t = new AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
967          if (this.withdrawalPeriod == null)
968            this.withdrawalPeriod = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
969          this.withdrawalPeriod.add(t);
970          return t;
971        }
972
973        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent addWithdrawalPeriod(AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent t) { //3
974          if (t == null)
975            return this;
976          if (this.withdrawalPeriod == null)
977            this.withdrawalPeriod = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
978          this.withdrawalPeriod.add(t);
979          return this;
980        }
981
982        /**
983         * @return The first repetition of repeating field {@link #withdrawalPeriod}, creating it if it does not already exist {3}
984         */
985        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent getWithdrawalPeriodFirstRep() { 
986          if (getWithdrawalPeriod().isEmpty()) {
987            addWithdrawalPeriod();
988          }
989          return getWithdrawalPeriod().get(0);
990        }
991
992        protected void listChildren(List<Property> children) {
993          super.listChildren(children);
994          children.add(new Property("code", "CodeableConcept", "Coded expression for the species.", 0, 1, code));
995          children.add(new Property("withdrawalPeriod", "", "A species specific time during which consumption of animal product is not appropriate.", 0, java.lang.Integer.MAX_VALUE, withdrawalPeriod));
996        }
997
998        @Override
999        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1000          switch (_hash) {
1001          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded expression for the species.", 0, 1, code);
1002          case -98450730: /*withdrawalPeriod*/  return new Property("withdrawalPeriod", "", "A species specific time during which consumption of animal product is not appropriate.", 0, java.lang.Integer.MAX_VALUE, withdrawalPeriod);
1003          default: return super.getNamedProperty(_hash, _name, _checkValid);
1004          }
1005
1006        }
1007
1008      @Override
1009      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1010        switch (hash) {
1011        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1012        case -98450730: /*withdrawalPeriod*/ return this.withdrawalPeriod == null ? new Base[0] : this.withdrawalPeriod.toArray(new Base[this.withdrawalPeriod.size()]); // AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent
1013        default: return super.getProperty(hash, name, checkValid);
1014        }
1015
1016      }
1017
1018      @Override
1019      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1020        switch (hash) {
1021        case 3059181: // code
1022          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1023          return value;
1024        case -98450730: // withdrawalPeriod
1025          this.getWithdrawalPeriod().add((AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) value); // AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent
1026          return value;
1027        default: return super.setProperty(hash, name, value);
1028        }
1029
1030      }
1031
1032      @Override
1033      public Base setProperty(String name, Base value) throws FHIRException {
1034        if (name.equals("code")) {
1035          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1036        } else if (name.equals("withdrawalPeriod")) {
1037          this.getWithdrawalPeriod().add((AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) value);
1038        } else
1039          return super.setProperty(name, value);
1040        return value;
1041      }
1042
1043      @Override
1044      public Base makeProperty(int hash, String name) throws FHIRException {
1045        switch (hash) {
1046        case 3059181:  return getCode();
1047        case -98450730:  return addWithdrawalPeriod(); 
1048        default: return super.makeProperty(hash, name);
1049        }
1050
1051      }
1052
1053      @Override
1054      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1055        switch (hash) {
1056        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1057        case -98450730: /*withdrawalPeriod*/ return new String[] {};
1058        default: return super.getTypesForProperty(hash, name);
1059        }
1060
1061      }
1062
1063      @Override
1064      public Base addChild(String name) throws FHIRException {
1065        if (name.equals("code")) {
1066          this.code = new CodeableConcept();
1067          return this.code;
1068        }
1069        else if (name.equals("withdrawalPeriod")) {
1070          return addWithdrawalPeriod();
1071        }
1072        else
1073          return super.addChild(name);
1074      }
1075
1076      public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent copy() {
1077        AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent dst = new AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent();
1078        copyValues(dst);
1079        return dst;
1080      }
1081
1082      public void copyValues(AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent dst) {
1083        super.copyValues(dst);
1084        dst.code = code == null ? null : code.copy();
1085        if (withdrawalPeriod != null) {
1086          dst.withdrawalPeriod = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
1087          for (AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent i : withdrawalPeriod)
1088            dst.withdrawalPeriod.add(i.copy());
1089        };
1090      }
1091
1092      @Override
1093      public boolean equalsDeep(Base other_) {
1094        if (!super.equalsDeep(other_))
1095          return false;
1096        if (!(other_ instanceof AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent))
1097          return false;
1098        AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent o = (AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent) other_;
1099        return compareDeep(code, o.code, true) && compareDeep(withdrawalPeriod, o.withdrawalPeriod, true)
1100          ;
1101      }
1102
1103      @Override
1104      public boolean equalsShallow(Base other_) {
1105        if (!super.equalsShallow(other_))
1106          return false;
1107        if (!(other_ instanceof AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent))
1108          return false;
1109        AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent o = (AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesComponent) other_;
1110        return true;
1111      }
1112
1113      public boolean isEmpty() {
1114        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, withdrawalPeriod);
1115      }
1116
1117  public String fhirType() {
1118    return "AdministrableProductDefinition.routeOfAdministration.targetSpecies";
1119
1120  }
1121
1122  }
1123
1124    @Block()
1125    public static class AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent extends BackboneElement implements IBaseBackboneElement {
1126        /**
1127         * Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.
1128         */
1129        @Child(name = "tissue", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1130        @Description(shortDefinition="Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk", formalDefinition="Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk." )
1131        protected CodeableConcept tissue;
1132
1133        /**
1134         * A value for the time.
1135         */
1136        @Child(name = "value", type = {Quantity.class}, order=2, min=1, max=1, modifier=false, summary=true)
1137        @Description(shortDefinition="A value for the time", formalDefinition="A value for the time." )
1138        protected Quantity value;
1139
1140        /**
1141         * Extra information about the withdrawal period.
1142         */
1143        @Child(name = "supportingInformation", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1144        @Description(shortDefinition="Extra information about the withdrawal period", formalDefinition="Extra information about the withdrawal period." )
1145        protected StringType supportingInformation;
1146
1147        private static final long serialVersionUID = -1113691238L;
1148
1149    /**
1150     * Constructor
1151     */
1152      public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent() {
1153        super();
1154      }
1155
1156    /**
1157     * Constructor
1158     */
1159      public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(CodeableConcept tissue, Quantity value) {
1160        super();
1161        this.setTissue(tissue);
1162        this.setValue(value);
1163      }
1164
1165        /**
1166         * @return {@link #tissue} (Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.)
1167         */
1168        public CodeableConcept getTissue() { 
1169          if (this.tissue == null)
1170            if (Configuration.errorOnAutoCreate())
1171              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.tissue");
1172            else if (Configuration.doAutoCreate())
1173              this.tissue = new CodeableConcept(); // cc
1174          return this.tissue;
1175        }
1176
1177        public boolean hasTissue() { 
1178          return this.tissue != null && !this.tissue.isEmpty();
1179        }
1180
1181        /**
1182         * @param value {@link #tissue} (Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.)
1183         */
1184        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setTissue(CodeableConcept value) { 
1185          this.tissue = value;
1186          return this;
1187        }
1188
1189        /**
1190         * @return {@link #value} (A value for the time.)
1191         */
1192        public Quantity getValue() { 
1193          if (this.value == null)
1194            if (Configuration.errorOnAutoCreate())
1195              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.value");
1196            else if (Configuration.doAutoCreate())
1197              this.value = new Quantity(); // cc
1198          return this.value;
1199        }
1200
1201        public boolean hasValue() { 
1202          return this.value != null && !this.value.isEmpty();
1203        }
1204
1205        /**
1206         * @param value {@link #value} (A value for the time.)
1207         */
1208        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setValue(Quantity value) { 
1209          this.value = value;
1210          return this;
1211        }
1212
1213        /**
1214         * @return {@link #supportingInformation} (Extra information about the withdrawal period.). This is the underlying object with id, value and extensions. The accessor "getSupportingInformation" gives direct access to the value
1215         */
1216        public StringType getSupportingInformationElement() { 
1217          if (this.supportingInformation == null)
1218            if (Configuration.errorOnAutoCreate())
1219              throw new Error("Attempt to auto-create AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.supportingInformation");
1220            else if (Configuration.doAutoCreate())
1221              this.supportingInformation = new StringType(); // bb
1222          return this.supportingInformation;
1223        }
1224
1225        public boolean hasSupportingInformationElement() { 
1226          return this.supportingInformation != null && !this.supportingInformation.isEmpty();
1227        }
1228
1229        public boolean hasSupportingInformation() { 
1230          return this.supportingInformation != null && !this.supportingInformation.isEmpty();
1231        }
1232
1233        /**
1234         * @param value {@link #supportingInformation} (Extra information about the withdrawal period.). This is the underlying object with id, value and extensions. The accessor "getSupportingInformation" gives direct access to the value
1235         */
1236        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setSupportingInformationElement(StringType value) { 
1237          this.supportingInformation = value;
1238          return this;
1239        }
1240
1241        /**
1242         * @return Extra information about the withdrawal period.
1243         */
1244        public String getSupportingInformation() { 
1245          return this.supportingInformation == null ? null : this.supportingInformation.getValue();
1246        }
1247
1248        /**
1249         * @param value Extra information about the withdrawal period.
1250         */
1251        public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setSupportingInformation(String value) { 
1252          if (Utilities.noString(value))
1253            this.supportingInformation = null;
1254          else {
1255            if (this.supportingInformation == null)
1256              this.supportingInformation = new StringType();
1257            this.supportingInformation.setValue(value);
1258          }
1259          return this;
1260        }
1261
1262        protected void listChildren(List<Property> children) {
1263          super.listChildren(children);
1264          children.add(new Property("tissue", "CodeableConcept", "Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.", 0, 1, tissue));
1265          children.add(new Property("value", "Quantity", "A value for the time.", 0, 1, value));
1266          children.add(new Property("supportingInformation", "string", "Extra information about the withdrawal period.", 0, 1, supportingInformation));
1267        }
1268
1269        @Override
1270        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1271          switch (_hash) {
1272          case -873475867: /*tissue*/  return new Property("tissue", "CodeableConcept", "Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.", 0, 1, tissue);
1273          case 111972721: /*value*/  return new Property("value", "Quantity", "A value for the time.", 0, 1, value);
1274          case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "string", "Extra information about the withdrawal period.", 0, 1, supportingInformation);
1275          default: return super.getNamedProperty(_hash, _name, _checkValid);
1276          }
1277
1278        }
1279
1280      @Override
1281      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1282        switch (hash) {
1283        case -873475867: /*tissue*/ return this.tissue == null ? new Base[0] : new Base[] {this.tissue}; // CodeableConcept
1284        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Quantity
1285        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : new Base[] {this.supportingInformation}; // StringType
1286        default: return super.getProperty(hash, name, checkValid);
1287        }
1288
1289      }
1290
1291      @Override
1292      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1293        switch (hash) {
1294        case -873475867: // tissue
1295          this.tissue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1296          return value;
1297        case 111972721: // value
1298          this.value = TypeConvertor.castToQuantity(value); // Quantity
1299          return value;
1300        case -1248768647: // supportingInformation
1301          this.supportingInformation = TypeConvertor.castToString(value); // StringType
1302          return value;
1303        default: return super.setProperty(hash, name, value);
1304        }
1305
1306      }
1307
1308      @Override
1309      public Base setProperty(String name, Base value) throws FHIRException {
1310        if (name.equals("tissue")) {
1311          this.tissue = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1312        } else if (name.equals("value")) {
1313          this.value = TypeConvertor.castToQuantity(value); // Quantity
1314        } else if (name.equals("supportingInformation")) {
1315          this.supportingInformation = TypeConvertor.castToString(value); // StringType
1316        } else
1317          return super.setProperty(name, value);
1318        return value;
1319      }
1320
1321      @Override
1322      public Base makeProperty(int hash, String name) throws FHIRException {
1323        switch (hash) {
1324        case -873475867:  return getTissue();
1325        case 111972721:  return getValue();
1326        case -1248768647:  return getSupportingInformationElement();
1327        default: return super.makeProperty(hash, name);
1328        }
1329
1330      }
1331
1332      @Override
1333      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1334        switch (hash) {
1335        case -873475867: /*tissue*/ return new String[] {"CodeableConcept"};
1336        case 111972721: /*value*/ return new String[] {"Quantity"};
1337        case -1248768647: /*supportingInformation*/ return new String[] {"string"};
1338        default: return super.getTypesForProperty(hash, name);
1339        }
1340
1341      }
1342
1343      @Override
1344      public Base addChild(String name) throws FHIRException {
1345        if (name.equals("tissue")) {
1346          this.tissue = new CodeableConcept();
1347          return this.tissue;
1348        }
1349        else if (name.equals("value")) {
1350          this.value = new Quantity();
1351          return this.value;
1352        }
1353        else if (name.equals("supportingInformation")) {
1354          throw new FHIRException("Cannot call addChild on a primitive type AdministrableProductDefinition.routeOfAdministration.targetSpecies.withdrawalPeriod.supportingInformation");
1355        }
1356        else
1357          return super.addChild(name);
1358      }
1359
1360      public AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent copy() {
1361        AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent dst = new AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
1362        copyValues(dst);
1363        return dst;
1364      }
1365
1366      public void copyValues(AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent dst) {
1367        super.copyValues(dst);
1368        dst.tissue = tissue == null ? null : tissue.copy();
1369        dst.value = value == null ? null : value.copy();
1370        dst.supportingInformation = supportingInformation == null ? null : supportingInformation.copy();
1371      }
1372
1373      @Override
1374      public boolean equalsDeep(Base other_) {
1375        if (!super.equalsDeep(other_))
1376          return false;
1377        if (!(other_ instanceof AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent))
1378          return false;
1379        AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent o = (AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) other_;
1380        return compareDeep(tissue, o.tissue, true) && compareDeep(value, o.value, true) && compareDeep(supportingInformation, o.supportingInformation, true)
1381          ;
1382      }
1383
1384      @Override
1385      public boolean equalsShallow(Base other_) {
1386        if (!super.equalsShallow(other_))
1387          return false;
1388        if (!(other_ instanceof AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent))
1389          return false;
1390        AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent o = (AdministrableProductDefinitionRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) other_;
1391        return compareValues(supportingInformation, o.supportingInformation, true);
1392      }
1393
1394      public boolean isEmpty() {
1395        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(tissue, value, supportingInformation
1396          );
1397      }
1398
1399  public String fhirType() {
1400    return "AdministrableProductDefinition.routeOfAdministration.targetSpecies.withdrawalPeriod";
1401
1402  }
1403
1404  }
1405
1406    /**
1407     * An identifier for the administrable product.
1408     */
1409    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1410    @Description(shortDefinition="An identifier for the administrable product", formalDefinition="An identifier for the administrable product." )
1411    protected List<Identifier> identifier;
1412
1413    /**
1414     * The status of this administrable product. Enables tracking the life-cycle of the content.
1415     */
1416    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1417    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The status of this administrable product. Enables tracking the life-cycle of the content." )
1418    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
1419    protected Enumeration<PublicationStatus> status;
1420
1421    /**
1422     * The medicinal product that this is a prepared administrable form of. This element is not a reference to the item(s) that make up this administrable form (for which see AdministrableProductDefinition.producedFrom). It is medicinal product as a whole, which may have several components (as well as packaging, devices etc.), that are given to the patient in this final administrable form. A single medicinal product may have several different administrable products (e.g. a tablet and a cream), and these could have different administrable forms (e.g. tablet as oral solid, or tablet crushed).
1423     */
1424    @Child(name = "formOf", type = {MedicinalProductDefinition.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1425    @Description(shortDefinition="The medicinal product that this is a prepared administrable form of. This element is not a reference to the item(s) that make up this administrable form (for which see AdministrableProductDefinition.producedFrom). It is medicinal product as a whole, which may have several components (as well as packaging, devices etc.), that are given to the patient in this final administrable form. A single medicinal product may have several different administrable products (e.g. a tablet and a cream), and these could have different administrable forms (e.g. tablet as oral solid, or tablet crushed)", formalDefinition="The medicinal product that this is a prepared administrable form of. This element is not a reference to the item(s) that make up this administrable form (for which see AdministrableProductDefinition.producedFrom). It is medicinal product as a whole, which may have several components (as well as packaging, devices etc.), that are given to the patient in this final administrable form. A single medicinal product may have several different administrable products (e.g. a tablet and a cream), and these could have different administrable forms (e.g. tablet as oral solid, or tablet crushed)." )
1426    protected List<Reference> formOf;
1427
1428    /**
1429     * The dose form of the final product after necessary reconstitution or processing. Contrasts to the manufactured dose form (see ManufacturedItemDefinition). If the manufactured form was 'powder for solution for injection', the administrable dose form could be 'solution for injection' (once mixed with another item having manufactured form 'solvent for solution for injection').
1430     */
1431    @Child(name = "administrableDoseForm", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1432    @Description(shortDefinition="The dose form of the final product after necessary reconstitution or processing. Contrasts to the manufactured dose form (see ManufacturedItemDefinition). If the manufactured form was 'powder for solution for injection', the administrable dose form could be 'solution for injection' (once mixed with another item having manufactured form 'solvent for solution for injection')", formalDefinition="The dose form of the final product after necessary reconstitution or processing. Contrasts to the manufactured dose form (see ManufacturedItemDefinition). If the manufactured form was 'powder for solution for injection', the administrable dose form could be 'solution for injection' (once mixed with another item having manufactured form 'solvent for solution for injection')." )
1433    protected CodeableConcept administrableDoseForm;
1434
1435    /**
1436     * The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' (as in 'contains 100 mcg per puff'), or for a liquid - 'vial' (as in 'contains 5 ml per vial').
1437     */
1438    @Child(name = "unitOfPresentation", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1439    @Description(shortDefinition="The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' (as in 'contains 100 mcg per puff'), or for a liquid - 'vial' (as in 'contains 5 ml per vial')", formalDefinition="The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' (as in 'contains 100 mcg per puff'), or for a liquid - 'vial' (as in 'contains 5 ml per vial')." )
1440    protected CodeableConcept unitOfPresentation;
1441
1442    /**
1443     * The constituent manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solvent item, to make a consumable solution). Note the items this is produced from are not raw ingredients (see AdministrableProductDefinition.ingredient), but manufactured medication items (ManufacturedItemDefinitions), which may be combined or prepared and transformed for patient use. The constituent items that this administrable form is produced from are all part of the product (for which see AdministrableProductDefinition.formOf).
1444     */
1445    @Child(name = "producedFrom", type = {ManufacturedItemDefinition.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1446    @Description(shortDefinition="The constituent manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solvent item, to make a consumable solution). Note the items this is produced from are not raw ingredients (see AdministrableProductDefinition.ingredient), but manufactured medication items (ManufacturedItemDefinitions), which may be combined or prepared and transformed for patient use. The constituent items that this administrable form is produced from are all part of the product (for which see AdministrableProductDefinition.formOf)", formalDefinition="The constituent manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solvent item, to make a consumable solution). Note the items this is produced from are not raw ingredients (see AdministrableProductDefinition.ingredient), but manufactured medication items (ManufacturedItemDefinitions), which may be combined or prepared and transformed for patient use. The constituent items that this administrable form is produced from are all part of the product (for which see AdministrableProductDefinition.formOf)." )
1447    protected List<Reference> producedFrom;
1448
1449    /**
1450     * The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton (via AdministrableProductDefinition.producedFrom) to state which component items are used to make this, or using by incoming references from the Ingredient resource, to state in detail which substances exist within this. This element allows a basic coded ingredient to be used.
1451     */
1452    @Child(name = "ingredient", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1453    @Description(shortDefinition="The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton (via AdministrableProductDefinition.producedFrom) to state which component items are used to make this, or using by incoming references from the Ingredient resource, to state in detail which substances exist within this. This element allows a basic coded ingredient to be used", formalDefinition="The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton (via AdministrableProductDefinition.producedFrom) to state which component items are used to make this, or using by incoming references from the Ingredient resource, to state in detail which substances exist within this. This element allows a basic coded ingredient to be used." )
1454    protected List<CodeableConcept> ingredient;
1455
1456    /**
1457     * A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product. This is not intended for devices that are just co-packaged.
1458     */
1459    @Child(name = "device", type = {DeviceDefinition.class}, order=7, min=0, max=1, modifier=false, summary=true)
1460    @Description(shortDefinition="A device that is integral to the medicinal product, in effect being considered as an \"ingredient\" of the medicinal product. This is not intended for devices that are just co-packaged", formalDefinition="A device that is integral to the medicinal product, in effect being considered as an \"ingredient\" of the medicinal product. This is not intended for devices that are just co-packaged." )
1461    protected Reference device;
1462
1463    /**
1464     * Characteristics e.g. a products onset of action.
1465     */
1466    @Child(name = "property", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1467    @Description(shortDefinition="Characteristics e.g. a products onset of action", formalDefinition="Characteristics e.g. a products onset of action." )
1468    protected List<AdministrableProductDefinitionPropertyComponent> property;
1469
1470    /**
1471     * The path by which the product is taken into or makes contact with the body. In some regions this is referred to as the licenced or approved route.
1472     */
1473    @Child(name = "routeOfAdministration", type = {}, order=9, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1474    @Description(shortDefinition="The path by which the product is taken into or makes contact with the body. In some regions this is referred to as the licenced or approved route", formalDefinition="The path by which the product is taken into or makes contact with the body. In some regions this is referred to as the licenced or approved route." )
1475    protected List<AdministrableProductDefinitionRouteOfAdministrationComponent> routeOfAdministration;
1476
1477    private static final long serialVersionUID = 1447528370L;
1478
1479  /**
1480   * Constructor
1481   */
1482    public AdministrableProductDefinition() {
1483      super();
1484    }
1485
1486  /**
1487   * Constructor
1488   */
1489    public AdministrableProductDefinition(PublicationStatus status, AdministrableProductDefinitionRouteOfAdministrationComponent routeOfAdministration) {
1490      super();
1491      this.setStatus(status);
1492      this.addRouteOfAdministration(routeOfAdministration);
1493    }
1494
1495    /**
1496     * @return {@link #identifier} (An identifier for the administrable product.)
1497     */
1498    public List<Identifier> getIdentifier() { 
1499      if (this.identifier == null)
1500        this.identifier = new ArrayList<Identifier>();
1501      return this.identifier;
1502    }
1503
1504    /**
1505     * @return Returns a reference to <code>this</code> for easy method chaining
1506     */
1507    public AdministrableProductDefinition setIdentifier(List<Identifier> theIdentifier) { 
1508      this.identifier = theIdentifier;
1509      return this;
1510    }
1511
1512    public boolean hasIdentifier() { 
1513      if (this.identifier == null)
1514        return false;
1515      for (Identifier item : this.identifier)
1516        if (!item.isEmpty())
1517          return true;
1518      return false;
1519    }
1520
1521    public Identifier addIdentifier() { //3
1522      Identifier t = new Identifier();
1523      if (this.identifier == null)
1524        this.identifier = new ArrayList<Identifier>();
1525      this.identifier.add(t);
1526      return t;
1527    }
1528
1529    public AdministrableProductDefinition addIdentifier(Identifier t) { //3
1530      if (t == null)
1531        return this;
1532      if (this.identifier == null)
1533        this.identifier = new ArrayList<Identifier>();
1534      this.identifier.add(t);
1535      return this;
1536    }
1537
1538    /**
1539     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1540     */
1541    public Identifier getIdentifierFirstRep() { 
1542      if (getIdentifier().isEmpty()) {
1543        addIdentifier();
1544      }
1545      return getIdentifier().get(0);
1546    }
1547
1548    /**
1549     * @return {@link #status} (The status of this administrable product. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1550     */
1551    public Enumeration<PublicationStatus> getStatusElement() { 
1552      if (this.status == null)
1553        if (Configuration.errorOnAutoCreate())
1554          throw new Error("Attempt to auto-create AdministrableProductDefinition.status");
1555        else if (Configuration.doAutoCreate())
1556          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
1557      return this.status;
1558    }
1559
1560    public boolean hasStatusElement() { 
1561      return this.status != null && !this.status.isEmpty();
1562    }
1563
1564    public boolean hasStatus() { 
1565      return this.status != null && !this.status.isEmpty();
1566    }
1567
1568    /**
1569     * @param value {@link #status} (The status of this administrable product. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1570     */
1571    public AdministrableProductDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
1572      this.status = value;
1573      return this;
1574    }
1575
1576    /**
1577     * @return The status of this administrable product. Enables tracking the life-cycle of the content.
1578     */
1579    public PublicationStatus getStatus() { 
1580      return this.status == null ? null : this.status.getValue();
1581    }
1582
1583    /**
1584     * @param value The status of this administrable product. Enables tracking the life-cycle of the content.
1585     */
1586    public AdministrableProductDefinition setStatus(PublicationStatus value) { 
1587        if (this.status == null)
1588          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
1589        this.status.setValue(value);
1590      return this;
1591    }
1592
1593    /**
1594     * @return {@link #formOf} (The medicinal product that this is a prepared administrable form of. This element is not a reference to the item(s) that make up this administrable form (for which see AdministrableProductDefinition.producedFrom). It is medicinal product as a whole, which may have several components (as well as packaging, devices etc.), that are given to the patient in this final administrable form. A single medicinal product may have several different administrable products (e.g. a tablet and a cream), and these could have different administrable forms (e.g. tablet as oral solid, or tablet crushed).)
1595     */
1596    public List<Reference> getFormOf() { 
1597      if (this.formOf == null)
1598        this.formOf = new ArrayList<Reference>();
1599      return this.formOf;
1600    }
1601
1602    /**
1603     * @return Returns a reference to <code>this</code> for easy method chaining
1604     */
1605    public AdministrableProductDefinition setFormOf(List<Reference> theFormOf) { 
1606      this.formOf = theFormOf;
1607      return this;
1608    }
1609
1610    public boolean hasFormOf() { 
1611      if (this.formOf == null)
1612        return false;
1613      for (Reference item : this.formOf)
1614        if (!item.isEmpty())
1615          return true;
1616      return false;
1617    }
1618
1619    public Reference addFormOf() { //3
1620      Reference t = new Reference();
1621      if (this.formOf == null)
1622        this.formOf = new ArrayList<Reference>();
1623      this.formOf.add(t);
1624      return t;
1625    }
1626
1627    public AdministrableProductDefinition addFormOf(Reference t) { //3
1628      if (t == null)
1629        return this;
1630      if (this.formOf == null)
1631        this.formOf = new ArrayList<Reference>();
1632      this.formOf.add(t);
1633      return this;
1634    }
1635
1636    /**
1637     * @return The first repetition of repeating field {@link #formOf}, creating it if it does not already exist {3}
1638     */
1639    public Reference getFormOfFirstRep() { 
1640      if (getFormOf().isEmpty()) {
1641        addFormOf();
1642      }
1643      return getFormOf().get(0);
1644    }
1645
1646    /**
1647     * @return {@link #administrableDoseForm} (The dose form of the final product after necessary reconstitution or processing. Contrasts to the manufactured dose form (see ManufacturedItemDefinition). If the manufactured form was 'powder for solution for injection', the administrable dose form could be 'solution for injection' (once mixed with another item having manufactured form 'solvent for solution for injection').)
1648     */
1649    public CodeableConcept getAdministrableDoseForm() { 
1650      if (this.administrableDoseForm == null)
1651        if (Configuration.errorOnAutoCreate())
1652          throw new Error("Attempt to auto-create AdministrableProductDefinition.administrableDoseForm");
1653        else if (Configuration.doAutoCreate())
1654          this.administrableDoseForm = new CodeableConcept(); // cc
1655      return this.administrableDoseForm;
1656    }
1657
1658    public boolean hasAdministrableDoseForm() { 
1659      return this.administrableDoseForm != null && !this.administrableDoseForm.isEmpty();
1660    }
1661
1662    /**
1663     * @param value {@link #administrableDoseForm} (The dose form of the final product after necessary reconstitution or processing. Contrasts to the manufactured dose form (see ManufacturedItemDefinition). If the manufactured form was 'powder for solution for injection', the administrable dose form could be 'solution for injection' (once mixed with another item having manufactured form 'solvent for solution for injection').)
1664     */
1665    public AdministrableProductDefinition setAdministrableDoseForm(CodeableConcept value) { 
1666      this.administrableDoseForm = value;
1667      return this;
1668    }
1669
1670    /**
1671     * @return {@link #unitOfPresentation} (The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' (as in 'contains 100 mcg per puff'), or for a liquid - 'vial' (as in 'contains 5 ml per vial').)
1672     */
1673    public CodeableConcept getUnitOfPresentation() { 
1674      if (this.unitOfPresentation == null)
1675        if (Configuration.errorOnAutoCreate())
1676          throw new Error("Attempt to auto-create AdministrableProductDefinition.unitOfPresentation");
1677        else if (Configuration.doAutoCreate())
1678          this.unitOfPresentation = new CodeableConcept(); // cc
1679      return this.unitOfPresentation;
1680    }
1681
1682    public boolean hasUnitOfPresentation() { 
1683      return this.unitOfPresentation != null && !this.unitOfPresentation.isEmpty();
1684    }
1685
1686    /**
1687     * @param value {@link #unitOfPresentation} (The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' (as in 'contains 100 mcg per puff'), or for a liquid - 'vial' (as in 'contains 5 ml per vial').)
1688     */
1689    public AdministrableProductDefinition setUnitOfPresentation(CodeableConcept value) { 
1690      this.unitOfPresentation = value;
1691      return this;
1692    }
1693
1694    /**
1695     * @return {@link #producedFrom} (The constituent manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solvent item, to make a consumable solution). Note the items this is produced from are not raw ingredients (see AdministrableProductDefinition.ingredient), but manufactured medication items (ManufacturedItemDefinitions), which may be combined or prepared and transformed for patient use. The constituent items that this administrable form is produced from are all part of the product (for which see AdministrableProductDefinition.formOf).)
1696     */
1697    public List<Reference> getProducedFrom() { 
1698      if (this.producedFrom == null)
1699        this.producedFrom = new ArrayList<Reference>();
1700      return this.producedFrom;
1701    }
1702
1703    /**
1704     * @return Returns a reference to <code>this</code> for easy method chaining
1705     */
1706    public AdministrableProductDefinition setProducedFrom(List<Reference> theProducedFrom) { 
1707      this.producedFrom = theProducedFrom;
1708      return this;
1709    }
1710
1711    public boolean hasProducedFrom() { 
1712      if (this.producedFrom == null)
1713        return false;
1714      for (Reference item : this.producedFrom)
1715        if (!item.isEmpty())
1716          return true;
1717      return false;
1718    }
1719
1720    public Reference addProducedFrom() { //3
1721      Reference t = new Reference();
1722      if (this.producedFrom == null)
1723        this.producedFrom = new ArrayList<Reference>();
1724      this.producedFrom.add(t);
1725      return t;
1726    }
1727
1728    public AdministrableProductDefinition addProducedFrom(Reference t) { //3
1729      if (t == null)
1730        return this;
1731      if (this.producedFrom == null)
1732        this.producedFrom = new ArrayList<Reference>();
1733      this.producedFrom.add(t);
1734      return this;
1735    }
1736
1737    /**
1738     * @return The first repetition of repeating field {@link #producedFrom}, creating it if it does not already exist {3}
1739     */
1740    public Reference getProducedFromFirstRep() { 
1741      if (getProducedFrom().isEmpty()) {
1742        addProducedFrom();
1743      }
1744      return getProducedFrom().get(0);
1745    }
1746
1747    /**
1748     * @return {@link #ingredient} (The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton (via AdministrableProductDefinition.producedFrom) to state which component items are used to make this, or using by incoming references from the Ingredient resource, to state in detail which substances exist within this. This element allows a basic coded ingredient to be used.)
1749     */
1750    public List<CodeableConcept> getIngredient() { 
1751      if (this.ingredient == null)
1752        this.ingredient = new ArrayList<CodeableConcept>();
1753      return this.ingredient;
1754    }
1755
1756    /**
1757     * @return Returns a reference to <code>this</code> for easy method chaining
1758     */
1759    public AdministrableProductDefinition setIngredient(List<CodeableConcept> theIngredient) { 
1760      this.ingredient = theIngredient;
1761      return this;
1762    }
1763
1764    public boolean hasIngredient() { 
1765      if (this.ingredient == null)
1766        return false;
1767      for (CodeableConcept item : this.ingredient)
1768        if (!item.isEmpty())
1769          return true;
1770      return false;
1771    }
1772
1773    public CodeableConcept addIngredient() { //3
1774      CodeableConcept t = new CodeableConcept();
1775      if (this.ingredient == null)
1776        this.ingredient = new ArrayList<CodeableConcept>();
1777      this.ingredient.add(t);
1778      return t;
1779    }
1780
1781    public AdministrableProductDefinition addIngredient(CodeableConcept t) { //3
1782      if (t == null)
1783        return this;
1784      if (this.ingredient == null)
1785        this.ingredient = new ArrayList<CodeableConcept>();
1786      this.ingredient.add(t);
1787      return this;
1788    }
1789
1790    /**
1791     * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist {3}
1792     */
1793    public CodeableConcept getIngredientFirstRep() { 
1794      if (getIngredient().isEmpty()) {
1795        addIngredient();
1796      }
1797      return getIngredient().get(0);
1798    }
1799
1800    /**
1801     * @return {@link #device} (A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product. This is not intended for devices that are just co-packaged.)
1802     */
1803    public Reference getDevice() { 
1804      if (this.device == null)
1805        if (Configuration.errorOnAutoCreate())
1806          throw new Error("Attempt to auto-create AdministrableProductDefinition.device");
1807        else if (Configuration.doAutoCreate())
1808          this.device = new Reference(); // cc
1809      return this.device;
1810    }
1811
1812    public boolean hasDevice() { 
1813      return this.device != null && !this.device.isEmpty();
1814    }
1815
1816    /**
1817     * @param value {@link #device} (A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product. This is not intended for devices that are just co-packaged.)
1818     */
1819    public AdministrableProductDefinition setDevice(Reference value) { 
1820      this.device = value;
1821      return this;
1822    }
1823
1824    /**
1825     * @return {@link #property} (Characteristics e.g. a products onset of action.)
1826     */
1827    public List<AdministrableProductDefinitionPropertyComponent> getProperty() { 
1828      if (this.property == null)
1829        this.property = new ArrayList<AdministrableProductDefinitionPropertyComponent>();
1830      return this.property;
1831    }
1832
1833    /**
1834     * @return Returns a reference to <code>this</code> for easy method chaining
1835     */
1836    public AdministrableProductDefinition setProperty(List<AdministrableProductDefinitionPropertyComponent> theProperty) { 
1837      this.property = theProperty;
1838      return this;
1839    }
1840
1841    public boolean hasProperty() { 
1842      if (this.property == null)
1843        return false;
1844      for (AdministrableProductDefinitionPropertyComponent item : this.property)
1845        if (!item.isEmpty())
1846          return true;
1847      return false;
1848    }
1849
1850    public AdministrableProductDefinitionPropertyComponent addProperty() { //3
1851      AdministrableProductDefinitionPropertyComponent t = new AdministrableProductDefinitionPropertyComponent();
1852      if (this.property == null)
1853        this.property = new ArrayList<AdministrableProductDefinitionPropertyComponent>();
1854      this.property.add(t);
1855      return t;
1856    }
1857
1858    public AdministrableProductDefinition addProperty(AdministrableProductDefinitionPropertyComponent t) { //3
1859      if (t == null)
1860        return this;
1861      if (this.property == null)
1862        this.property = new ArrayList<AdministrableProductDefinitionPropertyComponent>();
1863      this.property.add(t);
1864      return this;
1865    }
1866
1867    /**
1868     * @return The first repetition of repeating field {@link #property}, creating it if it does not already exist {3}
1869     */
1870    public AdministrableProductDefinitionPropertyComponent getPropertyFirstRep() { 
1871      if (getProperty().isEmpty()) {
1872        addProperty();
1873      }
1874      return getProperty().get(0);
1875    }
1876
1877    /**
1878     * @return {@link #routeOfAdministration} (The path by which the product is taken into or makes contact with the body. In some regions this is referred to as the licenced or approved route.)
1879     */
1880    public List<AdministrableProductDefinitionRouteOfAdministrationComponent> getRouteOfAdministration() { 
1881      if (this.routeOfAdministration == null)
1882        this.routeOfAdministration = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationComponent>();
1883      return this.routeOfAdministration;
1884    }
1885
1886    /**
1887     * @return Returns a reference to <code>this</code> for easy method chaining
1888     */
1889    public AdministrableProductDefinition setRouteOfAdministration(List<AdministrableProductDefinitionRouteOfAdministrationComponent> theRouteOfAdministration) { 
1890      this.routeOfAdministration = theRouteOfAdministration;
1891      return this;
1892    }
1893
1894    public boolean hasRouteOfAdministration() { 
1895      if (this.routeOfAdministration == null)
1896        return false;
1897      for (AdministrableProductDefinitionRouteOfAdministrationComponent item : this.routeOfAdministration)
1898        if (!item.isEmpty())
1899          return true;
1900      return false;
1901    }
1902
1903    public AdministrableProductDefinitionRouteOfAdministrationComponent addRouteOfAdministration() { //3
1904      AdministrableProductDefinitionRouteOfAdministrationComponent t = new AdministrableProductDefinitionRouteOfAdministrationComponent();
1905      if (this.routeOfAdministration == null)
1906        this.routeOfAdministration = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationComponent>();
1907      this.routeOfAdministration.add(t);
1908      return t;
1909    }
1910
1911    public AdministrableProductDefinition addRouteOfAdministration(AdministrableProductDefinitionRouteOfAdministrationComponent t) { //3
1912      if (t == null)
1913        return this;
1914      if (this.routeOfAdministration == null)
1915        this.routeOfAdministration = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationComponent>();
1916      this.routeOfAdministration.add(t);
1917      return this;
1918    }
1919
1920    /**
1921     * @return The first repetition of repeating field {@link #routeOfAdministration}, creating it if it does not already exist {3}
1922     */
1923    public AdministrableProductDefinitionRouteOfAdministrationComponent getRouteOfAdministrationFirstRep() { 
1924      if (getRouteOfAdministration().isEmpty()) {
1925        addRouteOfAdministration();
1926      }
1927      return getRouteOfAdministration().get(0);
1928    }
1929
1930      protected void listChildren(List<Property> children) {
1931        super.listChildren(children);
1932        children.add(new Property("identifier", "Identifier", "An identifier for the administrable product.", 0, java.lang.Integer.MAX_VALUE, identifier));
1933        children.add(new Property("status", "code", "The status of this administrable product. Enables tracking the life-cycle of the content.", 0, 1, status));
1934        children.add(new Property("formOf", "Reference(MedicinalProductDefinition)", "The medicinal product that this is a prepared administrable form of. This element is not a reference to the item(s) that make up this administrable form (for which see AdministrableProductDefinition.producedFrom). It is medicinal product as a whole, which may have several components (as well as packaging, devices etc.), that are given to the patient in this final administrable form. A single medicinal product may have several different administrable products (e.g. a tablet and a cream), and these could have different administrable forms (e.g. tablet as oral solid, or tablet crushed).", 0, java.lang.Integer.MAX_VALUE, formOf));
1935        children.add(new Property("administrableDoseForm", "CodeableConcept", "The dose form of the final product after necessary reconstitution or processing. Contrasts to the manufactured dose form (see ManufacturedItemDefinition). If the manufactured form was 'powder for solution for injection', the administrable dose form could be 'solution for injection' (once mixed with another item having manufactured form 'solvent for solution for injection').", 0, 1, administrableDoseForm));
1936        children.add(new Property("unitOfPresentation", "CodeableConcept", "The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' (as in 'contains 100 mcg per puff'), or for a liquid - 'vial' (as in 'contains 5 ml per vial').", 0, 1, unitOfPresentation));
1937        children.add(new Property("producedFrom", "Reference(ManufacturedItemDefinition)", "The constituent manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solvent item, to make a consumable solution). Note the items this is produced from are not raw ingredients (see AdministrableProductDefinition.ingredient), but manufactured medication items (ManufacturedItemDefinitions), which may be combined or prepared and transformed for patient use. The constituent items that this administrable form is produced from are all part of the product (for which see AdministrableProductDefinition.formOf).", 0, java.lang.Integer.MAX_VALUE, producedFrom));
1938        children.add(new Property("ingredient", "CodeableConcept", "The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton (via AdministrableProductDefinition.producedFrom) to state which component items are used to make this, or using by incoming references from the Ingredient resource, to state in detail which substances exist within this. This element allows a basic coded ingredient to be used.", 0, java.lang.Integer.MAX_VALUE, ingredient));
1939        children.add(new Property("device", "Reference(DeviceDefinition)", "A device that is integral to the medicinal product, in effect being considered as an \"ingredient\" of the medicinal product. This is not intended for devices that are just co-packaged.", 0, 1, device));
1940        children.add(new Property("property", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, property));
1941        children.add(new Property("routeOfAdministration", "", "The path by which the product is taken into or makes contact with the body. In some regions this is referred to as the licenced or approved route.", 0, java.lang.Integer.MAX_VALUE, routeOfAdministration));
1942      }
1943
1944      @Override
1945      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1946        switch (_hash) {
1947        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "An identifier for the administrable product.", 0, java.lang.Integer.MAX_VALUE, identifier);
1948        case -892481550: /*status*/  return new Property("status", "code", "The status of this administrable product. Enables tracking the life-cycle of the content.", 0, 1, status);
1949        case -1268779589: /*formOf*/  return new Property("formOf", "Reference(MedicinalProductDefinition)", "The medicinal product that this is a prepared administrable form of. This element is not a reference to the item(s) that make up this administrable form (for which see AdministrableProductDefinition.producedFrom). It is medicinal product as a whole, which may have several components (as well as packaging, devices etc.), that are given to the patient in this final administrable form. A single medicinal product may have several different administrable products (e.g. a tablet and a cream), and these could have different administrable forms (e.g. tablet as oral solid, or tablet crushed).", 0, java.lang.Integer.MAX_VALUE, formOf);
1950        case 1446105202: /*administrableDoseForm*/  return new Property("administrableDoseForm", "CodeableConcept", "The dose form of the final product after necessary reconstitution or processing. Contrasts to the manufactured dose form (see ManufacturedItemDefinition). If the manufactured form was 'powder for solution for injection', the administrable dose form could be 'solution for injection' (once mixed with another item having manufactured form 'solvent for solution for injection').", 0, 1, administrableDoseForm);
1951        case -1427765963: /*unitOfPresentation*/  return new Property("unitOfPresentation", "CodeableConcept", "The presentation type in which this item is given to a patient. e.g. for a spray - 'puff' (as in 'contains 100 mcg per puff'), or for a liquid - 'vial' (as in 'contains 5 ml per vial').", 0, 1, unitOfPresentation);
1952        case 588380494: /*producedFrom*/  return new Property("producedFrom", "Reference(ManufacturedItemDefinition)", "The constituent manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solvent item, to make a consumable solution). Note the items this is produced from are not raw ingredients (see AdministrableProductDefinition.ingredient), but manufactured medication items (ManufacturedItemDefinitions), which may be combined or prepared and transformed for patient use. The constituent items that this administrable form is produced from are all part of the product (for which see AdministrableProductDefinition.formOf).", 0, java.lang.Integer.MAX_VALUE, producedFrom);
1953        case -206409263: /*ingredient*/  return new Property("ingredient", "CodeableConcept", "The ingredients of this administrable medicinal product. This is only needed if the ingredients are not specified either using ManufacturedItemDefiniton (via AdministrableProductDefinition.producedFrom) to state which component items are used to make this, or using by incoming references from the Ingredient resource, to state in detail which substances exist within this. This element allows a basic coded ingredient to be used.", 0, java.lang.Integer.MAX_VALUE, ingredient);
1954        case -1335157162: /*device*/  return new Property("device", "Reference(DeviceDefinition)", "A device that is integral to the medicinal product, in effect being considered as an \"ingredient\" of the medicinal product. This is not intended for devices that are just co-packaged.", 0, 1, device);
1955        case -993141291: /*property*/  return new Property("property", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, property);
1956        case 1742084734: /*routeOfAdministration*/  return new Property("routeOfAdministration", "", "The path by which the product is taken into or makes contact with the body. In some regions this is referred to as the licenced or approved route.", 0, java.lang.Integer.MAX_VALUE, routeOfAdministration);
1957        default: return super.getNamedProperty(_hash, _name, _checkValid);
1958        }
1959
1960      }
1961
1962      @Override
1963      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1964        switch (hash) {
1965        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1966        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
1967        case -1268779589: /*formOf*/ return this.formOf == null ? new Base[0] : this.formOf.toArray(new Base[this.formOf.size()]); // Reference
1968        case 1446105202: /*administrableDoseForm*/ return this.administrableDoseForm == null ? new Base[0] : new Base[] {this.administrableDoseForm}; // CodeableConcept
1969        case -1427765963: /*unitOfPresentation*/ return this.unitOfPresentation == null ? new Base[0] : new Base[] {this.unitOfPresentation}; // CodeableConcept
1970        case 588380494: /*producedFrom*/ return this.producedFrom == null ? new Base[0] : this.producedFrom.toArray(new Base[this.producedFrom.size()]); // Reference
1971        case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // CodeableConcept
1972        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // Reference
1973        case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // AdministrableProductDefinitionPropertyComponent
1974        case 1742084734: /*routeOfAdministration*/ return this.routeOfAdministration == null ? new Base[0] : this.routeOfAdministration.toArray(new Base[this.routeOfAdministration.size()]); // AdministrableProductDefinitionRouteOfAdministrationComponent
1975        default: return super.getProperty(hash, name, checkValid);
1976        }
1977
1978      }
1979
1980      @Override
1981      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1982        switch (hash) {
1983        case -1618432855: // identifier
1984          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1985          return value;
1986        case -892481550: // status
1987          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1988          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
1989          return value;
1990        case -1268779589: // formOf
1991          this.getFormOf().add(TypeConvertor.castToReference(value)); // Reference
1992          return value;
1993        case 1446105202: // administrableDoseForm
1994          this.administrableDoseForm = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1995          return value;
1996        case -1427765963: // unitOfPresentation
1997          this.unitOfPresentation = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1998          return value;
1999        case 588380494: // producedFrom
2000          this.getProducedFrom().add(TypeConvertor.castToReference(value)); // Reference
2001          return value;
2002        case -206409263: // ingredient
2003          this.getIngredient().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
2004          return value;
2005        case -1335157162: // device
2006          this.device = TypeConvertor.castToReference(value); // Reference
2007          return value;
2008        case -993141291: // property
2009          this.getProperty().add((AdministrableProductDefinitionPropertyComponent) value); // AdministrableProductDefinitionPropertyComponent
2010          return value;
2011        case 1742084734: // routeOfAdministration
2012          this.getRouteOfAdministration().add((AdministrableProductDefinitionRouteOfAdministrationComponent) value); // AdministrableProductDefinitionRouteOfAdministrationComponent
2013          return value;
2014        default: return super.setProperty(hash, name, value);
2015        }
2016
2017      }
2018
2019      @Override
2020      public Base setProperty(String name, Base value) throws FHIRException {
2021        if (name.equals("identifier")) {
2022          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2023        } else if (name.equals("status")) {
2024          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
2025          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2026        } else if (name.equals("formOf")) {
2027          this.getFormOf().add(TypeConvertor.castToReference(value));
2028        } else if (name.equals("administrableDoseForm")) {
2029          this.administrableDoseForm = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2030        } else if (name.equals("unitOfPresentation")) {
2031          this.unitOfPresentation = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2032        } else if (name.equals("producedFrom")) {
2033          this.getProducedFrom().add(TypeConvertor.castToReference(value));
2034        } else if (name.equals("ingredient")) {
2035          this.getIngredient().add(TypeConvertor.castToCodeableConcept(value));
2036        } else if (name.equals("device")) {
2037          this.device = TypeConvertor.castToReference(value); // Reference
2038        } else if (name.equals("property")) {
2039          this.getProperty().add((AdministrableProductDefinitionPropertyComponent) value);
2040        } else if (name.equals("routeOfAdministration")) {
2041          this.getRouteOfAdministration().add((AdministrableProductDefinitionRouteOfAdministrationComponent) value);
2042        } else
2043          return super.setProperty(name, value);
2044        return value;
2045      }
2046
2047      @Override
2048      public Base makeProperty(int hash, String name) throws FHIRException {
2049        switch (hash) {
2050        case -1618432855:  return addIdentifier(); 
2051        case -892481550:  return getStatusElement();
2052        case -1268779589:  return addFormOf(); 
2053        case 1446105202:  return getAdministrableDoseForm();
2054        case -1427765963:  return getUnitOfPresentation();
2055        case 588380494:  return addProducedFrom(); 
2056        case -206409263:  return addIngredient(); 
2057        case -1335157162:  return getDevice();
2058        case -993141291:  return addProperty(); 
2059        case 1742084734:  return addRouteOfAdministration(); 
2060        default: return super.makeProperty(hash, name);
2061        }
2062
2063      }
2064
2065      @Override
2066      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2067        switch (hash) {
2068        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2069        case -892481550: /*status*/ return new String[] {"code"};
2070        case -1268779589: /*formOf*/ return new String[] {"Reference"};
2071        case 1446105202: /*administrableDoseForm*/ return new String[] {"CodeableConcept"};
2072        case -1427765963: /*unitOfPresentation*/ return new String[] {"CodeableConcept"};
2073        case 588380494: /*producedFrom*/ return new String[] {"Reference"};
2074        case -206409263: /*ingredient*/ return new String[] {"CodeableConcept"};
2075        case -1335157162: /*device*/ return new String[] {"Reference"};
2076        case -993141291: /*property*/ return new String[] {};
2077        case 1742084734: /*routeOfAdministration*/ return new String[] {};
2078        default: return super.getTypesForProperty(hash, name);
2079        }
2080
2081      }
2082
2083      @Override
2084      public Base addChild(String name) throws FHIRException {
2085        if (name.equals("identifier")) {
2086          return addIdentifier();
2087        }
2088        else if (name.equals("status")) {
2089          throw new FHIRException("Cannot call addChild on a primitive type AdministrableProductDefinition.status");
2090        }
2091        else if (name.equals("formOf")) {
2092          return addFormOf();
2093        }
2094        else if (name.equals("administrableDoseForm")) {
2095          this.administrableDoseForm = new CodeableConcept();
2096          return this.administrableDoseForm;
2097        }
2098        else if (name.equals("unitOfPresentation")) {
2099          this.unitOfPresentation = new CodeableConcept();
2100          return this.unitOfPresentation;
2101        }
2102        else if (name.equals("producedFrom")) {
2103          return addProducedFrom();
2104        }
2105        else if (name.equals("ingredient")) {
2106          return addIngredient();
2107        }
2108        else if (name.equals("device")) {
2109          this.device = new Reference();
2110          return this.device;
2111        }
2112        else if (name.equals("property")) {
2113          return addProperty();
2114        }
2115        else if (name.equals("routeOfAdministration")) {
2116          return addRouteOfAdministration();
2117        }
2118        else
2119          return super.addChild(name);
2120      }
2121
2122  public String fhirType() {
2123    return "AdministrableProductDefinition";
2124
2125  }
2126
2127      public AdministrableProductDefinition copy() {
2128        AdministrableProductDefinition dst = new AdministrableProductDefinition();
2129        copyValues(dst);
2130        return dst;
2131      }
2132
2133      public void copyValues(AdministrableProductDefinition dst) {
2134        super.copyValues(dst);
2135        if (identifier != null) {
2136          dst.identifier = new ArrayList<Identifier>();
2137          for (Identifier i : identifier)
2138            dst.identifier.add(i.copy());
2139        };
2140        dst.status = status == null ? null : status.copy();
2141        if (formOf != null) {
2142          dst.formOf = new ArrayList<Reference>();
2143          for (Reference i : formOf)
2144            dst.formOf.add(i.copy());
2145        };
2146        dst.administrableDoseForm = administrableDoseForm == null ? null : administrableDoseForm.copy();
2147        dst.unitOfPresentation = unitOfPresentation == null ? null : unitOfPresentation.copy();
2148        if (producedFrom != null) {
2149          dst.producedFrom = new ArrayList<Reference>();
2150          for (Reference i : producedFrom)
2151            dst.producedFrom.add(i.copy());
2152        };
2153        if (ingredient != null) {
2154          dst.ingredient = new ArrayList<CodeableConcept>();
2155          for (CodeableConcept i : ingredient)
2156            dst.ingredient.add(i.copy());
2157        };
2158        dst.device = device == null ? null : device.copy();
2159        if (property != null) {
2160          dst.property = new ArrayList<AdministrableProductDefinitionPropertyComponent>();
2161          for (AdministrableProductDefinitionPropertyComponent i : property)
2162            dst.property.add(i.copy());
2163        };
2164        if (routeOfAdministration != null) {
2165          dst.routeOfAdministration = new ArrayList<AdministrableProductDefinitionRouteOfAdministrationComponent>();
2166          for (AdministrableProductDefinitionRouteOfAdministrationComponent i : routeOfAdministration)
2167            dst.routeOfAdministration.add(i.copy());
2168        };
2169      }
2170
2171      protected AdministrableProductDefinition typedCopy() {
2172        return copy();
2173      }
2174
2175      @Override
2176      public boolean equalsDeep(Base other_) {
2177        if (!super.equalsDeep(other_))
2178          return false;
2179        if (!(other_ instanceof AdministrableProductDefinition))
2180          return false;
2181        AdministrableProductDefinition o = (AdministrableProductDefinition) other_;
2182        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(formOf, o.formOf, true)
2183           && compareDeep(administrableDoseForm, o.administrableDoseForm, true) && compareDeep(unitOfPresentation, o.unitOfPresentation, true)
2184           && compareDeep(producedFrom, o.producedFrom, true) && compareDeep(ingredient, o.ingredient, true)
2185           && compareDeep(device, o.device, true) && compareDeep(property, o.property, true) && compareDeep(routeOfAdministration, o.routeOfAdministration, true)
2186          ;
2187      }
2188
2189      @Override
2190      public boolean equalsShallow(Base other_) {
2191        if (!super.equalsShallow(other_))
2192          return false;
2193        if (!(other_ instanceof AdministrableProductDefinition))
2194          return false;
2195        AdministrableProductDefinition o = (AdministrableProductDefinition) other_;
2196        return compareValues(status, o.status, true);
2197      }
2198
2199      public boolean isEmpty() {
2200        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, formOf
2201          , administrableDoseForm, unitOfPresentation, producedFrom, ingredient, device, property
2202          , routeOfAdministration);
2203      }
2204
2205  @Override
2206  public ResourceType getResourceType() {
2207    return ResourceType.AdministrableProductDefinition;
2208   }
2209
2210 /**
2211   * Search parameter: <b>device</b>
2212   * <p>
2213   * Description: <b>A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product. This is not intended for devices that are just co-packaged</b><br>
2214   * Type: <b>reference</b><br>
2215   * Path: <b>AdministrableProductDefinition.device</b><br>
2216   * </p>
2217   */
2218  @SearchParamDefinition(name="device", path="AdministrableProductDefinition.device", description="A device that is integral to the medicinal product, in effect being considered as an \"ingredient\" of the medicinal product. This is not intended for devices that are just co-packaged", type="reference", target={DeviceDefinition.class } )
2219  public static final String SP_DEVICE = "device";
2220 /**
2221   * <b>Fluent Client</b> search parameter constant for <b>device</b>
2222   * <p>
2223   * Description: <b>A device that is integral to the medicinal product, in effect being considered as an "ingredient" of the medicinal product. This is not intended for devices that are just co-packaged</b><br>
2224   * Type: <b>reference</b><br>
2225   * Path: <b>AdministrableProductDefinition.device</b><br>
2226   * </p>
2227   */
2228  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE);
2229
2230/**
2231   * Constant for fluent queries to be used to add include statements. Specifies
2232   * the path value of "<b>AdministrableProductDefinition:device</b>".
2233   */
2234  public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("AdministrableProductDefinition:device").toLocked();
2235
2236 /**
2237   * Search parameter: <b>dose-form</b>
2238   * <p>
2239   * Description: <b>The administrable dose form, i.e. the dose form of the final product after necessary reconstitution or processing</b><br>
2240   * Type: <b>token</b><br>
2241   * Path: <b>AdministrableProductDefinition.administrableDoseForm</b><br>
2242   * </p>
2243   */
2244  @SearchParamDefinition(name="dose-form", path="AdministrableProductDefinition.administrableDoseForm", description="The administrable dose form, i.e. the dose form of the final product after necessary reconstitution or processing", type="token" )
2245  public static final String SP_DOSE_FORM = "dose-form";
2246 /**
2247   * <b>Fluent Client</b> search parameter constant for <b>dose-form</b>
2248   * <p>
2249   * Description: <b>The administrable dose form, i.e. the dose form of the final product after necessary reconstitution or processing</b><br>
2250   * Type: <b>token</b><br>
2251   * Path: <b>AdministrableProductDefinition.administrableDoseForm</b><br>
2252   * </p>
2253   */
2254  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DOSE_FORM = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DOSE_FORM);
2255
2256 /**
2257   * Search parameter: <b>form-of</b>
2258   * <p>
2259   * Description: <b>The medicinal product that this is an administrable form of. This is not a reference to the item(s) that make up this administrable form - it is the whole product</b><br>
2260   * Type: <b>reference</b><br>
2261   * Path: <b>AdministrableProductDefinition.formOf</b><br>
2262   * </p>
2263   */
2264  @SearchParamDefinition(name="form-of", path="AdministrableProductDefinition.formOf", description="The medicinal product that this is an administrable form of. This is not a reference to the item(s) that make up this administrable form - it is the whole product", type="reference", target={MedicinalProductDefinition.class } )
2265  public static final String SP_FORM_OF = "form-of";
2266 /**
2267   * <b>Fluent Client</b> search parameter constant for <b>form-of</b>
2268   * <p>
2269   * Description: <b>The medicinal product that this is an administrable form of. This is not a reference to the item(s) that make up this administrable form - it is the whole product</b><br>
2270   * Type: <b>reference</b><br>
2271   * Path: <b>AdministrableProductDefinition.formOf</b><br>
2272   * </p>
2273   */
2274  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FORM_OF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_FORM_OF);
2275
2276/**
2277   * Constant for fluent queries to be used to add include statements. Specifies
2278   * the path value of "<b>AdministrableProductDefinition:form-of</b>".
2279   */
2280  public static final ca.uhn.fhir.model.api.Include INCLUDE_FORM_OF = new ca.uhn.fhir.model.api.Include("AdministrableProductDefinition:form-of").toLocked();
2281
2282 /**
2283   * Search parameter: <b>identifier</b>
2284   * <p>
2285   * Description: <b>An identifier for the administrable product</b><br>
2286   * Type: <b>token</b><br>
2287   * Path: <b>AdministrableProductDefinition.identifier</b><br>
2288   * </p>
2289   */
2290  @SearchParamDefinition(name="identifier", path="AdministrableProductDefinition.identifier", description="An identifier for the administrable product", type="token" )
2291  public static final String SP_IDENTIFIER = "identifier";
2292 /**
2293   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2294   * <p>
2295   * Description: <b>An identifier for the administrable product</b><br>
2296   * Type: <b>token</b><br>
2297   * Path: <b>AdministrableProductDefinition.identifier</b><br>
2298   * </p>
2299   */
2300  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2301
2302 /**
2303   * Search parameter: <b>ingredient</b>
2304   * <p>
2305   * Description: <b>The ingredients of this administrable medicinal product</b><br>
2306   * Type: <b>token</b><br>
2307   * Path: <b>AdministrableProductDefinition.ingredient</b><br>
2308   * </p>
2309   */
2310  @SearchParamDefinition(name="ingredient", path="AdministrableProductDefinition.ingredient", description="The ingredients of this administrable medicinal product", type="token" )
2311  public static final String SP_INGREDIENT = "ingredient";
2312 /**
2313   * <b>Fluent Client</b> search parameter constant for <b>ingredient</b>
2314   * <p>
2315   * Description: <b>The ingredients of this administrable medicinal product</b><br>
2316   * Type: <b>token</b><br>
2317   * Path: <b>AdministrableProductDefinition.ingredient</b><br>
2318   * </p>
2319   */
2320  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INGREDIENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INGREDIENT);
2321
2322 /**
2323   * Search parameter: <b>manufactured-item</b>
2324   * <p>
2325   * Description: <b>The manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solution item). Note that these are not raw ingredients</b><br>
2326   * Type: <b>reference</b><br>
2327   * Path: <b>AdministrableProductDefinition.producedFrom</b><br>
2328   * </p>
2329   */
2330  @SearchParamDefinition(name="manufactured-item", path="AdministrableProductDefinition.producedFrom", description="The manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solution item). Note that these are not raw ingredients", type="reference", target={ManufacturedItemDefinition.class } )
2331  public static final String SP_MANUFACTURED_ITEM = "manufactured-item";
2332 /**
2333   * <b>Fluent Client</b> search parameter constant for <b>manufactured-item</b>
2334   * <p>
2335   * Description: <b>The manufactured item(s) that this administrable product is produced from. Either a single item, or several that are mixed before administration (e.g. a power item and a solution item). Note that these are not raw ingredients</b><br>
2336   * Type: <b>reference</b><br>
2337   * Path: <b>AdministrableProductDefinition.producedFrom</b><br>
2338   * </p>
2339   */
2340  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURED_ITEM = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURED_ITEM);
2341
2342/**
2343   * Constant for fluent queries to be used to add include statements. Specifies
2344   * the path value of "<b>AdministrableProductDefinition:manufactured-item</b>".
2345   */
2346  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURED_ITEM = new ca.uhn.fhir.model.api.Include("AdministrableProductDefinition:manufactured-item").toLocked();
2347
2348 /**
2349   * Search parameter: <b>route</b>
2350   * <p>
2351   * Description: <b>Coded expression for the route</b><br>
2352   * Type: <b>token</b><br>
2353   * Path: <b>AdministrableProductDefinition.routeOfAdministration.code</b><br>
2354   * </p>
2355   */
2356  @SearchParamDefinition(name="route", path="AdministrableProductDefinition.routeOfAdministration.code", description="Coded expression for the route", type="token" )
2357  public static final String SP_ROUTE = "route";
2358 /**
2359   * <b>Fluent Client</b> search parameter constant for <b>route</b>
2360   * <p>
2361   * Description: <b>Coded expression for the route</b><br>
2362   * Type: <b>token</b><br>
2363   * Path: <b>AdministrableProductDefinition.routeOfAdministration.code</b><br>
2364   * </p>
2365   */
2366  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ROUTE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ROUTE);
2367
2368 /**
2369   * Search parameter: <b>target-species</b>
2370   * <p>
2371   * Description: <b>Coded expression for the species</b><br>
2372   * Type: <b>token</b><br>
2373   * Path: <b>AdministrableProductDefinition.routeOfAdministration.targetSpecies.code</b><br>
2374   * </p>
2375   */
2376  @SearchParamDefinition(name="target-species", path="AdministrableProductDefinition.routeOfAdministration.targetSpecies.code", description="Coded expression for the species", type="token" )
2377  public static final String SP_TARGET_SPECIES = "target-species";
2378 /**
2379   * <b>Fluent Client</b> search parameter constant for <b>target-species</b>
2380   * <p>
2381   * Description: <b>Coded expression for the species</b><br>
2382   * Type: <b>token</b><br>
2383   * Path: <b>AdministrableProductDefinition.routeOfAdministration.targetSpecies.code</b><br>
2384   * </p>
2385   */
2386  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TARGET_SPECIES = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TARGET_SPECIES);
2387
2388
2389}
2390