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