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 java.math.*;
058import org.hl7.fhir.utilities.Utilities;
059import org.hl7.fhir.r5.model.Enumerations.*;
060import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
061import org.hl7.fhir.exceptions.FHIRException;
062import org.hl7.fhir.instance.model.api.ICompositeType;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
065import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
066import ca.uhn.fhir.model.api.annotation.Child;
067import ca.uhn.fhir.model.api.annotation.ChildOrder;
068import ca.uhn.fhir.model.api.annotation.Description;
069import ca.uhn.fhir.model.api.annotation.Block;
070
071/**
072 * Set of definitional characteristics for a kind of observation or measurement produced or consumed by an orderable health care service.
073 */
074@ResourceDef(name="ObservationDefinition", profile="http://hl7.org/fhir/StructureDefinition/ObservationDefinition")
075public class ObservationDefinition extends DomainResource {
076
077    public enum ObservationDataType {
078        /**
079         * A measured amount.
080         */
081        QUANTITY, 
082        /**
083         * A coded concept from a reference terminology and/or text.
084         */
085        CODEABLECONCEPT, 
086        /**
087         * A sequence of Unicode characters.
088         */
089        STRING, 
090        /**
091         * true or false.
092         */
093        BOOLEAN, 
094        /**
095         * A signed integer.
096         */
097        INTEGER, 
098        /**
099         * A set of values bounded by low and high.
100         */
101        RANGE, 
102        /**
103         * A ratio of two Quantity values - a numerator and a denominator.
104         */
105        RATIO, 
106        /**
107         * A series of measurements taken by a device.
108         */
109        SAMPLEDDATA, 
110        /**
111         * A time during the day, in the format hh:mm:ss.
112         */
113        TIME, 
114        /**
115         * A date, date-time or partial date (e.g. just year or year + month) as used in human communication.
116         */
117        DATETIME, 
118        /**
119         * A time range defined by start and end date/time.
120         */
121        PERIOD, 
122        /**
123         * added to help the parsers with the generic types
124         */
125        NULL;
126        public static ObservationDataType fromCode(String codeString) throws FHIRException {
127            if (codeString == null || "".equals(codeString))
128                return null;
129        if ("Quantity".equals(codeString))
130          return QUANTITY;
131        if ("CodeableConcept".equals(codeString))
132          return CODEABLECONCEPT;
133        if ("string".equals(codeString))
134          return STRING;
135        if ("boolean".equals(codeString))
136          return BOOLEAN;
137        if ("integer".equals(codeString))
138          return INTEGER;
139        if ("Range".equals(codeString))
140          return RANGE;
141        if ("Ratio".equals(codeString))
142          return RATIO;
143        if ("SampledData".equals(codeString))
144          return SAMPLEDDATA;
145        if ("time".equals(codeString))
146          return TIME;
147        if ("dateTime".equals(codeString))
148          return DATETIME;
149        if ("Period".equals(codeString))
150          return PERIOD;
151        if (Configuration.isAcceptInvalidEnums())
152          return null;
153        else
154          throw new FHIRException("Unknown ObservationDataType code '"+codeString+"'");
155        }
156        public String toCode() {
157          switch (this) {
158            case QUANTITY: return "Quantity";
159            case CODEABLECONCEPT: return "CodeableConcept";
160            case STRING: return "string";
161            case BOOLEAN: return "boolean";
162            case INTEGER: return "integer";
163            case RANGE: return "Range";
164            case RATIO: return "Ratio";
165            case SAMPLEDDATA: return "SampledData";
166            case TIME: return "time";
167            case DATETIME: return "dateTime";
168            case PERIOD: return "Period";
169            default: return "?";
170          }
171        }
172        public String getSystem() {
173          switch (this) {
174            case QUANTITY: return "http://hl7.org/fhir/permitted-data-type";
175            case CODEABLECONCEPT: return "http://hl7.org/fhir/permitted-data-type";
176            case STRING: return "http://hl7.org/fhir/permitted-data-type";
177            case BOOLEAN: return "http://hl7.org/fhir/permitted-data-type";
178            case INTEGER: return "http://hl7.org/fhir/permitted-data-type";
179            case RANGE: return "http://hl7.org/fhir/permitted-data-type";
180            case RATIO: return "http://hl7.org/fhir/permitted-data-type";
181            case SAMPLEDDATA: return "http://hl7.org/fhir/permitted-data-type";
182            case TIME: return "http://hl7.org/fhir/permitted-data-type";
183            case DATETIME: return "http://hl7.org/fhir/permitted-data-type";
184            case PERIOD: return "http://hl7.org/fhir/permitted-data-type";
185            default: return "?";
186          }
187        }
188        public String getDefinition() {
189          switch (this) {
190            case QUANTITY: return "A measured amount.";
191            case CODEABLECONCEPT: return "A coded concept from a reference terminology and/or text.";
192            case STRING: return "A sequence of Unicode characters.";
193            case BOOLEAN: return "true or false.";
194            case INTEGER: return "A signed integer.";
195            case RANGE: return "A set of values bounded by low and high.";
196            case RATIO: return "A ratio of two Quantity values - a numerator and a denominator.";
197            case SAMPLEDDATA: return "A series of measurements taken by a device.";
198            case TIME: return "A time during the day, in the format hh:mm:ss.";
199            case DATETIME: return "A date, date-time or partial date (e.g. just year or year + month) as used in human communication.";
200            case PERIOD: return "A time range defined by start and end date/time.";
201            default: return "?";
202          }
203        }
204        public String getDisplay() {
205          switch (this) {
206            case QUANTITY: return "Quantity";
207            case CODEABLECONCEPT: return "CodeableConcept";
208            case STRING: return "string";
209            case BOOLEAN: return "boolean";
210            case INTEGER: return "integer";
211            case RANGE: return "Range";
212            case RATIO: return "Ratio";
213            case SAMPLEDDATA: return "SampledData";
214            case TIME: return "time";
215            case DATETIME: return "dateTime";
216            case PERIOD: return "Period";
217            default: return "?";
218          }
219        }
220    }
221
222  public static class ObservationDataTypeEnumFactory implements EnumFactory<ObservationDataType> {
223    public ObservationDataType fromCode(String codeString) throws IllegalArgumentException {
224      if (codeString == null || "".equals(codeString))
225            if (codeString == null || "".equals(codeString))
226                return null;
227        if ("Quantity".equals(codeString))
228          return ObservationDataType.QUANTITY;
229        if ("CodeableConcept".equals(codeString))
230          return ObservationDataType.CODEABLECONCEPT;
231        if ("string".equals(codeString))
232          return ObservationDataType.STRING;
233        if ("boolean".equals(codeString))
234          return ObservationDataType.BOOLEAN;
235        if ("integer".equals(codeString))
236          return ObservationDataType.INTEGER;
237        if ("Range".equals(codeString))
238          return ObservationDataType.RANGE;
239        if ("Ratio".equals(codeString))
240          return ObservationDataType.RATIO;
241        if ("SampledData".equals(codeString))
242          return ObservationDataType.SAMPLEDDATA;
243        if ("time".equals(codeString))
244          return ObservationDataType.TIME;
245        if ("dateTime".equals(codeString))
246          return ObservationDataType.DATETIME;
247        if ("Period".equals(codeString))
248          return ObservationDataType.PERIOD;
249        throw new IllegalArgumentException("Unknown ObservationDataType code '"+codeString+"'");
250        }
251        public Enumeration<ObservationDataType> fromType(Base code) throws FHIRException {
252          if (code == null)
253            return null;
254          if (code.isEmpty())
255            return new Enumeration<ObservationDataType>(this);
256          String codeString = ((PrimitiveType) code).asStringValue();
257          if (codeString == null || "".equals(codeString))
258            return null;
259        if ("Quantity".equals(codeString))
260          return new Enumeration<ObservationDataType>(this, ObservationDataType.QUANTITY);
261        if ("CodeableConcept".equals(codeString))
262          return new Enumeration<ObservationDataType>(this, ObservationDataType.CODEABLECONCEPT);
263        if ("string".equals(codeString))
264          return new Enumeration<ObservationDataType>(this, ObservationDataType.STRING);
265        if ("boolean".equals(codeString))
266          return new Enumeration<ObservationDataType>(this, ObservationDataType.BOOLEAN);
267        if ("integer".equals(codeString))
268          return new Enumeration<ObservationDataType>(this, ObservationDataType.INTEGER);
269        if ("Range".equals(codeString))
270          return new Enumeration<ObservationDataType>(this, ObservationDataType.RANGE);
271        if ("Ratio".equals(codeString))
272          return new Enumeration<ObservationDataType>(this, ObservationDataType.RATIO);
273        if ("SampledData".equals(codeString))
274          return new Enumeration<ObservationDataType>(this, ObservationDataType.SAMPLEDDATA);
275        if ("time".equals(codeString))
276          return new Enumeration<ObservationDataType>(this, ObservationDataType.TIME);
277        if ("dateTime".equals(codeString))
278          return new Enumeration<ObservationDataType>(this, ObservationDataType.DATETIME);
279        if ("Period".equals(codeString))
280          return new Enumeration<ObservationDataType>(this, ObservationDataType.PERIOD);
281        throw new FHIRException("Unknown ObservationDataType code '"+codeString+"'");
282        }
283    public String toCode(ObservationDataType code) {
284      if (code == ObservationDataType.QUANTITY)
285        return "Quantity";
286      if (code == ObservationDataType.CODEABLECONCEPT)
287        return "CodeableConcept";
288      if (code == ObservationDataType.STRING)
289        return "string";
290      if (code == ObservationDataType.BOOLEAN)
291        return "boolean";
292      if (code == ObservationDataType.INTEGER)
293        return "integer";
294      if (code == ObservationDataType.RANGE)
295        return "Range";
296      if (code == ObservationDataType.RATIO)
297        return "Ratio";
298      if (code == ObservationDataType.SAMPLEDDATA)
299        return "SampledData";
300      if (code == ObservationDataType.TIME)
301        return "time";
302      if (code == ObservationDataType.DATETIME)
303        return "dateTime";
304      if (code == ObservationDataType.PERIOD)
305        return "Period";
306      return "?";
307      }
308    public String toSystem(ObservationDataType code) {
309      return code.getSystem();
310      }
311    }
312
313    public enum ObservationRangeCategory {
314        /**
315         * Reference (Normal) Range for Ordinal and Continuous Observations.
316         */
317        REFERENCE, 
318        /**
319         * Critical Range for Ordinal and Continuous Observations. Results outside this range are critical.
320         */
321        CRITICAL, 
322        /**
323         * Absolute Range for Ordinal and Continuous Observations. Results outside this range are not possible.
324         */
325        ABSOLUTE, 
326        /**
327         * added to help the parsers with the generic types
328         */
329        NULL;
330        public static ObservationRangeCategory fromCode(String codeString) throws FHIRException {
331            if (codeString == null || "".equals(codeString))
332                return null;
333        if ("reference".equals(codeString))
334          return REFERENCE;
335        if ("critical".equals(codeString))
336          return CRITICAL;
337        if ("absolute".equals(codeString))
338          return ABSOLUTE;
339        if (Configuration.isAcceptInvalidEnums())
340          return null;
341        else
342          throw new FHIRException("Unknown ObservationRangeCategory code '"+codeString+"'");
343        }
344        public String toCode() {
345          switch (this) {
346            case REFERENCE: return "reference";
347            case CRITICAL: return "critical";
348            case ABSOLUTE: return "absolute";
349            default: return "?";
350          }
351        }
352        public String getSystem() {
353          switch (this) {
354            case REFERENCE: return "http://hl7.org/fhir/observation-range-category";
355            case CRITICAL: return "http://hl7.org/fhir/observation-range-category";
356            case ABSOLUTE: return "http://hl7.org/fhir/observation-range-category";
357            default: return "?";
358          }
359        }
360        public String getDefinition() {
361          switch (this) {
362            case REFERENCE: return "Reference (Normal) Range for Ordinal and Continuous Observations.";
363            case CRITICAL: return "Critical Range for Ordinal and Continuous Observations. Results outside this range are critical.";
364            case ABSOLUTE: return "Absolute Range for Ordinal and Continuous Observations. Results outside this range are not possible.";
365            default: return "?";
366          }
367        }
368        public String getDisplay() {
369          switch (this) {
370            case REFERENCE: return "reference range";
371            case CRITICAL: return "critical range";
372            case ABSOLUTE: return "absolute range";
373            default: return "?";
374          }
375        }
376    }
377
378  public static class ObservationRangeCategoryEnumFactory implements EnumFactory<ObservationRangeCategory> {
379    public ObservationRangeCategory fromCode(String codeString) throws IllegalArgumentException {
380      if (codeString == null || "".equals(codeString))
381            if (codeString == null || "".equals(codeString))
382                return null;
383        if ("reference".equals(codeString))
384          return ObservationRangeCategory.REFERENCE;
385        if ("critical".equals(codeString))
386          return ObservationRangeCategory.CRITICAL;
387        if ("absolute".equals(codeString))
388          return ObservationRangeCategory.ABSOLUTE;
389        throw new IllegalArgumentException("Unknown ObservationRangeCategory code '"+codeString+"'");
390        }
391        public Enumeration<ObservationRangeCategory> fromType(Base code) throws FHIRException {
392          if (code == null)
393            return null;
394          if (code.isEmpty())
395            return new Enumeration<ObservationRangeCategory>(this);
396          String codeString = ((PrimitiveType) code).asStringValue();
397          if (codeString == null || "".equals(codeString))
398            return null;
399        if ("reference".equals(codeString))
400          return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.REFERENCE);
401        if ("critical".equals(codeString))
402          return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.CRITICAL);
403        if ("absolute".equals(codeString))
404          return new Enumeration<ObservationRangeCategory>(this, ObservationRangeCategory.ABSOLUTE);
405        throw new FHIRException("Unknown ObservationRangeCategory code '"+codeString+"'");
406        }
407    public String toCode(ObservationRangeCategory code) {
408      if (code == ObservationRangeCategory.REFERENCE)
409        return "reference";
410      if (code == ObservationRangeCategory.CRITICAL)
411        return "critical";
412      if (code == ObservationRangeCategory.ABSOLUTE)
413        return "absolute";
414      return "?";
415      }
416    public String toSystem(ObservationRangeCategory code) {
417      return code.getSystem();
418      }
419    }
420
421    @Block()
422    public static class ObservationDefinitionQuantitativeDetailsComponent extends BackboneElement implements IBaseBackboneElement {
423        /**
424         * Customary unit used to report quantitative results of observations conforming to this ObservationDefinition.
425         */
426        @Child(name = "customaryUnit", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
427        @Description(shortDefinition="Customary unit for quantitative results", formalDefinition="Customary unit used to report quantitative results of observations conforming to this ObservationDefinition." )
428        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ucum-units")
429        protected CodeableConcept customaryUnit;
430
431        /**
432         * SI unit used to report quantitative results of observations conforming to this ObservationDefinition.
433         */
434        @Child(name = "unit", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
435        @Description(shortDefinition="SI unit for quantitative results", formalDefinition="SI unit used to report quantitative results of observations conforming to this ObservationDefinition." )
436        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ucum-units")
437        protected CodeableConcept unit;
438
439        /**
440         * Factor for converting value expressed with SI unit to value expressed with customary unit.
441         */
442        @Child(name = "conversionFactor", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
443        @Description(shortDefinition="SI to Customary unit conversion factor", formalDefinition="Factor for converting value expressed with SI unit to value expressed with customary unit." )
444        protected DecimalType conversionFactor;
445
446        /**
447         * Number of digits after decimal separator when the results of such observations are of type Quantity.
448         */
449        @Child(name = "decimalPrecision", type = {IntegerType.class}, order=4, min=0, max=1, modifier=false, summary=false)
450        @Description(shortDefinition="Decimal precision of observation quantitative results", formalDefinition="Number of digits after decimal separator when the results of such observations are of type Quantity." )
451        protected IntegerType decimalPrecision;
452
453        private static final long serialVersionUID = 1790019610L;
454
455    /**
456     * Constructor
457     */
458      public ObservationDefinitionQuantitativeDetailsComponent() {
459        super();
460      }
461
462        /**
463         * @return {@link #customaryUnit} (Customary unit used to report quantitative results of observations conforming to this ObservationDefinition.)
464         */
465        public CodeableConcept getCustomaryUnit() { 
466          if (this.customaryUnit == null)
467            if (Configuration.errorOnAutoCreate())
468              throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.customaryUnit");
469            else if (Configuration.doAutoCreate())
470              this.customaryUnit = new CodeableConcept(); // cc
471          return this.customaryUnit;
472        }
473
474        public boolean hasCustomaryUnit() { 
475          return this.customaryUnit != null && !this.customaryUnit.isEmpty();
476        }
477
478        /**
479         * @param value {@link #customaryUnit} (Customary unit used to report quantitative results of observations conforming to this ObservationDefinition.)
480         */
481        public ObservationDefinitionQuantitativeDetailsComponent setCustomaryUnit(CodeableConcept value) { 
482          this.customaryUnit = value;
483          return this;
484        }
485
486        /**
487         * @return {@link #unit} (SI unit used to report quantitative results of observations conforming to this ObservationDefinition.)
488         */
489        public CodeableConcept getUnit() { 
490          if (this.unit == null)
491            if (Configuration.errorOnAutoCreate())
492              throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.unit");
493            else if (Configuration.doAutoCreate())
494              this.unit = new CodeableConcept(); // cc
495          return this.unit;
496        }
497
498        public boolean hasUnit() { 
499          return this.unit != null && !this.unit.isEmpty();
500        }
501
502        /**
503         * @param value {@link #unit} (SI unit used to report quantitative results of observations conforming to this ObservationDefinition.)
504         */
505        public ObservationDefinitionQuantitativeDetailsComponent setUnit(CodeableConcept value) { 
506          this.unit = value;
507          return this;
508        }
509
510        /**
511         * @return {@link #conversionFactor} (Factor for converting value expressed with SI unit to value expressed with customary unit.). This is the underlying object with id, value and extensions. The accessor "getConversionFactor" gives direct access to the value
512         */
513        public DecimalType getConversionFactorElement() { 
514          if (this.conversionFactor == null)
515            if (Configuration.errorOnAutoCreate())
516              throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.conversionFactor");
517            else if (Configuration.doAutoCreate())
518              this.conversionFactor = new DecimalType(); // bb
519          return this.conversionFactor;
520        }
521
522        public boolean hasConversionFactorElement() { 
523          return this.conversionFactor != null && !this.conversionFactor.isEmpty();
524        }
525
526        public boolean hasConversionFactor() { 
527          return this.conversionFactor != null && !this.conversionFactor.isEmpty();
528        }
529
530        /**
531         * @param value {@link #conversionFactor} (Factor for converting value expressed with SI unit to value expressed with customary unit.). This is the underlying object with id, value and extensions. The accessor "getConversionFactor" gives direct access to the value
532         */
533        public ObservationDefinitionQuantitativeDetailsComponent setConversionFactorElement(DecimalType value) { 
534          this.conversionFactor = value;
535          return this;
536        }
537
538        /**
539         * @return Factor for converting value expressed with SI unit to value expressed with customary unit.
540         */
541        public BigDecimal getConversionFactor() { 
542          return this.conversionFactor == null ? null : this.conversionFactor.getValue();
543        }
544
545        /**
546         * @param value Factor for converting value expressed with SI unit to value expressed with customary unit.
547         */
548        public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(BigDecimal value) { 
549          if (value == null)
550            this.conversionFactor = null;
551          else {
552            if (this.conversionFactor == null)
553              this.conversionFactor = new DecimalType();
554            this.conversionFactor.setValue(value);
555          }
556          return this;
557        }
558
559        /**
560         * @param value Factor for converting value expressed with SI unit to value expressed with customary unit.
561         */
562        public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(long value) { 
563              this.conversionFactor = new DecimalType();
564            this.conversionFactor.setValue(value);
565          return this;
566        }
567
568        /**
569         * @param value Factor for converting value expressed with SI unit to value expressed with customary unit.
570         */
571        public ObservationDefinitionQuantitativeDetailsComponent setConversionFactor(double value) { 
572              this.conversionFactor = new DecimalType();
573            this.conversionFactor.setValue(value);
574          return this;
575        }
576
577        /**
578         * @return {@link #decimalPrecision} (Number of digits after decimal separator when the results of such observations are of type Quantity.). This is the underlying object with id, value and extensions. The accessor "getDecimalPrecision" gives direct access to the value
579         */
580        public IntegerType getDecimalPrecisionElement() { 
581          if (this.decimalPrecision == null)
582            if (Configuration.errorOnAutoCreate())
583              throw new Error("Attempt to auto-create ObservationDefinitionQuantitativeDetailsComponent.decimalPrecision");
584            else if (Configuration.doAutoCreate())
585              this.decimalPrecision = new IntegerType(); // bb
586          return this.decimalPrecision;
587        }
588
589        public boolean hasDecimalPrecisionElement() { 
590          return this.decimalPrecision != null && !this.decimalPrecision.isEmpty();
591        }
592
593        public boolean hasDecimalPrecision() { 
594          return this.decimalPrecision != null && !this.decimalPrecision.isEmpty();
595        }
596
597        /**
598         * @param value {@link #decimalPrecision} (Number of digits after decimal separator when the results of such observations are of type Quantity.). This is the underlying object with id, value and extensions. The accessor "getDecimalPrecision" gives direct access to the value
599         */
600        public ObservationDefinitionQuantitativeDetailsComponent setDecimalPrecisionElement(IntegerType value) { 
601          this.decimalPrecision = value;
602          return this;
603        }
604
605        /**
606         * @return Number of digits after decimal separator when the results of such observations are of type Quantity.
607         */
608        public int getDecimalPrecision() { 
609          return this.decimalPrecision == null || this.decimalPrecision.isEmpty() ? 0 : this.decimalPrecision.getValue();
610        }
611
612        /**
613         * @param value Number of digits after decimal separator when the results of such observations are of type Quantity.
614         */
615        public ObservationDefinitionQuantitativeDetailsComponent setDecimalPrecision(int value) { 
616            if (this.decimalPrecision == null)
617              this.decimalPrecision = new IntegerType();
618            this.decimalPrecision.setValue(value);
619          return this;
620        }
621
622        protected void listChildren(List<Property> children) {
623          super.listChildren(children);
624          children.add(new Property("customaryUnit", "CodeableConcept", "Customary unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, customaryUnit));
625          children.add(new Property("unit", "CodeableConcept", "SI unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, unit));
626          children.add(new Property("conversionFactor", "decimal", "Factor for converting value expressed with SI unit to value expressed with customary unit.", 0, 1, conversionFactor));
627          children.add(new Property("decimalPrecision", "integer", "Number of digits after decimal separator when the results of such observations are of type Quantity.", 0, 1, decimalPrecision));
628        }
629
630        @Override
631        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
632          switch (_hash) {
633          case -1375586437: /*customaryUnit*/  return new Property("customaryUnit", "CodeableConcept", "Customary unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, customaryUnit);
634          case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "SI unit used to report quantitative results of observations conforming to this ObservationDefinition.", 0, 1, unit);
635          case 1438876165: /*conversionFactor*/  return new Property("conversionFactor", "decimal", "Factor for converting value expressed with SI unit to value expressed with customary unit.", 0, 1, conversionFactor);
636          case -1564447699: /*decimalPrecision*/  return new Property("decimalPrecision", "integer", "Number of digits after decimal separator when the results of such observations are of type Quantity.", 0, 1, decimalPrecision);
637          default: return super.getNamedProperty(_hash, _name, _checkValid);
638          }
639
640        }
641
642      @Override
643      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
644        switch (hash) {
645        case -1375586437: /*customaryUnit*/ return this.customaryUnit == null ? new Base[0] : new Base[] {this.customaryUnit}; // CodeableConcept
646        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
647        case 1438876165: /*conversionFactor*/ return this.conversionFactor == null ? new Base[0] : new Base[] {this.conversionFactor}; // DecimalType
648        case -1564447699: /*decimalPrecision*/ return this.decimalPrecision == null ? new Base[0] : new Base[] {this.decimalPrecision}; // IntegerType
649        default: return super.getProperty(hash, name, checkValid);
650        }
651
652      }
653
654      @Override
655      public Base setProperty(int hash, String name, Base value) throws FHIRException {
656        switch (hash) {
657        case -1375586437: // customaryUnit
658          this.customaryUnit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
659          return value;
660        case 3594628: // unit
661          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
662          return value;
663        case 1438876165: // conversionFactor
664          this.conversionFactor = TypeConvertor.castToDecimal(value); // DecimalType
665          return value;
666        case -1564447699: // decimalPrecision
667          this.decimalPrecision = TypeConvertor.castToInteger(value); // IntegerType
668          return value;
669        default: return super.setProperty(hash, name, value);
670        }
671
672      }
673
674      @Override
675      public Base setProperty(String name, Base value) throws FHIRException {
676        if (name.equals("customaryUnit")) {
677          this.customaryUnit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
678        } else if (name.equals("unit")) {
679          this.unit = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
680        } else if (name.equals("conversionFactor")) {
681          this.conversionFactor = TypeConvertor.castToDecimal(value); // DecimalType
682        } else if (name.equals("decimalPrecision")) {
683          this.decimalPrecision = TypeConvertor.castToInteger(value); // IntegerType
684        } else
685          return super.setProperty(name, value);
686        return value;
687      }
688
689      @Override
690      public Base makeProperty(int hash, String name) throws FHIRException {
691        switch (hash) {
692        case -1375586437:  return getCustomaryUnit();
693        case 3594628:  return getUnit();
694        case 1438876165:  return getConversionFactorElement();
695        case -1564447699:  return getDecimalPrecisionElement();
696        default: return super.makeProperty(hash, name);
697        }
698
699      }
700
701      @Override
702      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
703        switch (hash) {
704        case -1375586437: /*customaryUnit*/ return new String[] {"CodeableConcept"};
705        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
706        case 1438876165: /*conversionFactor*/ return new String[] {"decimal"};
707        case -1564447699: /*decimalPrecision*/ return new String[] {"integer"};
708        default: return super.getTypesForProperty(hash, name);
709        }
710
711      }
712
713      @Override
714      public Base addChild(String name) throws FHIRException {
715        if (name.equals("customaryUnit")) {
716          this.customaryUnit = new CodeableConcept();
717          return this.customaryUnit;
718        }
719        else if (name.equals("unit")) {
720          this.unit = new CodeableConcept();
721          return this.unit;
722        }
723        else if (name.equals("conversionFactor")) {
724          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.quantitativeDetails.conversionFactor");
725        }
726        else if (name.equals("decimalPrecision")) {
727          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.quantitativeDetails.decimalPrecision");
728        }
729        else
730          return super.addChild(name);
731      }
732
733      public ObservationDefinitionQuantitativeDetailsComponent copy() {
734        ObservationDefinitionQuantitativeDetailsComponent dst = new ObservationDefinitionQuantitativeDetailsComponent();
735        copyValues(dst);
736        return dst;
737      }
738
739      public void copyValues(ObservationDefinitionQuantitativeDetailsComponent dst) {
740        super.copyValues(dst);
741        dst.customaryUnit = customaryUnit == null ? null : customaryUnit.copy();
742        dst.unit = unit == null ? null : unit.copy();
743        dst.conversionFactor = conversionFactor == null ? null : conversionFactor.copy();
744        dst.decimalPrecision = decimalPrecision == null ? null : decimalPrecision.copy();
745      }
746
747      @Override
748      public boolean equalsDeep(Base other_) {
749        if (!super.equalsDeep(other_))
750          return false;
751        if (!(other_ instanceof ObservationDefinitionQuantitativeDetailsComponent))
752          return false;
753        ObservationDefinitionQuantitativeDetailsComponent o = (ObservationDefinitionQuantitativeDetailsComponent) other_;
754        return compareDeep(customaryUnit, o.customaryUnit, true) && compareDeep(unit, o.unit, true) && compareDeep(conversionFactor, o.conversionFactor, true)
755           && compareDeep(decimalPrecision, o.decimalPrecision, true);
756      }
757
758      @Override
759      public boolean equalsShallow(Base other_) {
760        if (!super.equalsShallow(other_))
761          return false;
762        if (!(other_ instanceof ObservationDefinitionQuantitativeDetailsComponent))
763          return false;
764        ObservationDefinitionQuantitativeDetailsComponent o = (ObservationDefinitionQuantitativeDetailsComponent) other_;
765        return compareValues(conversionFactor, o.conversionFactor, true) && compareValues(decimalPrecision, o.decimalPrecision, true)
766          ;
767      }
768
769      public boolean isEmpty() {
770        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(customaryUnit, unit, conversionFactor
771          , decimalPrecision);
772      }
773
774  public String fhirType() {
775    return "ObservationDefinition.quantitativeDetails";
776
777  }
778
779  }
780
781    @Block()
782    public static class ObservationDefinitionQualifiedIntervalComponent extends BackboneElement implements IBaseBackboneElement {
783        /**
784         * The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.
785         */
786        @Child(name = "category", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
787        @Description(shortDefinition="reference | critical | absolute", formalDefinition="The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition." )
788        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-range-category")
789        protected Enumeration<ObservationRangeCategory> category;
790
791        /**
792         * The low and high values determining the interval. There may be only one of the two.
793         */
794        @Child(name = "range", type = {Range.class}, order=2, min=0, max=1, modifier=false, summary=false)
795        @Description(shortDefinition="The interval itself, for continuous or ordinal observations", formalDefinition="The low and high values determining the interval. There may be only one of the two." )
796        protected Range range;
797
798        /**
799         * Codes to indicate the health context the range applies to. For example, the normal or therapeutic range.
800         */
801        @Child(name = "context", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
802        @Description(shortDefinition="Range context qualifier", formalDefinition="Codes to indicate the health context the range applies to. For example, the normal or therapeutic range." )
803        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/referencerange-meaning")
804        protected CodeableConcept context;
805
806        /**
807         * Codes to indicate the target population this reference range applies to.
808         */
809        @Child(name = "appliesTo", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
810        @Description(shortDefinition="Targetted population of the range", formalDefinition="Codes to indicate the target population this reference range applies to." )
811        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/referencerange-appliesto")
812        protected List<CodeableConcept> appliesTo;
813
814        /**
815         * Sex of the population the range applies to.
816         */
817        @Child(name = "gender", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
818        @Description(shortDefinition="male | female | other | unknown", formalDefinition="Sex of the population the range applies to." )
819        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/administrative-gender")
820        protected Enumeration<AdministrativeGender> gender;
821
822        /**
823         * The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.
824         */
825        @Child(name = "age", type = {Range.class}, order=6, min=0, max=1, modifier=false, summary=false)
826        @Description(shortDefinition="Applicable age range, if relevant", formalDefinition="The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so." )
827        protected Range age;
828
829        /**
830         * The gestational age to which this reference range is applicable, in the context of pregnancy.
831         */
832        @Child(name = "gestationalAge", type = {Range.class}, order=7, min=0, max=1, modifier=false, summary=false)
833        @Description(shortDefinition="Applicable gestational age range, if relevant", formalDefinition="The gestational age to which this reference range is applicable, in the context of pregnancy." )
834        protected Range gestationalAge;
835
836        /**
837         * Text based condition for which the reference range is valid.
838         */
839        @Child(name = "condition", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=false)
840        @Description(shortDefinition="Condition associated with the reference range", formalDefinition="Text based condition for which the reference range is valid." )
841        protected StringType condition;
842
843        private static final long serialVersionUID = -416423468L;
844
845    /**
846     * Constructor
847     */
848      public ObservationDefinitionQualifiedIntervalComponent() {
849        super();
850      }
851
852        /**
853         * @return {@link #category} (The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
854         */
855        public Enumeration<ObservationRangeCategory> getCategoryElement() { 
856          if (this.category == null)
857            if (Configuration.errorOnAutoCreate())
858              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.category");
859            else if (Configuration.doAutoCreate())
860              this.category = new Enumeration<ObservationRangeCategory>(new ObservationRangeCategoryEnumFactory()); // bb
861          return this.category;
862        }
863
864        public boolean hasCategoryElement() { 
865          return this.category != null && !this.category.isEmpty();
866        }
867
868        public boolean hasCategory() { 
869          return this.category != null && !this.category.isEmpty();
870        }
871
872        /**
873         * @param value {@link #category} (The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
874         */
875        public ObservationDefinitionQualifiedIntervalComponent setCategoryElement(Enumeration<ObservationRangeCategory> value) { 
876          this.category = value;
877          return this;
878        }
879
880        /**
881         * @return The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.
882         */
883        public ObservationRangeCategory getCategory() { 
884          return this.category == null ? null : this.category.getValue();
885        }
886
887        /**
888         * @param value The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.
889         */
890        public ObservationDefinitionQualifiedIntervalComponent setCategory(ObservationRangeCategory value) { 
891          if (value == null)
892            this.category = null;
893          else {
894            if (this.category == null)
895              this.category = new Enumeration<ObservationRangeCategory>(new ObservationRangeCategoryEnumFactory());
896            this.category.setValue(value);
897          }
898          return this;
899        }
900
901        /**
902         * @return {@link #range} (The low and high values determining the interval. There may be only one of the two.)
903         */
904        public Range getRange() { 
905          if (this.range == null)
906            if (Configuration.errorOnAutoCreate())
907              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.range");
908            else if (Configuration.doAutoCreate())
909              this.range = new Range(); // cc
910          return this.range;
911        }
912
913        public boolean hasRange() { 
914          return this.range != null && !this.range.isEmpty();
915        }
916
917        /**
918         * @param value {@link #range} (The low and high values determining the interval. There may be only one of the two.)
919         */
920        public ObservationDefinitionQualifiedIntervalComponent setRange(Range value) { 
921          this.range = value;
922          return this;
923        }
924
925        /**
926         * @return {@link #context} (Codes to indicate the health context the range applies to. For example, the normal or therapeutic range.)
927         */
928        public CodeableConcept getContext() { 
929          if (this.context == null)
930            if (Configuration.errorOnAutoCreate())
931              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.context");
932            else if (Configuration.doAutoCreate())
933              this.context = new CodeableConcept(); // cc
934          return this.context;
935        }
936
937        public boolean hasContext() { 
938          return this.context != null && !this.context.isEmpty();
939        }
940
941        /**
942         * @param value {@link #context} (Codes to indicate the health context the range applies to. For example, the normal or therapeutic range.)
943         */
944        public ObservationDefinitionQualifiedIntervalComponent setContext(CodeableConcept value) { 
945          this.context = value;
946          return this;
947        }
948
949        /**
950         * @return {@link #appliesTo} (Codes to indicate the target population this reference range applies to.)
951         */
952        public List<CodeableConcept> getAppliesTo() { 
953          if (this.appliesTo == null)
954            this.appliesTo = new ArrayList<CodeableConcept>();
955          return this.appliesTo;
956        }
957
958        /**
959         * @return Returns a reference to <code>this</code> for easy method chaining
960         */
961        public ObservationDefinitionQualifiedIntervalComponent setAppliesTo(List<CodeableConcept> theAppliesTo) { 
962          this.appliesTo = theAppliesTo;
963          return this;
964        }
965
966        public boolean hasAppliesTo() { 
967          if (this.appliesTo == null)
968            return false;
969          for (CodeableConcept item : this.appliesTo)
970            if (!item.isEmpty())
971              return true;
972          return false;
973        }
974
975        public CodeableConcept addAppliesTo() { //3
976          CodeableConcept t = new CodeableConcept();
977          if (this.appliesTo == null)
978            this.appliesTo = new ArrayList<CodeableConcept>();
979          this.appliesTo.add(t);
980          return t;
981        }
982
983        public ObservationDefinitionQualifiedIntervalComponent addAppliesTo(CodeableConcept t) { //3
984          if (t == null)
985            return this;
986          if (this.appliesTo == null)
987            this.appliesTo = new ArrayList<CodeableConcept>();
988          this.appliesTo.add(t);
989          return this;
990        }
991
992        /**
993         * @return The first repetition of repeating field {@link #appliesTo}, creating it if it does not already exist {3}
994         */
995        public CodeableConcept getAppliesToFirstRep() { 
996          if (getAppliesTo().isEmpty()) {
997            addAppliesTo();
998          }
999          return getAppliesTo().get(0);
1000        }
1001
1002        /**
1003         * @return {@link #gender} (Sex of the population the range applies to.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
1004         */
1005        public Enumeration<AdministrativeGender> getGenderElement() { 
1006          if (this.gender == null)
1007            if (Configuration.errorOnAutoCreate())
1008              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.gender");
1009            else if (Configuration.doAutoCreate())
1010              this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory()); // bb
1011          return this.gender;
1012        }
1013
1014        public boolean hasGenderElement() { 
1015          return this.gender != null && !this.gender.isEmpty();
1016        }
1017
1018        public boolean hasGender() { 
1019          return this.gender != null && !this.gender.isEmpty();
1020        }
1021
1022        /**
1023         * @param value {@link #gender} (Sex of the population the range applies to.). This is the underlying object with id, value and extensions. The accessor "getGender" gives direct access to the value
1024         */
1025        public ObservationDefinitionQualifiedIntervalComponent setGenderElement(Enumeration<AdministrativeGender> value) { 
1026          this.gender = value;
1027          return this;
1028        }
1029
1030        /**
1031         * @return Sex of the population the range applies to.
1032         */
1033        public AdministrativeGender getGender() { 
1034          return this.gender == null ? null : this.gender.getValue();
1035        }
1036
1037        /**
1038         * @param value Sex of the population the range applies to.
1039         */
1040        public ObservationDefinitionQualifiedIntervalComponent setGender(AdministrativeGender value) { 
1041          if (value == null)
1042            this.gender = null;
1043          else {
1044            if (this.gender == null)
1045              this.gender = new Enumeration<AdministrativeGender>(new AdministrativeGenderEnumFactory());
1046            this.gender.setValue(value);
1047          }
1048          return this;
1049        }
1050
1051        /**
1052         * @return {@link #age} (The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.)
1053         */
1054        public Range getAge() { 
1055          if (this.age == null)
1056            if (Configuration.errorOnAutoCreate())
1057              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.age");
1058            else if (Configuration.doAutoCreate())
1059              this.age = new Range(); // cc
1060          return this.age;
1061        }
1062
1063        public boolean hasAge() { 
1064          return this.age != null && !this.age.isEmpty();
1065        }
1066
1067        /**
1068         * @param value {@link #age} (The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.)
1069         */
1070        public ObservationDefinitionQualifiedIntervalComponent setAge(Range value) { 
1071          this.age = value;
1072          return this;
1073        }
1074
1075        /**
1076         * @return {@link #gestationalAge} (The gestational age to which this reference range is applicable, in the context of pregnancy.)
1077         */
1078        public Range getGestationalAge() { 
1079          if (this.gestationalAge == null)
1080            if (Configuration.errorOnAutoCreate())
1081              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.gestationalAge");
1082            else if (Configuration.doAutoCreate())
1083              this.gestationalAge = new Range(); // cc
1084          return this.gestationalAge;
1085        }
1086
1087        public boolean hasGestationalAge() { 
1088          return this.gestationalAge != null && !this.gestationalAge.isEmpty();
1089        }
1090
1091        /**
1092         * @param value {@link #gestationalAge} (The gestational age to which this reference range is applicable, in the context of pregnancy.)
1093         */
1094        public ObservationDefinitionQualifiedIntervalComponent setGestationalAge(Range value) { 
1095          this.gestationalAge = value;
1096          return this;
1097        }
1098
1099        /**
1100         * @return {@link #condition} (Text based condition for which the reference range is valid.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
1101         */
1102        public StringType getConditionElement() { 
1103          if (this.condition == null)
1104            if (Configuration.errorOnAutoCreate())
1105              throw new Error("Attempt to auto-create ObservationDefinitionQualifiedIntervalComponent.condition");
1106            else if (Configuration.doAutoCreate())
1107              this.condition = new StringType(); // bb
1108          return this.condition;
1109        }
1110
1111        public boolean hasConditionElement() { 
1112          return this.condition != null && !this.condition.isEmpty();
1113        }
1114
1115        public boolean hasCondition() { 
1116          return this.condition != null && !this.condition.isEmpty();
1117        }
1118
1119        /**
1120         * @param value {@link #condition} (Text based condition for which the reference range is valid.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
1121         */
1122        public ObservationDefinitionQualifiedIntervalComponent setConditionElement(StringType value) { 
1123          this.condition = value;
1124          return this;
1125        }
1126
1127        /**
1128         * @return Text based condition for which the reference range is valid.
1129         */
1130        public String getCondition() { 
1131          return this.condition == null ? null : this.condition.getValue();
1132        }
1133
1134        /**
1135         * @param value Text based condition for which the reference range is valid.
1136         */
1137        public ObservationDefinitionQualifiedIntervalComponent setCondition(String value) { 
1138          if (Utilities.noString(value))
1139            this.condition = null;
1140          else {
1141            if (this.condition == null)
1142              this.condition = new StringType();
1143            this.condition.setValue(value);
1144          }
1145          return this;
1146        }
1147
1148        protected void listChildren(List<Property> children) {
1149          super.listChildren(children);
1150          children.add(new Property("category", "code", "The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.", 0, 1, category));
1151          children.add(new Property("range", "Range", "The low and high values determining the interval. There may be only one of the two.", 0, 1, range));
1152          children.add(new Property("context", "CodeableConcept", "Codes to indicate the health context the range applies to. For example, the normal or therapeutic range.", 0, 1, context));
1153          children.add(new Property("appliesTo", "CodeableConcept", "Codes to indicate the target population this reference range applies to.", 0, java.lang.Integer.MAX_VALUE, appliesTo));
1154          children.add(new Property("gender", "code", "Sex of the population the range applies to.", 0, 1, gender));
1155          children.add(new Property("age", "Range", "The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.", 0, 1, age));
1156          children.add(new Property("gestationalAge", "Range", "The gestational age to which this reference range is applicable, in the context of pregnancy.", 0, 1, gestationalAge));
1157          children.add(new Property("condition", "string", "Text based condition for which the reference range is valid.", 0, 1, condition));
1158        }
1159
1160        @Override
1161        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1162          switch (_hash) {
1163          case 50511102: /*category*/  return new Property("category", "code", "The category of interval of values for continuous or ordinal observations conforming to this ObservationDefinition.", 0, 1, category);
1164          case 108280125: /*range*/  return new Property("range", "Range", "The low and high values determining the interval. There may be only one of the two.", 0, 1, range);
1165          case 951530927: /*context*/  return new Property("context", "CodeableConcept", "Codes to indicate the health context the range applies to. For example, the normal or therapeutic range.", 0, 1, context);
1166          case -2089924569: /*appliesTo*/  return new Property("appliesTo", "CodeableConcept", "Codes to indicate the target population this reference range applies to.", 0, java.lang.Integer.MAX_VALUE, appliesTo);
1167          case -1249512767: /*gender*/  return new Property("gender", "code", "Sex of the population the range applies to.", 0, 1, gender);
1168          case 96511: /*age*/  return new Property("age", "Range", "The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.", 0, 1, age);
1169          case -241217538: /*gestationalAge*/  return new Property("gestationalAge", "Range", "The gestational age to which this reference range is applicable, in the context of pregnancy.", 0, 1, gestationalAge);
1170          case -861311717: /*condition*/  return new Property("condition", "string", "Text based condition for which the reference range is valid.", 0, 1, condition);
1171          default: return super.getNamedProperty(_hash, _name, _checkValid);
1172          }
1173
1174        }
1175
1176      @Override
1177      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1178        switch (hash) {
1179        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Enumeration<ObservationRangeCategory>
1180        case 108280125: /*range*/ return this.range == null ? new Base[0] : new Base[] {this.range}; // Range
1181        case 951530927: /*context*/ return this.context == null ? new Base[0] : new Base[] {this.context}; // CodeableConcept
1182        case -2089924569: /*appliesTo*/ return this.appliesTo == null ? new Base[0] : this.appliesTo.toArray(new Base[this.appliesTo.size()]); // CodeableConcept
1183        case -1249512767: /*gender*/ return this.gender == null ? new Base[0] : new Base[] {this.gender}; // Enumeration<AdministrativeGender>
1184        case 96511: /*age*/ return this.age == null ? new Base[0] : new Base[] {this.age}; // Range
1185        case -241217538: /*gestationalAge*/ return this.gestationalAge == null ? new Base[0] : new Base[] {this.gestationalAge}; // Range
1186        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
1187        default: return super.getProperty(hash, name, checkValid);
1188        }
1189
1190      }
1191
1192      @Override
1193      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1194        switch (hash) {
1195        case 50511102: // category
1196          value = new ObservationRangeCategoryEnumFactory().fromType(TypeConvertor.castToCode(value));
1197          this.category = (Enumeration) value; // Enumeration<ObservationRangeCategory>
1198          return value;
1199        case 108280125: // range
1200          this.range = TypeConvertor.castToRange(value); // Range
1201          return value;
1202        case 951530927: // context
1203          this.context = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1204          return value;
1205        case -2089924569: // appliesTo
1206          this.getAppliesTo().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1207          return value;
1208        case -1249512767: // gender
1209          value = new AdministrativeGenderEnumFactory().fromType(TypeConvertor.castToCode(value));
1210          this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1211          return value;
1212        case 96511: // age
1213          this.age = TypeConvertor.castToRange(value); // Range
1214          return value;
1215        case -241217538: // gestationalAge
1216          this.gestationalAge = TypeConvertor.castToRange(value); // Range
1217          return value;
1218        case -861311717: // condition
1219          this.condition = TypeConvertor.castToString(value); // StringType
1220          return value;
1221        default: return super.setProperty(hash, name, value);
1222        }
1223
1224      }
1225
1226      @Override
1227      public Base setProperty(String name, Base value) throws FHIRException {
1228        if (name.equals("category")) {
1229          value = new ObservationRangeCategoryEnumFactory().fromType(TypeConvertor.castToCode(value));
1230          this.category = (Enumeration) value; // Enumeration<ObservationRangeCategory>
1231        } else if (name.equals("range")) {
1232          this.range = TypeConvertor.castToRange(value); // Range
1233        } else if (name.equals("context")) {
1234          this.context = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1235        } else if (name.equals("appliesTo")) {
1236          this.getAppliesTo().add(TypeConvertor.castToCodeableConcept(value));
1237        } else if (name.equals("gender")) {
1238          value = new AdministrativeGenderEnumFactory().fromType(TypeConvertor.castToCode(value));
1239          this.gender = (Enumeration) value; // Enumeration<AdministrativeGender>
1240        } else if (name.equals("age")) {
1241          this.age = TypeConvertor.castToRange(value); // Range
1242        } else if (name.equals("gestationalAge")) {
1243          this.gestationalAge = TypeConvertor.castToRange(value); // Range
1244        } else if (name.equals("condition")) {
1245          this.condition = TypeConvertor.castToString(value); // StringType
1246        } else
1247          return super.setProperty(name, value);
1248        return value;
1249      }
1250
1251      @Override
1252      public Base makeProperty(int hash, String name) throws FHIRException {
1253        switch (hash) {
1254        case 50511102:  return getCategoryElement();
1255        case 108280125:  return getRange();
1256        case 951530927:  return getContext();
1257        case -2089924569:  return addAppliesTo(); 
1258        case -1249512767:  return getGenderElement();
1259        case 96511:  return getAge();
1260        case -241217538:  return getGestationalAge();
1261        case -861311717:  return getConditionElement();
1262        default: return super.makeProperty(hash, name);
1263        }
1264
1265      }
1266
1267      @Override
1268      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1269        switch (hash) {
1270        case 50511102: /*category*/ return new String[] {"code"};
1271        case 108280125: /*range*/ return new String[] {"Range"};
1272        case 951530927: /*context*/ return new String[] {"CodeableConcept"};
1273        case -2089924569: /*appliesTo*/ return new String[] {"CodeableConcept"};
1274        case -1249512767: /*gender*/ return new String[] {"code"};
1275        case 96511: /*age*/ return new String[] {"Range"};
1276        case -241217538: /*gestationalAge*/ return new String[] {"Range"};
1277        case -861311717: /*condition*/ return new String[] {"string"};
1278        default: return super.getTypesForProperty(hash, name);
1279        }
1280
1281      }
1282
1283      @Override
1284      public Base addChild(String name) throws FHIRException {
1285        if (name.equals("category")) {
1286          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedInterval.category");
1287        }
1288        else if (name.equals("range")) {
1289          this.range = new Range();
1290          return this.range;
1291        }
1292        else if (name.equals("context")) {
1293          this.context = new CodeableConcept();
1294          return this.context;
1295        }
1296        else if (name.equals("appliesTo")) {
1297          return addAppliesTo();
1298        }
1299        else if (name.equals("gender")) {
1300          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedInterval.gender");
1301        }
1302        else if (name.equals("age")) {
1303          this.age = new Range();
1304          return this.age;
1305        }
1306        else if (name.equals("gestationalAge")) {
1307          this.gestationalAge = new Range();
1308          return this.gestationalAge;
1309        }
1310        else if (name.equals("condition")) {
1311          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.qualifiedInterval.condition");
1312        }
1313        else
1314          return super.addChild(name);
1315      }
1316
1317      public ObservationDefinitionQualifiedIntervalComponent copy() {
1318        ObservationDefinitionQualifiedIntervalComponent dst = new ObservationDefinitionQualifiedIntervalComponent();
1319        copyValues(dst);
1320        return dst;
1321      }
1322
1323      public void copyValues(ObservationDefinitionQualifiedIntervalComponent dst) {
1324        super.copyValues(dst);
1325        dst.category = category == null ? null : category.copy();
1326        dst.range = range == null ? null : range.copy();
1327        dst.context = context == null ? null : context.copy();
1328        if (appliesTo != null) {
1329          dst.appliesTo = new ArrayList<CodeableConcept>();
1330          for (CodeableConcept i : appliesTo)
1331            dst.appliesTo.add(i.copy());
1332        };
1333        dst.gender = gender == null ? null : gender.copy();
1334        dst.age = age == null ? null : age.copy();
1335        dst.gestationalAge = gestationalAge == null ? null : gestationalAge.copy();
1336        dst.condition = condition == null ? null : condition.copy();
1337      }
1338
1339      @Override
1340      public boolean equalsDeep(Base other_) {
1341        if (!super.equalsDeep(other_))
1342          return false;
1343        if (!(other_ instanceof ObservationDefinitionQualifiedIntervalComponent))
1344          return false;
1345        ObservationDefinitionQualifiedIntervalComponent o = (ObservationDefinitionQualifiedIntervalComponent) other_;
1346        return compareDeep(category, o.category, true) && compareDeep(range, o.range, true) && compareDeep(context, o.context, true)
1347           && compareDeep(appliesTo, o.appliesTo, true) && compareDeep(gender, o.gender, true) && compareDeep(age, o.age, true)
1348           && compareDeep(gestationalAge, o.gestationalAge, true) && compareDeep(condition, o.condition, true)
1349          ;
1350      }
1351
1352      @Override
1353      public boolean equalsShallow(Base other_) {
1354        if (!super.equalsShallow(other_))
1355          return false;
1356        if (!(other_ instanceof ObservationDefinitionQualifiedIntervalComponent))
1357          return false;
1358        ObservationDefinitionQualifiedIntervalComponent o = (ObservationDefinitionQualifiedIntervalComponent) other_;
1359        return compareValues(category, o.category, true) && compareValues(gender, o.gender, true) && compareValues(condition, o.condition, true)
1360          ;
1361      }
1362
1363      public boolean isEmpty() {
1364        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, range, context
1365          , appliesTo, gender, age, gestationalAge, condition);
1366      }
1367
1368  public String fhirType() {
1369    return "ObservationDefinition.qualifiedInterval";
1370
1371  }
1372
1373  }
1374
1375    @Block()
1376    public static class ObservationDefinitionComponentComponent extends BackboneElement implements IBaseBackboneElement {
1377        /**
1378         * Describes what will be observed.
1379         */
1380        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
1381        @Description(shortDefinition="Type of observation", formalDefinition="Describes what will be observed." )
1382        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
1383        protected CodeableConcept code;
1384
1385        /**
1386         * The data types allowed for the value element of the instance of this component observations.
1387         */
1388        @Child(name = "permittedDataType", type = {CodeType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1389        @Description(shortDefinition="Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period", formalDefinition="The data types allowed for the value element of the instance of this component observations." )
1390        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/permitted-data-type")
1391        protected List<Enumeration<ObservationDataType>> permittedDataType;
1392
1393        /**
1394         * The quantitative details specified.
1395         */
1396        @Child(name = "quantitativeDetails", type = {ObservationDefinitionQuantitativeDetailsComponent.class}, order=3, min=0, max=1, modifier=false, summary=false)
1397        @Description(shortDefinition="Quantitative details", formalDefinition="The quantitative details specified." )
1398        protected ObservationDefinitionQuantitativeDetailsComponent quantitativeDetails;
1399
1400        /**
1401         * The qualified interval specified.
1402         */
1403        @Child(name = "qualifiedInterval", type = {ObservationDefinitionQualifiedIntervalComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1404        @Description(shortDefinition="Qualified interval", formalDefinition="The qualified interval specified." )
1405        protected List<ObservationDefinitionQualifiedIntervalComponent> qualifiedInterval;
1406
1407        private static final long serialVersionUID = 527664521L;
1408
1409    /**
1410     * Constructor
1411     */
1412      public ObservationDefinitionComponentComponent() {
1413        super();
1414      }
1415
1416    /**
1417     * Constructor
1418     */
1419      public ObservationDefinitionComponentComponent(CodeableConcept code) {
1420        super();
1421        this.setCode(code);
1422      }
1423
1424        /**
1425         * @return {@link #code} (Describes what will be observed.)
1426         */
1427        public CodeableConcept getCode() { 
1428          if (this.code == null)
1429            if (Configuration.errorOnAutoCreate())
1430              throw new Error("Attempt to auto-create ObservationDefinitionComponentComponent.code");
1431            else if (Configuration.doAutoCreate())
1432              this.code = new CodeableConcept(); // cc
1433          return this.code;
1434        }
1435
1436        public boolean hasCode() { 
1437          return this.code != null && !this.code.isEmpty();
1438        }
1439
1440        /**
1441         * @param value {@link #code} (Describes what will be observed.)
1442         */
1443        public ObservationDefinitionComponentComponent setCode(CodeableConcept value) { 
1444          this.code = value;
1445          return this;
1446        }
1447
1448        /**
1449         * @return {@link #permittedDataType} (The data types allowed for the value element of the instance of this component observations.)
1450         */
1451        public List<Enumeration<ObservationDataType>> getPermittedDataType() { 
1452          if (this.permittedDataType == null)
1453            this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
1454          return this.permittedDataType;
1455        }
1456
1457        /**
1458         * @return Returns a reference to <code>this</code> for easy method chaining
1459         */
1460        public ObservationDefinitionComponentComponent setPermittedDataType(List<Enumeration<ObservationDataType>> thePermittedDataType) { 
1461          this.permittedDataType = thePermittedDataType;
1462          return this;
1463        }
1464
1465        public boolean hasPermittedDataType() { 
1466          if (this.permittedDataType == null)
1467            return false;
1468          for (Enumeration<ObservationDataType> item : this.permittedDataType)
1469            if (!item.isEmpty())
1470              return true;
1471          return false;
1472        }
1473
1474        /**
1475         * @return {@link #permittedDataType} (The data types allowed for the value element of the instance of this component observations.)
1476         */
1477        public Enumeration<ObservationDataType> addPermittedDataTypeElement() {//2 
1478          Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory());
1479          if (this.permittedDataType == null)
1480            this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
1481          this.permittedDataType.add(t);
1482          return t;
1483        }
1484
1485        /**
1486         * @param value {@link #permittedDataType} (The data types allowed for the value element of the instance of this component observations.)
1487         */
1488        public ObservationDefinitionComponentComponent addPermittedDataType(ObservationDataType value) { //1
1489          Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory());
1490          t.setValue(value);
1491          if (this.permittedDataType == null)
1492            this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
1493          this.permittedDataType.add(t);
1494          return this;
1495        }
1496
1497        /**
1498         * @param value {@link #permittedDataType} (The data types allowed for the value element of the instance of this component observations.)
1499         */
1500        public boolean hasPermittedDataType(ObservationDataType value) { 
1501          if (this.permittedDataType == null)
1502            return false;
1503          for (Enumeration<ObservationDataType> v : this.permittedDataType)
1504            if (v.getValue().equals(value)) // code
1505              return true;
1506          return false;
1507        }
1508
1509        /**
1510         * @return {@link #quantitativeDetails} (The quantitative details specified.)
1511         */
1512        public ObservationDefinitionQuantitativeDetailsComponent getQuantitativeDetails() { 
1513          if (this.quantitativeDetails == null)
1514            if (Configuration.errorOnAutoCreate())
1515              throw new Error("Attempt to auto-create ObservationDefinitionComponentComponent.quantitativeDetails");
1516            else if (Configuration.doAutoCreate())
1517              this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent(); // cc
1518          return this.quantitativeDetails;
1519        }
1520
1521        public boolean hasQuantitativeDetails() { 
1522          return this.quantitativeDetails != null && !this.quantitativeDetails.isEmpty();
1523        }
1524
1525        /**
1526         * @param value {@link #quantitativeDetails} (The quantitative details specified.)
1527         */
1528        public ObservationDefinitionComponentComponent setQuantitativeDetails(ObservationDefinitionQuantitativeDetailsComponent value) { 
1529          this.quantitativeDetails = value;
1530          return this;
1531        }
1532
1533        /**
1534         * @return {@link #qualifiedInterval} (The qualified interval specified.)
1535         */
1536        public List<ObservationDefinitionQualifiedIntervalComponent> getQualifiedInterval() { 
1537          if (this.qualifiedInterval == null)
1538            this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>();
1539          return this.qualifiedInterval;
1540        }
1541
1542        /**
1543         * @return Returns a reference to <code>this</code> for easy method chaining
1544         */
1545        public ObservationDefinitionComponentComponent setQualifiedInterval(List<ObservationDefinitionQualifiedIntervalComponent> theQualifiedInterval) { 
1546          this.qualifiedInterval = theQualifiedInterval;
1547          return this;
1548        }
1549
1550        public boolean hasQualifiedInterval() { 
1551          if (this.qualifiedInterval == null)
1552            return false;
1553          for (ObservationDefinitionQualifiedIntervalComponent item : this.qualifiedInterval)
1554            if (!item.isEmpty())
1555              return true;
1556          return false;
1557        }
1558
1559        public ObservationDefinitionQualifiedIntervalComponent addQualifiedInterval() { //3
1560          ObservationDefinitionQualifiedIntervalComponent t = new ObservationDefinitionQualifiedIntervalComponent();
1561          if (this.qualifiedInterval == null)
1562            this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>();
1563          this.qualifiedInterval.add(t);
1564          return t;
1565        }
1566
1567        public ObservationDefinitionComponentComponent addQualifiedInterval(ObservationDefinitionQualifiedIntervalComponent t) { //3
1568          if (t == null)
1569            return this;
1570          if (this.qualifiedInterval == null)
1571            this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>();
1572          this.qualifiedInterval.add(t);
1573          return this;
1574        }
1575
1576        /**
1577         * @return The first repetition of repeating field {@link #qualifiedInterval}, creating it if it does not already exist {3}
1578         */
1579        public ObservationDefinitionQualifiedIntervalComponent getQualifiedIntervalFirstRep() { 
1580          if (getQualifiedInterval().isEmpty()) {
1581            addQualifiedInterval();
1582          }
1583          return getQualifiedInterval().get(0);
1584        }
1585
1586        protected void listChildren(List<Property> children) {
1587          super.listChildren(children);
1588          children.add(new Property("code", "CodeableConcept", "Describes what will be observed.", 0, 1, code));
1589          children.add(new Property("permittedDataType", "code", "The data types allowed for the value element of the instance of this component observations.", 0, java.lang.Integer.MAX_VALUE, permittedDataType));
1590          children.add(new Property("quantitativeDetails", "@ObservationDefinition.quantitativeDetails", "The quantitative details specified.", 0, 1, quantitativeDetails));
1591          children.add(new Property("qualifiedInterval", "@ObservationDefinition.qualifiedInterval", "The qualified interval specified.", 0, java.lang.Integer.MAX_VALUE, qualifiedInterval));
1592        }
1593
1594        @Override
1595        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1596          switch (_hash) {
1597          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Describes what will be observed.", 0, 1, code);
1598          case -99492804: /*permittedDataType*/  return new Property("permittedDataType", "code", "The data types allowed for the value element of the instance of this component observations.", 0, java.lang.Integer.MAX_VALUE, permittedDataType);
1599          case 842150763: /*quantitativeDetails*/  return new Property("quantitativeDetails", "@ObservationDefinition.quantitativeDetails", "The quantitative details specified.", 0, 1, quantitativeDetails);
1600          case 1882971521: /*qualifiedInterval*/  return new Property("qualifiedInterval", "@ObservationDefinition.qualifiedInterval", "The qualified interval specified.", 0, java.lang.Integer.MAX_VALUE, qualifiedInterval);
1601          default: return super.getNamedProperty(_hash, _name, _checkValid);
1602          }
1603
1604        }
1605
1606      @Override
1607      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1608        switch (hash) {
1609        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1610        case -99492804: /*permittedDataType*/ return this.permittedDataType == null ? new Base[0] : this.permittedDataType.toArray(new Base[this.permittedDataType.size()]); // Enumeration<ObservationDataType>
1611        case 842150763: /*quantitativeDetails*/ return this.quantitativeDetails == null ? new Base[0] : new Base[] {this.quantitativeDetails}; // ObservationDefinitionQuantitativeDetailsComponent
1612        case 1882971521: /*qualifiedInterval*/ return this.qualifiedInterval == null ? new Base[0] : this.qualifiedInterval.toArray(new Base[this.qualifiedInterval.size()]); // ObservationDefinitionQualifiedIntervalComponent
1613        default: return super.getProperty(hash, name, checkValid);
1614        }
1615
1616      }
1617
1618      @Override
1619      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1620        switch (hash) {
1621        case 3059181: // code
1622          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1623          return value;
1624        case -99492804: // permittedDataType
1625          value = new ObservationDataTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1626          this.getPermittedDataType().add((Enumeration) value); // Enumeration<ObservationDataType>
1627          return value;
1628        case 842150763: // quantitativeDetails
1629          this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent
1630          return value;
1631        case 1882971521: // qualifiedInterval
1632          this.getQualifiedInterval().add((ObservationDefinitionQualifiedIntervalComponent) value); // ObservationDefinitionQualifiedIntervalComponent
1633          return value;
1634        default: return super.setProperty(hash, name, value);
1635        }
1636
1637      }
1638
1639      @Override
1640      public Base setProperty(String name, Base value) throws FHIRException {
1641        if (name.equals("code")) {
1642          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1643        } else if (name.equals("permittedDataType")) {
1644          value = new ObservationDataTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1645          this.getPermittedDataType().add((Enumeration) value);
1646        } else if (name.equals("quantitativeDetails")) {
1647          this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent
1648        } else if (name.equals("qualifiedInterval")) {
1649          this.getQualifiedInterval().add((ObservationDefinitionQualifiedIntervalComponent) value);
1650        } else
1651          return super.setProperty(name, value);
1652        return value;
1653      }
1654
1655      @Override
1656      public Base makeProperty(int hash, String name) throws FHIRException {
1657        switch (hash) {
1658        case 3059181:  return getCode();
1659        case -99492804:  return addPermittedDataTypeElement();
1660        case 842150763:  return getQuantitativeDetails();
1661        case 1882971521:  return addQualifiedInterval(); 
1662        default: return super.makeProperty(hash, name);
1663        }
1664
1665      }
1666
1667      @Override
1668      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1669        switch (hash) {
1670        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1671        case -99492804: /*permittedDataType*/ return new String[] {"code"};
1672        case 842150763: /*quantitativeDetails*/ return new String[] {"@ObservationDefinition.quantitativeDetails"};
1673        case 1882971521: /*qualifiedInterval*/ return new String[] {"@ObservationDefinition.qualifiedInterval"};
1674        default: return super.getTypesForProperty(hash, name);
1675        }
1676
1677      }
1678
1679      @Override
1680      public Base addChild(String name) throws FHIRException {
1681        if (name.equals("code")) {
1682          this.code = new CodeableConcept();
1683          return this.code;
1684        }
1685        else if (name.equals("permittedDataType")) {
1686          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.component.permittedDataType");
1687        }
1688        else if (name.equals("quantitativeDetails")) {
1689          this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent();
1690          return this.quantitativeDetails;
1691        }
1692        else if (name.equals("qualifiedInterval")) {
1693          return addQualifiedInterval();
1694        }
1695        else
1696          return super.addChild(name);
1697      }
1698
1699      public ObservationDefinitionComponentComponent copy() {
1700        ObservationDefinitionComponentComponent dst = new ObservationDefinitionComponentComponent();
1701        copyValues(dst);
1702        return dst;
1703      }
1704
1705      public void copyValues(ObservationDefinitionComponentComponent dst) {
1706        super.copyValues(dst);
1707        dst.code = code == null ? null : code.copy();
1708        if (permittedDataType != null) {
1709          dst.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
1710          for (Enumeration<ObservationDataType> i : permittedDataType)
1711            dst.permittedDataType.add(i.copy());
1712        };
1713        dst.quantitativeDetails = quantitativeDetails == null ? null : quantitativeDetails.copy();
1714        if (qualifiedInterval != null) {
1715          dst.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>();
1716          for (ObservationDefinitionQualifiedIntervalComponent i : qualifiedInterval)
1717            dst.qualifiedInterval.add(i.copy());
1718        };
1719      }
1720
1721      @Override
1722      public boolean equalsDeep(Base other_) {
1723        if (!super.equalsDeep(other_))
1724          return false;
1725        if (!(other_ instanceof ObservationDefinitionComponentComponent))
1726          return false;
1727        ObservationDefinitionComponentComponent o = (ObservationDefinitionComponentComponent) other_;
1728        return compareDeep(code, o.code, true) && compareDeep(permittedDataType, o.permittedDataType, true)
1729           && compareDeep(quantitativeDetails, o.quantitativeDetails, true) && compareDeep(qualifiedInterval, o.qualifiedInterval, true)
1730          ;
1731      }
1732
1733      @Override
1734      public boolean equalsShallow(Base other_) {
1735        if (!super.equalsShallow(other_))
1736          return false;
1737        if (!(other_ instanceof ObservationDefinitionComponentComponent))
1738          return false;
1739        ObservationDefinitionComponentComponent o = (ObservationDefinitionComponentComponent) other_;
1740        return compareValues(permittedDataType, o.permittedDataType, true);
1741      }
1742
1743      public boolean isEmpty() {
1744        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, permittedDataType, quantitativeDetails
1745          , qualifiedInterval);
1746      }
1747
1748  public String fhirType() {
1749    return "ObservationDefinition.component";
1750
1751  }
1752
1753  }
1754
1755    /**
1756     * An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.
1757     */
1758    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
1759    @Description(shortDefinition="Logical canonical URL to reference this ObservationDefinition (globally unique)", formalDefinition="An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions." )
1760    protected UriType url;
1761
1762    /**
1763     * Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.
1764     */
1765    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1766    @Description(shortDefinition="Business identifier of the ObservationDefinition", formalDefinition="Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server." )
1767    protected Identifier identifier;
1768
1769    /**
1770     * The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.
1771     */
1772    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1773    @Description(shortDefinition="Business version of the ObservationDefinition", formalDefinition="The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable." )
1774    protected StringType version;
1775
1776    /**
1777     * A short, descriptive, user-friendly title for the ObservationDefinition.
1778     */
1779    @Child(name = "title", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1780    @Description(shortDefinition="Name for this ObservationDefinition (Human friendly)", formalDefinition="A short, descriptive, user-friendly title for the ObservationDefinition." )
1781    protected StringType title;
1782
1783    /**
1784     * The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.
1785     */
1786    @Child(name = "derivedFromCanonical", type = {CanonicalType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1787    @Description(shortDefinition="Based on FHIR definition of another observation", formalDefinition="The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition." )
1788    protected List<CanonicalType> derivedFromCanonical;
1789
1790    /**
1791     * The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.
1792     */
1793    @Child(name = "derivedFromUri", type = {UriType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1794    @Description(shortDefinition="Based on external definition", formalDefinition="The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition." )
1795    protected List<UriType> derivedFromUri;
1796
1797    /**
1798     * The current state of the ObservationDefinition.
1799     */
1800    @Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
1801    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The current state of the ObservationDefinition." )
1802    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
1803    protected Enumeration<PublicationStatus> status;
1804
1805    /**
1806     * A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1807     */
1808    @Child(name = "experimental", type = {BooleanType.class}, order=7, min=0, max=1, modifier=true, summary=true)
1809    @Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
1810    protected BooleanType experimental;
1811
1812    /**
1813     * A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.
1814     */
1815    @Child(name = "subject", type = {CodeableConcept.class, Group.class}, order=8, min=0, max=1, modifier=false, summary=true)
1816    @Description(shortDefinition="Type of subject for the defined observation", formalDefinition="A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition." )
1817    protected DataType subject;
1818
1819    /**
1820     * For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.
1821     */
1822    @Child(name = "date", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1823    @Description(shortDefinition="Date status first applied", formalDefinition="For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal." )
1824    protected DateTimeType date;
1825
1826    /**
1827     * Helps establish the "authority/credibility" of the ObservationDefinition. May also allow for contact.
1828     */
1829    @Child(name = "publisher", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=10, min=0, max=1, modifier=false, summary=true)
1830    @Description(shortDefinition="The name of the individual or organization that published the ObservationDefinition", formalDefinition="Helps establish the \"authority/credibility\" of the ObservationDefinition. May also allow for contact." )
1831    protected Reference publisher;
1832
1833    /**
1834     * Contact details to assist a user in finding and communicating with the publisher.
1835     */
1836    @Child(name = "contact", type = {ContactDetail.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1837    @Description(shortDefinition="Contact details for the publisher", formalDefinition="Contact details to assist a user in finding and communicating with the publisher." )
1838    protected List<ContactDetail> contact;
1839
1840    /**
1841     * A free text natural language description of the ObservationDefinition from the consumer's perspective.
1842     */
1843    @Child(name = "description", type = {MarkdownType.class}, order=12, min=0, max=1, modifier=false, summary=false)
1844    @Description(shortDefinition="Natural language description of the ObservationDefinition", formalDefinition="A free text natural language description of the ObservationDefinition from the consumer's perspective." )
1845    protected MarkdownType description;
1846
1847    /**
1848     * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of observation definitions.
1849     */
1850    @Child(name = "useContext", type = {UsageContext.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1851    @Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of observation definitions." )
1852    protected List<UsageContext> useContext;
1853
1854    /**
1855     * A jurisdiction in which the ObservationDefinition is intended to be used.
1856     */
1857    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1858    @Description(shortDefinition="Intended jurisdiction for this ObservationDefinition (if applicable)", formalDefinition="A jurisdiction in which the ObservationDefinition is intended to be used." )
1859    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/jurisdiction")
1860    protected List<CodeableConcept> jurisdiction;
1861
1862    /**
1863     * Explains why this ObservationDefinition is needed and why it has been designed as it has.
1864     */
1865    @Child(name = "purpose", type = {MarkdownType.class}, order=15, min=0, max=1, modifier=false, summary=false)
1866    @Description(shortDefinition="Why this ObservationDefinition is defined", formalDefinition="Explains why this ObservationDefinition is needed and why it has been designed as it has." )
1867    protected MarkdownType purpose;
1868
1869    /**
1870     * Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.
1871     */
1872    @Child(name = "copyright", type = {MarkdownType.class}, order=16, min=0, max=1, modifier=false, summary=false)
1873    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition." )
1874    protected MarkdownType copyright;
1875
1876    /**
1877     * The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
1878     */
1879    @Child(name = "approvalDate", type = {DateType.class}, order=17, min=0, max=1, modifier=false, summary=false)
1880    @Description(shortDefinition="When ObservationDefinition was approved by publisher", formalDefinition="The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage." )
1881    protected DateType approvalDate;
1882
1883    /**
1884     * The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
1885     */
1886    @Child(name = "lastReviewDate", type = {DateType.class}, order=18, min=0, max=1, modifier=false, summary=false)
1887    @Description(shortDefinition="Last review date for the ObservationDefinition", formalDefinition="The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date." )
1888    protected DateType lastReviewDate;
1889
1890    /**
1891     * The period during which the ObservationDefinition content was or is planned to be effective.
1892     */
1893    @Child(name = "effectivePeriod", type = {Period.class}, order=19, min=0, max=1, modifier=false, summary=true)
1894    @Description(shortDefinition="The effective date range for the ObservationDefinition", formalDefinition="The period during which the ObservationDefinition content was or is planned to be effective." )
1895    protected Period effectivePeriod;
1896
1897    /**
1898     * The type of individual/organization/device that is expected to act upon instances of this definition.
1899     */
1900    @Child(name = "performerType", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=true)
1901    @Description(shortDefinition="Desired kind of performer for such kind of observation", formalDefinition="The type of individual/organization/device that is expected to act upon instances of this definition." )
1902    protected CodeableConcept performerType;
1903
1904    /**
1905     * A code that classifies the general type of observation.
1906     */
1907    @Child(name = "category", type = {CodeableConcept.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1908    @Description(shortDefinition="Category of observation", formalDefinition="A code that classifies the general type of observation." )
1909    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-category")
1910    protected List<CodeableConcept> category;
1911
1912    /**
1913     * Describes what will be observed. Sometimes this is called the observation "name".
1914     */
1915    @Child(name = "code", type = {CodeableConcept.class}, order=22, min=1, max=1, modifier=false, summary=true)
1916    @Description(shortDefinition="Type of observation", formalDefinition="Describes what will be observed. Sometimes this is called the observation \"name\"." )
1917    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
1918    protected CodeableConcept code;
1919
1920    /**
1921     * The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.
1922     */
1923    @Child(name = "permittedDataType", type = {CodeType.class}, order=23, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1924    @Description(shortDefinition="Quantity | CodeableConcept | string | boolean | integer | Range | Ratio | SampledData | time | dateTime | Period", formalDefinition="The data types allowed for the value element of the instance observations conforming to this ObservationDefinition." )
1925    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/permitted-data-type")
1926    protected List<Enumeration<ObservationDataType>> permittedDataType;
1927
1928    /**
1929     * Multiple results allowed for observations conforming to this ObservationDefinition.
1930     */
1931    @Child(name = "multipleResultsAllowed", type = {BooleanType.class}, order=24, min=0, max=1, modifier=false, summary=false)
1932    @Description(shortDefinition="Multiple results allowed", formalDefinition="Multiple results allowed for observations conforming to this ObservationDefinition." )
1933    protected BooleanType multipleResultsAllowed;
1934
1935    /**
1936     * The site on the subject's body where the  observation is to be made.
1937     */
1938    @Child(name = "bodySite", type = {CodeableConcept.class}, order=25, min=0, max=1, modifier=false, summary=false)
1939    @Description(shortDefinition="Body part to be observed", formalDefinition="The site on the subject's body where the  observation is to be made." )
1940    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
1941    protected CodeableConcept bodySite;
1942
1943    /**
1944     * The method or technique used to perform the observation.
1945     */
1946    @Child(name = "method", type = {CodeableConcept.class}, order=26, min=0, max=1, modifier=false, summary=false)
1947    @Description(shortDefinition="Method used to produce the observation", formalDefinition="The method or technique used to perform the observation." )
1948    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-methods")
1949    protected CodeableConcept method;
1950
1951    /**
1952     * The kind of specimen that this type of observation is produced on.
1953     */
1954    @Child(name = "specimen", type = {SpecimenDefinition.class}, order=27, min=0, max=1, modifier=false, summary=false)
1955    @Description(shortDefinition="Kind of specimen used by this type of observation", formalDefinition="The kind of specimen that this type of observation is produced on." )
1956    protected Reference specimen;
1957
1958    /**
1959     * The measurement device used to produce observations of this type.
1960     */
1961    @Child(name = "device", type = {Device.class}, order=28, min=0, max=1, modifier=false, summary=false)
1962    @Description(shortDefinition="Measurement device", formalDefinition="The measurement device used to produce observations of this type." )
1963    protected Reference device;
1964
1965    /**
1966     * The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.
1967     */
1968    @Child(name = "preferredReportName", type = {StringType.class}, order=29, min=0, max=1, modifier=false, summary=false)
1969    @Description(shortDefinition="Preferred report name", formalDefinition="The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition." )
1970    protected StringType preferredReportName;
1971
1972    /**
1973     * Characteristics for quantitative results of this observation.
1974     */
1975    @Child(name = "quantitativeDetails", type = {}, order=30, min=0, max=1, modifier=false, summary=false)
1976    @Description(shortDefinition="Characteristics of quantitative results", formalDefinition="Characteristics for quantitative results of this observation." )
1977    protected ObservationDefinitionQuantitativeDetailsComponent quantitativeDetails;
1978
1979    /**
1980     * Multiple  ranges of results qualified by different contexts for ordinal or continuous observations conforming to this ObservationDefinition.
1981     */
1982    @Child(name = "qualifiedInterval", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1983    @Description(shortDefinition="Qualified range for continuous and ordinal observation results", formalDefinition="Multiple  ranges of results qualified by different contexts for ordinal or continuous observations conforming to this ObservationDefinition." )
1984    protected List<ObservationDefinitionQualifiedIntervalComponent> qualifiedInterval;
1985
1986    /**
1987     * The set of valid coded results for the observations  conforming to this ObservationDefinition.
1988     */
1989    @Child(name = "validCodedValueSet", type = {ValueSet.class}, order=32, min=0, max=1, modifier=false, summary=false)
1990    @Description(shortDefinition="Value set of valid coded values for the observations conforming to this ObservationDefinition", formalDefinition="The set of valid coded results for the observations  conforming to this ObservationDefinition." )
1991    protected Reference validCodedValueSet;
1992
1993    /**
1994     * The set of normal coded results for the observations conforming to this ObservationDefinition.
1995     */
1996    @Child(name = "normalCodedValueSet", type = {ValueSet.class}, order=33, min=0, max=1, modifier=false, summary=false)
1997    @Description(shortDefinition="Value set of normal coded values for the observations conforming to this ObservationDefinition", formalDefinition="The set of normal coded results for the observations conforming to this ObservationDefinition." )
1998    protected Reference normalCodedValueSet;
1999
2000    /**
2001     * The set of abnormal coded results for the observation conforming to this ObservationDefinition.
2002     */
2003    @Child(name = "abnormalCodedValueSet", type = {ValueSet.class}, order=34, min=0, max=1, modifier=false, summary=false)
2004    @Description(shortDefinition="Value set of abnormal coded values for the observations conforming to this ObservationDefinition", formalDefinition="The set of abnormal coded results for the observation conforming to this ObservationDefinition." )
2005    protected Reference abnormalCodedValueSet;
2006
2007    /**
2008     * The set of critical coded results for the observation conforming to this ObservationDefinition.
2009     */
2010    @Child(name = "criticalCodedValueSet", type = {ValueSet.class}, order=35, min=0, max=1, modifier=false, summary=false)
2011    @Description(shortDefinition="Value set of critical coded values for the observations conforming to this ObservationDefinition", formalDefinition="The set of critical coded results for the observation conforming to this ObservationDefinition." )
2012    protected Reference criticalCodedValueSet;
2013
2014    /**
2015     * This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.
2016     */
2017    @Child(name = "hasMember", type = {ObservationDefinition.class, Questionnaire.class}, order=36, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2018    @Description(shortDefinition="Definitions of related resources belonging to this kind of observation group", formalDefinition="This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group." )
2019    protected List<Reference> hasMember;
2020
2021    /**
2022     * Some observations have multiple component observations, expressed as separate code value pairs.
2023     */
2024    @Child(name = "component", type = {}, order=37, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2025    @Description(shortDefinition="Component results", formalDefinition="Some observations have multiple component observations, expressed as separate code value pairs." )
2026    protected List<ObservationDefinitionComponentComponent> component;
2027
2028    private static final long serialVersionUID = 469528550L;
2029
2030  /**
2031   * Constructor
2032   */
2033    public ObservationDefinition() {
2034      super();
2035    }
2036
2037  /**
2038   * Constructor
2039   */
2040    public ObservationDefinition(PublicationStatus status, CodeableConcept code) {
2041      super();
2042      this.setStatus(status);
2043      this.setCode(code);
2044    }
2045
2046    /**
2047     * @return {@link #url} (An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2048     */
2049    public UriType getUrlElement() { 
2050      if (this.url == null)
2051        if (Configuration.errorOnAutoCreate())
2052          throw new Error("Attempt to auto-create ObservationDefinition.url");
2053        else if (Configuration.doAutoCreate())
2054          this.url = new UriType(); // bb
2055      return this.url;
2056    }
2057
2058    public boolean hasUrlElement() { 
2059      return this.url != null && !this.url.isEmpty();
2060    }
2061
2062    public boolean hasUrl() { 
2063      return this.url != null && !this.url.isEmpty();
2064    }
2065
2066    /**
2067     * @param value {@link #url} (An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
2068     */
2069    public ObservationDefinition setUrlElement(UriType value) { 
2070      this.url = value;
2071      return this;
2072    }
2073
2074    /**
2075     * @return An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.
2076     */
2077    public String getUrl() { 
2078      return this.url == null ? null : this.url.getValue();
2079    }
2080
2081    /**
2082     * @param value An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.
2083     */
2084    public ObservationDefinition setUrl(String value) { 
2085      if (Utilities.noString(value))
2086        this.url = null;
2087      else {
2088        if (this.url == null)
2089          this.url = new UriType();
2090        this.url.setValue(value);
2091      }
2092      return this;
2093    }
2094
2095    /**
2096     * @return {@link #identifier} (Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.)
2097     */
2098    public Identifier getIdentifier() { 
2099      if (this.identifier == null)
2100        if (Configuration.errorOnAutoCreate())
2101          throw new Error("Attempt to auto-create ObservationDefinition.identifier");
2102        else if (Configuration.doAutoCreate())
2103          this.identifier = new Identifier(); // cc
2104      return this.identifier;
2105    }
2106
2107    public boolean hasIdentifier() { 
2108      return this.identifier != null && !this.identifier.isEmpty();
2109    }
2110
2111    /**
2112     * @param value {@link #identifier} (Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.)
2113     */
2114    public ObservationDefinition setIdentifier(Identifier value) { 
2115      this.identifier = value;
2116      return this;
2117    }
2118
2119    /**
2120     * @return {@link #version} (The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2121     */
2122    public StringType getVersionElement() { 
2123      if (this.version == null)
2124        if (Configuration.errorOnAutoCreate())
2125          throw new Error("Attempt to auto-create ObservationDefinition.version");
2126        else if (Configuration.doAutoCreate())
2127          this.version = new StringType(); // bb
2128      return this.version;
2129    }
2130
2131    public boolean hasVersionElement() { 
2132      return this.version != null && !this.version.isEmpty();
2133    }
2134
2135    public boolean hasVersion() { 
2136      return this.version != null && !this.version.isEmpty();
2137    }
2138
2139    /**
2140     * @param value {@link #version} (The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2141     */
2142    public ObservationDefinition setVersionElement(StringType value) { 
2143      this.version = value;
2144      return this;
2145    }
2146
2147    /**
2148     * @return The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.
2149     */
2150    public String getVersion() { 
2151      return this.version == null ? null : this.version.getValue();
2152    }
2153
2154    /**
2155     * @param value The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.
2156     */
2157    public ObservationDefinition setVersion(String value) { 
2158      if (Utilities.noString(value))
2159        this.version = null;
2160      else {
2161        if (this.version == null)
2162          this.version = new StringType();
2163        this.version.setValue(value);
2164      }
2165      return this;
2166    }
2167
2168    /**
2169     * @return {@link #title} (A short, descriptive, user-friendly title for the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2170     */
2171    public StringType getTitleElement() { 
2172      if (this.title == null)
2173        if (Configuration.errorOnAutoCreate())
2174          throw new Error("Attempt to auto-create ObservationDefinition.title");
2175        else if (Configuration.doAutoCreate())
2176          this.title = new StringType(); // bb
2177      return this.title;
2178    }
2179
2180    public boolean hasTitleElement() { 
2181      return this.title != null && !this.title.isEmpty();
2182    }
2183
2184    public boolean hasTitle() { 
2185      return this.title != null && !this.title.isEmpty();
2186    }
2187
2188    /**
2189     * @param value {@link #title} (A short, descriptive, user-friendly title for the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2190     */
2191    public ObservationDefinition setTitleElement(StringType value) { 
2192      this.title = value;
2193      return this;
2194    }
2195
2196    /**
2197     * @return A short, descriptive, user-friendly title for the ObservationDefinition.
2198     */
2199    public String getTitle() { 
2200      return this.title == null ? null : this.title.getValue();
2201    }
2202
2203    /**
2204     * @param value A short, descriptive, user-friendly title for the ObservationDefinition.
2205     */
2206    public ObservationDefinition setTitle(String value) { 
2207      if (Utilities.noString(value))
2208        this.title = null;
2209      else {
2210        if (this.title == null)
2211          this.title = new StringType();
2212        this.title.setValue(value);
2213      }
2214      return this;
2215    }
2216
2217    /**
2218     * @return {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.)
2219     */
2220    public List<CanonicalType> getDerivedFromCanonical() { 
2221      if (this.derivedFromCanonical == null)
2222        this.derivedFromCanonical = new ArrayList<CanonicalType>();
2223      return this.derivedFromCanonical;
2224    }
2225
2226    /**
2227     * @return Returns a reference to <code>this</code> for easy method chaining
2228     */
2229    public ObservationDefinition setDerivedFromCanonical(List<CanonicalType> theDerivedFromCanonical) { 
2230      this.derivedFromCanonical = theDerivedFromCanonical;
2231      return this;
2232    }
2233
2234    public boolean hasDerivedFromCanonical() { 
2235      if (this.derivedFromCanonical == null)
2236        return false;
2237      for (CanonicalType item : this.derivedFromCanonical)
2238        if (!item.isEmpty())
2239          return true;
2240      return false;
2241    }
2242
2243    /**
2244     * @return {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.)
2245     */
2246    public CanonicalType addDerivedFromCanonicalElement() {//2 
2247      CanonicalType t = new CanonicalType();
2248      if (this.derivedFromCanonical == null)
2249        this.derivedFromCanonical = new ArrayList<CanonicalType>();
2250      this.derivedFromCanonical.add(t);
2251      return t;
2252    }
2253
2254    /**
2255     * @param value {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.)
2256     */
2257    public ObservationDefinition addDerivedFromCanonical(String value) { //1
2258      CanonicalType t = new CanonicalType();
2259      t.setValue(value);
2260      if (this.derivedFromCanonical == null)
2261        this.derivedFromCanonical = new ArrayList<CanonicalType>();
2262      this.derivedFromCanonical.add(t);
2263      return this;
2264    }
2265
2266    /**
2267     * @param value {@link #derivedFromCanonical} (The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.)
2268     */
2269    public boolean hasDerivedFromCanonical(String value) { 
2270      if (this.derivedFromCanonical == null)
2271        return false;
2272      for (CanonicalType v : this.derivedFromCanonical)
2273        if (v.getValue().equals(value)) // canonical
2274          return true;
2275      return false;
2276    }
2277
2278    /**
2279     * @return {@link #derivedFromUri} (The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.)
2280     */
2281    public List<UriType> getDerivedFromUri() { 
2282      if (this.derivedFromUri == null)
2283        this.derivedFromUri = new ArrayList<UriType>();
2284      return this.derivedFromUri;
2285    }
2286
2287    /**
2288     * @return Returns a reference to <code>this</code> for easy method chaining
2289     */
2290    public ObservationDefinition setDerivedFromUri(List<UriType> theDerivedFromUri) { 
2291      this.derivedFromUri = theDerivedFromUri;
2292      return this;
2293    }
2294
2295    public boolean hasDerivedFromUri() { 
2296      if (this.derivedFromUri == null)
2297        return false;
2298      for (UriType item : this.derivedFromUri)
2299        if (!item.isEmpty())
2300          return true;
2301      return false;
2302    }
2303
2304    /**
2305     * @return {@link #derivedFromUri} (The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.)
2306     */
2307    public UriType addDerivedFromUriElement() {//2 
2308      UriType t = new UriType();
2309      if (this.derivedFromUri == null)
2310        this.derivedFromUri = new ArrayList<UriType>();
2311      this.derivedFromUri.add(t);
2312      return t;
2313    }
2314
2315    /**
2316     * @param value {@link #derivedFromUri} (The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.)
2317     */
2318    public ObservationDefinition addDerivedFromUri(String value) { //1
2319      UriType t = new UriType();
2320      t.setValue(value);
2321      if (this.derivedFromUri == null)
2322        this.derivedFromUri = new ArrayList<UriType>();
2323      this.derivedFromUri.add(t);
2324      return this;
2325    }
2326
2327    /**
2328     * @param value {@link #derivedFromUri} (The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.)
2329     */
2330    public boolean hasDerivedFromUri(String value) { 
2331      if (this.derivedFromUri == null)
2332        return false;
2333      for (UriType v : this.derivedFromUri)
2334        if (v.getValue().equals(value)) // uri
2335          return true;
2336      return false;
2337    }
2338
2339    /**
2340     * @return {@link #status} (The current state of the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2341     */
2342    public Enumeration<PublicationStatus> getStatusElement() { 
2343      if (this.status == null)
2344        if (Configuration.errorOnAutoCreate())
2345          throw new Error("Attempt to auto-create ObservationDefinition.status");
2346        else if (Configuration.doAutoCreate())
2347          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
2348      return this.status;
2349    }
2350
2351    public boolean hasStatusElement() { 
2352      return this.status != null && !this.status.isEmpty();
2353    }
2354
2355    public boolean hasStatus() { 
2356      return this.status != null && !this.status.isEmpty();
2357    }
2358
2359    /**
2360     * @param value {@link #status} (The current state of the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2361     */
2362    public ObservationDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
2363      this.status = value;
2364      return this;
2365    }
2366
2367    /**
2368     * @return The current state of the ObservationDefinition.
2369     */
2370    public PublicationStatus getStatus() { 
2371      return this.status == null ? null : this.status.getValue();
2372    }
2373
2374    /**
2375     * @param value The current state of the ObservationDefinition.
2376     */
2377    public ObservationDefinition setStatus(PublicationStatus value) { 
2378        if (this.status == null)
2379          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
2380        this.status.setValue(value);
2381      return this;
2382    }
2383
2384    /**
2385     * @return {@link #experimental} (A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
2386     */
2387    public BooleanType getExperimentalElement() { 
2388      if (this.experimental == null)
2389        if (Configuration.errorOnAutoCreate())
2390          throw new Error("Attempt to auto-create ObservationDefinition.experimental");
2391        else if (Configuration.doAutoCreate())
2392          this.experimental = new BooleanType(); // bb
2393      return this.experimental;
2394    }
2395
2396    public boolean hasExperimentalElement() { 
2397      return this.experimental != null && !this.experimental.isEmpty();
2398    }
2399
2400    public boolean hasExperimental() { 
2401      return this.experimental != null && !this.experimental.isEmpty();
2402    }
2403
2404    /**
2405     * @param value {@link #experimental} (A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
2406     */
2407    public ObservationDefinition setExperimentalElement(BooleanType value) { 
2408      this.experimental = value;
2409      return this;
2410    }
2411
2412    /**
2413     * @return A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
2414     */
2415    public boolean getExperimental() { 
2416      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
2417    }
2418
2419    /**
2420     * @param value A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
2421     */
2422    public ObservationDefinition setExperimental(boolean value) { 
2423        if (this.experimental == null)
2424          this.experimental = new BooleanType();
2425        this.experimental.setValue(value);
2426      return this;
2427    }
2428
2429    /**
2430     * @return {@link #subject} (A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.)
2431     */
2432    public DataType getSubject() { 
2433      return this.subject;
2434    }
2435
2436    /**
2437     * @return {@link #subject} (A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.)
2438     */
2439    public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
2440      if (this.subject == null)
2441        this.subject = new CodeableConcept();
2442      if (!(this.subject instanceof CodeableConcept))
2443        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
2444      return (CodeableConcept) this.subject;
2445    }
2446
2447    public boolean hasSubjectCodeableConcept() { 
2448      return this != null && this.subject instanceof CodeableConcept;
2449    }
2450
2451    /**
2452     * @return {@link #subject} (A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.)
2453     */
2454    public Reference getSubjectReference() throws FHIRException { 
2455      if (this.subject == null)
2456        this.subject = new Reference();
2457      if (!(this.subject instanceof Reference))
2458        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
2459      return (Reference) this.subject;
2460    }
2461
2462    public boolean hasSubjectReference() { 
2463      return this != null && this.subject instanceof Reference;
2464    }
2465
2466    public boolean hasSubject() { 
2467      return this.subject != null && !this.subject.isEmpty();
2468    }
2469
2470    /**
2471     * @param value {@link #subject} (A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.)
2472     */
2473    public ObservationDefinition setSubject(DataType value) { 
2474      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2475        throw new Error("Not the right type for ObservationDefinition.subject[x]: "+value.fhirType());
2476      this.subject = value;
2477      return this;
2478    }
2479
2480    /**
2481     * @return {@link #date} (For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2482     */
2483    public DateTimeType getDateElement() { 
2484      if (this.date == null)
2485        if (Configuration.errorOnAutoCreate())
2486          throw new Error("Attempt to auto-create ObservationDefinition.date");
2487        else if (Configuration.doAutoCreate())
2488          this.date = new DateTimeType(); // bb
2489      return this.date;
2490    }
2491
2492    public boolean hasDateElement() { 
2493      return this.date != null && !this.date.isEmpty();
2494    }
2495
2496    public boolean hasDate() { 
2497      return this.date != null && !this.date.isEmpty();
2498    }
2499
2500    /**
2501     * @param value {@link #date} (For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2502     */
2503    public ObservationDefinition setDateElement(DateTimeType value) { 
2504      this.date = value;
2505      return this;
2506    }
2507
2508    /**
2509     * @return For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.
2510     */
2511    public Date getDate() { 
2512      return this.date == null ? null : this.date.getValue();
2513    }
2514
2515    /**
2516     * @param value For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.
2517     */
2518    public ObservationDefinition setDate(Date value) { 
2519      if (value == null)
2520        this.date = null;
2521      else {
2522        if (this.date == null)
2523          this.date = new DateTimeType();
2524        this.date.setValue(value);
2525      }
2526      return this;
2527    }
2528
2529    /**
2530     * @return {@link #publisher} (Helps establish the "authority/credibility" of the ObservationDefinition. May also allow for contact.)
2531     */
2532    public Reference getPublisher() { 
2533      if (this.publisher == null)
2534        if (Configuration.errorOnAutoCreate())
2535          throw new Error("Attempt to auto-create ObservationDefinition.publisher");
2536        else if (Configuration.doAutoCreate())
2537          this.publisher = new Reference(); // cc
2538      return this.publisher;
2539    }
2540
2541    public boolean hasPublisher() { 
2542      return this.publisher != null && !this.publisher.isEmpty();
2543    }
2544
2545    /**
2546     * @param value {@link #publisher} (Helps establish the "authority/credibility" of the ObservationDefinition. May also allow for contact.)
2547     */
2548    public ObservationDefinition setPublisher(Reference value) { 
2549      this.publisher = value;
2550      return this;
2551    }
2552
2553    /**
2554     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
2555     */
2556    public List<ContactDetail> getContact() { 
2557      if (this.contact == null)
2558        this.contact = new ArrayList<ContactDetail>();
2559      return this.contact;
2560    }
2561
2562    /**
2563     * @return Returns a reference to <code>this</code> for easy method chaining
2564     */
2565    public ObservationDefinition setContact(List<ContactDetail> theContact) { 
2566      this.contact = theContact;
2567      return this;
2568    }
2569
2570    public boolean hasContact() { 
2571      if (this.contact == null)
2572        return false;
2573      for (ContactDetail item : this.contact)
2574        if (!item.isEmpty())
2575          return true;
2576      return false;
2577    }
2578
2579    public ContactDetail addContact() { //3
2580      ContactDetail t = new ContactDetail();
2581      if (this.contact == null)
2582        this.contact = new ArrayList<ContactDetail>();
2583      this.contact.add(t);
2584      return t;
2585    }
2586
2587    public ObservationDefinition addContact(ContactDetail t) { //3
2588      if (t == null)
2589        return this;
2590      if (this.contact == null)
2591        this.contact = new ArrayList<ContactDetail>();
2592      this.contact.add(t);
2593      return this;
2594    }
2595
2596    /**
2597     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
2598     */
2599    public ContactDetail getContactFirstRep() { 
2600      if (getContact().isEmpty()) {
2601        addContact();
2602      }
2603      return getContact().get(0);
2604    }
2605
2606    /**
2607     * @return {@link #description} (A free text natural language description of the ObservationDefinition from the consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2608     */
2609    public MarkdownType getDescriptionElement() { 
2610      if (this.description == null)
2611        if (Configuration.errorOnAutoCreate())
2612          throw new Error("Attempt to auto-create ObservationDefinition.description");
2613        else if (Configuration.doAutoCreate())
2614          this.description = new MarkdownType(); // bb
2615      return this.description;
2616    }
2617
2618    public boolean hasDescriptionElement() { 
2619      return this.description != null && !this.description.isEmpty();
2620    }
2621
2622    public boolean hasDescription() { 
2623      return this.description != null && !this.description.isEmpty();
2624    }
2625
2626    /**
2627     * @param value {@link #description} (A free text natural language description of the ObservationDefinition from the consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2628     */
2629    public ObservationDefinition setDescriptionElement(MarkdownType value) { 
2630      this.description = value;
2631      return this;
2632    }
2633
2634    /**
2635     * @return A free text natural language description of the ObservationDefinition from the consumer's perspective.
2636     */
2637    public String getDescription() { 
2638      return this.description == null ? null : this.description.getValue();
2639    }
2640
2641    /**
2642     * @param value A free text natural language description of the ObservationDefinition from the consumer's perspective.
2643     */
2644    public ObservationDefinition setDescription(String value) { 
2645      if (value == null)
2646        this.description = null;
2647      else {
2648        if (this.description == null)
2649          this.description = new MarkdownType();
2650        this.description.setValue(value);
2651      }
2652      return this;
2653    }
2654
2655    /**
2656     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of observation definitions.)
2657     */
2658    public List<UsageContext> getUseContext() { 
2659      if (this.useContext == null)
2660        this.useContext = new ArrayList<UsageContext>();
2661      return this.useContext;
2662    }
2663
2664    /**
2665     * @return Returns a reference to <code>this</code> for easy method chaining
2666     */
2667    public ObservationDefinition setUseContext(List<UsageContext> theUseContext) { 
2668      this.useContext = theUseContext;
2669      return this;
2670    }
2671
2672    public boolean hasUseContext() { 
2673      if (this.useContext == null)
2674        return false;
2675      for (UsageContext item : this.useContext)
2676        if (!item.isEmpty())
2677          return true;
2678      return false;
2679    }
2680
2681    public UsageContext addUseContext() { //3
2682      UsageContext t = new UsageContext();
2683      if (this.useContext == null)
2684        this.useContext = new ArrayList<UsageContext>();
2685      this.useContext.add(t);
2686      return t;
2687    }
2688
2689    public ObservationDefinition addUseContext(UsageContext t) { //3
2690      if (t == null)
2691        return this;
2692      if (this.useContext == null)
2693        this.useContext = new ArrayList<UsageContext>();
2694      this.useContext.add(t);
2695      return this;
2696    }
2697
2698    /**
2699     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist {3}
2700     */
2701    public UsageContext getUseContextFirstRep() { 
2702      if (getUseContext().isEmpty()) {
2703        addUseContext();
2704      }
2705      return getUseContext().get(0);
2706    }
2707
2708    /**
2709     * @return {@link #jurisdiction} (A jurisdiction in which the ObservationDefinition is intended to be used.)
2710     */
2711    public List<CodeableConcept> getJurisdiction() { 
2712      if (this.jurisdiction == null)
2713        this.jurisdiction = new ArrayList<CodeableConcept>();
2714      return this.jurisdiction;
2715    }
2716
2717    /**
2718     * @return Returns a reference to <code>this</code> for easy method chaining
2719     */
2720    public ObservationDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) { 
2721      this.jurisdiction = theJurisdiction;
2722      return this;
2723    }
2724
2725    public boolean hasJurisdiction() { 
2726      if (this.jurisdiction == null)
2727        return false;
2728      for (CodeableConcept item : this.jurisdiction)
2729        if (!item.isEmpty())
2730          return true;
2731      return false;
2732    }
2733
2734    public CodeableConcept addJurisdiction() { //3
2735      CodeableConcept t = new CodeableConcept();
2736      if (this.jurisdiction == null)
2737        this.jurisdiction = new ArrayList<CodeableConcept>();
2738      this.jurisdiction.add(t);
2739      return t;
2740    }
2741
2742    public ObservationDefinition addJurisdiction(CodeableConcept t) { //3
2743      if (t == null)
2744        return this;
2745      if (this.jurisdiction == null)
2746        this.jurisdiction = new ArrayList<CodeableConcept>();
2747      this.jurisdiction.add(t);
2748      return this;
2749    }
2750
2751    /**
2752     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist {3}
2753     */
2754    public CodeableConcept getJurisdictionFirstRep() { 
2755      if (getJurisdiction().isEmpty()) {
2756        addJurisdiction();
2757      }
2758      return getJurisdiction().get(0);
2759    }
2760
2761    /**
2762     * @return {@link #purpose} (Explains why this ObservationDefinition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
2763     */
2764    public MarkdownType getPurposeElement() { 
2765      if (this.purpose == null)
2766        if (Configuration.errorOnAutoCreate())
2767          throw new Error("Attempt to auto-create ObservationDefinition.purpose");
2768        else if (Configuration.doAutoCreate())
2769          this.purpose = new MarkdownType(); // bb
2770      return this.purpose;
2771    }
2772
2773    public boolean hasPurposeElement() { 
2774      return this.purpose != null && !this.purpose.isEmpty();
2775    }
2776
2777    public boolean hasPurpose() { 
2778      return this.purpose != null && !this.purpose.isEmpty();
2779    }
2780
2781    /**
2782     * @param value {@link #purpose} (Explains why this ObservationDefinition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
2783     */
2784    public ObservationDefinition setPurposeElement(MarkdownType value) { 
2785      this.purpose = value;
2786      return this;
2787    }
2788
2789    /**
2790     * @return Explains why this ObservationDefinition is needed and why it has been designed as it has.
2791     */
2792    public String getPurpose() { 
2793      return this.purpose == null ? null : this.purpose.getValue();
2794    }
2795
2796    /**
2797     * @param value Explains why this ObservationDefinition is needed and why it has been designed as it has.
2798     */
2799    public ObservationDefinition setPurpose(String value) { 
2800      if (value == null)
2801        this.purpose = null;
2802      else {
2803        if (this.purpose == null)
2804          this.purpose = new MarkdownType();
2805        this.purpose.setValue(value);
2806      }
2807      return this;
2808    }
2809
2810    /**
2811     * @return {@link #copyright} (Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
2812     */
2813    public MarkdownType getCopyrightElement() { 
2814      if (this.copyright == null)
2815        if (Configuration.errorOnAutoCreate())
2816          throw new Error("Attempt to auto-create ObservationDefinition.copyright");
2817        else if (Configuration.doAutoCreate())
2818          this.copyright = new MarkdownType(); // bb
2819      return this.copyright;
2820    }
2821
2822    public boolean hasCopyrightElement() { 
2823      return this.copyright != null && !this.copyright.isEmpty();
2824    }
2825
2826    public boolean hasCopyright() { 
2827      return this.copyright != null && !this.copyright.isEmpty();
2828    }
2829
2830    /**
2831     * @param value {@link #copyright} (Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
2832     */
2833    public ObservationDefinition setCopyrightElement(MarkdownType value) { 
2834      this.copyright = value;
2835      return this;
2836    }
2837
2838    /**
2839     * @return Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.
2840     */
2841    public String getCopyright() { 
2842      return this.copyright == null ? null : this.copyright.getValue();
2843    }
2844
2845    /**
2846     * @param value Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.
2847     */
2848    public ObservationDefinition setCopyright(String value) { 
2849      if (value == null)
2850        this.copyright = null;
2851      else {
2852        if (this.copyright == null)
2853          this.copyright = new MarkdownType();
2854        this.copyright.setValue(value);
2855      }
2856      return this;
2857    }
2858
2859    /**
2860     * @return {@link #approvalDate} (The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
2861     */
2862    public DateType getApprovalDateElement() { 
2863      if (this.approvalDate == null)
2864        if (Configuration.errorOnAutoCreate())
2865          throw new Error("Attempt to auto-create ObservationDefinition.approvalDate");
2866        else if (Configuration.doAutoCreate())
2867          this.approvalDate = new DateType(); // bb
2868      return this.approvalDate;
2869    }
2870
2871    public boolean hasApprovalDateElement() { 
2872      return this.approvalDate != null && !this.approvalDate.isEmpty();
2873    }
2874
2875    public boolean hasApprovalDate() { 
2876      return this.approvalDate != null && !this.approvalDate.isEmpty();
2877    }
2878
2879    /**
2880     * @param value {@link #approvalDate} (The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
2881     */
2882    public ObservationDefinition setApprovalDateElement(DateType value) { 
2883      this.approvalDate = value;
2884      return this;
2885    }
2886
2887    /**
2888     * @return The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
2889     */
2890    public Date getApprovalDate() { 
2891      return this.approvalDate == null ? null : this.approvalDate.getValue();
2892    }
2893
2894    /**
2895     * @param value The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.
2896     */
2897    public ObservationDefinition setApprovalDate(Date value) { 
2898      if (value == null)
2899        this.approvalDate = null;
2900      else {
2901        if (this.approvalDate == null)
2902          this.approvalDate = new DateType();
2903        this.approvalDate.setValue(value);
2904      }
2905      return this;
2906    }
2907
2908    /**
2909     * @return {@link #lastReviewDate} (The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
2910     */
2911    public DateType getLastReviewDateElement() { 
2912      if (this.lastReviewDate == null)
2913        if (Configuration.errorOnAutoCreate())
2914          throw new Error("Attempt to auto-create ObservationDefinition.lastReviewDate");
2915        else if (Configuration.doAutoCreate())
2916          this.lastReviewDate = new DateType(); // bb
2917      return this.lastReviewDate;
2918    }
2919
2920    public boolean hasLastReviewDateElement() { 
2921      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
2922    }
2923
2924    public boolean hasLastReviewDate() { 
2925      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
2926    }
2927
2928    /**
2929     * @param value {@link #lastReviewDate} (The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
2930     */
2931    public ObservationDefinition setLastReviewDateElement(DateType value) { 
2932      this.lastReviewDate = value;
2933      return this;
2934    }
2935
2936    /**
2937     * @return The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
2938     */
2939    public Date getLastReviewDate() { 
2940      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
2941    }
2942
2943    /**
2944     * @param value The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.
2945     */
2946    public ObservationDefinition setLastReviewDate(Date value) { 
2947      if (value == null)
2948        this.lastReviewDate = null;
2949      else {
2950        if (this.lastReviewDate == null)
2951          this.lastReviewDate = new DateType();
2952        this.lastReviewDate.setValue(value);
2953      }
2954      return this;
2955    }
2956
2957    /**
2958     * @return {@link #effectivePeriod} (The period during which the ObservationDefinition content was or is planned to be effective.)
2959     */
2960    public Period getEffectivePeriod() { 
2961      if (this.effectivePeriod == null)
2962        if (Configuration.errorOnAutoCreate())
2963          throw new Error("Attempt to auto-create ObservationDefinition.effectivePeriod");
2964        else if (Configuration.doAutoCreate())
2965          this.effectivePeriod = new Period(); // cc
2966      return this.effectivePeriod;
2967    }
2968
2969    public boolean hasEffectivePeriod() { 
2970      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
2971    }
2972
2973    /**
2974     * @param value {@link #effectivePeriod} (The period during which the ObservationDefinition content was or is planned to be effective.)
2975     */
2976    public ObservationDefinition setEffectivePeriod(Period value) { 
2977      this.effectivePeriod = value;
2978      return this;
2979    }
2980
2981    /**
2982     * @return {@link #performerType} (The type of individual/organization/device that is expected to act upon instances of this definition.)
2983     */
2984    public CodeableConcept getPerformerType() { 
2985      if (this.performerType == null)
2986        if (Configuration.errorOnAutoCreate())
2987          throw new Error("Attempt to auto-create ObservationDefinition.performerType");
2988        else if (Configuration.doAutoCreate())
2989          this.performerType = new CodeableConcept(); // cc
2990      return this.performerType;
2991    }
2992
2993    public boolean hasPerformerType() { 
2994      return this.performerType != null && !this.performerType.isEmpty();
2995    }
2996
2997    /**
2998     * @param value {@link #performerType} (The type of individual/organization/device that is expected to act upon instances of this definition.)
2999     */
3000    public ObservationDefinition setPerformerType(CodeableConcept value) { 
3001      this.performerType = value;
3002      return this;
3003    }
3004
3005    /**
3006     * @return {@link #category} (A code that classifies the general type of observation.)
3007     */
3008    public List<CodeableConcept> getCategory() { 
3009      if (this.category == null)
3010        this.category = new ArrayList<CodeableConcept>();
3011      return this.category;
3012    }
3013
3014    /**
3015     * @return Returns a reference to <code>this</code> for easy method chaining
3016     */
3017    public ObservationDefinition setCategory(List<CodeableConcept> theCategory) { 
3018      this.category = theCategory;
3019      return this;
3020    }
3021
3022    public boolean hasCategory() { 
3023      if (this.category == null)
3024        return false;
3025      for (CodeableConcept item : this.category)
3026        if (!item.isEmpty())
3027          return true;
3028      return false;
3029    }
3030
3031    public CodeableConcept addCategory() { //3
3032      CodeableConcept t = new CodeableConcept();
3033      if (this.category == null)
3034        this.category = new ArrayList<CodeableConcept>();
3035      this.category.add(t);
3036      return t;
3037    }
3038
3039    public ObservationDefinition addCategory(CodeableConcept t) { //3
3040      if (t == null)
3041        return this;
3042      if (this.category == null)
3043        this.category = new ArrayList<CodeableConcept>();
3044      this.category.add(t);
3045      return this;
3046    }
3047
3048    /**
3049     * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3}
3050     */
3051    public CodeableConcept getCategoryFirstRep() { 
3052      if (getCategory().isEmpty()) {
3053        addCategory();
3054      }
3055      return getCategory().get(0);
3056    }
3057
3058    /**
3059     * @return {@link #code} (Describes what will be observed. Sometimes this is called the observation "name".)
3060     */
3061    public CodeableConcept getCode() { 
3062      if (this.code == null)
3063        if (Configuration.errorOnAutoCreate())
3064          throw new Error("Attempt to auto-create ObservationDefinition.code");
3065        else if (Configuration.doAutoCreate())
3066          this.code = new CodeableConcept(); // cc
3067      return this.code;
3068    }
3069
3070    public boolean hasCode() { 
3071      return this.code != null && !this.code.isEmpty();
3072    }
3073
3074    /**
3075     * @param value {@link #code} (Describes what will be observed. Sometimes this is called the observation "name".)
3076     */
3077    public ObservationDefinition setCode(CodeableConcept value) { 
3078      this.code = value;
3079      return this;
3080    }
3081
3082    /**
3083     * @return {@link #permittedDataType} (The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.)
3084     */
3085    public List<Enumeration<ObservationDataType>> getPermittedDataType() { 
3086      if (this.permittedDataType == null)
3087        this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
3088      return this.permittedDataType;
3089    }
3090
3091    /**
3092     * @return Returns a reference to <code>this</code> for easy method chaining
3093     */
3094    public ObservationDefinition setPermittedDataType(List<Enumeration<ObservationDataType>> thePermittedDataType) { 
3095      this.permittedDataType = thePermittedDataType;
3096      return this;
3097    }
3098
3099    public boolean hasPermittedDataType() { 
3100      if (this.permittedDataType == null)
3101        return false;
3102      for (Enumeration<ObservationDataType> item : this.permittedDataType)
3103        if (!item.isEmpty())
3104          return true;
3105      return false;
3106    }
3107
3108    /**
3109     * @return {@link #permittedDataType} (The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.)
3110     */
3111    public Enumeration<ObservationDataType> addPermittedDataTypeElement() {//2 
3112      Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory());
3113      if (this.permittedDataType == null)
3114        this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
3115      this.permittedDataType.add(t);
3116      return t;
3117    }
3118
3119    /**
3120     * @param value {@link #permittedDataType} (The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.)
3121     */
3122    public ObservationDefinition addPermittedDataType(ObservationDataType value) { //1
3123      Enumeration<ObservationDataType> t = new Enumeration<ObservationDataType>(new ObservationDataTypeEnumFactory());
3124      t.setValue(value);
3125      if (this.permittedDataType == null)
3126        this.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
3127      this.permittedDataType.add(t);
3128      return this;
3129    }
3130
3131    /**
3132     * @param value {@link #permittedDataType} (The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.)
3133     */
3134    public boolean hasPermittedDataType(ObservationDataType value) { 
3135      if (this.permittedDataType == null)
3136        return false;
3137      for (Enumeration<ObservationDataType> v : this.permittedDataType)
3138        if (v.getValue().equals(value)) // code
3139          return true;
3140      return false;
3141    }
3142
3143    /**
3144     * @return {@link #multipleResultsAllowed} (Multiple results allowed for observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getMultipleResultsAllowed" gives direct access to the value
3145     */
3146    public BooleanType getMultipleResultsAllowedElement() { 
3147      if (this.multipleResultsAllowed == null)
3148        if (Configuration.errorOnAutoCreate())
3149          throw new Error("Attempt to auto-create ObservationDefinition.multipleResultsAllowed");
3150        else if (Configuration.doAutoCreate())
3151          this.multipleResultsAllowed = new BooleanType(); // bb
3152      return this.multipleResultsAllowed;
3153    }
3154
3155    public boolean hasMultipleResultsAllowedElement() { 
3156      return this.multipleResultsAllowed != null && !this.multipleResultsAllowed.isEmpty();
3157    }
3158
3159    public boolean hasMultipleResultsAllowed() { 
3160      return this.multipleResultsAllowed != null && !this.multipleResultsAllowed.isEmpty();
3161    }
3162
3163    /**
3164     * @param value {@link #multipleResultsAllowed} (Multiple results allowed for observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getMultipleResultsAllowed" gives direct access to the value
3165     */
3166    public ObservationDefinition setMultipleResultsAllowedElement(BooleanType value) { 
3167      this.multipleResultsAllowed = value;
3168      return this;
3169    }
3170
3171    /**
3172     * @return Multiple results allowed for observations conforming to this ObservationDefinition.
3173     */
3174    public boolean getMultipleResultsAllowed() { 
3175      return this.multipleResultsAllowed == null || this.multipleResultsAllowed.isEmpty() ? false : this.multipleResultsAllowed.getValue();
3176    }
3177
3178    /**
3179     * @param value Multiple results allowed for observations conforming to this ObservationDefinition.
3180     */
3181    public ObservationDefinition setMultipleResultsAllowed(boolean value) { 
3182        if (this.multipleResultsAllowed == null)
3183          this.multipleResultsAllowed = new BooleanType();
3184        this.multipleResultsAllowed.setValue(value);
3185      return this;
3186    }
3187
3188    /**
3189     * @return {@link #bodySite} (The site on the subject's body where the  observation is to be made.)
3190     */
3191    public CodeableConcept getBodySite() { 
3192      if (this.bodySite == null)
3193        if (Configuration.errorOnAutoCreate())
3194          throw new Error("Attempt to auto-create ObservationDefinition.bodySite");
3195        else if (Configuration.doAutoCreate())
3196          this.bodySite = new CodeableConcept(); // cc
3197      return this.bodySite;
3198    }
3199
3200    public boolean hasBodySite() { 
3201      return this.bodySite != null && !this.bodySite.isEmpty();
3202    }
3203
3204    /**
3205     * @param value {@link #bodySite} (The site on the subject's body where the  observation is to be made.)
3206     */
3207    public ObservationDefinition setBodySite(CodeableConcept value) { 
3208      this.bodySite = value;
3209      return this;
3210    }
3211
3212    /**
3213     * @return {@link #method} (The method or technique used to perform the observation.)
3214     */
3215    public CodeableConcept getMethod() { 
3216      if (this.method == null)
3217        if (Configuration.errorOnAutoCreate())
3218          throw new Error("Attempt to auto-create ObservationDefinition.method");
3219        else if (Configuration.doAutoCreate())
3220          this.method = new CodeableConcept(); // cc
3221      return this.method;
3222    }
3223
3224    public boolean hasMethod() { 
3225      return this.method != null && !this.method.isEmpty();
3226    }
3227
3228    /**
3229     * @param value {@link #method} (The method or technique used to perform the observation.)
3230     */
3231    public ObservationDefinition setMethod(CodeableConcept value) { 
3232      this.method = value;
3233      return this;
3234    }
3235
3236    /**
3237     * @return {@link #specimen} (The kind of specimen that this type of observation is produced on.)
3238     */
3239    public Reference getSpecimen() { 
3240      if (this.specimen == null)
3241        if (Configuration.errorOnAutoCreate())
3242          throw new Error("Attempt to auto-create ObservationDefinition.specimen");
3243        else if (Configuration.doAutoCreate())
3244          this.specimen = new Reference(); // cc
3245      return this.specimen;
3246    }
3247
3248    public boolean hasSpecimen() { 
3249      return this.specimen != null && !this.specimen.isEmpty();
3250    }
3251
3252    /**
3253     * @param value {@link #specimen} (The kind of specimen that this type of observation is produced on.)
3254     */
3255    public ObservationDefinition setSpecimen(Reference value) { 
3256      this.specimen = value;
3257      return this;
3258    }
3259
3260    /**
3261     * @return {@link #device} (The measurement device used to produce observations of this type.)
3262     */
3263    public Reference getDevice() { 
3264      if (this.device == null)
3265        if (Configuration.errorOnAutoCreate())
3266          throw new Error("Attempt to auto-create ObservationDefinition.device");
3267        else if (Configuration.doAutoCreate())
3268          this.device = new Reference(); // cc
3269      return this.device;
3270    }
3271
3272    public boolean hasDevice() { 
3273      return this.device != null && !this.device.isEmpty();
3274    }
3275
3276    /**
3277     * @param value {@link #device} (The measurement device used to produce observations of this type.)
3278     */
3279    public ObservationDefinition setDevice(Reference value) { 
3280      this.device = value;
3281      return this;
3282    }
3283
3284    /**
3285     * @return {@link #preferredReportName} (The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getPreferredReportName" gives direct access to the value
3286     */
3287    public StringType getPreferredReportNameElement() { 
3288      if (this.preferredReportName == null)
3289        if (Configuration.errorOnAutoCreate())
3290          throw new Error("Attempt to auto-create ObservationDefinition.preferredReportName");
3291        else if (Configuration.doAutoCreate())
3292          this.preferredReportName = new StringType(); // bb
3293      return this.preferredReportName;
3294    }
3295
3296    public boolean hasPreferredReportNameElement() { 
3297      return this.preferredReportName != null && !this.preferredReportName.isEmpty();
3298    }
3299
3300    public boolean hasPreferredReportName() { 
3301      return this.preferredReportName != null && !this.preferredReportName.isEmpty();
3302    }
3303
3304    /**
3305     * @param value {@link #preferredReportName} (The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.). This is the underlying object with id, value and extensions. The accessor "getPreferredReportName" gives direct access to the value
3306     */
3307    public ObservationDefinition setPreferredReportNameElement(StringType value) { 
3308      this.preferredReportName = value;
3309      return this;
3310    }
3311
3312    /**
3313     * @return The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.
3314     */
3315    public String getPreferredReportName() { 
3316      return this.preferredReportName == null ? null : this.preferredReportName.getValue();
3317    }
3318
3319    /**
3320     * @param value The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.
3321     */
3322    public ObservationDefinition setPreferredReportName(String value) { 
3323      if (Utilities.noString(value))
3324        this.preferredReportName = null;
3325      else {
3326        if (this.preferredReportName == null)
3327          this.preferredReportName = new StringType();
3328        this.preferredReportName.setValue(value);
3329      }
3330      return this;
3331    }
3332
3333    /**
3334     * @return {@link #quantitativeDetails} (Characteristics for quantitative results of this observation.)
3335     */
3336    public ObservationDefinitionQuantitativeDetailsComponent getQuantitativeDetails() { 
3337      if (this.quantitativeDetails == null)
3338        if (Configuration.errorOnAutoCreate())
3339          throw new Error("Attempt to auto-create ObservationDefinition.quantitativeDetails");
3340        else if (Configuration.doAutoCreate())
3341          this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent(); // cc
3342      return this.quantitativeDetails;
3343    }
3344
3345    public boolean hasQuantitativeDetails() { 
3346      return this.quantitativeDetails != null && !this.quantitativeDetails.isEmpty();
3347    }
3348
3349    /**
3350     * @param value {@link #quantitativeDetails} (Characteristics for quantitative results of this observation.)
3351     */
3352    public ObservationDefinition setQuantitativeDetails(ObservationDefinitionQuantitativeDetailsComponent value) { 
3353      this.quantitativeDetails = value;
3354      return this;
3355    }
3356
3357    /**
3358     * @return {@link #qualifiedInterval} (Multiple  ranges of results qualified by different contexts for ordinal or continuous observations conforming to this ObservationDefinition.)
3359     */
3360    public List<ObservationDefinitionQualifiedIntervalComponent> getQualifiedInterval() { 
3361      if (this.qualifiedInterval == null)
3362        this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>();
3363      return this.qualifiedInterval;
3364    }
3365
3366    /**
3367     * @return Returns a reference to <code>this</code> for easy method chaining
3368     */
3369    public ObservationDefinition setQualifiedInterval(List<ObservationDefinitionQualifiedIntervalComponent> theQualifiedInterval) { 
3370      this.qualifiedInterval = theQualifiedInterval;
3371      return this;
3372    }
3373
3374    public boolean hasQualifiedInterval() { 
3375      if (this.qualifiedInterval == null)
3376        return false;
3377      for (ObservationDefinitionQualifiedIntervalComponent item : this.qualifiedInterval)
3378        if (!item.isEmpty())
3379          return true;
3380      return false;
3381    }
3382
3383    public ObservationDefinitionQualifiedIntervalComponent addQualifiedInterval() { //3
3384      ObservationDefinitionQualifiedIntervalComponent t = new ObservationDefinitionQualifiedIntervalComponent();
3385      if (this.qualifiedInterval == null)
3386        this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>();
3387      this.qualifiedInterval.add(t);
3388      return t;
3389    }
3390
3391    public ObservationDefinition addQualifiedInterval(ObservationDefinitionQualifiedIntervalComponent t) { //3
3392      if (t == null)
3393        return this;
3394      if (this.qualifiedInterval == null)
3395        this.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>();
3396      this.qualifiedInterval.add(t);
3397      return this;
3398    }
3399
3400    /**
3401     * @return The first repetition of repeating field {@link #qualifiedInterval}, creating it if it does not already exist {3}
3402     */
3403    public ObservationDefinitionQualifiedIntervalComponent getQualifiedIntervalFirstRep() { 
3404      if (getQualifiedInterval().isEmpty()) {
3405        addQualifiedInterval();
3406      }
3407      return getQualifiedInterval().get(0);
3408    }
3409
3410    /**
3411     * @return {@link #validCodedValueSet} (The set of valid coded results for the observations  conforming to this ObservationDefinition.)
3412     */
3413    public Reference getValidCodedValueSet() { 
3414      if (this.validCodedValueSet == null)
3415        if (Configuration.errorOnAutoCreate())
3416          throw new Error("Attempt to auto-create ObservationDefinition.validCodedValueSet");
3417        else if (Configuration.doAutoCreate())
3418          this.validCodedValueSet = new Reference(); // cc
3419      return this.validCodedValueSet;
3420    }
3421
3422    public boolean hasValidCodedValueSet() { 
3423      return this.validCodedValueSet != null && !this.validCodedValueSet.isEmpty();
3424    }
3425
3426    /**
3427     * @param value {@link #validCodedValueSet} (The set of valid coded results for the observations  conforming to this ObservationDefinition.)
3428     */
3429    public ObservationDefinition setValidCodedValueSet(Reference value) { 
3430      this.validCodedValueSet = value;
3431      return this;
3432    }
3433
3434    /**
3435     * @return {@link #normalCodedValueSet} (The set of normal coded results for the observations conforming to this ObservationDefinition.)
3436     */
3437    public Reference getNormalCodedValueSet() { 
3438      if (this.normalCodedValueSet == null)
3439        if (Configuration.errorOnAutoCreate())
3440          throw new Error("Attempt to auto-create ObservationDefinition.normalCodedValueSet");
3441        else if (Configuration.doAutoCreate())
3442          this.normalCodedValueSet = new Reference(); // cc
3443      return this.normalCodedValueSet;
3444    }
3445
3446    public boolean hasNormalCodedValueSet() { 
3447      return this.normalCodedValueSet != null && !this.normalCodedValueSet.isEmpty();
3448    }
3449
3450    /**
3451     * @param value {@link #normalCodedValueSet} (The set of normal coded results for the observations conforming to this ObservationDefinition.)
3452     */
3453    public ObservationDefinition setNormalCodedValueSet(Reference value) { 
3454      this.normalCodedValueSet = value;
3455      return this;
3456    }
3457
3458    /**
3459     * @return {@link #abnormalCodedValueSet} (The set of abnormal coded results for the observation conforming to this ObservationDefinition.)
3460     */
3461    public Reference getAbnormalCodedValueSet() { 
3462      if (this.abnormalCodedValueSet == null)
3463        if (Configuration.errorOnAutoCreate())
3464          throw new Error("Attempt to auto-create ObservationDefinition.abnormalCodedValueSet");
3465        else if (Configuration.doAutoCreate())
3466          this.abnormalCodedValueSet = new Reference(); // cc
3467      return this.abnormalCodedValueSet;
3468    }
3469
3470    public boolean hasAbnormalCodedValueSet() { 
3471      return this.abnormalCodedValueSet != null && !this.abnormalCodedValueSet.isEmpty();
3472    }
3473
3474    /**
3475     * @param value {@link #abnormalCodedValueSet} (The set of abnormal coded results for the observation conforming to this ObservationDefinition.)
3476     */
3477    public ObservationDefinition setAbnormalCodedValueSet(Reference value) { 
3478      this.abnormalCodedValueSet = value;
3479      return this;
3480    }
3481
3482    /**
3483     * @return {@link #criticalCodedValueSet} (The set of critical coded results for the observation conforming to this ObservationDefinition.)
3484     */
3485    public Reference getCriticalCodedValueSet() { 
3486      if (this.criticalCodedValueSet == null)
3487        if (Configuration.errorOnAutoCreate())
3488          throw new Error("Attempt to auto-create ObservationDefinition.criticalCodedValueSet");
3489        else if (Configuration.doAutoCreate())
3490          this.criticalCodedValueSet = new Reference(); // cc
3491      return this.criticalCodedValueSet;
3492    }
3493
3494    public boolean hasCriticalCodedValueSet() { 
3495      return this.criticalCodedValueSet != null && !this.criticalCodedValueSet.isEmpty();
3496    }
3497
3498    /**
3499     * @param value {@link #criticalCodedValueSet} (The set of critical coded results for the observation conforming to this ObservationDefinition.)
3500     */
3501    public ObservationDefinition setCriticalCodedValueSet(Reference value) { 
3502      this.criticalCodedValueSet = value;
3503      return this;
3504    }
3505
3506    /**
3507     * @return {@link #hasMember} (This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.)
3508     */
3509    public List<Reference> getHasMember() { 
3510      if (this.hasMember == null)
3511        this.hasMember = new ArrayList<Reference>();
3512      return this.hasMember;
3513    }
3514
3515    /**
3516     * @return Returns a reference to <code>this</code> for easy method chaining
3517     */
3518    public ObservationDefinition setHasMember(List<Reference> theHasMember) { 
3519      this.hasMember = theHasMember;
3520      return this;
3521    }
3522
3523    public boolean hasHasMember() { 
3524      if (this.hasMember == null)
3525        return false;
3526      for (Reference item : this.hasMember)
3527        if (!item.isEmpty())
3528          return true;
3529      return false;
3530    }
3531
3532    public Reference addHasMember() { //3
3533      Reference t = new Reference();
3534      if (this.hasMember == null)
3535        this.hasMember = new ArrayList<Reference>();
3536      this.hasMember.add(t);
3537      return t;
3538    }
3539
3540    public ObservationDefinition addHasMember(Reference t) { //3
3541      if (t == null)
3542        return this;
3543      if (this.hasMember == null)
3544        this.hasMember = new ArrayList<Reference>();
3545      this.hasMember.add(t);
3546      return this;
3547    }
3548
3549    /**
3550     * @return The first repetition of repeating field {@link #hasMember}, creating it if it does not already exist {3}
3551     */
3552    public Reference getHasMemberFirstRep() { 
3553      if (getHasMember().isEmpty()) {
3554        addHasMember();
3555      }
3556      return getHasMember().get(0);
3557    }
3558
3559    /**
3560     * @return {@link #component} (Some observations have multiple component observations, expressed as separate code value pairs.)
3561     */
3562    public List<ObservationDefinitionComponentComponent> getComponent() { 
3563      if (this.component == null)
3564        this.component = new ArrayList<ObservationDefinitionComponentComponent>();
3565      return this.component;
3566    }
3567
3568    /**
3569     * @return Returns a reference to <code>this</code> for easy method chaining
3570     */
3571    public ObservationDefinition setComponent(List<ObservationDefinitionComponentComponent> theComponent) { 
3572      this.component = theComponent;
3573      return this;
3574    }
3575
3576    public boolean hasComponent() { 
3577      if (this.component == null)
3578        return false;
3579      for (ObservationDefinitionComponentComponent item : this.component)
3580        if (!item.isEmpty())
3581          return true;
3582      return false;
3583    }
3584
3585    public ObservationDefinitionComponentComponent addComponent() { //3
3586      ObservationDefinitionComponentComponent t = new ObservationDefinitionComponentComponent();
3587      if (this.component == null)
3588        this.component = new ArrayList<ObservationDefinitionComponentComponent>();
3589      this.component.add(t);
3590      return t;
3591    }
3592
3593    public ObservationDefinition addComponent(ObservationDefinitionComponentComponent t) { //3
3594      if (t == null)
3595        return this;
3596      if (this.component == null)
3597        this.component = new ArrayList<ObservationDefinitionComponentComponent>();
3598      this.component.add(t);
3599      return this;
3600    }
3601
3602    /**
3603     * @return The first repetition of repeating field {@link #component}, creating it if it does not already exist {3}
3604     */
3605    public ObservationDefinitionComponentComponent getComponentFirstRep() { 
3606      if (getComponent().isEmpty()) {
3607        addComponent();
3608      }
3609      return getComponent().get(0);
3610    }
3611
3612      protected void listChildren(List<Property> children) {
3613        super.listChildren(children);
3614        children.add(new Property("url", "uri", "An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.", 0, 1, url));
3615        children.add(new Property("identifier", "Identifier", "Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.", 0, 1, identifier));
3616        children.add(new Property("version", "string", "The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.", 0, 1, version));
3617        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the ObservationDefinition.", 0, 1, title));
3618        children.add(new Property("derivedFromCanonical", "canonical(ObservationDefinition)", "The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromCanonical));
3619        children.add(new Property("derivedFromUri", "uri", "The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromUri));
3620        children.add(new Property("status", "code", "The current state of the ObservationDefinition.", 0, 1, status));
3621        children.add(new Property("experimental", "boolean", "A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, 1, experimental));
3622        children.add(new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.", 0, 1, subject));
3623        children.add(new Property("date", "dateTime", "For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.", 0, 1, date));
3624        children.add(new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "Helps establish the \"authority/credibility\" of the ObservationDefinition. May also allow for contact.", 0, 1, publisher));
3625        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
3626        children.add(new Property("description", "markdown", "A free text natural language description of the ObservationDefinition from the consumer's perspective.", 0, 1, description));
3627        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of observation definitions.", 0, java.lang.Integer.MAX_VALUE, useContext));
3628        children.add(new Property("jurisdiction", "CodeableConcept", "A jurisdiction in which the ObservationDefinition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
3629        children.add(new Property("purpose", "markdown", "Explains why this ObservationDefinition is needed and why it has been designed as it has.", 0, 1, purpose));
3630        children.add(new Property("copyright", "markdown", "Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.", 0, 1, copyright));
3631        children.add(new Property("approvalDate", "date", "The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate));
3632        children.add(new Property("lastReviewDate", "date", "The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.", 0, 1, lastReviewDate));
3633        children.add(new Property("effectivePeriod", "Period", "The period during which the ObservationDefinition content was or is planned to be effective.", 0, 1, effectivePeriod));
3634        children.add(new Property("performerType", "CodeableConcept", "The type of individual/organization/device that is expected to act upon instances of this definition.", 0, 1, performerType));
3635        children.add(new Property("category", "CodeableConcept", "A code that classifies the general type of observation.", 0, java.lang.Integer.MAX_VALUE, category));
3636        children.add(new Property("code", "CodeableConcept", "Describes what will be observed. Sometimes this is called the observation \"name\".", 0, 1, code));
3637        children.add(new Property("permittedDataType", "code", "The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.", 0, java.lang.Integer.MAX_VALUE, permittedDataType));
3638        children.add(new Property("multipleResultsAllowed", "boolean", "Multiple results allowed for observations conforming to this ObservationDefinition.", 0, 1, multipleResultsAllowed));
3639        children.add(new Property("bodySite", "CodeableConcept", "The site on the subject's body where the  observation is to be made.", 0, 1, bodySite));
3640        children.add(new Property("method", "CodeableConcept", "The method or technique used to perform the observation.", 0, 1, method));
3641        children.add(new Property("specimen", "Reference(SpecimenDefinition)", "The kind of specimen that this type of observation is produced on.", 0, 1, specimen));
3642        children.add(new Property("device", "Reference(Device)", "The measurement device used to produce observations of this type.", 0, 1, device));
3643        children.add(new Property("preferredReportName", "string", "The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.", 0, 1, preferredReportName));
3644        children.add(new Property("quantitativeDetails", "", "Characteristics for quantitative results of this observation.", 0, 1, quantitativeDetails));
3645        children.add(new Property("qualifiedInterval", "", "Multiple  ranges of results qualified by different contexts for ordinal or continuous observations conforming to this ObservationDefinition.", 0, java.lang.Integer.MAX_VALUE, qualifiedInterval));
3646        children.add(new Property("validCodedValueSet", "Reference(ValueSet)", "The set of valid coded results for the observations  conforming to this ObservationDefinition.", 0, 1, validCodedValueSet));
3647        children.add(new Property("normalCodedValueSet", "Reference(ValueSet)", "The set of normal coded results for the observations conforming to this ObservationDefinition.", 0, 1, normalCodedValueSet));
3648        children.add(new Property("abnormalCodedValueSet", "Reference(ValueSet)", "The set of abnormal coded results for the observation conforming to this ObservationDefinition.", 0, 1, abnormalCodedValueSet));
3649        children.add(new Property("criticalCodedValueSet", "Reference(ValueSet)", "The set of critical coded results for the observation conforming to this ObservationDefinition.", 0, 1, criticalCodedValueSet));
3650        children.add(new Property("hasMember", "Reference(ObservationDefinition|Questionnaire)", "This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.", 0, java.lang.Integer.MAX_VALUE, hasMember));
3651        children.add(new Property("component", "", "Some observations have multiple component observations, expressed as separate code value pairs.", 0, java.lang.Integer.MAX_VALUE, component));
3652      }
3653
3654      @Override
3655      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3656        switch (_hash) {
3657        case 116079: /*url*/  return new Property("url", "uri", "An absolute URL that is used to identify this ObservationDefinition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this ObservationDefinition is (or will be) published. The URL SHOULD include the major version of the ObservationDefinition. For more information see Technical and Business Versions.", 0, 1, url);
3658        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Business identifiers assigned to this ObservationDefinition. by the performer and/or other systems. These identifiers remain constant as the resource is updated and propagates from server to server.", 0, 1, identifier);
3659        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the ObservationDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the ObservationDefinition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions are orderable.", 0, 1, version);
3660        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the ObservationDefinition.", 0, 1, title);
3661        case -978133683: /*derivedFromCanonical*/  return new Property("derivedFromCanonical", "canonical(ObservationDefinition)", "The canonical URL pointing to another FHIR-defined ObservationDefinition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromCanonical);
3662        case -1076333435: /*derivedFromUri*/  return new Property("derivedFromUri", "uri", "The URL pointing to an externally-defined observation definition, guideline or other definition that is adhered to in whole or in part by this definition.", 0, java.lang.Integer.MAX_VALUE, derivedFromUri);
3663        case -892481550: /*status*/  return new Property("status", "code", "The current state of the ObservationDefinition.", 0, 1, status);
3664        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A flag to indicate that this ObservationDefinition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, 1, experimental);
3665        case -573640748: /*subject[x]*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.", 0, 1, subject);
3666        case -1867885268: /*subject*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.", 0, 1, subject);
3667        case -1257122603: /*subjectCodeableConcept*/  return new Property("subject[x]", "CodeableConcept", "A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.", 0, 1, subject);
3668        case 772938623: /*subjectReference*/  return new Property("subject[x]", "Reference(Group)", "A code or group definition that describes the intended subject of Observation instances conforming to this ObservationDefinition.", 0, 1, subject);
3669        case 3076014: /*date*/  return new Property("date", "dateTime", "For draft definitions, indicates the date of initial creation. For active definitions, represents the date of activation. For withdrawn definitions, indicates the date of withdrawal.", 0, 1, date);
3670        case 1447404028: /*publisher*/  return new Property("publisher", "Reference(Practitioner|PractitionerRole|Organization)", "Helps establish the \"authority/credibility\" of the ObservationDefinition. May also allow for contact.", 0, 1, publisher);
3671        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
3672        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the ObservationDefinition from the consumer's perspective.", 0, 1, description);
3673        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of observation definitions.", 0, java.lang.Integer.MAX_VALUE, useContext);
3674        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A jurisdiction in which the ObservationDefinition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
3675        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explains why this ObservationDefinition is needed and why it has been designed as it has.", 0, 1, purpose);
3676        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "Copyright statement relating to the ObservationDefinition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the ObservationDefinition.", 0, 1, copyright);
3677        case 223539345: /*approvalDate*/  return new Property("approvalDate", "date", "The date on which the asset content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate);
3678        case -1687512484: /*lastReviewDate*/  return new Property("lastReviewDate", "date", "The date on which the asset content was last reviewed. Review happens periodically after that, but doesn't change the original approval date.", 0, 1, lastReviewDate);
3679        case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "The period during which the ObservationDefinition content was or is planned to be effective.", 0, 1, effectivePeriod);
3680        case -901444568: /*performerType*/  return new Property("performerType", "CodeableConcept", "The type of individual/organization/device that is expected to act upon instances of this definition.", 0, 1, performerType);
3681        case 50511102: /*category*/  return new Property("category", "CodeableConcept", "A code that classifies the general type of observation.", 0, java.lang.Integer.MAX_VALUE, category);
3682        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "Describes what will be observed. Sometimes this is called the observation \"name\".", 0, 1, code);
3683        case -99492804: /*permittedDataType*/  return new Property("permittedDataType", "code", "The data types allowed for the value element of the instance observations conforming to this ObservationDefinition.", 0, java.lang.Integer.MAX_VALUE, permittedDataType);
3684        case -2102414590: /*multipleResultsAllowed*/  return new Property("multipleResultsAllowed", "boolean", "Multiple results allowed for observations conforming to this ObservationDefinition.", 0, 1, multipleResultsAllowed);
3685        case 1702620169: /*bodySite*/  return new Property("bodySite", "CodeableConcept", "The site on the subject's body where the  observation is to be made.", 0, 1, bodySite);
3686        case -1077554975: /*method*/  return new Property("method", "CodeableConcept", "The method or technique used to perform the observation.", 0, 1, method);
3687        case -2132868344: /*specimen*/  return new Property("specimen", "Reference(SpecimenDefinition)", "The kind of specimen that this type of observation is produced on.", 0, 1, specimen);
3688        case -1335157162: /*device*/  return new Property("device", "Reference(Device)", "The measurement device used to produce observations of this type.", 0, 1, device);
3689        case -1851030208: /*preferredReportName*/  return new Property("preferredReportName", "string", "The preferred name to be used when reporting the results of observations conforming to this ObservationDefinition.", 0, 1, preferredReportName);
3690        case 842150763: /*quantitativeDetails*/  return new Property("quantitativeDetails", "", "Characteristics for quantitative results of this observation.", 0, 1, quantitativeDetails);
3691        case 1882971521: /*qualifiedInterval*/  return new Property("qualifiedInterval", "", "Multiple  ranges of results qualified by different contexts for ordinal or continuous observations conforming to this ObservationDefinition.", 0, java.lang.Integer.MAX_VALUE, qualifiedInterval);
3692        case 1374640076: /*validCodedValueSet*/  return new Property("validCodedValueSet", "Reference(ValueSet)", "The set of valid coded results for the observations  conforming to this ObservationDefinition.", 0, 1, validCodedValueSet);
3693        case -837500735: /*normalCodedValueSet*/  return new Property("normalCodedValueSet", "Reference(ValueSet)", "The set of normal coded results for the observations conforming to this ObservationDefinition.", 0, 1, normalCodedValueSet);
3694        case 1073600256: /*abnormalCodedValueSet*/  return new Property("abnormalCodedValueSet", "Reference(ValueSet)", "The set of abnormal coded results for the observation conforming to this ObservationDefinition.", 0, 1, abnormalCodedValueSet);
3695        case 2568457: /*criticalCodedValueSet*/  return new Property("criticalCodedValueSet", "Reference(ValueSet)", "The set of critical coded results for the observation conforming to this ObservationDefinition.", 0, 1, criticalCodedValueSet);
3696        case -458019372: /*hasMember*/  return new Property("hasMember", "Reference(ObservationDefinition|Questionnaire)", "This ObservationDefinition defines a group  observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.", 0, java.lang.Integer.MAX_VALUE, hasMember);
3697        case -1399907075: /*component*/  return new Property("component", "", "Some observations have multiple component observations, expressed as separate code value pairs.", 0, java.lang.Integer.MAX_VALUE, component);
3698        default: return super.getNamedProperty(_hash, _name, _checkValid);
3699        }
3700
3701      }
3702
3703      @Override
3704      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3705        switch (hash) {
3706        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
3707        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
3708        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
3709        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
3710        case -978133683: /*derivedFromCanonical*/ return this.derivedFromCanonical == null ? new Base[0] : this.derivedFromCanonical.toArray(new Base[this.derivedFromCanonical.size()]); // CanonicalType
3711        case -1076333435: /*derivedFromUri*/ return this.derivedFromUri == null ? new Base[0] : this.derivedFromUri.toArray(new Base[this.derivedFromUri.size()]); // UriType
3712        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
3713        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
3714        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // DataType
3715        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
3716        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // Reference
3717        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
3718        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
3719        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
3720        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
3721        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
3722        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
3723        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
3724        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
3725        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
3726        case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : new Base[] {this.performerType}; // CodeableConcept
3727        case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept
3728        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3729        case -99492804: /*permittedDataType*/ return this.permittedDataType == null ? new Base[0] : this.permittedDataType.toArray(new Base[this.permittedDataType.size()]); // Enumeration<ObservationDataType>
3730        case -2102414590: /*multipleResultsAllowed*/ return this.multipleResultsAllowed == null ? new Base[0] : new Base[] {this.multipleResultsAllowed}; // BooleanType
3731        case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // CodeableConcept
3732        case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept
3733        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : new Base[] {this.specimen}; // Reference
3734        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // Reference
3735        case -1851030208: /*preferredReportName*/ return this.preferredReportName == null ? new Base[0] : new Base[] {this.preferredReportName}; // StringType
3736        case 842150763: /*quantitativeDetails*/ return this.quantitativeDetails == null ? new Base[0] : new Base[] {this.quantitativeDetails}; // ObservationDefinitionQuantitativeDetailsComponent
3737        case 1882971521: /*qualifiedInterval*/ return this.qualifiedInterval == null ? new Base[0] : this.qualifiedInterval.toArray(new Base[this.qualifiedInterval.size()]); // ObservationDefinitionQualifiedIntervalComponent
3738        case 1374640076: /*validCodedValueSet*/ return this.validCodedValueSet == null ? new Base[0] : new Base[] {this.validCodedValueSet}; // Reference
3739        case -837500735: /*normalCodedValueSet*/ return this.normalCodedValueSet == null ? new Base[0] : new Base[] {this.normalCodedValueSet}; // Reference
3740        case 1073600256: /*abnormalCodedValueSet*/ return this.abnormalCodedValueSet == null ? new Base[0] : new Base[] {this.abnormalCodedValueSet}; // Reference
3741        case 2568457: /*criticalCodedValueSet*/ return this.criticalCodedValueSet == null ? new Base[0] : new Base[] {this.criticalCodedValueSet}; // Reference
3742        case -458019372: /*hasMember*/ return this.hasMember == null ? new Base[0] : this.hasMember.toArray(new Base[this.hasMember.size()]); // Reference
3743        case -1399907075: /*component*/ return this.component == null ? new Base[0] : this.component.toArray(new Base[this.component.size()]); // ObservationDefinitionComponentComponent
3744        default: return super.getProperty(hash, name, checkValid);
3745        }
3746
3747      }
3748
3749      @Override
3750      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3751        switch (hash) {
3752        case 116079: // url
3753          this.url = TypeConvertor.castToUri(value); // UriType
3754          return value;
3755        case -1618432855: // identifier
3756          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
3757          return value;
3758        case 351608024: // version
3759          this.version = TypeConvertor.castToString(value); // StringType
3760          return value;
3761        case 110371416: // title
3762          this.title = TypeConvertor.castToString(value); // StringType
3763          return value;
3764        case -978133683: // derivedFromCanonical
3765          this.getDerivedFromCanonical().add(TypeConvertor.castToCanonical(value)); // CanonicalType
3766          return value;
3767        case -1076333435: // derivedFromUri
3768          this.getDerivedFromUri().add(TypeConvertor.castToUri(value)); // UriType
3769          return value;
3770        case -892481550: // status
3771          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3772          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3773          return value;
3774        case -404562712: // experimental
3775          this.experimental = TypeConvertor.castToBoolean(value); // BooleanType
3776          return value;
3777        case -1867885268: // subject
3778          this.subject = TypeConvertor.castToType(value); // DataType
3779          return value;
3780        case 3076014: // date
3781          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
3782          return value;
3783        case 1447404028: // publisher
3784          this.publisher = TypeConvertor.castToReference(value); // Reference
3785          return value;
3786        case 951526432: // contact
3787          this.getContact().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
3788          return value;
3789        case -1724546052: // description
3790          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
3791          return value;
3792        case -669707736: // useContext
3793          this.getUseContext().add(TypeConvertor.castToUsageContext(value)); // UsageContext
3794          return value;
3795        case -507075711: // jurisdiction
3796          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3797          return value;
3798        case -220463842: // purpose
3799          this.purpose = TypeConvertor.castToMarkdown(value); // MarkdownType
3800          return value;
3801        case 1522889671: // copyright
3802          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
3803          return value;
3804        case 223539345: // approvalDate
3805          this.approvalDate = TypeConvertor.castToDate(value); // DateType
3806          return value;
3807        case -1687512484: // lastReviewDate
3808          this.lastReviewDate = TypeConvertor.castToDate(value); // DateType
3809          return value;
3810        case -403934648: // effectivePeriod
3811          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
3812          return value;
3813        case -901444568: // performerType
3814          this.performerType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3815          return value;
3816        case 50511102: // category
3817          this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3818          return value;
3819        case 3059181: // code
3820          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3821          return value;
3822        case -99492804: // permittedDataType
3823          value = new ObservationDataTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
3824          this.getPermittedDataType().add((Enumeration) value); // Enumeration<ObservationDataType>
3825          return value;
3826        case -2102414590: // multipleResultsAllowed
3827          this.multipleResultsAllowed = TypeConvertor.castToBoolean(value); // BooleanType
3828          return value;
3829        case 1702620169: // bodySite
3830          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3831          return value;
3832        case -1077554975: // method
3833          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3834          return value;
3835        case -2132868344: // specimen
3836          this.specimen = TypeConvertor.castToReference(value); // Reference
3837          return value;
3838        case -1335157162: // device
3839          this.device = TypeConvertor.castToReference(value); // Reference
3840          return value;
3841        case -1851030208: // preferredReportName
3842          this.preferredReportName = TypeConvertor.castToString(value); // StringType
3843          return value;
3844        case 842150763: // quantitativeDetails
3845          this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent
3846          return value;
3847        case 1882971521: // qualifiedInterval
3848          this.getQualifiedInterval().add((ObservationDefinitionQualifiedIntervalComponent) value); // ObservationDefinitionQualifiedIntervalComponent
3849          return value;
3850        case 1374640076: // validCodedValueSet
3851          this.validCodedValueSet = TypeConvertor.castToReference(value); // Reference
3852          return value;
3853        case -837500735: // normalCodedValueSet
3854          this.normalCodedValueSet = TypeConvertor.castToReference(value); // Reference
3855          return value;
3856        case 1073600256: // abnormalCodedValueSet
3857          this.abnormalCodedValueSet = TypeConvertor.castToReference(value); // Reference
3858          return value;
3859        case 2568457: // criticalCodedValueSet
3860          this.criticalCodedValueSet = TypeConvertor.castToReference(value); // Reference
3861          return value;
3862        case -458019372: // hasMember
3863          this.getHasMember().add(TypeConvertor.castToReference(value)); // Reference
3864          return value;
3865        case -1399907075: // component
3866          this.getComponent().add((ObservationDefinitionComponentComponent) value); // ObservationDefinitionComponentComponent
3867          return value;
3868        default: return super.setProperty(hash, name, value);
3869        }
3870
3871      }
3872
3873      @Override
3874      public Base setProperty(String name, Base value) throws FHIRException {
3875        if (name.equals("url")) {
3876          this.url = TypeConvertor.castToUri(value); // UriType
3877        } else if (name.equals("identifier")) {
3878          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
3879        } else if (name.equals("version")) {
3880          this.version = TypeConvertor.castToString(value); // StringType
3881        } else if (name.equals("title")) {
3882          this.title = TypeConvertor.castToString(value); // StringType
3883        } else if (name.equals("derivedFromCanonical")) {
3884          this.getDerivedFromCanonical().add(TypeConvertor.castToCanonical(value));
3885        } else if (name.equals("derivedFromUri")) {
3886          this.getDerivedFromUri().add(TypeConvertor.castToUri(value));
3887        } else if (name.equals("status")) {
3888          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
3889          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
3890        } else if (name.equals("experimental")) {
3891          this.experimental = TypeConvertor.castToBoolean(value); // BooleanType
3892        } else if (name.equals("subject[x]")) {
3893          this.subject = TypeConvertor.castToType(value); // DataType
3894        } else if (name.equals("date")) {
3895          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
3896        } else if (name.equals("publisher")) {
3897          this.publisher = TypeConvertor.castToReference(value); // Reference
3898        } else if (name.equals("contact")) {
3899          this.getContact().add(TypeConvertor.castToContactDetail(value));
3900        } else if (name.equals("description")) {
3901          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
3902        } else if (name.equals("useContext")) {
3903          this.getUseContext().add(TypeConvertor.castToUsageContext(value));
3904        } else if (name.equals("jurisdiction")) {
3905          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value));
3906        } else if (name.equals("purpose")) {
3907          this.purpose = TypeConvertor.castToMarkdown(value); // MarkdownType
3908        } else if (name.equals("copyright")) {
3909          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
3910        } else if (name.equals("approvalDate")) {
3911          this.approvalDate = TypeConvertor.castToDate(value); // DateType
3912        } else if (name.equals("lastReviewDate")) {
3913          this.lastReviewDate = TypeConvertor.castToDate(value); // DateType
3914        } else if (name.equals("effectivePeriod")) {
3915          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
3916        } else if (name.equals("performerType")) {
3917          this.performerType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3918        } else if (name.equals("category")) {
3919          this.getCategory().add(TypeConvertor.castToCodeableConcept(value));
3920        } else if (name.equals("code")) {
3921          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3922        } else if (name.equals("permittedDataType")) {
3923          value = new ObservationDataTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
3924          this.getPermittedDataType().add((Enumeration) value);
3925        } else if (name.equals("multipleResultsAllowed")) {
3926          this.multipleResultsAllowed = TypeConvertor.castToBoolean(value); // BooleanType
3927        } else if (name.equals("bodySite")) {
3928          this.bodySite = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3929        } else if (name.equals("method")) {
3930          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3931        } else if (name.equals("specimen")) {
3932          this.specimen = TypeConvertor.castToReference(value); // Reference
3933        } else if (name.equals("device")) {
3934          this.device = TypeConvertor.castToReference(value); // Reference
3935        } else if (name.equals("preferredReportName")) {
3936          this.preferredReportName = TypeConvertor.castToString(value); // StringType
3937        } else if (name.equals("quantitativeDetails")) {
3938          this.quantitativeDetails = (ObservationDefinitionQuantitativeDetailsComponent) value; // ObservationDefinitionQuantitativeDetailsComponent
3939        } else if (name.equals("qualifiedInterval")) {
3940          this.getQualifiedInterval().add((ObservationDefinitionQualifiedIntervalComponent) value);
3941        } else if (name.equals("validCodedValueSet")) {
3942          this.validCodedValueSet = TypeConvertor.castToReference(value); // Reference
3943        } else if (name.equals("normalCodedValueSet")) {
3944          this.normalCodedValueSet = TypeConvertor.castToReference(value); // Reference
3945        } else if (name.equals("abnormalCodedValueSet")) {
3946          this.abnormalCodedValueSet = TypeConvertor.castToReference(value); // Reference
3947        } else if (name.equals("criticalCodedValueSet")) {
3948          this.criticalCodedValueSet = TypeConvertor.castToReference(value); // Reference
3949        } else if (name.equals("hasMember")) {
3950          this.getHasMember().add(TypeConvertor.castToReference(value));
3951        } else if (name.equals("component")) {
3952          this.getComponent().add((ObservationDefinitionComponentComponent) value);
3953        } else
3954          return super.setProperty(name, value);
3955        return value;
3956      }
3957
3958      @Override
3959      public Base makeProperty(int hash, String name) throws FHIRException {
3960        switch (hash) {
3961        case 116079:  return getUrlElement();
3962        case -1618432855:  return getIdentifier();
3963        case 351608024:  return getVersionElement();
3964        case 110371416:  return getTitleElement();
3965        case -978133683:  return addDerivedFromCanonicalElement();
3966        case -1076333435:  return addDerivedFromUriElement();
3967        case -892481550:  return getStatusElement();
3968        case -404562712:  return getExperimentalElement();
3969        case -573640748:  return getSubject();
3970        case -1867885268:  return getSubject();
3971        case 3076014:  return getDateElement();
3972        case 1447404028:  return getPublisher();
3973        case 951526432:  return addContact(); 
3974        case -1724546052:  return getDescriptionElement();
3975        case -669707736:  return addUseContext(); 
3976        case -507075711:  return addJurisdiction(); 
3977        case -220463842:  return getPurposeElement();
3978        case 1522889671:  return getCopyrightElement();
3979        case 223539345:  return getApprovalDateElement();
3980        case -1687512484:  return getLastReviewDateElement();
3981        case -403934648:  return getEffectivePeriod();
3982        case -901444568:  return getPerformerType();
3983        case 50511102:  return addCategory(); 
3984        case 3059181:  return getCode();
3985        case -99492804:  return addPermittedDataTypeElement();
3986        case -2102414590:  return getMultipleResultsAllowedElement();
3987        case 1702620169:  return getBodySite();
3988        case -1077554975:  return getMethod();
3989        case -2132868344:  return getSpecimen();
3990        case -1335157162:  return getDevice();
3991        case -1851030208:  return getPreferredReportNameElement();
3992        case 842150763:  return getQuantitativeDetails();
3993        case 1882971521:  return addQualifiedInterval(); 
3994        case 1374640076:  return getValidCodedValueSet();
3995        case -837500735:  return getNormalCodedValueSet();
3996        case 1073600256:  return getAbnormalCodedValueSet();
3997        case 2568457:  return getCriticalCodedValueSet();
3998        case -458019372:  return addHasMember(); 
3999        case -1399907075:  return addComponent(); 
4000        default: return super.makeProperty(hash, name);
4001        }
4002
4003      }
4004
4005      @Override
4006      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4007        switch (hash) {
4008        case 116079: /*url*/ return new String[] {"uri"};
4009        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4010        case 351608024: /*version*/ return new String[] {"string"};
4011        case 110371416: /*title*/ return new String[] {"string"};
4012        case -978133683: /*derivedFromCanonical*/ return new String[] {"canonical"};
4013        case -1076333435: /*derivedFromUri*/ return new String[] {"uri"};
4014        case -892481550: /*status*/ return new String[] {"code"};
4015        case -404562712: /*experimental*/ return new String[] {"boolean"};
4016        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference"};
4017        case 3076014: /*date*/ return new String[] {"dateTime"};
4018        case 1447404028: /*publisher*/ return new String[] {"Reference"};
4019        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
4020        case -1724546052: /*description*/ return new String[] {"markdown"};
4021        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
4022        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
4023        case -220463842: /*purpose*/ return new String[] {"markdown"};
4024        case 1522889671: /*copyright*/ return new String[] {"markdown"};
4025        case 223539345: /*approvalDate*/ return new String[] {"date"};
4026        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
4027        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
4028        case -901444568: /*performerType*/ return new String[] {"CodeableConcept"};
4029        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
4030        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
4031        case -99492804: /*permittedDataType*/ return new String[] {"code"};
4032        case -2102414590: /*multipleResultsAllowed*/ return new String[] {"boolean"};
4033        case 1702620169: /*bodySite*/ return new String[] {"CodeableConcept"};
4034        case -1077554975: /*method*/ return new String[] {"CodeableConcept"};
4035        case -2132868344: /*specimen*/ return new String[] {"Reference"};
4036        case -1335157162: /*device*/ return new String[] {"Reference"};
4037        case -1851030208: /*preferredReportName*/ return new String[] {"string"};
4038        case 842150763: /*quantitativeDetails*/ return new String[] {};
4039        case 1882971521: /*qualifiedInterval*/ return new String[] {};
4040        case 1374640076: /*validCodedValueSet*/ return new String[] {"Reference"};
4041        case -837500735: /*normalCodedValueSet*/ return new String[] {"Reference"};
4042        case 1073600256: /*abnormalCodedValueSet*/ return new String[] {"Reference"};
4043        case 2568457: /*criticalCodedValueSet*/ return new String[] {"Reference"};
4044        case -458019372: /*hasMember*/ return new String[] {"Reference"};
4045        case -1399907075: /*component*/ return new String[] {};
4046        default: return super.getTypesForProperty(hash, name);
4047        }
4048
4049      }
4050
4051      @Override
4052      public Base addChild(String name) throws FHIRException {
4053        if (name.equals("url")) {
4054          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.url");
4055        }
4056        else if (name.equals("identifier")) {
4057          this.identifier = new Identifier();
4058          return this.identifier;
4059        }
4060        else if (name.equals("version")) {
4061          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.version");
4062        }
4063        else if (name.equals("title")) {
4064          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.title");
4065        }
4066        else if (name.equals("derivedFromCanonical")) {
4067          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.derivedFromCanonical");
4068        }
4069        else if (name.equals("derivedFromUri")) {
4070          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.derivedFromUri");
4071        }
4072        else if (name.equals("status")) {
4073          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.status");
4074        }
4075        else if (name.equals("experimental")) {
4076          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.experimental");
4077        }
4078        else if (name.equals("subjectCodeableConcept")) {
4079          this.subject = new CodeableConcept();
4080          return this.subject;
4081        }
4082        else if (name.equals("subjectReference")) {
4083          this.subject = new Reference();
4084          return this.subject;
4085        }
4086        else if (name.equals("date")) {
4087          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.date");
4088        }
4089        else if (name.equals("publisher")) {
4090          this.publisher = new Reference();
4091          return this.publisher;
4092        }
4093        else if (name.equals("contact")) {
4094          return addContact();
4095        }
4096        else if (name.equals("description")) {
4097          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.description");
4098        }
4099        else if (name.equals("useContext")) {
4100          return addUseContext();
4101        }
4102        else if (name.equals("jurisdiction")) {
4103          return addJurisdiction();
4104        }
4105        else if (name.equals("purpose")) {
4106          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.purpose");
4107        }
4108        else if (name.equals("copyright")) {
4109          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.copyright");
4110        }
4111        else if (name.equals("approvalDate")) {
4112          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.approvalDate");
4113        }
4114        else if (name.equals("lastReviewDate")) {
4115          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.lastReviewDate");
4116        }
4117        else if (name.equals("effectivePeriod")) {
4118          this.effectivePeriod = new Period();
4119          return this.effectivePeriod;
4120        }
4121        else if (name.equals("performerType")) {
4122          this.performerType = new CodeableConcept();
4123          return this.performerType;
4124        }
4125        else if (name.equals("category")) {
4126          return addCategory();
4127        }
4128        else if (name.equals("code")) {
4129          this.code = new CodeableConcept();
4130          return this.code;
4131        }
4132        else if (name.equals("permittedDataType")) {
4133          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.permittedDataType");
4134        }
4135        else if (name.equals("multipleResultsAllowed")) {
4136          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.multipleResultsAllowed");
4137        }
4138        else if (name.equals("bodySite")) {
4139          this.bodySite = new CodeableConcept();
4140          return this.bodySite;
4141        }
4142        else if (name.equals("method")) {
4143          this.method = new CodeableConcept();
4144          return this.method;
4145        }
4146        else if (name.equals("specimen")) {
4147          this.specimen = new Reference();
4148          return this.specimen;
4149        }
4150        else if (name.equals("device")) {
4151          this.device = new Reference();
4152          return this.device;
4153        }
4154        else if (name.equals("preferredReportName")) {
4155          throw new FHIRException("Cannot call addChild on a primitive type ObservationDefinition.preferredReportName");
4156        }
4157        else if (name.equals("quantitativeDetails")) {
4158          this.quantitativeDetails = new ObservationDefinitionQuantitativeDetailsComponent();
4159          return this.quantitativeDetails;
4160        }
4161        else if (name.equals("qualifiedInterval")) {
4162          return addQualifiedInterval();
4163        }
4164        else if (name.equals("validCodedValueSet")) {
4165          this.validCodedValueSet = new Reference();
4166          return this.validCodedValueSet;
4167        }
4168        else if (name.equals("normalCodedValueSet")) {
4169          this.normalCodedValueSet = new Reference();
4170          return this.normalCodedValueSet;
4171        }
4172        else if (name.equals("abnormalCodedValueSet")) {
4173          this.abnormalCodedValueSet = new Reference();
4174          return this.abnormalCodedValueSet;
4175        }
4176        else if (name.equals("criticalCodedValueSet")) {
4177          this.criticalCodedValueSet = new Reference();
4178          return this.criticalCodedValueSet;
4179        }
4180        else if (name.equals("hasMember")) {
4181          return addHasMember();
4182        }
4183        else if (name.equals("component")) {
4184          return addComponent();
4185        }
4186        else
4187          return super.addChild(name);
4188      }
4189
4190  public String fhirType() {
4191    return "ObservationDefinition";
4192
4193  }
4194
4195      public ObservationDefinition copy() {
4196        ObservationDefinition dst = new ObservationDefinition();
4197        copyValues(dst);
4198        return dst;
4199      }
4200
4201      public void copyValues(ObservationDefinition dst) {
4202        super.copyValues(dst);
4203        dst.url = url == null ? null : url.copy();
4204        dst.identifier = identifier == null ? null : identifier.copy();
4205        dst.version = version == null ? null : version.copy();
4206        dst.title = title == null ? null : title.copy();
4207        if (derivedFromCanonical != null) {
4208          dst.derivedFromCanonical = new ArrayList<CanonicalType>();
4209          for (CanonicalType i : derivedFromCanonical)
4210            dst.derivedFromCanonical.add(i.copy());
4211        };
4212        if (derivedFromUri != null) {
4213          dst.derivedFromUri = new ArrayList<UriType>();
4214          for (UriType i : derivedFromUri)
4215            dst.derivedFromUri.add(i.copy());
4216        };
4217        dst.status = status == null ? null : status.copy();
4218        dst.experimental = experimental == null ? null : experimental.copy();
4219        dst.subject = subject == null ? null : subject.copy();
4220        dst.date = date == null ? null : date.copy();
4221        dst.publisher = publisher == null ? null : publisher.copy();
4222        if (contact != null) {
4223          dst.contact = new ArrayList<ContactDetail>();
4224          for (ContactDetail i : contact)
4225            dst.contact.add(i.copy());
4226        };
4227        dst.description = description == null ? null : description.copy();
4228        if (useContext != null) {
4229          dst.useContext = new ArrayList<UsageContext>();
4230          for (UsageContext i : useContext)
4231            dst.useContext.add(i.copy());
4232        };
4233        if (jurisdiction != null) {
4234          dst.jurisdiction = new ArrayList<CodeableConcept>();
4235          for (CodeableConcept i : jurisdiction)
4236            dst.jurisdiction.add(i.copy());
4237        };
4238        dst.purpose = purpose == null ? null : purpose.copy();
4239        dst.copyright = copyright == null ? null : copyright.copy();
4240        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
4241        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
4242        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
4243        dst.performerType = performerType == null ? null : performerType.copy();
4244        if (category != null) {
4245          dst.category = new ArrayList<CodeableConcept>();
4246          for (CodeableConcept i : category)
4247            dst.category.add(i.copy());
4248        };
4249        dst.code = code == null ? null : code.copy();
4250        if (permittedDataType != null) {
4251          dst.permittedDataType = new ArrayList<Enumeration<ObservationDataType>>();
4252          for (Enumeration<ObservationDataType> i : permittedDataType)
4253            dst.permittedDataType.add(i.copy());
4254        };
4255        dst.multipleResultsAllowed = multipleResultsAllowed == null ? null : multipleResultsAllowed.copy();
4256        dst.bodySite = bodySite == null ? null : bodySite.copy();
4257        dst.method = method == null ? null : method.copy();
4258        dst.specimen = specimen == null ? null : specimen.copy();
4259        dst.device = device == null ? null : device.copy();
4260        dst.preferredReportName = preferredReportName == null ? null : preferredReportName.copy();
4261        dst.quantitativeDetails = quantitativeDetails == null ? null : quantitativeDetails.copy();
4262        if (qualifiedInterval != null) {
4263          dst.qualifiedInterval = new ArrayList<ObservationDefinitionQualifiedIntervalComponent>();
4264          for (ObservationDefinitionQualifiedIntervalComponent i : qualifiedInterval)
4265            dst.qualifiedInterval.add(i.copy());
4266        };
4267        dst.validCodedValueSet = validCodedValueSet == null ? null : validCodedValueSet.copy();
4268        dst.normalCodedValueSet = normalCodedValueSet == null ? null : normalCodedValueSet.copy();
4269        dst.abnormalCodedValueSet = abnormalCodedValueSet == null ? null : abnormalCodedValueSet.copy();
4270        dst.criticalCodedValueSet = criticalCodedValueSet == null ? null : criticalCodedValueSet.copy();
4271        if (hasMember != null) {
4272          dst.hasMember = new ArrayList<Reference>();
4273          for (Reference i : hasMember)
4274            dst.hasMember.add(i.copy());
4275        };
4276        if (component != null) {
4277          dst.component = new ArrayList<ObservationDefinitionComponentComponent>();
4278          for (ObservationDefinitionComponentComponent i : component)
4279            dst.component.add(i.copy());
4280        };
4281      }
4282
4283      protected ObservationDefinition typedCopy() {
4284        return copy();
4285      }
4286
4287      @Override
4288      public boolean equalsDeep(Base other_) {
4289        if (!super.equalsDeep(other_))
4290          return false;
4291        if (!(other_ instanceof ObservationDefinition))
4292          return false;
4293        ObservationDefinition o = (ObservationDefinition) other_;
4294        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
4295           && compareDeep(title, o.title, true) && compareDeep(derivedFromCanonical, o.derivedFromCanonical, true)
4296           && compareDeep(derivedFromUri, o.derivedFromUri, true) && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true)
4297           && compareDeep(subject, o.subject, true) && compareDeep(date, o.date, true) && compareDeep(publisher, o.publisher, true)
4298           && compareDeep(contact, o.contact, true) && compareDeep(description, o.description, true) && compareDeep(useContext, o.useContext, true)
4299           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
4300           && compareDeep(approvalDate, o.approvalDate, true) && compareDeep(lastReviewDate, o.lastReviewDate, true)
4301           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(performerType, o.performerType, true)
4302           && compareDeep(category, o.category, true) && compareDeep(code, o.code, true) && compareDeep(permittedDataType, o.permittedDataType, true)
4303           && compareDeep(multipleResultsAllowed, o.multipleResultsAllowed, true) && compareDeep(bodySite, o.bodySite, true)
4304           && compareDeep(method, o.method, true) && compareDeep(specimen, o.specimen, true) && compareDeep(device, o.device, true)
4305           && compareDeep(preferredReportName, o.preferredReportName, true) && compareDeep(quantitativeDetails, o.quantitativeDetails, true)
4306           && compareDeep(qualifiedInterval, o.qualifiedInterval, true) && compareDeep(validCodedValueSet, o.validCodedValueSet, true)
4307           && compareDeep(normalCodedValueSet, o.normalCodedValueSet, true) && compareDeep(abnormalCodedValueSet, o.abnormalCodedValueSet, true)
4308           && compareDeep(criticalCodedValueSet, o.criticalCodedValueSet, true) && compareDeep(hasMember, o.hasMember, true)
4309           && compareDeep(component, o.component, true);
4310      }
4311
4312      @Override
4313      public boolean equalsShallow(Base other_) {
4314        if (!super.equalsShallow(other_))
4315          return false;
4316        if (!(other_ instanceof ObservationDefinition))
4317          return false;
4318        ObservationDefinition o = (ObservationDefinition) other_;
4319        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(title, o.title, true)
4320           && compareValues(derivedFromCanonical, o.derivedFromCanonical, true) && compareValues(derivedFromUri, o.derivedFromUri, true)
4321           && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true) && compareValues(date, o.date, true)
4322           && compareValues(description, o.description, true) && compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true)
4323           && compareValues(approvalDate, o.approvalDate, true) && compareValues(lastReviewDate, o.lastReviewDate, true)
4324           && compareValues(permittedDataType, o.permittedDataType, true) && compareValues(multipleResultsAllowed, o.multipleResultsAllowed, true)
4325           && compareValues(preferredReportName, o.preferredReportName, true);
4326      }
4327
4328      public boolean isEmpty() {
4329        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, identifier, version
4330          , title, derivedFromCanonical, derivedFromUri, status, experimental, subject, date
4331          , publisher, contact, description, useContext, jurisdiction, purpose, copyright
4332          , approvalDate, lastReviewDate, effectivePeriod, performerType, category, code, permittedDataType
4333          , multipleResultsAllowed, bodySite, method, specimen, device, preferredReportName
4334          , quantitativeDetails, qualifiedInterval, validCodedValueSet, normalCodedValueSet, abnormalCodedValueSet
4335          , criticalCodedValueSet, hasMember, component);
4336      }
4337
4338  @Override
4339  public ResourceType getResourceType() {
4340    return ResourceType.ObservationDefinition;
4341   }
4342
4343 /**
4344   * Search parameter: <b>category</b>
4345   * <p>
4346   * Description: <b>Category (class) of observation</b><br>
4347   * Type: <b>token</b><br>
4348   * Path: <b>ObservationDefinition.category</b><br>
4349   * </p>
4350   */
4351  @SearchParamDefinition(name="category", path="ObservationDefinition.category", description="Category (class) of observation", type="token" )
4352  public static final String SP_CATEGORY = "category";
4353 /**
4354   * <b>Fluent Client</b> search parameter constant for <b>category</b>
4355   * <p>
4356   * Description: <b>Category (class) of observation</b><br>
4357   * Type: <b>token</b><br>
4358   * Path: <b>ObservationDefinition.category</b><br>
4359   * </p>
4360   */
4361  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
4362
4363 /**
4364   * Search parameter: <b>code</b>
4365   * <p>
4366   * Description: <b>Observation code</b><br>
4367   * Type: <b>token</b><br>
4368   * Path: <b>ObservationDefinition.code</b><br>
4369   * </p>
4370   */
4371  @SearchParamDefinition(name="code", path="ObservationDefinition.code", description="Observation code", type="token" )
4372  public static final String SP_CODE = "code";
4373 /**
4374   * <b>Fluent Client</b> search parameter constant for <b>code</b>
4375   * <p>
4376   * Description: <b>Observation code</b><br>
4377   * Type: <b>token</b><br>
4378   * Path: <b>ObservationDefinition.code</b><br>
4379   * </p>
4380   */
4381  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
4382
4383 /**
4384   * Search parameter: <b>experimental</b>
4385   * <p>
4386   * Description: <b>Not for genuine usage (true)</b><br>
4387   * Type: <b>token</b><br>
4388   * Path: <b>ObservationDefinition.experimental</b><br>
4389   * </p>
4390   */
4391  @SearchParamDefinition(name="experimental", path="ObservationDefinition.experimental", description="Not for genuine usage (true)", type="token" )
4392  public static final String SP_EXPERIMENTAL = "experimental";
4393 /**
4394   * <b>Fluent Client</b> search parameter constant for <b>experimental</b>
4395   * <p>
4396   * Description: <b>Not for genuine usage (true)</b><br>
4397   * Type: <b>token</b><br>
4398   * Path: <b>ObservationDefinition.experimental</b><br>
4399   * </p>
4400   */
4401  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EXPERIMENTAL = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EXPERIMENTAL);
4402
4403 /**
4404   * Search parameter: <b>identifier</b>
4405   * <p>
4406   * Description: <b>The unique identifier associated with the specimen definition</b><br>
4407   * Type: <b>token</b><br>
4408   * Path: <b>ObservationDefinition.identifier</b><br>
4409   * </p>
4410   */
4411  @SearchParamDefinition(name="identifier", path="ObservationDefinition.identifier", description="The unique identifier associated with the specimen definition", type="token" )
4412  public static final String SP_IDENTIFIER = "identifier";
4413 /**
4414   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4415   * <p>
4416   * Description: <b>The unique identifier associated with the specimen definition</b><br>
4417   * Type: <b>token</b><br>
4418   * Path: <b>ObservationDefinition.identifier</b><br>
4419   * </p>
4420   */
4421  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4422
4423 /**
4424   * Search parameter: <b>method</b>
4425   * <p>
4426   * Description: <b>Method of observation</b><br>
4427   * Type: <b>token</b><br>
4428   * Path: <b>ObservationDefinition.method</b><br>
4429   * </p>
4430   */
4431  @SearchParamDefinition(name="method", path="ObservationDefinition.method", description="Method of observation", type="token" )
4432  public static final String SP_METHOD = "method";
4433 /**
4434   * <b>Fluent Client</b> search parameter constant for <b>method</b>
4435   * <p>
4436   * Description: <b>Method of observation</b><br>
4437   * Type: <b>token</b><br>
4438   * Path: <b>ObservationDefinition.method</b><br>
4439   * </p>
4440   */
4441  public static final ca.uhn.fhir.rest.gclient.TokenClientParam METHOD = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_METHOD);
4442
4443 /**
4444   * Search parameter: <b>status</b>
4445   * <p>
4446   * Description: <b>Publication status of the ObservationDefinition: draft, active, retired, unknown</b><br>
4447   * Type: <b>token</b><br>
4448   * Path: <b>ObservationDefinition.status</b><br>
4449   * </p>
4450   */
4451  @SearchParamDefinition(name="status", path="ObservationDefinition.status", description="Publication status of the ObservationDefinition: draft, active, retired, unknown", type="token" )
4452  public static final String SP_STATUS = "status";
4453 /**
4454   * <b>Fluent Client</b> search parameter constant for <b>status</b>
4455   * <p>
4456   * Description: <b>Publication status of the ObservationDefinition: draft, active, retired, unknown</b><br>
4457   * Type: <b>token</b><br>
4458   * Path: <b>ObservationDefinition.status</b><br>
4459   * </p>
4460   */
4461  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
4462
4463 /**
4464   * Search parameter: <b>title</b>
4465   * <p>
4466   * Description: <b>Human-friendly name of the ObservationDefinition</b><br>
4467   * Type: <b>string</b><br>
4468   * Path: <b>ObservationDefinition.title</b><br>
4469   * </p>
4470   */
4471  @SearchParamDefinition(name="title", path="ObservationDefinition.title", description="Human-friendly name of the ObservationDefinition", type="string" )
4472  public static final String SP_TITLE = "title";
4473 /**
4474   * <b>Fluent Client</b> search parameter constant for <b>title</b>
4475   * <p>
4476   * Description: <b>Human-friendly name of the ObservationDefinition</b><br>
4477   * Type: <b>string</b><br>
4478   * Path: <b>ObservationDefinition.title</b><br>
4479   * </p>
4480   */
4481  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
4482
4483
4484}
4485