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