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