001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * A pharmaceutical product described in terms of its composition and dose form.
047 */
048@ResourceDef(name="MedicinalProductPharmaceutical", profile="http://hl7.org/fhir/StructureDefinition/MedicinalProductPharmaceutical")
049public class MedicinalProductPharmaceutical extends DomainResource {
050
051    @Block()
052    public static class MedicinalProductPharmaceuticalCharacteristicsComponent extends BackboneElement implements IBaseBackboneElement {
053        /**
054         * A coded characteristic.
055         */
056        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
057        @Description(shortDefinition="A coded characteristic", formalDefinition="A coded characteristic." )
058        protected CodeableConcept code;
059
060        /**
061         * The status of characteristic e.g. assigned or pending.
062         */
063        @Child(name = "status", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
064        @Description(shortDefinition="The status of characteristic e.g. assigned or pending", formalDefinition="The status of characteristic e.g. assigned or pending." )
065        protected CodeableConcept status;
066
067        private static final long serialVersionUID = 1414556635L;
068
069    /**
070     * Constructor
071     */
072      public MedicinalProductPharmaceuticalCharacteristicsComponent() {
073        super();
074      }
075
076    /**
077     * Constructor
078     */
079      public MedicinalProductPharmaceuticalCharacteristicsComponent(CodeableConcept code) {
080        super();
081        this.code = code;
082      }
083
084        /**
085         * @return {@link #code} (A coded characteristic.)
086         */
087        public CodeableConcept getCode() { 
088          if (this.code == null)
089            if (Configuration.errorOnAutoCreate())
090              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalCharacteristicsComponent.code");
091            else if (Configuration.doAutoCreate())
092              this.code = new CodeableConcept(); // cc
093          return this.code;
094        }
095
096        public boolean hasCode() { 
097          return this.code != null && !this.code.isEmpty();
098        }
099
100        /**
101         * @param value {@link #code} (A coded characteristic.)
102         */
103        public MedicinalProductPharmaceuticalCharacteristicsComponent setCode(CodeableConcept value) { 
104          this.code = value;
105          return this;
106        }
107
108        /**
109         * @return {@link #status} (The status of characteristic e.g. assigned or pending.)
110         */
111        public CodeableConcept getStatus() { 
112          if (this.status == null)
113            if (Configuration.errorOnAutoCreate())
114              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalCharacteristicsComponent.status");
115            else if (Configuration.doAutoCreate())
116              this.status = new CodeableConcept(); // cc
117          return this.status;
118        }
119
120        public boolean hasStatus() { 
121          return this.status != null && !this.status.isEmpty();
122        }
123
124        /**
125         * @param value {@link #status} (The status of characteristic e.g. assigned or pending.)
126         */
127        public MedicinalProductPharmaceuticalCharacteristicsComponent setStatus(CodeableConcept value) { 
128          this.status = value;
129          return this;
130        }
131
132        protected void listChildren(List<Property> children) {
133          super.listChildren(children);
134          children.add(new Property("code", "CodeableConcept", "A coded characteristic.", 0, 1, code));
135          children.add(new Property("status", "CodeableConcept", "The status of characteristic e.g. assigned or pending.", 0, 1, status));
136        }
137
138        @Override
139        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
140          switch (_hash) {
141          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A coded characteristic.", 0, 1, code);
142          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status of characteristic e.g. assigned or pending.", 0, 1, status);
143          default: return super.getNamedProperty(_hash, _name, _checkValid);
144          }
145
146        }
147
148      @Override
149      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
150        switch (hash) {
151        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
152        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
153        default: return super.getProperty(hash, name, checkValid);
154        }
155
156      }
157
158      @Override
159      public Base setProperty(int hash, String name, Base value) throws FHIRException {
160        switch (hash) {
161        case 3059181: // code
162          this.code = castToCodeableConcept(value); // CodeableConcept
163          return value;
164        case -892481550: // status
165          this.status = castToCodeableConcept(value); // CodeableConcept
166          return value;
167        default: return super.setProperty(hash, name, value);
168        }
169
170      }
171
172      @Override
173      public Base setProperty(String name, Base value) throws FHIRException {
174        if (name.equals("code")) {
175          this.code = castToCodeableConcept(value); // CodeableConcept
176        } else if (name.equals("status")) {
177          this.status = castToCodeableConcept(value); // CodeableConcept
178        } else
179          return super.setProperty(name, value);
180        return value;
181      }
182
183      @Override
184      public Base makeProperty(int hash, String name) throws FHIRException {
185        switch (hash) {
186        case 3059181:  return getCode(); 
187        case -892481550:  return getStatus(); 
188        default: return super.makeProperty(hash, name);
189        }
190
191      }
192
193      @Override
194      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
195        switch (hash) {
196        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
197        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
198        default: return super.getTypesForProperty(hash, name);
199        }
200
201      }
202
203      @Override
204      public Base addChild(String name) throws FHIRException {
205        if (name.equals("code")) {
206          this.code = new CodeableConcept();
207          return this.code;
208        }
209        else if (name.equals("status")) {
210          this.status = new CodeableConcept();
211          return this.status;
212        }
213        else
214          return super.addChild(name);
215      }
216
217      public MedicinalProductPharmaceuticalCharacteristicsComponent copy() {
218        MedicinalProductPharmaceuticalCharacteristicsComponent dst = new MedicinalProductPharmaceuticalCharacteristicsComponent();
219        copyValues(dst);
220        dst.code = code == null ? null : code.copy();
221        dst.status = status == null ? null : status.copy();
222        return dst;
223      }
224
225      @Override
226      public boolean equalsDeep(Base other_) {
227        if (!super.equalsDeep(other_))
228          return false;
229        if (!(other_ instanceof MedicinalProductPharmaceuticalCharacteristicsComponent))
230          return false;
231        MedicinalProductPharmaceuticalCharacteristicsComponent o = (MedicinalProductPharmaceuticalCharacteristicsComponent) other_;
232        return compareDeep(code, o.code, true) && compareDeep(status, o.status, true);
233      }
234
235      @Override
236      public boolean equalsShallow(Base other_) {
237        if (!super.equalsShallow(other_))
238          return false;
239        if (!(other_ instanceof MedicinalProductPharmaceuticalCharacteristicsComponent))
240          return false;
241        MedicinalProductPharmaceuticalCharacteristicsComponent o = (MedicinalProductPharmaceuticalCharacteristicsComponent) other_;
242        return true;
243      }
244
245      public boolean isEmpty() {
246        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, status);
247      }
248
249  public String fhirType() {
250    return "MedicinalProductPharmaceutical.characteristics";
251
252  }
253
254  }
255
256    @Block()
257    public static class MedicinalProductPharmaceuticalRouteOfAdministrationComponent extends BackboneElement implements IBaseBackboneElement {
258        /**
259         * Coded expression for the route.
260         */
261        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
262        @Description(shortDefinition="Coded expression for the route", formalDefinition="Coded expression for the route." )
263        protected CodeableConcept code;
264
265        /**
266         * The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.
267         */
268        @Child(name = "firstDose", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=true)
269        @Description(shortDefinition="The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement", formalDefinition="The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement." )
270        protected Quantity firstDose;
271
272        /**
273         * The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.
274         */
275        @Child(name = "maxSingleDose", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true)
276        @Description(shortDefinition="The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement", formalDefinition="The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement." )
277        protected Quantity maxSingleDose;
278
279        /**
280         * The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation.
281         */
282        @Child(name = "maxDosePerDay", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=true)
283        @Description(shortDefinition="The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation", formalDefinition="The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation." )
284        protected Quantity maxDosePerDay;
285
286        /**
287         * The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.
288         */
289        @Child(name = "maxDosePerTreatmentPeriod", type = {Ratio.class}, order=5, min=0, max=1, modifier=false, summary=true)
290        @Description(shortDefinition="The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation", formalDefinition="The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation." )
291        protected Ratio maxDosePerTreatmentPeriod;
292
293        /**
294         * The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.
295         */
296        @Child(name = "maxTreatmentPeriod", type = {Duration.class}, order=6, min=0, max=1, modifier=false, summary=true)
297        @Description(shortDefinition="The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation", formalDefinition="The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation." )
298        protected Duration maxTreatmentPeriod;
299
300        /**
301         * A species for which this route applies.
302         */
303        @Child(name = "targetSpecies", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
304        @Description(shortDefinition="A species for which this route applies", formalDefinition="A species for which this route applies." )
305        protected List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent> targetSpecies;
306
307        private static final long serialVersionUID = 854394783L;
308
309    /**
310     * Constructor
311     */
312      public MedicinalProductPharmaceuticalRouteOfAdministrationComponent() {
313        super();
314      }
315
316    /**
317     * Constructor
318     */
319      public MedicinalProductPharmaceuticalRouteOfAdministrationComponent(CodeableConcept code) {
320        super();
321        this.code = code;
322      }
323
324        /**
325         * @return {@link #code} (Coded expression for the route.)
326         */
327        public CodeableConcept getCode() { 
328          if (this.code == null)
329            if (Configuration.errorOnAutoCreate())
330              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.code");
331            else if (Configuration.doAutoCreate())
332              this.code = new CodeableConcept(); // cc
333          return this.code;
334        }
335
336        public boolean hasCode() { 
337          return this.code != null && !this.code.isEmpty();
338        }
339
340        /**
341         * @param value {@link #code} (Coded expression for the route.)
342         */
343        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setCode(CodeableConcept value) { 
344          this.code = value;
345          return this;
346        }
347
348        /**
349         * @return {@link #firstDose} (The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.)
350         */
351        public Quantity getFirstDose() { 
352          if (this.firstDose == null)
353            if (Configuration.errorOnAutoCreate())
354              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.firstDose");
355            else if (Configuration.doAutoCreate())
356              this.firstDose = new Quantity(); // cc
357          return this.firstDose;
358        }
359
360        public boolean hasFirstDose() { 
361          return this.firstDose != null && !this.firstDose.isEmpty();
362        }
363
364        /**
365         * @param value {@link #firstDose} (The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.)
366         */
367        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setFirstDose(Quantity value) { 
368          this.firstDose = value;
369          return this;
370        }
371
372        /**
373         * @return {@link #maxSingleDose} (The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.)
374         */
375        public Quantity getMaxSingleDose() { 
376          if (this.maxSingleDose == null)
377            if (Configuration.errorOnAutoCreate())
378              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.maxSingleDose");
379            else if (Configuration.doAutoCreate())
380              this.maxSingleDose = new Quantity(); // cc
381          return this.maxSingleDose;
382        }
383
384        public boolean hasMaxSingleDose() { 
385          return this.maxSingleDose != null && !this.maxSingleDose.isEmpty();
386        }
387
388        /**
389         * @param value {@link #maxSingleDose} (The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.)
390         */
391        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setMaxSingleDose(Quantity value) { 
392          this.maxSingleDose = value;
393          return this;
394        }
395
396        /**
397         * @return {@link #maxDosePerDay} (The maximum dose per day (maximum dose quantity to be administered in any one 24-h period) that can be administered as per the protocol referenced in the clinical trial authorisation.)
398         */
399        public Quantity getMaxDosePerDay() { 
400          if (this.maxDosePerDay == null)
401            if (Configuration.errorOnAutoCreate())
402              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.maxDosePerDay");
403            else if (Configuration.doAutoCreate())
404              this.maxDosePerDay = new Quantity(); // cc
405          return this.maxDosePerDay;
406        }
407
408        public boolean hasMaxDosePerDay() { 
409          return this.maxDosePerDay != null && !this.maxDosePerDay.isEmpty();
410        }
411
412        /**
413         * @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 as per the protocol referenced in the clinical trial authorisation.)
414         */
415        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setMaxDosePerDay(Quantity value) { 
416          this.maxDosePerDay = value;
417          return this;
418        }
419
420        /**
421         * @return {@link #maxDosePerTreatmentPeriod} (The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.)
422         */
423        public Ratio getMaxDosePerTreatmentPeriod() { 
424          if (this.maxDosePerTreatmentPeriod == null)
425            if (Configuration.errorOnAutoCreate())
426              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.maxDosePerTreatmentPeriod");
427            else if (Configuration.doAutoCreate())
428              this.maxDosePerTreatmentPeriod = new Ratio(); // cc
429          return this.maxDosePerTreatmentPeriod;
430        }
431
432        public boolean hasMaxDosePerTreatmentPeriod() { 
433          return this.maxDosePerTreatmentPeriod != null && !this.maxDosePerTreatmentPeriod.isEmpty();
434        }
435
436        /**
437         * @param value {@link #maxDosePerTreatmentPeriod} (The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.)
438         */
439        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setMaxDosePerTreatmentPeriod(Ratio value) { 
440          this.maxDosePerTreatmentPeriod = value;
441          return this;
442        }
443
444        /**
445         * @return {@link #maxTreatmentPeriod} (The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.)
446         */
447        public Duration getMaxTreatmentPeriod() { 
448          if (this.maxTreatmentPeriod == null)
449            if (Configuration.errorOnAutoCreate())
450              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationComponent.maxTreatmentPeriod");
451            else if (Configuration.doAutoCreate())
452              this.maxTreatmentPeriod = new Duration(); // cc
453          return this.maxTreatmentPeriod;
454        }
455
456        public boolean hasMaxTreatmentPeriod() { 
457          return this.maxTreatmentPeriod != null && !this.maxTreatmentPeriod.isEmpty();
458        }
459
460        /**
461         * @param value {@link #maxTreatmentPeriod} (The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.)
462         */
463        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setMaxTreatmentPeriod(Duration value) { 
464          this.maxTreatmentPeriod = value;
465          return this;
466        }
467
468        /**
469         * @return {@link #targetSpecies} (A species for which this route applies.)
470         */
471        public List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent> getTargetSpecies() { 
472          if (this.targetSpecies == null)
473            this.targetSpecies = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent>();
474          return this.targetSpecies;
475        }
476
477        /**
478         * @return Returns a reference to <code>this</code> for easy method chaining
479         */
480        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent setTargetSpecies(List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent> theTargetSpecies) { 
481          this.targetSpecies = theTargetSpecies;
482          return this;
483        }
484
485        public boolean hasTargetSpecies() { 
486          if (this.targetSpecies == null)
487            return false;
488          for (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent item : this.targetSpecies)
489            if (!item.isEmpty())
490              return true;
491          return false;
492        }
493
494        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent addTargetSpecies() { //3
495          MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent t = new MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
496          if (this.targetSpecies == null)
497            this.targetSpecies = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent>();
498          this.targetSpecies.add(t);
499          return t;
500        }
501
502        public MedicinalProductPharmaceuticalRouteOfAdministrationComponent addTargetSpecies(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent t) { //3
503          if (t == null)
504            return this;
505          if (this.targetSpecies == null)
506            this.targetSpecies = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent>();
507          this.targetSpecies.add(t);
508          return this;
509        }
510
511        /**
512         * @return The first repetition of repeating field {@link #targetSpecies}, creating it if it does not already exist
513         */
514        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent getTargetSpeciesFirstRep() { 
515          if (getTargetSpecies().isEmpty()) {
516            addTargetSpecies();
517          }
518          return getTargetSpecies().get(0);
519        }
520
521        protected void listChildren(List<Property> children) {
522          super.listChildren(children);
523          children.add(new Property("code", "CodeableConcept", "Coded expression for the route.", 0, 1, code));
524          children.add(new Property("firstDose", "Quantity", "The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.", 0, 1, firstDose));
525          children.add(new Property("maxSingleDose", "Quantity", "The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.", 0, 1, maxSingleDose));
526          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 as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxDosePerDay));
527          children.add(new Property("maxDosePerTreatmentPeriod", "Ratio", "The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxDosePerTreatmentPeriod));
528          children.add(new Property("maxTreatmentPeriod", "Duration", "The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxTreatmentPeriod));
529          children.add(new Property("targetSpecies", "", "A species for which this route applies.", 0, java.lang.Integer.MAX_VALUE, targetSpecies));
530        }
531
532        @Override
533        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
534          switch (_hash) {
535          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded expression for the route.", 0, 1, code);
536          case 132551405: /*firstDose*/  return new Property("firstDose", "Quantity", "The first dose (dose quantity) administered in humans can be specified, for a product under investigation, using a numerical value and its unit of measurement.", 0, 1, firstDose);
537          case -259207927: /*maxSingleDose*/  return new Property("maxSingleDose", "Quantity", "The maximum single dose that can be administered as per the protocol of a clinical trial can be specified using a numerical value and its unit of measurement.", 0, 1, maxSingleDose);
538          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 as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxDosePerDay);
539          case -608040195: /*maxDosePerTreatmentPeriod*/  return new Property("maxDosePerTreatmentPeriod", "Ratio", "The maximum dose per treatment period that can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxDosePerTreatmentPeriod);
540          case 920698453: /*maxTreatmentPeriod*/  return new Property("maxTreatmentPeriod", "Duration", "The maximum treatment period during which an Investigational Medicinal Product can be administered as per the protocol referenced in the clinical trial authorisation.", 0, 1, maxTreatmentPeriod);
541          case 295481963: /*targetSpecies*/  return new Property("targetSpecies", "", "A species for which this route applies.", 0, java.lang.Integer.MAX_VALUE, targetSpecies);
542          default: return super.getNamedProperty(_hash, _name, _checkValid);
543          }
544
545        }
546
547      @Override
548      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
549        switch (hash) {
550        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
551        case 132551405: /*firstDose*/ return this.firstDose == null ? new Base[0] : new Base[] {this.firstDose}; // Quantity
552        case -259207927: /*maxSingleDose*/ return this.maxSingleDose == null ? new Base[0] : new Base[] {this.maxSingleDose}; // Quantity
553        case -2017475520: /*maxDosePerDay*/ return this.maxDosePerDay == null ? new Base[0] : new Base[] {this.maxDosePerDay}; // Quantity
554        case -608040195: /*maxDosePerTreatmentPeriod*/ return this.maxDosePerTreatmentPeriod == null ? new Base[0] : new Base[] {this.maxDosePerTreatmentPeriod}; // Ratio
555        case 920698453: /*maxTreatmentPeriod*/ return this.maxTreatmentPeriod == null ? new Base[0] : new Base[] {this.maxTreatmentPeriod}; // Duration
556        case 295481963: /*targetSpecies*/ return this.targetSpecies == null ? new Base[0] : this.targetSpecies.toArray(new Base[this.targetSpecies.size()]); // MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent
557        default: return super.getProperty(hash, name, checkValid);
558        }
559
560      }
561
562      @Override
563      public Base setProperty(int hash, String name, Base value) throws FHIRException {
564        switch (hash) {
565        case 3059181: // code
566          this.code = castToCodeableConcept(value); // CodeableConcept
567          return value;
568        case 132551405: // firstDose
569          this.firstDose = castToQuantity(value); // Quantity
570          return value;
571        case -259207927: // maxSingleDose
572          this.maxSingleDose = castToQuantity(value); // Quantity
573          return value;
574        case -2017475520: // maxDosePerDay
575          this.maxDosePerDay = castToQuantity(value); // Quantity
576          return value;
577        case -608040195: // maxDosePerTreatmentPeriod
578          this.maxDosePerTreatmentPeriod = castToRatio(value); // Ratio
579          return value;
580        case 920698453: // maxTreatmentPeriod
581          this.maxTreatmentPeriod = castToDuration(value); // Duration
582          return value;
583        case 295481963: // targetSpecies
584          this.getTargetSpecies().add((MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent) value); // MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent
585          return value;
586        default: return super.setProperty(hash, name, value);
587        }
588
589      }
590
591      @Override
592      public Base setProperty(String name, Base value) throws FHIRException {
593        if (name.equals("code")) {
594          this.code = castToCodeableConcept(value); // CodeableConcept
595        } else if (name.equals("firstDose")) {
596          this.firstDose = castToQuantity(value); // Quantity
597        } else if (name.equals("maxSingleDose")) {
598          this.maxSingleDose = castToQuantity(value); // Quantity
599        } else if (name.equals("maxDosePerDay")) {
600          this.maxDosePerDay = castToQuantity(value); // Quantity
601        } else if (name.equals("maxDosePerTreatmentPeriod")) {
602          this.maxDosePerTreatmentPeriod = castToRatio(value); // Ratio
603        } else if (name.equals("maxTreatmentPeriod")) {
604          this.maxTreatmentPeriod = castToDuration(value); // Duration
605        } else if (name.equals("targetSpecies")) {
606          this.getTargetSpecies().add((MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent) value);
607        } else
608          return super.setProperty(name, value);
609        return value;
610      }
611
612      @Override
613      public Base makeProperty(int hash, String name) throws FHIRException {
614        switch (hash) {
615        case 3059181:  return getCode(); 
616        case 132551405:  return getFirstDose(); 
617        case -259207927:  return getMaxSingleDose(); 
618        case -2017475520:  return getMaxDosePerDay(); 
619        case -608040195:  return getMaxDosePerTreatmentPeriod(); 
620        case 920698453:  return getMaxTreatmentPeriod(); 
621        case 295481963:  return addTargetSpecies(); 
622        default: return super.makeProperty(hash, name);
623        }
624
625      }
626
627      @Override
628      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
629        switch (hash) {
630        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
631        case 132551405: /*firstDose*/ return new String[] {"Quantity"};
632        case -259207927: /*maxSingleDose*/ return new String[] {"Quantity"};
633        case -2017475520: /*maxDosePerDay*/ return new String[] {"Quantity"};
634        case -608040195: /*maxDosePerTreatmentPeriod*/ return new String[] {"Ratio"};
635        case 920698453: /*maxTreatmentPeriod*/ return new String[] {"Duration"};
636        case 295481963: /*targetSpecies*/ return new String[] {};
637        default: return super.getTypesForProperty(hash, name);
638        }
639
640      }
641
642      @Override
643      public Base addChild(String name) throws FHIRException {
644        if (name.equals("code")) {
645          this.code = new CodeableConcept();
646          return this.code;
647        }
648        else if (name.equals("firstDose")) {
649          this.firstDose = new Quantity();
650          return this.firstDose;
651        }
652        else if (name.equals("maxSingleDose")) {
653          this.maxSingleDose = new Quantity();
654          return this.maxSingleDose;
655        }
656        else if (name.equals("maxDosePerDay")) {
657          this.maxDosePerDay = new Quantity();
658          return this.maxDosePerDay;
659        }
660        else if (name.equals("maxDosePerTreatmentPeriod")) {
661          this.maxDosePerTreatmentPeriod = new Ratio();
662          return this.maxDosePerTreatmentPeriod;
663        }
664        else if (name.equals("maxTreatmentPeriod")) {
665          this.maxTreatmentPeriod = new Duration();
666          return this.maxTreatmentPeriod;
667        }
668        else if (name.equals("targetSpecies")) {
669          return addTargetSpecies();
670        }
671        else
672          return super.addChild(name);
673      }
674
675      public MedicinalProductPharmaceuticalRouteOfAdministrationComponent copy() {
676        MedicinalProductPharmaceuticalRouteOfAdministrationComponent dst = new MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
677        copyValues(dst);
678        dst.code = code == null ? null : code.copy();
679        dst.firstDose = firstDose == null ? null : firstDose.copy();
680        dst.maxSingleDose = maxSingleDose == null ? null : maxSingleDose.copy();
681        dst.maxDosePerDay = maxDosePerDay == null ? null : maxDosePerDay.copy();
682        dst.maxDosePerTreatmentPeriod = maxDosePerTreatmentPeriod == null ? null : maxDosePerTreatmentPeriod.copy();
683        dst.maxTreatmentPeriod = maxTreatmentPeriod == null ? null : maxTreatmentPeriod.copy();
684        if (targetSpecies != null) {
685          dst.targetSpecies = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent>();
686          for (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent i : targetSpecies)
687            dst.targetSpecies.add(i.copy());
688        };
689        return dst;
690      }
691
692      @Override
693      public boolean equalsDeep(Base other_) {
694        if (!super.equalsDeep(other_))
695          return false;
696        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationComponent))
697          return false;
698        MedicinalProductPharmaceuticalRouteOfAdministrationComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationComponent) other_;
699        return compareDeep(code, o.code, true) && compareDeep(firstDose, o.firstDose, true) && compareDeep(maxSingleDose, o.maxSingleDose, true)
700           && compareDeep(maxDosePerDay, o.maxDosePerDay, true) && compareDeep(maxDosePerTreatmentPeriod, o.maxDosePerTreatmentPeriod, true)
701           && compareDeep(maxTreatmentPeriod, o.maxTreatmentPeriod, true) && compareDeep(targetSpecies, o.targetSpecies, true)
702          ;
703      }
704
705      @Override
706      public boolean equalsShallow(Base other_) {
707        if (!super.equalsShallow(other_))
708          return false;
709        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationComponent))
710          return false;
711        MedicinalProductPharmaceuticalRouteOfAdministrationComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationComponent) other_;
712        return true;
713      }
714
715      public boolean isEmpty() {
716        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, firstDose, maxSingleDose
717          , maxDosePerDay, maxDosePerTreatmentPeriod, maxTreatmentPeriod, targetSpecies);
718      }
719
720  public String fhirType() {
721    return "MedicinalProductPharmaceutical.routeOfAdministration";
722
723  }
724
725  }
726
727    @Block()
728    public static class MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent extends BackboneElement implements IBaseBackboneElement {
729        /**
730         * Coded expression for the species.
731         */
732        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
733        @Description(shortDefinition="Coded expression for the species", formalDefinition="Coded expression for the species." )
734        protected CodeableConcept code;
735
736        /**
737         * A species specific time during which consumption of animal product is not appropriate.
738         */
739        @Child(name = "withdrawalPeriod", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
740        @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." )
741        protected List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> withdrawalPeriod;
742
743        private static final long serialVersionUID = -664052812L;
744
745    /**
746     * Constructor
747     */
748      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent() {
749        super();
750      }
751
752    /**
753     * Constructor
754     */
755      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(CodeableConcept code) {
756        super();
757        this.code = code;
758      }
759
760        /**
761         * @return {@link #code} (Coded expression for the species.)
762         */
763        public CodeableConcept getCode() { 
764          if (this.code == null)
765            if (Configuration.errorOnAutoCreate())
766              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent.code");
767            else if (Configuration.doAutoCreate())
768              this.code = new CodeableConcept(); // cc
769          return this.code;
770        }
771
772        public boolean hasCode() { 
773          return this.code != null && !this.code.isEmpty();
774        }
775
776        /**
777         * @param value {@link #code} (Coded expression for the species.)
778         */
779        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent setCode(CodeableConcept value) { 
780          this.code = value;
781          return this;
782        }
783
784        /**
785         * @return {@link #withdrawalPeriod} (A species specific time during which consumption of animal product is not appropriate.)
786         */
787        public List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> getWithdrawalPeriod() { 
788          if (this.withdrawalPeriod == null)
789            this.withdrawalPeriod = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
790          return this.withdrawalPeriod;
791        }
792
793        /**
794         * @return Returns a reference to <code>this</code> for easy method chaining
795         */
796        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent setWithdrawalPeriod(List<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent> theWithdrawalPeriod) { 
797          this.withdrawalPeriod = theWithdrawalPeriod;
798          return this;
799        }
800
801        public boolean hasWithdrawalPeriod() { 
802          if (this.withdrawalPeriod == null)
803            return false;
804          for (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent item : this.withdrawalPeriod)
805            if (!item.isEmpty())
806              return true;
807          return false;
808        }
809
810        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent addWithdrawalPeriod() { //3
811          MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent t = new MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
812          if (this.withdrawalPeriod == null)
813            this.withdrawalPeriod = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
814          this.withdrawalPeriod.add(t);
815          return t;
816        }
817
818        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent addWithdrawalPeriod(MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent t) { //3
819          if (t == null)
820            return this;
821          if (this.withdrawalPeriod == null)
822            this.withdrawalPeriod = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
823          this.withdrawalPeriod.add(t);
824          return this;
825        }
826
827        /**
828         * @return The first repetition of repeating field {@link #withdrawalPeriod}, creating it if it does not already exist
829         */
830        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent getWithdrawalPeriodFirstRep() { 
831          if (getWithdrawalPeriod().isEmpty()) {
832            addWithdrawalPeriod();
833          }
834          return getWithdrawalPeriod().get(0);
835        }
836
837        protected void listChildren(List<Property> children) {
838          super.listChildren(children);
839          children.add(new Property("code", "CodeableConcept", "Coded expression for the species.", 0, 1, code));
840          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));
841        }
842
843        @Override
844        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
845          switch (_hash) {
846          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Coded expression for the species.", 0, 1, code);
847          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);
848          default: return super.getNamedProperty(_hash, _name, _checkValid);
849          }
850
851        }
852
853      @Override
854      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
855        switch (hash) {
856        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
857        case -98450730: /*withdrawalPeriod*/ return this.withdrawalPeriod == null ? new Base[0] : this.withdrawalPeriod.toArray(new Base[this.withdrawalPeriod.size()]); // MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent
858        default: return super.getProperty(hash, name, checkValid);
859        }
860
861      }
862
863      @Override
864      public Base setProperty(int hash, String name, Base value) throws FHIRException {
865        switch (hash) {
866        case 3059181: // code
867          this.code = castToCodeableConcept(value); // CodeableConcept
868          return value;
869        case -98450730: // withdrawalPeriod
870          this.getWithdrawalPeriod().add((MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) value); // MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent
871          return value;
872        default: return super.setProperty(hash, name, value);
873        }
874
875      }
876
877      @Override
878      public Base setProperty(String name, Base value) throws FHIRException {
879        if (name.equals("code")) {
880          this.code = castToCodeableConcept(value); // CodeableConcept
881        } else if (name.equals("withdrawalPeriod")) {
882          this.getWithdrawalPeriod().add((MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) value);
883        } else
884          return super.setProperty(name, value);
885        return value;
886      }
887
888      @Override
889      public Base makeProperty(int hash, String name) throws FHIRException {
890        switch (hash) {
891        case 3059181:  return getCode(); 
892        case -98450730:  return addWithdrawalPeriod(); 
893        default: return super.makeProperty(hash, name);
894        }
895
896      }
897
898      @Override
899      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
900        switch (hash) {
901        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
902        case -98450730: /*withdrawalPeriod*/ return new String[] {};
903        default: return super.getTypesForProperty(hash, name);
904        }
905
906      }
907
908      @Override
909      public Base addChild(String name) throws FHIRException {
910        if (name.equals("code")) {
911          this.code = new CodeableConcept();
912          return this.code;
913        }
914        else if (name.equals("withdrawalPeriod")) {
915          return addWithdrawalPeriod();
916        }
917        else
918          return super.addChild(name);
919      }
920
921      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent copy() {
922        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent dst = new MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
923        copyValues(dst);
924        dst.code = code == null ? null : code.copy();
925        if (withdrawalPeriod != null) {
926          dst.withdrawalPeriod = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent>();
927          for (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent i : withdrawalPeriod)
928            dst.withdrawalPeriod.add(i.copy());
929        };
930        return dst;
931      }
932
933      @Override
934      public boolean equalsDeep(Base other_) {
935        if (!super.equalsDeep(other_))
936          return false;
937        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent))
938          return false;
939        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent) other_;
940        return compareDeep(code, o.code, true) && compareDeep(withdrawalPeriod, o.withdrawalPeriod, true)
941          ;
942      }
943
944      @Override
945      public boolean equalsShallow(Base other_) {
946        if (!super.equalsShallow(other_))
947          return false;
948        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent))
949          return false;
950        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent) other_;
951        return true;
952      }
953
954      public boolean isEmpty() {
955        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, withdrawalPeriod);
956      }
957
958  public String fhirType() {
959    return "MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies";
960
961  }
962
963  }
964
965    @Block()
966    public static class MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent extends BackboneElement implements IBaseBackboneElement {
967        /**
968         * Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.
969         */
970        @Child(name = "tissue", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
971        @Description(shortDefinition="Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk", formalDefinition="Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk." )
972        protected CodeableConcept tissue;
973
974        /**
975         * A value for the time.
976         */
977        @Child(name = "value", type = {Quantity.class}, order=2, min=1, max=1, modifier=false, summary=true)
978        @Description(shortDefinition="A value for the time", formalDefinition="A value for the time." )
979        protected Quantity value;
980
981        /**
982         * Extra information about the withdrawal period.
983         */
984        @Child(name = "supportingInformation", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
985        @Description(shortDefinition="Extra information about the withdrawal period", formalDefinition="Extra information about the withdrawal period." )
986        protected StringType supportingInformation;
987
988        private static final long serialVersionUID = -1113691238L;
989
990    /**
991     * Constructor
992     */
993      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent() {
994        super();
995      }
996
997    /**
998     * Constructor
999     */
1000      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(CodeableConcept tissue, Quantity value) {
1001        super();
1002        this.tissue = tissue;
1003        this.value = value;
1004      }
1005
1006        /**
1007         * @return {@link #tissue} (Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.)
1008         */
1009        public CodeableConcept getTissue() { 
1010          if (this.tissue == null)
1011            if (Configuration.errorOnAutoCreate())
1012              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.tissue");
1013            else if (Configuration.doAutoCreate())
1014              this.tissue = new CodeableConcept(); // cc
1015          return this.tissue;
1016        }
1017
1018        public boolean hasTissue() { 
1019          return this.tissue != null && !this.tissue.isEmpty();
1020        }
1021
1022        /**
1023         * @param value {@link #tissue} (Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.)
1024         */
1025        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setTissue(CodeableConcept value) { 
1026          this.tissue = value;
1027          return this;
1028        }
1029
1030        /**
1031         * @return {@link #value} (A value for the time.)
1032         */
1033        public Quantity getValue() { 
1034          if (this.value == null)
1035            if (Configuration.errorOnAutoCreate())
1036              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.value");
1037            else if (Configuration.doAutoCreate())
1038              this.value = new Quantity(); // cc
1039          return this.value;
1040        }
1041
1042        public boolean hasValue() { 
1043          return this.value != null && !this.value.isEmpty();
1044        }
1045
1046        /**
1047         * @param value {@link #value} (A value for the time.)
1048         */
1049        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setValue(Quantity value) { 
1050          this.value = value;
1051          return this;
1052        }
1053
1054        /**
1055         * @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
1056         */
1057        public StringType getSupportingInformationElement() { 
1058          if (this.supportingInformation == null)
1059            if (Configuration.errorOnAutoCreate())
1060              throw new Error("Attempt to auto-create MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent.supportingInformation");
1061            else if (Configuration.doAutoCreate())
1062              this.supportingInformation = new StringType(); // bb
1063          return this.supportingInformation;
1064        }
1065
1066        public boolean hasSupportingInformationElement() { 
1067          return this.supportingInformation != null && !this.supportingInformation.isEmpty();
1068        }
1069
1070        public boolean hasSupportingInformation() { 
1071          return this.supportingInformation != null && !this.supportingInformation.isEmpty();
1072        }
1073
1074        /**
1075         * @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
1076         */
1077        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setSupportingInformationElement(StringType value) { 
1078          this.supportingInformation = value;
1079          return this;
1080        }
1081
1082        /**
1083         * @return Extra information about the withdrawal period.
1084         */
1085        public String getSupportingInformation() { 
1086          return this.supportingInformation == null ? null : this.supportingInformation.getValue();
1087        }
1088
1089        /**
1090         * @param value Extra information about the withdrawal period.
1091         */
1092        public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent setSupportingInformation(String value) { 
1093          if (Utilities.noString(value))
1094            this.supportingInformation = null;
1095          else {
1096            if (this.supportingInformation == null)
1097              this.supportingInformation = new StringType();
1098            this.supportingInformation.setValue(value);
1099          }
1100          return this;
1101        }
1102
1103        protected void listChildren(List<Property> children) {
1104          super.listChildren(children);
1105          children.add(new Property("tissue", "CodeableConcept", "Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.", 0, 1, tissue));
1106          children.add(new Property("value", "Quantity", "A value for the time.", 0, 1, value));
1107          children.add(new Property("supportingInformation", "string", "Extra information about the withdrawal period.", 0, 1, supportingInformation));
1108        }
1109
1110        @Override
1111        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1112          switch (_hash) {
1113          case -873475867: /*tissue*/  return new Property("tissue", "CodeableConcept", "Coded expression for the type of tissue for which the withdrawal period applues, e.g. meat, milk.", 0, 1, tissue);
1114          case 111972721: /*value*/  return new Property("value", "Quantity", "A value for the time.", 0, 1, value);
1115          case -1248768647: /*supportingInformation*/  return new Property("supportingInformation", "string", "Extra information about the withdrawal period.", 0, 1, supportingInformation);
1116          default: return super.getNamedProperty(_hash, _name, _checkValid);
1117          }
1118
1119        }
1120
1121      @Override
1122      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1123        switch (hash) {
1124        case -873475867: /*tissue*/ return this.tissue == null ? new Base[0] : new Base[] {this.tissue}; // CodeableConcept
1125        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Quantity
1126        case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : new Base[] {this.supportingInformation}; // StringType
1127        default: return super.getProperty(hash, name, checkValid);
1128        }
1129
1130      }
1131
1132      @Override
1133      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1134        switch (hash) {
1135        case -873475867: // tissue
1136          this.tissue = castToCodeableConcept(value); // CodeableConcept
1137          return value;
1138        case 111972721: // value
1139          this.value = castToQuantity(value); // Quantity
1140          return value;
1141        case -1248768647: // supportingInformation
1142          this.supportingInformation = castToString(value); // StringType
1143          return value;
1144        default: return super.setProperty(hash, name, value);
1145        }
1146
1147      }
1148
1149      @Override
1150      public Base setProperty(String name, Base value) throws FHIRException {
1151        if (name.equals("tissue")) {
1152          this.tissue = castToCodeableConcept(value); // CodeableConcept
1153        } else if (name.equals("value")) {
1154          this.value = castToQuantity(value); // Quantity
1155        } else if (name.equals("supportingInformation")) {
1156          this.supportingInformation = castToString(value); // StringType
1157        } else
1158          return super.setProperty(name, value);
1159        return value;
1160      }
1161
1162      @Override
1163      public Base makeProperty(int hash, String name) throws FHIRException {
1164        switch (hash) {
1165        case -873475867:  return getTissue(); 
1166        case 111972721:  return getValue(); 
1167        case -1248768647:  return getSupportingInformationElement();
1168        default: return super.makeProperty(hash, name);
1169        }
1170
1171      }
1172
1173      @Override
1174      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1175        switch (hash) {
1176        case -873475867: /*tissue*/ return new String[] {"CodeableConcept"};
1177        case 111972721: /*value*/ return new String[] {"Quantity"};
1178        case -1248768647: /*supportingInformation*/ return new String[] {"string"};
1179        default: return super.getTypesForProperty(hash, name);
1180        }
1181
1182      }
1183
1184      @Override
1185      public Base addChild(String name) throws FHIRException {
1186        if (name.equals("tissue")) {
1187          this.tissue = new CodeableConcept();
1188          return this.tissue;
1189        }
1190        else if (name.equals("value")) {
1191          this.value = new Quantity();
1192          return this.value;
1193        }
1194        else if (name.equals("supportingInformation")) {
1195          throw new FHIRException("Cannot call addChild on a primitive type MedicinalProductPharmaceutical.supportingInformation");
1196        }
1197        else
1198          return super.addChild(name);
1199      }
1200
1201      public MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent copy() {
1202        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent dst = new MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
1203        copyValues(dst);
1204        dst.tissue = tissue == null ? null : tissue.copy();
1205        dst.value = value == null ? null : value.copy();
1206        dst.supportingInformation = supportingInformation == null ? null : supportingInformation.copy();
1207        return dst;
1208      }
1209
1210      @Override
1211      public boolean equalsDeep(Base other_) {
1212        if (!super.equalsDeep(other_))
1213          return false;
1214        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent))
1215          return false;
1216        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) other_;
1217        return compareDeep(tissue, o.tissue, true) && compareDeep(value, o.value, true) && compareDeep(supportingInformation, o.supportingInformation, true)
1218          ;
1219      }
1220
1221      @Override
1222      public boolean equalsShallow(Base other_) {
1223        if (!super.equalsShallow(other_))
1224          return false;
1225        if (!(other_ instanceof MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent))
1226          return false;
1227        MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent o = (MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent) other_;
1228        return compareValues(supportingInformation, o.supportingInformation, true);
1229      }
1230
1231      public boolean isEmpty() {
1232        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(tissue, value, supportingInformation
1233          );
1234      }
1235
1236  public String fhirType() {
1237    return "MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies.withdrawalPeriod";
1238
1239  }
1240
1241  }
1242
1243    /**
1244     * An identifier for the pharmaceutical medicinal product.
1245     */
1246    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1247    @Description(shortDefinition="An identifier for the pharmaceutical medicinal product", formalDefinition="An identifier for the pharmaceutical medicinal product." )
1248    protected List<Identifier> identifier;
1249
1250    /**
1251     * The administrable dose form, after necessary reconstitution.
1252     */
1253    @Child(name = "administrableDoseForm", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1254    @Description(shortDefinition="The administrable dose form, after necessary reconstitution", formalDefinition="The administrable dose form, after necessary reconstitution." )
1255    protected CodeableConcept administrableDoseForm;
1256
1257    /**
1258     * Todo.
1259     */
1260    @Child(name = "unitOfPresentation", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1261    @Description(shortDefinition="Todo", formalDefinition="Todo." )
1262    protected CodeableConcept unitOfPresentation;
1263
1264    /**
1265     * Ingredient.
1266     */
1267    @Child(name = "ingredient", type = {MedicinalProductIngredient.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1268    @Description(shortDefinition="Ingredient", formalDefinition="Ingredient." )
1269    protected List<Reference> ingredient;
1270    /**
1271     * The actual objects that are the target of the reference (Ingredient.)
1272     */
1273    protected List<MedicinalProductIngredient> ingredientTarget;
1274
1275
1276    /**
1277     * Accompanying device.
1278     */
1279    @Child(name = "device", type = {MedicinalProductDeviceSpec.class, DeviceDefinition.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1280    @Description(shortDefinition="Accompanying device", formalDefinition="Accompanying device." )
1281    protected List<Reference> device;
1282    /**
1283     * The actual objects that are the target of the reference (Accompanying device.)
1284     */
1285    protected List<Resource> deviceTarget;
1286
1287
1288    /**
1289     * Characteristics e.g. a products onset of action.
1290     */
1291    @Child(name = "characteristics", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1292    @Description(shortDefinition="Characteristics e.g. a products onset of action", formalDefinition="Characteristics e.g. a products onset of action." )
1293    protected List<MedicinalProductPharmaceuticalCharacteristicsComponent> characteristics;
1294
1295    /**
1296     * The path by which the pharmaceutical product is taken into or makes contact with the body.
1297     */
1298    @Child(name = "routeOfAdministration", type = {}, order=6, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1299    @Description(shortDefinition="The path by which the pharmaceutical product is taken into or makes contact with the body", formalDefinition="The path by which the pharmaceutical product is taken into or makes contact with the body." )
1300    protected List<MedicinalProductPharmaceuticalRouteOfAdministrationComponent> routeOfAdministration;
1301
1302    private static final long serialVersionUID = 920439689L;
1303
1304  /**
1305   * Constructor
1306   */
1307    public MedicinalProductPharmaceutical() {
1308      super();
1309    }
1310
1311  /**
1312   * Constructor
1313   */
1314    public MedicinalProductPharmaceutical(CodeableConcept administrableDoseForm) {
1315      super();
1316      this.administrableDoseForm = administrableDoseForm;
1317    }
1318
1319    /**
1320     * @return {@link #identifier} (An identifier for the pharmaceutical medicinal product.)
1321     */
1322    public List<Identifier> getIdentifier() { 
1323      if (this.identifier == null)
1324        this.identifier = new ArrayList<Identifier>();
1325      return this.identifier;
1326    }
1327
1328    /**
1329     * @return Returns a reference to <code>this</code> for easy method chaining
1330     */
1331    public MedicinalProductPharmaceutical setIdentifier(List<Identifier> theIdentifier) { 
1332      this.identifier = theIdentifier;
1333      return this;
1334    }
1335
1336    public boolean hasIdentifier() { 
1337      if (this.identifier == null)
1338        return false;
1339      for (Identifier item : this.identifier)
1340        if (!item.isEmpty())
1341          return true;
1342      return false;
1343    }
1344
1345    public Identifier addIdentifier() { //3
1346      Identifier t = new Identifier();
1347      if (this.identifier == null)
1348        this.identifier = new ArrayList<Identifier>();
1349      this.identifier.add(t);
1350      return t;
1351    }
1352
1353    public MedicinalProductPharmaceutical addIdentifier(Identifier t) { //3
1354      if (t == null)
1355        return this;
1356      if (this.identifier == null)
1357        this.identifier = new ArrayList<Identifier>();
1358      this.identifier.add(t);
1359      return this;
1360    }
1361
1362    /**
1363     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1364     */
1365    public Identifier getIdentifierFirstRep() { 
1366      if (getIdentifier().isEmpty()) {
1367        addIdentifier();
1368      }
1369      return getIdentifier().get(0);
1370    }
1371
1372    /**
1373     * @return {@link #administrableDoseForm} (The administrable dose form, after necessary reconstitution.)
1374     */
1375    public CodeableConcept getAdministrableDoseForm() { 
1376      if (this.administrableDoseForm == null)
1377        if (Configuration.errorOnAutoCreate())
1378          throw new Error("Attempt to auto-create MedicinalProductPharmaceutical.administrableDoseForm");
1379        else if (Configuration.doAutoCreate())
1380          this.administrableDoseForm = new CodeableConcept(); // cc
1381      return this.administrableDoseForm;
1382    }
1383
1384    public boolean hasAdministrableDoseForm() { 
1385      return this.administrableDoseForm != null && !this.administrableDoseForm.isEmpty();
1386    }
1387
1388    /**
1389     * @param value {@link #administrableDoseForm} (The administrable dose form, after necessary reconstitution.)
1390     */
1391    public MedicinalProductPharmaceutical setAdministrableDoseForm(CodeableConcept value) { 
1392      this.administrableDoseForm = value;
1393      return this;
1394    }
1395
1396    /**
1397     * @return {@link #unitOfPresentation} (Todo.)
1398     */
1399    public CodeableConcept getUnitOfPresentation() { 
1400      if (this.unitOfPresentation == null)
1401        if (Configuration.errorOnAutoCreate())
1402          throw new Error("Attempt to auto-create MedicinalProductPharmaceutical.unitOfPresentation");
1403        else if (Configuration.doAutoCreate())
1404          this.unitOfPresentation = new CodeableConcept(); // cc
1405      return this.unitOfPresentation;
1406    }
1407
1408    public boolean hasUnitOfPresentation() { 
1409      return this.unitOfPresentation != null && !this.unitOfPresentation.isEmpty();
1410    }
1411
1412    /**
1413     * @param value {@link #unitOfPresentation} (Todo.)
1414     */
1415    public MedicinalProductPharmaceutical setUnitOfPresentation(CodeableConcept value) { 
1416      this.unitOfPresentation = value;
1417      return this;
1418    }
1419
1420    /**
1421     * @return {@link #ingredient} (Ingredient.)
1422     */
1423    public List<Reference> getIngredient() { 
1424      if (this.ingredient == null)
1425        this.ingredient = new ArrayList<Reference>();
1426      return this.ingredient;
1427    }
1428
1429    /**
1430     * @return Returns a reference to <code>this</code> for easy method chaining
1431     */
1432    public MedicinalProductPharmaceutical setIngredient(List<Reference> theIngredient) { 
1433      this.ingredient = theIngredient;
1434      return this;
1435    }
1436
1437    public boolean hasIngredient() { 
1438      if (this.ingredient == null)
1439        return false;
1440      for (Reference item : this.ingredient)
1441        if (!item.isEmpty())
1442          return true;
1443      return false;
1444    }
1445
1446    public Reference addIngredient() { //3
1447      Reference t = new Reference();
1448      if (this.ingredient == null)
1449        this.ingredient = new ArrayList<Reference>();
1450      this.ingredient.add(t);
1451      return t;
1452    }
1453
1454    public MedicinalProductPharmaceutical addIngredient(Reference t) { //3
1455      if (t == null)
1456        return this;
1457      if (this.ingredient == null)
1458        this.ingredient = new ArrayList<Reference>();
1459      this.ingredient.add(t);
1460      return this;
1461    }
1462
1463    /**
1464     * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist
1465     */
1466    public Reference getIngredientFirstRep() { 
1467      if (getIngredient().isEmpty()) {
1468        addIngredient();
1469      }
1470      return getIngredient().get(0);
1471    }
1472
1473    /**
1474     * @deprecated Use Reference#setResource(IBaseResource) instead
1475     */
1476    @Deprecated
1477    public List<MedicinalProductIngredient> getIngredientTarget() { 
1478      if (this.ingredientTarget == null)
1479        this.ingredientTarget = new ArrayList<MedicinalProductIngredient>();
1480      return this.ingredientTarget;
1481    }
1482
1483    /**
1484     * @deprecated Use Reference#setResource(IBaseResource) instead
1485     */
1486    @Deprecated
1487    public MedicinalProductIngredient addIngredientTarget() { 
1488      MedicinalProductIngredient r = new MedicinalProductIngredient();
1489      if (this.ingredientTarget == null)
1490        this.ingredientTarget = new ArrayList<MedicinalProductIngredient>();
1491      this.ingredientTarget.add(r);
1492      return r;
1493    }
1494
1495    /**
1496     * @return {@link #device} (Accompanying device.)
1497     */
1498    public List<Reference> getDevice() { 
1499      if (this.device == null)
1500        this.device = new ArrayList<Reference>();
1501      return this.device;
1502    }
1503
1504    /**
1505     * @return Returns a reference to <code>this</code> for easy method chaining
1506     */
1507    public MedicinalProductPharmaceutical setDevice(List<Reference> theDevice) { 
1508      this.device = theDevice;
1509      return this;
1510    }
1511
1512    public boolean hasDevice() { 
1513      if (this.device == null)
1514        return false;
1515      for (Reference item : this.device)
1516        if (!item.isEmpty())
1517          return true;
1518      return false;
1519    }
1520
1521    public Reference addDevice() { //3
1522      Reference t = new Reference();
1523      if (this.device == null)
1524        this.device = new ArrayList<Reference>();
1525      this.device.add(t);
1526      return t;
1527    }
1528
1529    public MedicinalProductPharmaceutical addDevice(Reference t) { //3
1530      if (t == null)
1531        return this;
1532      if (this.device == null)
1533        this.device = new ArrayList<Reference>();
1534      this.device.add(t);
1535      return this;
1536    }
1537
1538    /**
1539     * @return The first repetition of repeating field {@link #device}, creating it if it does not already exist
1540     */
1541    public Reference getDeviceFirstRep() { 
1542      if (getDevice().isEmpty()) {
1543        addDevice();
1544      }
1545      return getDevice().get(0);
1546    }
1547
1548    /**
1549     * @deprecated Use Reference#setResource(IBaseResource) instead
1550     */
1551    @Deprecated
1552    public List<Resource> getDeviceTarget() { 
1553      if (this.deviceTarget == null)
1554        this.deviceTarget = new ArrayList<Resource>();
1555      return this.deviceTarget;
1556    }
1557
1558    /**
1559     * @return {@link #characteristics} (Characteristics e.g. a products onset of action.)
1560     */
1561    public List<MedicinalProductPharmaceuticalCharacteristicsComponent> getCharacteristics() { 
1562      if (this.characteristics == null)
1563        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1564      return this.characteristics;
1565    }
1566
1567    /**
1568     * @return Returns a reference to <code>this</code> for easy method chaining
1569     */
1570    public MedicinalProductPharmaceutical setCharacteristics(List<MedicinalProductPharmaceuticalCharacteristicsComponent> theCharacteristics) { 
1571      this.characteristics = theCharacteristics;
1572      return this;
1573    }
1574
1575    public boolean hasCharacteristics() { 
1576      if (this.characteristics == null)
1577        return false;
1578      for (MedicinalProductPharmaceuticalCharacteristicsComponent item : this.characteristics)
1579        if (!item.isEmpty())
1580          return true;
1581      return false;
1582    }
1583
1584    public MedicinalProductPharmaceuticalCharacteristicsComponent addCharacteristics() { //3
1585      MedicinalProductPharmaceuticalCharacteristicsComponent t = new MedicinalProductPharmaceuticalCharacteristicsComponent();
1586      if (this.characteristics == null)
1587        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1588      this.characteristics.add(t);
1589      return t;
1590    }
1591
1592    public MedicinalProductPharmaceutical addCharacteristics(MedicinalProductPharmaceuticalCharacteristicsComponent t) { //3
1593      if (t == null)
1594        return this;
1595      if (this.characteristics == null)
1596        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1597      this.characteristics.add(t);
1598      return this;
1599    }
1600
1601    /**
1602     * @return The first repetition of repeating field {@link #characteristics}, creating it if it does not already exist
1603     */
1604    public MedicinalProductPharmaceuticalCharacteristicsComponent getCharacteristicsFirstRep() { 
1605      if (getCharacteristics().isEmpty()) {
1606        addCharacteristics();
1607      }
1608      return getCharacteristics().get(0);
1609    }
1610
1611    /**
1612     * @return {@link #routeOfAdministration} (The path by which the pharmaceutical product is taken into or makes contact with the body.)
1613     */
1614    public List<MedicinalProductPharmaceuticalRouteOfAdministrationComponent> getRouteOfAdministration() { 
1615      if (this.routeOfAdministration == null)
1616        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1617      return this.routeOfAdministration;
1618    }
1619
1620    /**
1621     * @return Returns a reference to <code>this</code> for easy method chaining
1622     */
1623    public MedicinalProductPharmaceutical setRouteOfAdministration(List<MedicinalProductPharmaceuticalRouteOfAdministrationComponent> theRouteOfAdministration) { 
1624      this.routeOfAdministration = theRouteOfAdministration;
1625      return this;
1626    }
1627
1628    public boolean hasRouteOfAdministration() { 
1629      if (this.routeOfAdministration == null)
1630        return false;
1631      for (MedicinalProductPharmaceuticalRouteOfAdministrationComponent item : this.routeOfAdministration)
1632        if (!item.isEmpty())
1633          return true;
1634      return false;
1635    }
1636
1637    public MedicinalProductPharmaceuticalRouteOfAdministrationComponent addRouteOfAdministration() { //3
1638      MedicinalProductPharmaceuticalRouteOfAdministrationComponent t = new MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
1639      if (this.routeOfAdministration == null)
1640        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1641      this.routeOfAdministration.add(t);
1642      return t;
1643    }
1644
1645    public MedicinalProductPharmaceutical addRouteOfAdministration(MedicinalProductPharmaceuticalRouteOfAdministrationComponent t) { //3
1646      if (t == null)
1647        return this;
1648      if (this.routeOfAdministration == null)
1649        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1650      this.routeOfAdministration.add(t);
1651      return this;
1652    }
1653
1654    /**
1655     * @return The first repetition of repeating field {@link #routeOfAdministration}, creating it if it does not already exist
1656     */
1657    public MedicinalProductPharmaceuticalRouteOfAdministrationComponent getRouteOfAdministrationFirstRep() { 
1658      if (getRouteOfAdministration().isEmpty()) {
1659        addRouteOfAdministration();
1660      }
1661      return getRouteOfAdministration().get(0);
1662    }
1663
1664      protected void listChildren(List<Property> children) {
1665        super.listChildren(children);
1666        children.add(new Property("identifier", "Identifier", "An identifier for the pharmaceutical medicinal product.", 0, java.lang.Integer.MAX_VALUE, identifier));
1667        children.add(new Property("administrableDoseForm", "CodeableConcept", "The administrable dose form, after necessary reconstitution.", 0, 1, administrableDoseForm));
1668        children.add(new Property("unitOfPresentation", "CodeableConcept", "Todo.", 0, 1, unitOfPresentation));
1669        children.add(new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0, java.lang.Integer.MAX_VALUE, ingredient));
1670        children.add(new Property("device", "Reference(MedicinalProductDeviceSpec|DeviceDefinition)", "Accompanying device.", 0, java.lang.Integer.MAX_VALUE, device));
1671        children.add(new Property("characteristics", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, characteristics));
1672        children.add(new Property("routeOfAdministration", "", "The path by which the pharmaceutical product is taken into or makes contact with the body.", 0, java.lang.Integer.MAX_VALUE, routeOfAdministration));
1673      }
1674
1675      @Override
1676      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1677        switch (_hash) {
1678        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "An identifier for the pharmaceutical medicinal product.", 0, java.lang.Integer.MAX_VALUE, identifier);
1679        case 1446105202: /*administrableDoseForm*/  return new Property("administrableDoseForm", "CodeableConcept", "The administrable dose form, after necessary reconstitution.", 0, 1, administrableDoseForm);
1680        case -1427765963: /*unitOfPresentation*/  return new Property("unitOfPresentation", "CodeableConcept", "Todo.", 0, 1, unitOfPresentation);
1681        case -206409263: /*ingredient*/  return new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0, java.lang.Integer.MAX_VALUE, ingredient);
1682        case -1335157162: /*device*/  return new Property("device", "Reference(MedicinalProductDeviceSpec|DeviceDefinition)", "Accompanying device.", 0, java.lang.Integer.MAX_VALUE, device);
1683        case -1529171400: /*characteristics*/  return new Property("characteristics", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, characteristics);
1684        case 1742084734: /*routeOfAdministration*/  return new Property("routeOfAdministration", "", "The path by which the pharmaceutical product is taken into or makes contact with the body.", 0, java.lang.Integer.MAX_VALUE, routeOfAdministration);
1685        default: return super.getNamedProperty(_hash, _name, _checkValid);
1686        }
1687
1688      }
1689
1690      @Override
1691      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1692        switch (hash) {
1693        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1694        case 1446105202: /*administrableDoseForm*/ return this.administrableDoseForm == null ? new Base[0] : new Base[] {this.administrableDoseForm}; // CodeableConcept
1695        case -1427765963: /*unitOfPresentation*/ return this.unitOfPresentation == null ? new Base[0] : new Base[] {this.unitOfPresentation}; // CodeableConcept
1696        case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // Reference
1697        case -1335157162: /*device*/ return this.device == null ? new Base[0] : this.device.toArray(new Base[this.device.size()]); // Reference
1698        case -1529171400: /*characteristics*/ return this.characteristics == null ? new Base[0] : this.characteristics.toArray(new Base[this.characteristics.size()]); // MedicinalProductPharmaceuticalCharacteristicsComponent
1699        case 1742084734: /*routeOfAdministration*/ return this.routeOfAdministration == null ? new Base[0] : this.routeOfAdministration.toArray(new Base[this.routeOfAdministration.size()]); // MedicinalProductPharmaceuticalRouteOfAdministrationComponent
1700        default: return super.getProperty(hash, name, checkValid);
1701        }
1702
1703      }
1704
1705      @Override
1706      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1707        switch (hash) {
1708        case -1618432855: // identifier
1709          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1710          return value;
1711        case 1446105202: // administrableDoseForm
1712          this.administrableDoseForm = castToCodeableConcept(value); // CodeableConcept
1713          return value;
1714        case -1427765963: // unitOfPresentation
1715          this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept
1716          return value;
1717        case -206409263: // ingredient
1718          this.getIngredient().add(castToReference(value)); // Reference
1719          return value;
1720        case -1335157162: // device
1721          this.getDevice().add(castToReference(value)); // Reference
1722          return value;
1723        case -1529171400: // characteristics
1724          this.getCharacteristics().add((MedicinalProductPharmaceuticalCharacteristicsComponent) value); // MedicinalProductPharmaceuticalCharacteristicsComponent
1725          return value;
1726        case 1742084734: // routeOfAdministration
1727          this.getRouteOfAdministration().add((MedicinalProductPharmaceuticalRouteOfAdministrationComponent) value); // MedicinalProductPharmaceuticalRouteOfAdministrationComponent
1728          return value;
1729        default: return super.setProperty(hash, name, value);
1730        }
1731
1732      }
1733
1734      @Override
1735      public Base setProperty(String name, Base value) throws FHIRException {
1736        if (name.equals("identifier")) {
1737          this.getIdentifier().add(castToIdentifier(value));
1738        } else if (name.equals("administrableDoseForm")) {
1739          this.administrableDoseForm = castToCodeableConcept(value); // CodeableConcept
1740        } else if (name.equals("unitOfPresentation")) {
1741          this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept
1742        } else if (name.equals("ingredient")) {
1743          this.getIngredient().add(castToReference(value));
1744        } else if (name.equals("device")) {
1745          this.getDevice().add(castToReference(value));
1746        } else if (name.equals("characteristics")) {
1747          this.getCharacteristics().add((MedicinalProductPharmaceuticalCharacteristicsComponent) value);
1748        } else if (name.equals("routeOfAdministration")) {
1749          this.getRouteOfAdministration().add((MedicinalProductPharmaceuticalRouteOfAdministrationComponent) value);
1750        } else
1751          return super.setProperty(name, value);
1752        return value;
1753      }
1754
1755      @Override
1756      public Base makeProperty(int hash, String name) throws FHIRException {
1757        switch (hash) {
1758        case -1618432855:  return addIdentifier(); 
1759        case 1446105202:  return getAdministrableDoseForm(); 
1760        case -1427765963:  return getUnitOfPresentation(); 
1761        case -206409263:  return addIngredient(); 
1762        case -1335157162:  return addDevice(); 
1763        case -1529171400:  return addCharacteristics(); 
1764        case 1742084734:  return addRouteOfAdministration(); 
1765        default: return super.makeProperty(hash, name);
1766        }
1767
1768      }
1769
1770      @Override
1771      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1772        switch (hash) {
1773        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1774        case 1446105202: /*administrableDoseForm*/ return new String[] {"CodeableConcept"};
1775        case -1427765963: /*unitOfPresentation*/ return new String[] {"CodeableConcept"};
1776        case -206409263: /*ingredient*/ return new String[] {"Reference"};
1777        case -1335157162: /*device*/ return new String[] {"Reference"};
1778        case -1529171400: /*characteristics*/ return new String[] {};
1779        case 1742084734: /*routeOfAdministration*/ return new String[] {};
1780        default: return super.getTypesForProperty(hash, name);
1781        }
1782
1783      }
1784
1785      @Override
1786      public Base addChild(String name) throws FHIRException {
1787        if (name.equals("identifier")) {
1788          return addIdentifier();
1789        }
1790        else if (name.equals("administrableDoseForm")) {
1791          this.administrableDoseForm = new CodeableConcept();
1792          return this.administrableDoseForm;
1793        }
1794        else if (name.equals("unitOfPresentation")) {
1795          this.unitOfPresentation = new CodeableConcept();
1796          return this.unitOfPresentation;
1797        }
1798        else if (name.equals("ingredient")) {
1799          return addIngredient();
1800        }
1801        else if (name.equals("device")) {
1802          return addDevice();
1803        }
1804        else if (name.equals("characteristics")) {
1805          return addCharacteristics();
1806        }
1807        else if (name.equals("routeOfAdministration")) {
1808          return addRouteOfAdministration();
1809        }
1810        else
1811          return super.addChild(name);
1812      }
1813
1814  public String fhirType() {
1815    return "MedicinalProductPharmaceutical";
1816
1817  }
1818
1819      public MedicinalProductPharmaceutical copy() {
1820        MedicinalProductPharmaceutical dst = new MedicinalProductPharmaceutical();
1821        copyValues(dst);
1822        if (identifier != null) {
1823          dst.identifier = new ArrayList<Identifier>();
1824          for (Identifier i : identifier)
1825            dst.identifier.add(i.copy());
1826        };
1827        dst.administrableDoseForm = administrableDoseForm == null ? null : administrableDoseForm.copy();
1828        dst.unitOfPresentation = unitOfPresentation == null ? null : unitOfPresentation.copy();
1829        if (ingredient != null) {
1830          dst.ingredient = new ArrayList<Reference>();
1831          for (Reference i : ingredient)
1832            dst.ingredient.add(i.copy());
1833        };
1834        if (device != null) {
1835          dst.device = new ArrayList<Reference>();
1836          for (Reference i : device)
1837            dst.device.add(i.copy());
1838        };
1839        if (characteristics != null) {
1840          dst.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1841          for (MedicinalProductPharmaceuticalCharacteristicsComponent i : characteristics)
1842            dst.characteristics.add(i.copy());
1843        };
1844        if (routeOfAdministration != null) {
1845          dst.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1846          for (MedicinalProductPharmaceuticalRouteOfAdministrationComponent i : routeOfAdministration)
1847            dst.routeOfAdministration.add(i.copy());
1848        };
1849        return dst;
1850      }
1851
1852      protected MedicinalProductPharmaceutical typedCopy() {
1853        return copy();
1854      }
1855
1856      @Override
1857      public boolean equalsDeep(Base other_) {
1858        if (!super.equalsDeep(other_))
1859          return false;
1860        if (!(other_ instanceof MedicinalProductPharmaceutical))
1861          return false;
1862        MedicinalProductPharmaceutical o = (MedicinalProductPharmaceutical) other_;
1863        return compareDeep(identifier, o.identifier, true) && compareDeep(administrableDoseForm, o.administrableDoseForm, true)
1864           && compareDeep(unitOfPresentation, o.unitOfPresentation, true) && compareDeep(ingredient, o.ingredient, true)
1865           && compareDeep(device, o.device, true) && compareDeep(characteristics, o.characteristics, true)
1866           && compareDeep(routeOfAdministration, o.routeOfAdministration, true);
1867      }
1868
1869      @Override
1870      public boolean equalsShallow(Base other_) {
1871        if (!super.equalsShallow(other_))
1872          return false;
1873        if (!(other_ instanceof MedicinalProductPharmaceutical))
1874          return false;
1875        MedicinalProductPharmaceutical o = (MedicinalProductPharmaceutical) other_;
1876        return true;
1877      }
1878
1879      public boolean isEmpty() {
1880        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, administrableDoseForm
1881          , unitOfPresentation, ingredient, device, characteristics, routeOfAdministration);
1882      }
1883
1884  @Override
1885  public ResourceType getResourceType() {
1886    return ResourceType.MedicinalProductPharmaceutical;
1887   }
1888
1889
1890}
1891