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, Dec 27, 2018 10:06-0500 for FHIR v4.0.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 = {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<DeviceDefinition> 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 = -1201548050L;
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<DeviceDefinition> getDeviceTarget() { 
1553      if (this.deviceTarget == null)
1554        this.deviceTarget = new ArrayList<DeviceDefinition>();
1555      return this.deviceTarget;
1556    }
1557
1558    /**
1559     * @deprecated Use Reference#setResource(IBaseResource) instead
1560     */
1561    @Deprecated
1562    public DeviceDefinition addDeviceTarget() { 
1563      DeviceDefinition r = new DeviceDefinition();
1564      if (this.deviceTarget == null)
1565        this.deviceTarget = new ArrayList<DeviceDefinition>();
1566      this.deviceTarget.add(r);
1567      return r;
1568    }
1569
1570    /**
1571     * @return {@link #characteristics} (Characteristics e.g. a products onset of action.)
1572     */
1573    public List<MedicinalProductPharmaceuticalCharacteristicsComponent> getCharacteristics() { 
1574      if (this.characteristics == null)
1575        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1576      return this.characteristics;
1577    }
1578
1579    /**
1580     * @return Returns a reference to <code>this</code> for easy method chaining
1581     */
1582    public MedicinalProductPharmaceutical setCharacteristics(List<MedicinalProductPharmaceuticalCharacteristicsComponent> theCharacteristics) { 
1583      this.characteristics = theCharacteristics;
1584      return this;
1585    }
1586
1587    public boolean hasCharacteristics() { 
1588      if (this.characteristics == null)
1589        return false;
1590      for (MedicinalProductPharmaceuticalCharacteristicsComponent item : this.characteristics)
1591        if (!item.isEmpty())
1592          return true;
1593      return false;
1594    }
1595
1596    public MedicinalProductPharmaceuticalCharacteristicsComponent addCharacteristics() { //3
1597      MedicinalProductPharmaceuticalCharacteristicsComponent t = new MedicinalProductPharmaceuticalCharacteristicsComponent();
1598      if (this.characteristics == null)
1599        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1600      this.characteristics.add(t);
1601      return t;
1602    }
1603
1604    public MedicinalProductPharmaceutical addCharacteristics(MedicinalProductPharmaceuticalCharacteristicsComponent t) { //3
1605      if (t == null)
1606        return this;
1607      if (this.characteristics == null)
1608        this.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1609      this.characteristics.add(t);
1610      return this;
1611    }
1612
1613    /**
1614     * @return The first repetition of repeating field {@link #characteristics}, creating it if it does not already exist
1615     */
1616    public MedicinalProductPharmaceuticalCharacteristicsComponent getCharacteristicsFirstRep() { 
1617      if (getCharacteristics().isEmpty()) {
1618        addCharacteristics();
1619      }
1620      return getCharacteristics().get(0);
1621    }
1622
1623    /**
1624     * @return {@link #routeOfAdministration} (The path by which the pharmaceutical product is taken into or makes contact with the body.)
1625     */
1626    public List<MedicinalProductPharmaceuticalRouteOfAdministrationComponent> getRouteOfAdministration() { 
1627      if (this.routeOfAdministration == null)
1628        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1629      return this.routeOfAdministration;
1630    }
1631
1632    /**
1633     * @return Returns a reference to <code>this</code> for easy method chaining
1634     */
1635    public MedicinalProductPharmaceutical setRouteOfAdministration(List<MedicinalProductPharmaceuticalRouteOfAdministrationComponent> theRouteOfAdministration) { 
1636      this.routeOfAdministration = theRouteOfAdministration;
1637      return this;
1638    }
1639
1640    public boolean hasRouteOfAdministration() { 
1641      if (this.routeOfAdministration == null)
1642        return false;
1643      for (MedicinalProductPharmaceuticalRouteOfAdministrationComponent item : this.routeOfAdministration)
1644        if (!item.isEmpty())
1645          return true;
1646      return false;
1647    }
1648
1649    public MedicinalProductPharmaceuticalRouteOfAdministrationComponent addRouteOfAdministration() { //3
1650      MedicinalProductPharmaceuticalRouteOfAdministrationComponent t = new MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
1651      if (this.routeOfAdministration == null)
1652        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1653      this.routeOfAdministration.add(t);
1654      return t;
1655    }
1656
1657    public MedicinalProductPharmaceutical addRouteOfAdministration(MedicinalProductPharmaceuticalRouteOfAdministrationComponent t) { //3
1658      if (t == null)
1659        return this;
1660      if (this.routeOfAdministration == null)
1661        this.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1662      this.routeOfAdministration.add(t);
1663      return this;
1664    }
1665
1666    /**
1667     * @return The first repetition of repeating field {@link #routeOfAdministration}, creating it if it does not already exist
1668     */
1669    public MedicinalProductPharmaceuticalRouteOfAdministrationComponent getRouteOfAdministrationFirstRep() { 
1670      if (getRouteOfAdministration().isEmpty()) {
1671        addRouteOfAdministration();
1672      }
1673      return getRouteOfAdministration().get(0);
1674    }
1675
1676      protected void listChildren(List<Property> children) {
1677        super.listChildren(children);
1678        children.add(new Property("identifier", "Identifier", "An identifier for the pharmaceutical medicinal product.", 0, java.lang.Integer.MAX_VALUE, identifier));
1679        children.add(new Property("administrableDoseForm", "CodeableConcept", "The administrable dose form, after necessary reconstitution.", 0, 1, administrableDoseForm));
1680        children.add(new Property("unitOfPresentation", "CodeableConcept", "Todo.", 0, 1, unitOfPresentation));
1681        children.add(new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0, java.lang.Integer.MAX_VALUE, ingredient));
1682        children.add(new Property("device", "Reference(DeviceDefinition)", "Accompanying device.", 0, java.lang.Integer.MAX_VALUE, device));
1683        children.add(new Property("characteristics", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, characteristics));
1684        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));
1685      }
1686
1687      @Override
1688      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1689        switch (_hash) {
1690        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "An identifier for the pharmaceutical medicinal product.", 0, java.lang.Integer.MAX_VALUE, identifier);
1691        case 1446105202: /*administrableDoseForm*/  return new Property("administrableDoseForm", "CodeableConcept", "The administrable dose form, after necessary reconstitution.", 0, 1, administrableDoseForm);
1692        case -1427765963: /*unitOfPresentation*/  return new Property("unitOfPresentation", "CodeableConcept", "Todo.", 0, 1, unitOfPresentation);
1693        case -206409263: /*ingredient*/  return new Property("ingredient", "Reference(MedicinalProductIngredient)", "Ingredient.", 0, java.lang.Integer.MAX_VALUE, ingredient);
1694        case -1335157162: /*device*/  return new Property("device", "Reference(DeviceDefinition)", "Accompanying device.", 0, java.lang.Integer.MAX_VALUE, device);
1695        case -1529171400: /*characteristics*/  return new Property("characteristics", "", "Characteristics e.g. a products onset of action.", 0, java.lang.Integer.MAX_VALUE, characteristics);
1696        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);
1697        default: return super.getNamedProperty(_hash, _name, _checkValid);
1698        }
1699
1700      }
1701
1702      @Override
1703      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1704        switch (hash) {
1705        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1706        case 1446105202: /*administrableDoseForm*/ return this.administrableDoseForm == null ? new Base[0] : new Base[] {this.administrableDoseForm}; // CodeableConcept
1707        case -1427765963: /*unitOfPresentation*/ return this.unitOfPresentation == null ? new Base[0] : new Base[] {this.unitOfPresentation}; // CodeableConcept
1708        case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // Reference
1709        case -1335157162: /*device*/ return this.device == null ? new Base[0] : this.device.toArray(new Base[this.device.size()]); // Reference
1710        case -1529171400: /*characteristics*/ return this.characteristics == null ? new Base[0] : this.characteristics.toArray(new Base[this.characteristics.size()]); // MedicinalProductPharmaceuticalCharacteristicsComponent
1711        case 1742084734: /*routeOfAdministration*/ return this.routeOfAdministration == null ? new Base[0] : this.routeOfAdministration.toArray(new Base[this.routeOfAdministration.size()]); // MedicinalProductPharmaceuticalRouteOfAdministrationComponent
1712        default: return super.getProperty(hash, name, checkValid);
1713        }
1714
1715      }
1716
1717      @Override
1718      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1719        switch (hash) {
1720        case -1618432855: // identifier
1721          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1722          return value;
1723        case 1446105202: // administrableDoseForm
1724          this.administrableDoseForm = castToCodeableConcept(value); // CodeableConcept
1725          return value;
1726        case -1427765963: // unitOfPresentation
1727          this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept
1728          return value;
1729        case -206409263: // ingredient
1730          this.getIngredient().add(castToReference(value)); // Reference
1731          return value;
1732        case -1335157162: // device
1733          this.getDevice().add(castToReference(value)); // Reference
1734          return value;
1735        case -1529171400: // characteristics
1736          this.getCharacteristics().add((MedicinalProductPharmaceuticalCharacteristicsComponent) value); // MedicinalProductPharmaceuticalCharacteristicsComponent
1737          return value;
1738        case 1742084734: // routeOfAdministration
1739          this.getRouteOfAdministration().add((MedicinalProductPharmaceuticalRouteOfAdministrationComponent) value); // MedicinalProductPharmaceuticalRouteOfAdministrationComponent
1740          return value;
1741        default: return super.setProperty(hash, name, value);
1742        }
1743
1744      }
1745
1746      @Override
1747      public Base setProperty(String name, Base value) throws FHIRException {
1748        if (name.equals("identifier")) {
1749          this.getIdentifier().add(castToIdentifier(value));
1750        } else if (name.equals("administrableDoseForm")) {
1751          this.administrableDoseForm = castToCodeableConcept(value); // CodeableConcept
1752        } else if (name.equals("unitOfPresentation")) {
1753          this.unitOfPresentation = castToCodeableConcept(value); // CodeableConcept
1754        } else if (name.equals("ingredient")) {
1755          this.getIngredient().add(castToReference(value));
1756        } else if (name.equals("device")) {
1757          this.getDevice().add(castToReference(value));
1758        } else if (name.equals("characteristics")) {
1759          this.getCharacteristics().add((MedicinalProductPharmaceuticalCharacteristicsComponent) value);
1760        } else if (name.equals("routeOfAdministration")) {
1761          this.getRouteOfAdministration().add((MedicinalProductPharmaceuticalRouteOfAdministrationComponent) value);
1762        } else
1763          return super.setProperty(name, value);
1764        return value;
1765      }
1766
1767      @Override
1768      public Base makeProperty(int hash, String name) throws FHIRException {
1769        switch (hash) {
1770        case -1618432855:  return addIdentifier(); 
1771        case 1446105202:  return getAdministrableDoseForm(); 
1772        case -1427765963:  return getUnitOfPresentation(); 
1773        case -206409263:  return addIngredient(); 
1774        case -1335157162:  return addDevice(); 
1775        case -1529171400:  return addCharacteristics(); 
1776        case 1742084734:  return addRouteOfAdministration(); 
1777        default: return super.makeProperty(hash, name);
1778        }
1779
1780      }
1781
1782      @Override
1783      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1784        switch (hash) {
1785        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1786        case 1446105202: /*administrableDoseForm*/ return new String[] {"CodeableConcept"};
1787        case -1427765963: /*unitOfPresentation*/ return new String[] {"CodeableConcept"};
1788        case -206409263: /*ingredient*/ return new String[] {"Reference"};
1789        case -1335157162: /*device*/ return new String[] {"Reference"};
1790        case -1529171400: /*characteristics*/ return new String[] {};
1791        case 1742084734: /*routeOfAdministration*/ return new String[] {};
1792        default: return super.getTypesForProperty(hash, name);
1793        }
1794
1795      }
1796
1797      @Override
1798      public Base addChild(String name) throws FHIRException {
1799        if (name.equals("identifier")) {
1800          return addIdentifier();
1801        }
1802        else if (name.equals("administrableDoseForm")) {
1803          this.administrableDoseForm = new CodeableConcept();
1804          return this.administrableDoseForm;
1805        }
1806        else if (name.equals("unitOfPresentation")) {
1807          this.unitOfPresentation = new CodeableConcept();
1808          return this.unitOfPresentation;
1809        }
1810        else if (name.equals("ingredient")) {
1811          return addIngredient();
1812        }
1813        else if (name.equals("device")) {
1814          return addDevice();
1815        }
1816        else if (name.equals("characteristics")) {
1817          return addCharacteristics();
1818        }
1819        else if (name.equals("routeOfAdministration")) {
1820          return addRouteOfAdministration();
1821        }
1822        else
1823          return super.addChild(name);
1824      }
1825
1826  public String fhirType() {
1827    return "MedicinalProductPharmaceutical";
1828
1829  }
1830
1831      public MedicinalProductPharmaceutical copy() {
1832        MedicinalProductPharmaceutical dst = new MedicinalProductPharmaceutical();
1833        copyValues(dst);
1834        if (identifier != null) {
1835          dst.identifier = new ArrayList<Identifier>();
1836          for (Identifier i : identifier)
1837            dst.identifier.add(i.copy());
1838        };
1839        dst.administrableDoseForm = administrableDoseForm == null ? null : administrableDoseForm.copy();
1840        dst.unitOfPresentation = unitOfPresentation == null ? null : unitOfPresentation.copy();
1841        if (ingredient != null) {
1842          dst.ingredient = new ArrayList<Reference>();
1843          for (Reference i : ingredient)
1844            dst.ingredient.add(i.copy());
1845        };
1846        if (device != null) {
1847          dst.device = new ArrayList<Reference>();
1848          for (Reference i : device)
1849            dst.device.add(i.copy());
1850        };
1851        if (characteristics != null) {
1852          dst.characteristics = new ArrayList<MedicinalProductPharmaceuticalCharacteristicsComponent>();
1853          for (MedicinalProductPharmaceuticalCharacteristicsComponent i : characteristics)
1854            dst.characteristics.add(i.copy());
1855        };
1856        if (routeOfAdministration != null) {
1857          dst.routeOfAdministration = new ArrayList<MedicinalProductPharmaceuticalRouteOfAdministrationComponent>();
1858          for (MedicinalProductPharmaceuticalRouteOfAdministrationComponent i : routeOfAdministration)
1859            dst.routeOfAdministration.add(i.copy());
1860        };
1861        return dst;
1862      }
1863
1864      protected MedicinalProductPharmaceutical typedCopy() {
1865        return copy();
1866      }
1867
1868      @Override
1869      public boolean equalsDeep(Base other_) {
1870        if (!super.equalsDeep(other_))
1871          return false;
1872        if (!(other_ instanceof MedicinalProductPharmaceutical))
1873          return false;
1874        MedicinalProductPharmaceutical o = (MedicinalProductPharmaceutical) other_;
1875        return compareDeep(identifier, o.identifier, true) && compareDeep(administrableDoseForm, o.administrableDoseForm, true)
1876           && compareDeep(unitOfPresentation, o.unitOfPresentation, true) && compareDeep(ingredient, o.ingredient, true)
1877           && compareDeep(device, o.device, true) && compareDeep(characteristics, o.characteristics, true)
1878           && compareDeep(routeOfAdministration, o.routeOfAdministration, true);
1879      }
1880
1881      @Override
1882      public boolean equalsShallow(Base other_) {
1883        if (!super.equalsShallow(other_))
1884          return false;
1885        if (!(other_ instanceof MedicinalProductPharmaceutical))
1886          return false;
1887        MedicinalProductPharmaceutical o = (MedicinalProductPharmaceutical) other_;
1888        return true;
1889      }
1890
1891      public boolean isEmpty() {
1892        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, administrableDoseForm
1893          , unitOfPresentation, ingredient, device, characteristics, routeOfAdministration);
1894      }
1895
1896  @Override
1897  public ResourceType getResourceType() {
1898    return ResourceType.MedicinalProductPharmaceutical;
1899   }
1900
1901 /**
1902   * Search parameter: <b>identifier</b>
1903   * <p>
1904   * Description: <b>An identifier for the pharmaceutical medicinal product</b><br>
1905   * Type: <b>token</b><br>
1906   * Path: <b>MedicinalProductPharmaceutical.identifier</b><br>
1907   * </p>
1908   */
1909  @SearchParamDefinition(name="identifier", path="MedicinalProductPharmaceutical.identifier", description="An identifier for the pharmaceutical medicinal product", type="token" )
1910  public static final String SP_IDENTIFIER = "identifier";
1911 /**
1912   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1913   * <p>
1914   * Description: <b>An identifier for the pharmaceutical medicinal product</b><br>
1915   * Type: <b>token</b><br>
1916   * Path: <b>MedicinalProductPharmaceutical.identifier</b><br>
1917   * </p>
1918   */
1919  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1920
1921 /**
1922   * Search parameter: <b>route</b>
1923   * <p>
1924   * Description: <b>Coded expression for the route</b><br>
1925   * Type: <b>token</b><br>
1926   * Path: <b>MedicinalProductPharmaceutical.routeOfAdministration.code</b><br>
1927   * </p>
1928   */
1929  @SearchParamDefinition(name="route", path="MedicinalProductPharmaceutical.routeOfAdministration.code", description="Coded expression for the route", type="token" )
1930  public static final String SP_ROUTE = "route";
1931 /**
1932   * <b>Fluent Client</b> search parameter constant for <b>route</b>
1933   * <p>
1934   * Description: <b>Coded expression for the route</b><br>
1935   * Type: <b>token</b><br>
1936   * Path: <b>MedicinalProductPharmaceutical.routeOfAdministration.code</b><br>
1937   * </p>
1938   */
1939  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ROUTE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ROUTE);
1940
1941 /**
1942   * Search parameter: <b>target-species</b>
1943   * <p>
1944   * Description: <b>Coded expression for the species</b><br>
1945   * Type: <b>token</b><br>
1946   * Path: <b>MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies.code</b><br>
1947   * </p>
1948   */
1949  @SearchParamDefinition(name="target-species", path="MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies.code", description="Coded expression for the species", type="token" )
1950  public static final String SP_TARGET_SPECIES = "target-species";
1951 /**
1952   * <b>Fluent Client</b> search parameter constant for <b>target-species</b>
1953   * <p>
1954   * Description: <b>Coded expression for the species</b><br>
1955   * Type: <b>token</b><br>
1956   * Path: <b>MedicinalProductPharmaceutical.routeOfAdministration.targetSpecies.code</b><br>
1957   * </p>
1958   */
1959  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TARGET_SPECIES = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TARGET_SPECIES);
1960
1961
1962}
1963