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