001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048import org.hl7.fhir.instance.model.api.ICompositeType;
049import  org.hl7.fhir.r5.model.Enumerations.BindingStrength;
050import  org.hl7.fhir.r5.model.Enumerations.BindingStrengthEnumFactory;
051import  org.hl7.fhir.r5.utils.ToolingExtensions;
052import  org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
053import  org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
054/**
055 * ElementDefinition Type: Captures constraints on each element within the resource, profile, or extension.
056 */
057@DatatypeDef(name="ElementDefinition")
058public class ElementDefinition extends BackboneType implements ICompositeType {
059
060    public enum AdditionalBindingPurposeVS {
061        /**
062         * A required binding, for use when the binding strength is 'extensible' or 'preferred'
063         */
064        MAXIMUM, 
065        /**
066         * The minimum allowable value set - any conformant system SHALL support all these codes
067         */
068        MINIMUM, 
069        /**
070         * This value set is used as a required binding (in addition to the base binding (not a replacement), usually in a particular usage context)
071         */
072        REQUIRED, 
073        /**
074         * This value set is used as an extensible binding (in addition to the base binding (not a replacement), usually in a particular usage context)
075         */
076        EXTENSIBLE, 
077        /**
078         * This value set is a candidate to substitute for the overall conformance value set in some situations; usually these are defined in the documentation
079         */
080        CANDIDATE, 
081        /**
082         * New records are required to use this value set, but legacy records may use other codes. The definition of 'new record' is difficult, since systems often create new records based on pre-existing data. Usually 'current' bindings are mandated by an external authority that makes clear rules around this
083         */
084        CURRENT, 
085        /**
086         * This is the value set that is preferred in a given context (documentation should explain why)
087         */
088        PREFERRED, 
089        /**
090         * This value set is provided for user look up in a given context. Typically, these valuesets only include a subset of codes relevant for input in a context
091         */
092        UI, 
093        /**
094         * This value set is a good set of codes to start with when designing your system
095         */
096        STARTER, 
097        /**
098         * This value set is a component of the base value set. Usually this is called out so that documentation can be written about a portion of the value set
099         */
100        COMPONENT, 
101        /**
102         * added to help the parsers with the generic types
103         */
104        NULL;
105        public static AdditionalBindingPurposeVS fromCode(String codeString) throws FHIRException {
106            if (codeString == null || "".equals(codeString))
107                return null;
108        if ("maximum".equals(codeString))
109          return MAXIMUM;
110        if ("minimum".equals(codeString))
111          return MINIMUM;
112        if ("required".equals(codeString))
113          return REQUIRED;
114        if ("extensible".equals(codeString))
115          return EXTENSIBLE;
116        if ("candidate".equals(codeString))
117          return CANDIDATE;
118        if ("current".equals(codeString))
119          return CURRENT;
120        if ("preferred".equals(codeString))
121          return PREFERRED;
122        if ("ui".equals(codeString))
123          return UI;
124        if ("starter".equals(codeString))
125          return STARTER;
126        if ("component".equals(codeString))
127          return COMPONENT;
128        if (Configuration.isAcceptInvalidEnums())
129          return null;
130        else
131          throw new FHIRException("Unknown AdditionalBindingPurposeVS code '"+codeString+"'");
132        }
133        public String toCode() {
134          switch (this) {
135            case MAXIMUM: return "maximum";
136            case MINIMUM: return "minimum";
137            case REQUIRED: return "required";
138            case EXTENSIBLE: return "extensible";
139            case CANDIDATE: return "candidate";
140            case CURRENT: return "current";
141            case PREFERRED: return "preferred";
142            case UI: return "ui";
143            case STARTER: return "starter";
144            case COMPONENT: return "component";
145            case NULL: return null;
146            default: return "?";
147          }
148        }
149        public String getSystem() {
150          switch (this) {
151            case MAXIMUM: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
152            case MINIMUM: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
153            case REQUIRED: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
154            case EXTENSIBLE: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
155            case CANDIDATE: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
156            case CURRENT: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
157            case PREFERRED: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
158            case UI: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
159            case STARTER: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
160            case COMPONENT: return "http://hl7.org/fhir/CodeSystem/additional-binding-purpose";
161            case NULL: return null;
162            default: return "?";
163          }
164        }
165        public String getDefinition() {
166          switch (this) {
167            case MAXIMUM: return "A required binding, for use when the binding strength is 'extensible' or 'preferred'";
168            case MINIMUM: return "The minimum allowable value set - any conformant system SHALL support all these codes";
169            case REQUIRED: return "This value set is used as a required binding (in addition to the base binding (not a replacement), usually in a particular usage context)";
170            case EXTENSIBLE: return "This value set is used as an extensible binding (in addition to the base binding (not a replacement), usually in a particular usage context)";
171            case CANDIDATE: return "This value set is a candidate to substitute for the overall conformance value set in some situations; usually these are defined in the documentation";
172            case CURRENT: return "New records are required to use this value set, but legacy records may use other codes. The definition of 'new record' is difficult, since systems often create new records based on pre-existing data. Usually 'current' bindings are mandated by an external authority that makes clear rules around this";
173            case PREFERRED: return "This is the value set that is preferred in a given context (documentation should explain why)";
174            case UI: return "This value set is provided for user look up in a given context. Typically, these valuesets only include a subset of codes relevant for input in a context";
175            case STARTER: return "This value set is a good set of codes to start with when designing your system";
176            case COMPONENT: return "This value set is a component of the base value set. Usually this is called out so that documentation can be written about a portion of the value set";
177            case NULL: return null;
178            default: return "?";
179          }
180        }
181        public String getDisplay() {
182          switch (this) {
183            case MAXIMUM: return "Maximum Binding";
184            case MINIMUM: return "Minimum Binding";
185            case REQUIRED: return "Required Binding";
186            case EXTENSIBLE: return "Conformance Binding";
187            case CANDIDATE: return "Candidate Binding";
188            case CURRENT: return "Current Binding";
189            case PREFERRED: return "Preferred Binding";
190            case UI: return "UI Suggested Binding";
191            case STARTER: return "Starter Binding";
192            case COMPONENT: return "Component Binding";
193            case NULL: return null;
194            default: return "?";
195          }
196        }
197    }
198
199  public static class AdditionalBindingPurposeVSEnumFactory implements EnumFactory<AdditionalBindingPurposeVS> {
200    public AdditionalBindingPurposeVS fromCode(String codeString) throws IllegalArgumentException {
201      if (codeString == null || "".equals(codeString))
202            if (codeString == null || "".equals(codeString))
203                return null;
204        if ("maximum".equals(codeString))
205          return AdditionalBindingPurposeVS.MAXIMUM;
206        if ("minimum".equals(codeString))
207          return AdditionalBindingPurposeVS.MINIMUM;
208        if ("required".equals(codeString))
209          return AdditionalBindingPurposeVS.REQUIRED;
210        if ("extensible".equals(codeString))
211          return AdditionalBindingPurposeVS.EXTENSIBLE;
212        if ("candidate".equals(codeString))
213          return AdditionalBindingPurposeVS.CANDIDATE;
214        if ("current".equals(codeString))
215          return AdditionalBindingPurposeVS.CURRENT;
216        if ("preferred".equals(codeString))
217          return AdditionalBindingPurposeVS.PREFERRED;
218        if ("ui".equals(codeString))
219          return AdditionalBindingPurposeVS.UI;
220        if ("starter".equals(codeString))
221          return AdditionalBindingPurposeVS.STARTER;
222        if ("component".equals(codeString))
223          return AdditionalBindingPurposeVS.COMPONENT;
224        throw new IllegalArgumentException("Unknown AdditionalBindingPurposeVS code '"+codeString+"'");
225        }
226        public Enumeration<AdditionalBindingPurposeVS> fromType(PrimitiveType<?> code) throws FHIRException {
227          if (code == null)
228            return null;
229          if (code.isEmpty())
230            return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.NULL, code);
231          String codeString = ((PrimitiveType) code).asStringValue();
232          if (codeString == null || "".equals(codeString))
233            return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.NULL, code);
234        if ("maximum".equals(codeString))
235          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.MAXIMUM, code);
236        if ("minimum".equals(codeString))
237          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.MINIMUM, code);
238        if ("required".equals(codeString))
239          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.REQUIRED, code);
240        if ("extensible".equals(codeString))
241          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.EXTENSIBLE, code);
242        if ("candidate".equals(codeString))
243          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.CANDIDATE, code);
244        if ("current".equals(codeString))
245          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.CURRENT, code);
246        if ("preferred".equals(codeString))
247          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.PREFERRED, code);
248        if ("ui".equals(codeString))
249          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.UI, code);
250        if ("starter".equals(codeString))
251          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.STARTER, code);
252        if ("component".equals(codeString))
253          return new Enumeration<AdditionalBindingPurposeVS>(this, AdditionalBindingPurposeVS.COMPONENT, code);
254        throw new FHIRException("Unknown AdditionalBindingPurposeVS code '"+codeString+"'");
255        }
256    public String toCode(AdditionalBindingPurposeVS code) {
257      if (code == AdditionalBindingPurposeVS.MAXIMUM)
258        return "maximum";
259      if (code == AdditionalBindingPurposeVS.MINIMUM)
260        return "minimum";
261      if (code == AdditionalBindingPurposeVS.REQUIRED)
262        return "required";
263      if (code == AdditionalBindingPurposeVS.EXTENSIBLE)
264        return "extensible";
265      if (code == AdditionalBindingPurposeVS.CANDIDATE)
266        return "candidate";
267      if (code == AdditionalBindingPurposeVS.CURRENT)
268        return "current";
269      if (code == AdditionalBindingPurposeVS.PREFERRED)
270        return "preferred";
271      if (code == AdditionalBindingPurposeVS.UI)
272        return "ui";
273      if (code == AdditionalBindingPurposeVS.STARTER)
274        return "starter";
275      if (code == AdditionalBindingPurposeVS.COMPONENT)
276        return "component";
277      return "?";
278      }
279    public String toSystem(AdditionalBindingPurposeVS code) {
280      return code.getSystem();
281      }
282    }
283
284    public enum AggregationMode {
285        /**
286         * The reference is a local reference to a contained resource.
287         */
288        CONTAINED, 
289        /**
290         * The reference to a resource that has to be resolved externally to the resource that includes the reference.
291         */
292        REFERENCED, 
293        /**
294         * When the resource is in a Bundle, the resource the reference points to will be found in the same bundle as the resource that includes the reference.
295         */
296        BUNDLED, 
297        /**
298         * added to help the parsers with the generic types
299         */
300        NULL;
301        public static AggregationMode fromCode(String codeString) throws FHIRException {
302            if (codeString == null || "".equals(codeString))
303                return null;
304        if ("contained".equals(codeString))
305          return CONTAINED;
306        if ("referenced".equals(codeString))
307          return REFERENCED;
308        if ("bundled".equals(codeString))
309          return BUNDLED;
310        if (Configuration.isAcceptInvalidEnums())
311          return null;
312        else
313          throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
314        }
315        public String toCode() {
316          switch (this) {
317            case CONTAINED: return "contained";
318            case REFERENCED: return "referenced";
319            case BUNDLED: return "bundled";
320            case NULL: return null;
321            default: return "?";
322          }
323        }
324        public String getSystem() {
325          switch (this) {
326            case CONTAINED: return "http://hl7.org/fhir/resource-aggregation-mode";
327            case REFERENCED: return "http://hl7.org/fhir/resource-aggregation-mode";
328            case BUNDLED: return "http://hl7.org/fhir/resource-aggregation-mode";
329            case NULL: return null;
330            default: return "?";
331          }
332        }
333        public String getDefinition() {
334          switch (this) {
335            case CONTAINED: return "The reference is a local reference to a contained resource.";
336            case REFERENCED: return "The reference to a resource that has to be resolved externally to the resource that includes the reference.";
337            case BUNDLED: return "When the resource is in a Bundle, the resource the reference points to will be found in the same bundle as the resource that includes the reference.";
338            case NULL: return null;
339            default: return "?";
340          }
341        }
342        public String getDisplay() {
343          switch (this) {
344            case CONTAINED: return "Contained";
345            case REFERENCED: return "Referenced";
346            case BUNDLED: return "Bundled";
347            case NULL: return null;
348            default: return "?";
349          }
350        }
351    }
352
353  public static class AggregationModeEnumFactory implements EnumFactory<AggregationMode> {
354    public AggregationMode fromCode(String codeString) throws IllegalArgumentException {
355      if (codeString == null || "".equals(codeString))
356            if (codeString == null || "".equals(codeString))
357                return null;
358        if ("contained".equals(codeString))
359          return AggregationMode.CONTAINED;
360        if ("referenced".equals(codeString))
361          return AggregationMode.REFERENCED;
362        if ("bundled".equals(codeString))
363          return AggregationMode.BUNDLED;
364        throw new IllegalArgumentException("Unknown AggregationMode code '"+codeString+"'");
365        }
366        public Enumeration<AggregationMode> fromType(PrimitiveType<?> code) throws FHIRException {
367          if (code == null)
368            return null;
369          if (code.isEmpty())
370            return new Enumeration<AggregationMode>(this, AggregationMode.NULL, code);
371          String codeString = ((PrimitiveType) code).asStringValue();
372          if (codeString == null || "".equals(codeString))
373            return new Enumeration<AggregationMode>(this, AggregationMode.NULL, code);
374        if ("contained".equals(codeString))
375          return new Enumeration<AggregationMode>(this, AggregationMode.CONTAINED, code);
376        if ("referenced".equals(codeString))
377          return new Enumeration<AggregationMode>(this, AggregationMode.REFERENCED, code);
378        if ("bundled".equals(codeString))
379          return new Enumeration<AggregationMode>(this, AggregationMode.BUNDLED, code);
380        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
381        }
382    public String toCode(AggregationMode code) {
383      if (code == AggregationMode.CONTAINED)
384        return "contained";
385      if (code == AggregationMode.REFERENCED)
386        return "referenced";
387      if (code == AggregationMode.BUNDLED)
388        return "bundled";
389      return "?";
390      }
391    public String toSystem(AggregationMode code) {
392      return code.getSystem();
393      }
394    }
395
396    public enum ConstraintSeverity {
397        /**
398         * If the constraint is violated, the resource is not conformant.
399         */
400        ERROR, 
401        /**
402         * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.
403         */
404        WARNING, 
405        /**
406         * added to help the parsers with the generic types
407         */
408        NULL;
409        public static ConstraintSeverity fromCode(String codeString) throws FHIRException {
410            if (codeString == null || "".equals(codeString))
411                return null;
412        if ("error".equals(codeString))
413          return ERROR;
414        if ("warning".equals(codeString))
415          return WARNING;
416        if (Configuration.isAcceptInvalidEnums())
417          return null;
418        else
419          throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
420        }
421        public String toCode() {
422          switch (this) {
423            case ERROR: return "error";
424            case WARNING: return "warning";
425            case NULL: return null;
426            default: return "?";
427          }
428        }
429        public String getSystem() {
430          switch (this) {
431            case ERROR: return "http://hl7.org/fhir/constraint-severity";
432            case WARNING: return "http://hl7.org/fhir/constraint-severity";
433            case NULL: return null;
434            default: return "?";
435          }
436        }
437        public String getDefinition() {
438          switch (this) {
439            case ERROR: return "If the constraint is violated, the resource is not conformant.";
440            case WARNING: return "If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.";
441            case NULL: return null;
442            default: return "?";
443          }
444        }
445        public String getDisplay() {
446          switch (this) {
447            case ERROR: return "Error";
448            case WARNING: return "Warning";
449            case NULL: return null;
450            default: return "?";
451          }
452        }
453    }
454
455  public static class ConstraintSeverityEnumFactory implements EnumFactory<ConstraintSeverity> {
456    public ConstraintSeverity fromCode(String codeString) throws IllegalArgumentException {
457      if (codeString == null || "".equals(codeString))
458            if (codeString == null || "".equals(codeString))
459                return null;
460        if ("error".equals(codeString))
461          return ConstraintSeverity.ERROR;
462        if ("warning".equals(codeString))
463          return ConstraintSeverity.WARNING;
464        throw new IllegalArgumentException("Unknown ConstraintSeverity code '"+codeString+"'");
465        }
466        public Enumeration<ConstraintSeverity> fromType(PrimitiveType<?> code) throws FHIRException {
467          if (code == null)
468            return null;
469          if (code.isEmpty())
470            return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.NULL, code);
471          String codeString = ((PrimitiveType) code).asStringValue();
472          if (codeString == null || "".equals(codeString))
473            return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.NULL, code);
474        if ("error".equals(codeString))
475          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.ERROR, code);
476        if ("warning".equals(codeString))
477          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.WARNING, code);
478        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
479        }
480    public String toCode(ConstraintSeverity code) {
481      if (code == ConstraintSeverity.ERROR)
482        return "error";
483      if (code == ConstraintSeverity.WARNING)
484        return "warning";
485      return "?";
486      }
487    public String toSystem(ConstraintSeverity code) {
488      return code.getSystem();
489      }
490    }
491
492    public enum DiscriminatorType {
493        /**
494         * The slices have different values in the nominated element, as determined by the applicable fixed value, pattern, or required ValueSet binding.
495         */
496        VALUE, 
497        /**
498         * The slices are differentiated by the presence or absence of the nominated element. There SHALL be no more than two slices. The slices are differentiated by the fact that one must have a max of 0 and the other must have a min of 1 (or more).  The order in which the slices are declared doesn't matter.
499         */
500        EXISTS, 
501        /**
502         * The slices have different values in the nominated element, as determined by the applicable fixed value, pattern, or required ValueSet binding. This has the same meaning as 'value' and is deprecated.
503         */
504        PATTERN, 
505        /**
506         * The slices are differentiated by type of the nominated element.
507         */
508        TYPE, 
509        /**
510         * The slices are differentiated by conformance of the nominated element to a specified profile. Note that if the path specifies .resolve() then the profile is the target profile on the reference. In this case, validation by the possible profiles is required to differentiate the slices.
511         */
512        PROFILE, 
513        /**
514         * The slices are differentiated by their index. This is only possible if all but the last slice have min=max cardinality, and the (optional) last slice contains other undifferentiated elements.
515         */
516        POSITION, 
517        /**
518         * added to help the parsers with the generic types
519         */
520        NULL;
521        public static DiscriminatorType fromCode(String codeString) throws FHIRException {
522            if (codeString == null || "".equals(codeString))
523                return null;
524        if ("value".equals(codeString))
525          return VALUE;
526        if ("exists".equals(codeString))
527          return EXISTS;
528        if ("pattern".equals(codeString))
529          return PATTERN;
530        if ("type".equals(codeString))
531          return TYPE;
532        if ("profile".equals(codeString))
533          return PROFILE;
534        if ("position".equals(codeString))
535          return POSITION;
536        if (Configuration.isAcceptInvalidEnums())
537          return null;
538        else
539          throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
540        }
541        public String toCode() {
542          switch (this) {
543            case VALUE: return "value";
544            case EXISTS: return "exists";
545            case PATTERN: return "pattern";
546            case TYPE: return "type";
547            case PROFILE: return "profile";
548            case POSITION: return "position";
549            case NULL: return null;
550            default: return "?";
551          }
552        }
553        public String getSystem() {
554          switch (this) {
555            case VALUE: return "http://hl7.org/fhir/discriminator-type";
556            case EXISTS: return "http://hl7.org/fhir/discriminator-type";
557            case PATTERN: return "http://hl7.org/fhir/discriminator-type";
558            case TYPE: return "http://hl7.org/fhir/discriminator-type";
559            case PROFILE: return "http://hl7.org/fhir/discriminator-type";
560            case POSITION: return "http://hl7.org/fhir/discriminator-type";
561            case NULL: return null;
562            default: return "?";
563          }
564        }
565        public String getDefinition() {
566          switch (this) {
567            case VALUE: return "The slices have different values in the nominated element, as determined by the applicable fixed value, pattern, or required ValueSet binding.";
568            case EXISTS: return "The slices are differentiated by the presence or absence of the nominated element. There SHALL be no more than two slices. The slices are differentiated by the fact that one must have a max of 0 and the other must have a min of 1 (or more).  The order in which the slices are declared doesn't matter.";
569            case PATTERN: return "The slices have different values in the nominated element, as determined by the applicable fixed value, pattern, or required ValueSet binding. This has the same meaning as 'value' and is deprecated.";
570            case TYPE: return "The slices are differentiated by type of the nominated element.";
571            case PROFILE: return "The slices are differentiated by conformance of the nominated element to a specified profile. Note that if the path specifies .resolve() then the profile is the target profile on the reference. In this case, validation by the possible profiles is required to differentiate the slices.";
572            case POSITION: return "The slices are differentiated by their index. This is only possible if all but the last slice have min=max cardinality, and the (optional) last slice contains other undifferentiated elements.";
573            case NULL: return null;
574            default: return "?";
575          }
576        }
577        public String getDisplay() {
578          switch (this) {
579            case VALUE: return "Value";
580            case EXISTS: return "Exists";
581            case PATTERN: return "Pattern";
582            case TYPE: return "Type";
583            case PROFILE: return "Profile";
584            case POSITION: return "Position";
585            case NULL: return null;
586            default: return "?";
587          }
588        }
589    }
590
591  public static class DiscriminatorTypeEnumFactory implements EnumFactory<DiscriminatorType> {
592    public DiscriminatorType fromCode(String codeString) throws IllegalArgumentException {
593      if (codeString == null || "".equals(codeString))
594            if (codeString == null || "".equals(codeString))
595                return null;
596        if ("value".equals(codeString))
597          return DiscriminatorType.VALUE;
598        if ("exists".equals(codeString))
599          return DiscriminatorType.EXISTS;
600        if ("pattern".equals(codeString))
601          return DiscriminatorType.PATTERN;
602        if ("type".equals(codeString))
603          return DiscriminatorType.TYPE;
604        if ("profile".equals(codeString))
605          return DiscriminatorType.PROFILE;
606        if ("position".equals(codeString))
607          return DiscriminatorType.POSITION;
608        throw new IllegalArgumentException("Unknown DiscriminatorType code '"+codeString+"'");
609        }
610        public Enumeration<DiscriminatorType> fromType(PrimitiveType<?> code) throws FHIRException {
611          if (code == null)
612            return null;
613          if (code.isEmpty())
614            return new Enumeration<DiscriminatorType>(this, DiscriminatorType.NULL, code);
615          String codeString = ((PrimitiveType) code).asStringValue();
616          if (codeString == null || "".equals(codeString))
617            return new Enumeration<DiscriminatorType>(this, DiscriminatorType.NULL, code);
618        if ("value".equals(codeString))
619          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.VALUE, code);
620        if ("exists".equals(codeString))
621          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.EXISTS, code);
622        if ("pattern".equals(codeString))
623          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.PATTERN, code);
624        if ("type".equals(codeString))
625          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.TYPE, code);
626        if ("profile".equals(codeString))
627          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.PROFILE, code);
628        if ("position".equals(codeString))
629          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.POSITION, code);
630        throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
631        }
632    public String toCode(DiscriminatorType code) {
633      if (code == DiscriminatorType.VALUE)
634        return "value";
635      if (code == DiscriminatorType.EXISTS)
636        return "exists";
637      if (code == DiscriminatorType.PATTERN)
638        return "pattern";
639      if (code == DiscriminatorType.TYPE)
640        return "type";
641      if (code == DiscriminatorType.PROFILE)
642        return "profile";
643      if (code == DiscriminatorType.POSITION)
644        return "position";
645      return "?";
646      }
647    public String toSystem(DiscriminatorType code) {
648      return code.getSystem();
649      }
650    }
651
652    public enum PropertyRepresentation {
653        /**
654         * In XML, this property is represented as an attribute not an element.
655         */
656        XMLATTR, 
657        /**
658         * This element is represented using the XML text attribute (primitives only).
659         */
660        XMLTEXT, 
661        /**
662         * The type of this element is indicated using xsi:type.
663         */
664        TYPEATTR, 
665        /**
666         * Use CDA narrative instead of XHTML.
667         */
668        CDATEXT, 
669        /**
670         * The property is represented using XHTML.
671         */
672        XHTML, 
673        /**
674         * added to help the parsers with the generic types
675         */
676        NULL;
677        public static PropertyRepresentation fromCode(String codeString) throws FHIRException {
678            if (codeString == null || "".equals(codeString))
679                return null;
680        if ("xmlAttr".equals(codeString))
681          return XMLATTR;
682        if ("xmlText".equals(codeString))
683          return XMLTEXT;
684        if ("typeAttr".equals(codeString))
685          return TYPEATTR;
686        if ("cdaText".equals(codeString))
687          return CDATEXT;
688        if ("xhtml".equals(codeString))
689          return XHTML;
690        if (Configuration.isAcceptInvalidEnums())
691          return null;
692        else
693          throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
694        }
695        public String toCode() {
696          switch (this) {
697            case XMLATTR: return "xmlAttr";
698            case XMLTEXT: return "xmlText";
699            case TYPEATTR: return "typeAttr";
700            case CDATEXT: return "cdaText";
701            case XHTML: return "xhtml";
702            case NULL: return null;
703            default: return "?";
704          }
705        }
706        public String getSystem() {
707          switch (this) {
708            case XMLATTR: return "http://hl7.org/fhir/property-representation";
709            case XMLTEXT: return "http://hl7.org/fhir/property-representation";
710            case TYPEATTR: return "http://hl7.org/fhir/property-representation";
711            case CDATEXT: return "http://hl7.org/fhir/property-representation";
712            case XHTML: return "http://hl7.org/fhir/property-representation";
713            case NULL: return null;
714            default: return "?";
715          }
716        }
717        public String getDefinition() {
718          switch (this) {
719            case XMLATTR: return "In XML, this property is represented as an attribute not an element.";
720            case XMLTEXT: return "This element is represented using the XML text attribute (primitives only).";
721            case TYPEATTR: return "The type of this element is indicated using xsi:type.";
722            case CDATEXT: return "Use CDA narrative instead of XHTML.";
723            case XHTML: return "The property is represented using XHTML.";
724            case NULL: return null;
725            default: return "?";
726          }
727        }
728        public String getDisplay() {
729          switch (this) {
730            case XMLATTR: return "XML Attribute";
731            case XMLTEXT: return "XML Text";
732            case TYPEATTR: return "Type Attribute";
733            case CDATEXT: return "CDA Text Format";
734            case XHTML: return "XHTML";
735            case NULL: return null;
736            default: return "?";
737          }
738        }
739    }
740
741  public static class PropertyRepresentationEnumFactory implements EnumFactory<PropertyRepresentation> {
742    public PropertyRepresentation fromCode(String codeString) throws IllegalArgumentException {
743      if (codeString == null || "".equals(codeString))
744            if (codeString == null || "".equals(codeString))
745                return null;
746        if ("xmlAttr".equals(codeString))
747          return PropertyRepresentation.XMLATTR;
748        if ("xmlText".equals(codeString))
749          return PropertyRepresentation.XMLTEXT;
750        if ("typeAttr".equals(codeString))
751          return PropertyRepresentation.TYPEATTR;
752        if ("cdaText".equals(codeString))
753          return PropertyRepresentation.CDATEXT;
754        if ("xhtml".equals(codeString))
755          return PropertyRepresentation.XHTML;
756        throw new IllegalArgumentException("Unknown PropertyRepresentation code '"+codeString+"'");
757        }
758        public Enumeration<PropertyRepresentation> fromType(PrimitiveType<?> code) throws FHIRException {
759          if (code == null)
760            return null;
761          if (code.isEmpty())
762            return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.NULL, code);
763          String codeString = ((PrimitiveType) code).asStringValue();
764          if (codeString == null || "".equals(codeString))
765            return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.NULL, code);
766        if ("xmlAttr".equals(codeString))
767          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLATTR, code);
768        if ("xmlText".equals(codeString))
769          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLTEXT, code);
770        if ("typeAttr".equals(codeString))
771          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.TYPEATTR, code);
772        if ("cdaText".equals(codeString))
773          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.CDATEXT, code);
774        if ("xhtml".equals(codeString))
775          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XHTML, code);
776        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
777        }
778    public String toCode(PropertyRepresentation code) {
779      if (code == PropertyRepresentation.XMLATTR)
780        return "xmlAttr";
781      if (code == PropertyRepresentation.XMLTEXT)
782        return "xmlText";
783      if (code == PropertyRepresentation.TYPEATTR)
784        return "typeAttr";
785      if (code == PropertyRepresentation.CDATEXT)
786        return "cdaText";
787      if (code == PropertyRepresentation.XHTML)
788        return "xhtml";
789      return "?";
790      }
791    public String toSystem(PropertyRepresentation code) {
792      return code.getSystem();
793      }
794    }
795
796    public enum ReferenceVersionRules {
797        /**
798         * The reference may be either version independent or version specific.
799         */
800        EITHER, 
801        /**
802         * The reference must be version independent.
803         */
804        INDEPENDENT, 
805        /**
806         * The reference must be version specific.
807         */
808        SPECIFIC, 
809        /**
810         * added to help the parsers with the generic types
811         */
812        NULL;
813        public static ReferenceVersionRules fromCode(String codeString) throws FHIRException {
814            if (codeString == null || "".equals(codeString))
815                return null;
816        if ("either".equals(codeString))
817          return EITHER;
818        if ("independent".equals(codeString))
819          return INDEPENDENT;
820        if ("specific".equals(codeString))
821          return SPECIFIC;
822        if (Configuration.isAcceptInvalidEnums())
823          return null;
824        else
825          throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
826        }
827        public String toCode() {
828          switch (this) {
829            case EITHER: return "either";
830            case INDEPENDENT: return "independent";
831            case SPECIFIC: return "specific";
832            case NULL: return null;
833            default: return "?";
834          }
835        }
836        public String getSystem() {
837          switch (this) {
838            case EITHER: return "http://hl7.org/fhir/reference-version-rules";
839            case INDEPENDENT: return "http://hl7.org/fhir/reference-version-rules";
840            case SPECIFIC: return "http://hl7.org/fhir/reference-version-rules";
841            case NULL: return null;
842            default: return "?";
843          }
844        }
845        public String getDefinition() {
846          switch (this) {
847            case EITHER: return "The reference may be either version independent or version specific.";
848            case INDEPENDENT: return "The reference must be version independent.";
849            case SPECIFIC: return "The reference must be version specific.";
850            case NULL: return null;
851            default: return "?";
852          }
853        }
854        public String getDisplay() {
855          switch (this) {
856            case EITHER: return "Either Specific or independent";
857            case INDEPENDENT: return "Version independent";
858            case SPECIFIC: return "Version Specific";
859            case NULL: return null;
860            default: return "?";
861          }
862        }
863    }
864
865  public static class ReferenceVersionRulesEnumFactory implements EnumFactory<ReferenceVersionRules> {
866    public ReferenceVersionRules fromCode(String codeString) throws IllegalArgumentException {
867      if (codeString == null || "".equals(codeString))
868            if (codeString == null || "".equals(codeString))
869                return null;
870        if ("either".equals(codeString))
871          return ReferenceVersionRules.EITHER;
872        if ("independent".equals(codeString))
873          return ReferenceVersionRules.INDEPENDENT;
874        if ("specific".equals(codeString))
875          return ReferenceVersionRules.SPECIFIC;
876        throw new IllegalArgumentException("Unknown ReferenceVersionRules code '"+codeString+"'");
877        }
878        public Enumeration<ReferenceVersionRules> fromType(PrimitiveType<?> code) throws FHIRException {
879          if (code == null)
880            return null;
881          if (code.isEmpty())
882            return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.NULL, code);
883          String codeString = ((PrimitiveType) code).asStringValue();
884          if (codeString == null || "".equals(codeString))
885            return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.NULL, code);
886        if ("either".equals(codeString))
887          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.EITHER, code);
888        if ("independent".equals(codeString))
889          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.INDEPENDENT, code);
890        if ("specific".equals(codeString))
891          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.SPECIFIC, code);
892        throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
893        }
894    public String toCode(ReferenceVersionRules code) {
895      if (code == ReferenceVersionRules.EITHER)
896        return "either";
897      if (code == ReferenceVersionRules.INDEPENDENT)
898        return "independent";
899      if (code == ReferenceVersionRules.SPECIFIC)
900        return "specific";
901      return "?";
902      }
903    public String toSystem(ReferenceVersionRules code) {
904      return code.getSystem();
905      }
906    }
907
908    public enum SlicingRules {
909        /**
910         * No additional content is allowed other than that described by the slices in this profile.
911         */
912        CLOSED, 
913        /**
914         * Additional content is allowed anywhere in the list.
915         */
916        OPEN, 
917        /**
918         * Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.
919         */
920        OPENATEND, 
921        /**
922         * added to help the parsers with the generic types
923         */
924        NULL;
925        public static SlicingRules fromCode(String codeString) throws FHIRException {
926            if (codeString == null || "".equals(codeString))
927                return null;
928        if ("closed".equals(codeString))
929          return CLOSED;
930        if ("open".equals(codeString))
931          return OPEN;
932        if ("openAtEnd".equals(codeString))
933          return OPENATEND;
934        if (Configuration.isAcceptInvalidEnums())
935          return null;
936        else
937          throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
938        }
939        public String toCode() {
940          switch (this) {
941            case CLOSED: return "closed";
942            case OPEN: return "open";
943            case OPENATEND: return "openAtEnd";
944            case NULL: return null;
945            default: return "?";
946          }
947        }
948        public String getSystem() {
949          switch (this) {
950            case CLOSED: return "http://hl7.org/fhir/resource-slicing-rules";
951            case OPEN: return "http://hl7.org/fhir/resource-slicing-rules";
952            case OPENATEND: return "http://hl7.org/fhir/resource-slicing-rules";
953            case NULL: return null;
954            default: return "?";
955          }
956        }
957        public String getDefinition() {
958          switch (this) {
959            case CLOSED: return "No additional content is allowed other than that described by the slices in this profile.";
960            case OPEN: return "Additional content is allowed anywhere in the list.";
961            case OPENATEND: return "Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.";
962            case NULL: return null;
963            default: return "?";
964          }
965        }
966        public String getDisplay() {
967          switch (this) {
968            case CLOSED: return "Closed";
969            case OPEN: return "Open";
970            case OPENATEND: return "Open at End";
971            case NULL: return null;
972            default: return "?";
973          }
974        }
975    }
976
977  public static class SlicingRulesEnumFactory implements EnumFactory<SlicingRules> {
978    public SlicingRules fromCode(String codeString) throws IllegalArgumentException {
979      if (codeString == null || "".equals(codeString))
980            if (codeString == null || "".equals(codeString))
981                return null;
982        if ("closed".equals(codeString))
983          return SlicingRules.CLOSED;
984        if ("open".equals(codeString))
985          return SlicingRules.OPEN;
986        if ("openAtEnd".equals(codeString))
987          return SlicingRules.OPENATEND;
988        throw new IllegalArgumentException("Unknown SlicingRules code '"+codeString+"'");
989        }
990        public Enumeration<SlicingRules> fromType(PrimitiveType<?> code) throws FHIRException {
991          if (code == null)
992            return null;
993          if (code.isEmpty())
994            return new Enumeration<SlicingRules>(this, SlicingRules.NULL, code);
995          String codeString = ((PrimitiveType) code).asStringValue();
996          if (codeString == null || "".equals(codeString))
997            return new Enumeration<SlicingRules>(this, SlicingRules.NULL, code);
998        if ("closed".equals(codeString))
999          return new Enumeration<SlicingRules>(this, SlicingRules.CLOSED, code);
1000        if ("open".equals(codeString))
1001          return new Enumeration<SlicingRules>(this, SlicingRules.OPEN, code);
1002        if ("openAtEnd".equals(codeString))
1003          return new Enumeration<SlicingRules>(this, SlicingRules.OPENATEND, code);
1004        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
1005        }
1006    public String toCode(SlicingRules code) {
1007      if (code == SlicingRules.CLOSED)
1008        return "closed";
1009      if (code == SlicingRules.OPEN)
1010        return "open";
1011      if (code == SlicingRules.OPENATEND)
1012        return "openAtEnd";
1013      return "?";
1014      }
1015    public String toSystem(SlicingRules code) {
1016      return code.getSystem();
1017      }
1018    }
1019
1020    @Block()
1021    public static class ElementDefinitionSlicingComponent extends Element implements IBaseDatatypeElement {
1022        /**
1023         * Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.
1024         */
1025        @Child(name = "discriminator", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1026        @Description(shortDefinition="Element values that are used to distinguish the slices", formalDefinition="Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices." )
1027        protected List<ElementDefinitionSlicingDiscriminatorComponent> discriminator;
1028
1029        /**
1030         * A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
1031         */
1032        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1033        @Description(shortDefinition="Text description of how slicing works (or not)", formalDefinition="A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated." )
1034        protected StringType description;
1035
1036        /**
1037         * If the matching elements have to occur in the same order as defined in the profile.
1038         */
1039        @Child(name = "ordered", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1040        @Description(shortDefinition="If elements must be in same order as slices", formalDefinition="If the matching elements have to occur in the same order as defined in the profile." )
1041        protected BooleanType ordered;
1042
1043        /**
1044         * Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
1045         */
1046        @Child(name = "rules", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
1047        @Description(shortDefinition="closed | open | openAtEnd", formalDefinition="Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end." )
1048        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-slicing-rules")
1049        protected Enumeration<SlicingRules> rules;
1050
1051        private static final long serialVersionUID = -311635839L;
1052
1053    /**
1054     * Constructor
1055     */
1056      public ElementDefinitionSlicingComponent() {
1057        super();
1058      }
1059
1060    /**
1061     * Constructor
1062     */
1063      public ElementDefinitionSlicingComponent(SlicingRules rules) {
1064        super();
1065        this.setRules(rules);
1066      }
1067
1068        /**
1069         * @return {@link #discriminator} (Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.)
1070         */
1071        public List<ElementDefinitionSlicingDiscriminatorComponent> getDiscriminator() { 
1072          if (this.discriminator == null)
1073            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1074          return this.discriminator;
1075        }
1076
1077        /**
1078         * @return Returns a reference to <code>this</code> for easy method chaining
1079         */
1080        public ElementDefinitionSlicingComponent setDiscriminator(List<ElementDefinitionSlicingDiscriminatorComponent> theDiscriminator) { 
1081          this.discriminator = theDiscriminator;
1082          return this;
1083        }
1084
1085        public boolean hasDiscriminator() { 
1086          if (this.discriminator == null)
1087            return false;
1088          for (ElementDefinitionSlicingDiscriminatorComponent item : this.discriminator)
1089            if (!item.isEmpty())
1090              return true;
1091          return false;
1092        }
1093
1094        public ElementDefinitionSlicingDiscriminatorComponent addDiscriminator() { //3
1095          ElementDefinitionSlicingDiscriminatorComponent t = new ElementDefinitionSlicingDiscriminatorComponent();
1096          if (this.discriminator == null)
1097            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1098          this.discriminator.add(t);
1099          return t;
1100        }
1101
1102        public ElementDefinitionSlicingComponent addDiscriminator(ElementDefinitionSlicingDiscriminatorComponent t) { //3
1103          if (t == null)
1104            return this;
1105          if (this.discriminator == null)
1106            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1107          this.discriminator.add(t);
1108          return this;
1109        }
1110
1111        /**
1112         * @return The first repetition of repeating field {@link #discriminator}, creating it if it does not already exist {3}
1113         */
1114        public ElementDefinitionSlicingDiscriminatorComponent getDiscriminatorFirstRep() { 
1115          if (getDiscriminator().isEmpty()) {
1116            addDiscriminator();
1117          }
1118          return getDiscriminator().get(0);
1119        }
1120
1121        /**
1122         * @return {@link #description} (A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1123         */
1124        public StringType getDescriptionElement() { 
1125          if (this.description == null)
1126            if (Configuration.errorOnAutoCreate())
1127              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.description");
1128            else if (Configuration.doAutoCreate())
1129              this.description = new StringType(); // bb
1130          return this.description;
1131        }
1132
1133        public boolean hasDescriptionElement() { 
1134          return this.description != null && !this.description.isEmpty();
1135        }
1136
1137        public boolean hasDescription() { 
1138          return this.description != null && !this.description.isEmpty();
1139        }
1140
1141        /**
1142         * @param value {@link #description} (A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1143         */
1144        public ElementDefinitionSlicingComponent setDescriptionElement(StringType value) { 
1145          this.description = value;
1146          return this;
1147        }
1148
1149        /**
1150         * @return A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
1151         */
1152        public String getDescription() { 
1153          return this.description == null ? null : this.description.getValue();
1154        }
1155
1156        /**
1157         * @param value A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
1158         */
1159        public ElementDefinitionSlicingComponent setDescription(String value) { 
1160          if (Utilities.noString(value))
1161            this.description = null;
1162          else {
1163            if (this.description == null)
1164              this.description = new StringType();
1165            this.description.setValue(value);
1166          }
1167          return this;
1168        }
1169
1170        /**
1171         * @return {@link #ordered} (If the matching elements have to occur in the same order as defined in the profile.). This is the underlying object with id, value and extensions. The accessor "getOrdered" gives direct access to the value
1172         */
1173        public BooleanType getOrderedElement() { 
1174          if (this.ordered == null)
1175            if (Configuration.errorOnAutoCreate())
1176              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.ordered");
1177            else if (Configuration.doAutoCreate())
1178              this.ordered = new BooleanType(); // bb
1179          return this.ordered;
1180        }
1181
1182        public boolean hasOrderedElement() { 
1183          return this.ordered != null && !this.ordered.isEmpty();
1184        }
1185
1186        public boolean hasOrdered() { 
1187          return this.ordered != null && !this.ordered.isEmpty();
1188        }
1189
1190        /**
1191         * @param value {@link #ordered} (If the matching elements have to occur in the same order as defined in the profile.). This is the underlying object with id, value and extensions. The accessor "getOrdered" gives direct access to the value
1192         */
1193        public ElementDefinitionSlicingComponent setOrderedElement(BooleanType value) { 
1194          this.ordered = value;
1195          return this;
1196        }
1197
1198        /**
1199         * @return If the matching elements have to occur in the same order as defined in the profile.
1200         */
1201        public boolean getOrdered() { 
1202          return this.ordered == null || this.ordered.isEmpty() ? false : this.ordered.getValue();
1203        }
1204
1205        /**
1206         * @param value If the matching elements have to occur in the same order as defined in the profile.
1207         */
1208        public ElementDefinitionSlicingComponent setOrdered(boolean value) { 
1209            if (this.ordered == null)
1210              this.ordered = new BooleanType();
1211            this.ordered.setValue(value);
1212          return this;
1213        }
1214
1215        /**
1216         * @return {@link #rules} (Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.). This is the underlying object with id, value and extensions. The accessor "getRules" gives direct access to the value
1217         */
1218        public Enumeration<SlicingRules> getRulesElement() { 
1219          if (this.rules == null)
1220            if (Configuration.errorOnAutoCreate())
1221              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.rules");
1222            else if (Configuration.doAutoCreate())
1223              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory()); // bb
1224          return this.rules;
1225        }
1226
1227        public boolean hasRulesElement() { 
1228          return this.rules != null && !this.rules.isEmpty();
1229        }
1230
1231        public boolean hasRules() { 
1232          return this.rules != null && !this.rules.isEmpty();
1233        }
1234
1235        /**
1236         * @param value {@link #rules} (Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.). This is the underlying object with id, value and extensions. The accessor "getRules" gives direct access to the value
1237         */
1238        public ElementDefinitionSlicingComponent setRulesElement(Enumeration<SlicingRules> value) { 
1239          this.rules = value;
1240          return this;
1241        }
1242
1243        /**
1244         * @return Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
1245         */
1246        public SlicingRules getRules() { 
1247          return this.rules == null ? null : this.rules.getValue();
1248        }
1249
1250        /**
1251         * @param value Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
1252         */
1253        public ElementDefinitionSlicingComponent setRules(SlicingRules value) { 
1254            if (this.rules == null)
1255              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory());
1256            this.rules.setValue(value);
1257          return this;
1258        }
1259
1260        protected void listChildren(List<Property> children) {
1261          super.listChildren(children);
1262          children.add(new Property("discriminator", "", "Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.", 0, java.lang.Integer.MAX_VALUE, discriminator));
1263          children.add(new Property("description", "string", "A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.", 0, 1, description));
1264          children.add(new Property("ordered", "boolean", "If the matching elements have to occur in the same order as defined in the profile.", 0, 1, ordered));
1265          children.add(new Property("rules", "code", "Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.", 0, 1, rules));
1266        }
1267
1268        @Override
1269        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1270          switch (_hash) {
1271          case -1888270692: /*discriminator*/  return new Property("discriminator", "", "Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.", 0, java.lang.Integer.MAX_VALUE, discriminator);
1272          case -1724546052: /*description*/  return new Property("description", "string", "A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.", 0, 1, description);
1273          case -1207109523: /*ordered*/  return new Property("ordered", "boolean", "If the matching elements have to occur in the same order as defined in the profile.", 0, 1, ordered);
1274          case 108873975: /*rules*/  return new Property("rules", "code", "Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.", 0, 1, rules);
1275          default: return super.getNamedProperty(_hash, _name, _checkValid);
1276          }
1277
1278        }
1279
1280      @Override
1281      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1282        switch (hash) {
1283        case -1888270692: /*discriminator*/ return this.discriminator == null ? new Base[0] : this.discriminator.toArray(new Base[this.discriminator.size()]); // ElementDefinitionSlicingDiscriminatorComponent
1284        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1285        case -1207109523: /*ordered*/ return this.ordered == null ? new Base[0] : new Base[] {this.ordered}; // BooleanType
1286        case 108873975: /*rules*/ return this.rules == null ? new Base[0] : new Base[] {this.rules}; // Enumeration<SlicingRules>
1287        default: return super.getProperty(hash, name, checkValid);
1288        }
1289
1290      }
1291
1292      @Override
1293      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1294        switch (hash) {
1295        case -1888270692: // discriminator
1296          this.getDiscriminator().add((ElementDefinitionSlicingDiscriminatorComponent) value); // ElementDefinitionSlicingDiscriminatorComponent
1297          return value;
1298        case -1724546052: // description
1299          this.description = TypeConvertor.castToString(value); // StringType
1300          return value;
1301        case -1207109523: // ordered
1302          this.ordered = TypeConvertor.castToBoolean(value); // BooleanType
1303          return value;
1304        case 108873975: // rules
1305          value = new SlicingRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
1306          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1307          return value;
1308        default: return super.setProperty(hash, name, value);
1309        }
1310
1311      }
1312
1313      @Override
1314      public Base setProperty(String name, Base value) throws FHIRException {
1315        if (name.equals("discriminator")) {
1316          this.getDiscriminator().add((ElementDefinitionSlicingDiscriminatorComponent) value);
1317        } else if (name.equals("description")) {
1318          this.description = TypeConvertor.castToString(value); // StringType
1319        } else if (name.equals("ordered")) {
1320          this.ordered = TypeConvertor.castToBoolean(value); // BooleanType
1321        } else if (name.equals("rules")) {
1322          value = new SlicingRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
1323          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1324        } else
1325          return super.setProperty(name, value);
1326        return value;
1327      }
1328
1329      @Override
1330      public Base makeProperty(int hash, String name) throws FHIRException {
1331        switch (hash) {
1332        case -1888270692:  return addDiscriminator(); 
1333        case -1724546052:  return getDescriptionElement();
1334        case -1207109523:  return getOrderedElement();
1335        case 108873975:  return getRulesElement();
1336        default: return super.makeProperty(hash, name);
1337        }
1338
1339      }
1340
1341      @Override
1342      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1343        switch (hash) {
1344        case -1888270692: /*discriminator*/ return new String[] {};
1345        case -1724546052: /*description*/ return new String[] {"string"};
1346        case -1207109523: /*ordered*/ return new String[] {"boolean"};
1347        case 108873975: /*rules*/ return new String[] {"code"};
1348        default: return super.getTypesForProperty(hash, name);
1349        }
1350
1351      }
1352
1353      @Override
1354      public Base addChild(String name) throws FHIRException {
1355        if (name.equals("discriminator")) {
1356          return addDiscriminator();
1357        }
1358        else if (name.equals("description")) {
1359          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.description");
1360        }
1361        else if (name.equals("ordered")) {
1362          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.ordered");
1363        }
1364        else if (name.equals("rules")) {
1365          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.rules");
1366        }
1367        else
1368          return super.addChild(name);
1369      }
1370
1371      public ElementDefinitionSlicingComponent copy() {
1372        ElementDefinitionSlicingComponent dst = new ElementDefinitionSlicingComponent();
1373        copyValues(dst);
1374        return dst;
1375      }
1376
1377      public void copyValues(ElementDefinitionSlicingComponent dst) {
1378        super.copyValues(dst);
1379        if (discriminator != null) {
1380          dst.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1381          for (ElementDefinitionSlicingDiscriminatorComponent i : discriminator)
1382            dst.discriminator.add(i.copy());
1383        };
1384        dst.description = description == null ? null : description.copy();
1385        dst.ordered = ordered == null ? null : ordered.copy();
1386        dst.rules = rules == null ? null : rules.copy();
1387      }
1388
1389      @Override
1390      public boolean equalsDeep(Base other_) {
1391        if (!super.equalsDeep(other_))
1392          return false;
1393        if (!(other_ instanceof ElementDefinitionSlicingComponent))
1394          return false;
1395        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other_;
1396        return compareDeep(discriminator, o.discriminator, true) && compareDeep(description, o.description, true)
1397           && compareDeep(ordered, o.ordered, true) && compareDeep(rules, o.rules, true);
1398      }
1399
1400      @Override
1401      public boolean equalsShallow(Base other_) {
1402        if (!super.equalsShallow(other_))
1403          return false;
1404        if (!(other_ instanceof ElementDefinitionSlicingComponent))
1405          return false;
1406        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other_;
1407        return compareValues(description, o.description, true) && compareValues(ordered, o.ordered, true) && compareValues(rules, o.rules, true)
1408          ;
1409      }
1410
1411      public boolean isEmpty() {
1412        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(discriminator, description
1413          , ordered, rules);
1414      }
1415
1416      public String fhirType() {
1417        return "ElementDefinition.slicing";
1418
1419      }
1420
1421      @Override
1422      public String toString() {
1423        return (ordered == null ? "??" : "true".equals(ordered.asStringValue()) ? "ordered" : "unordered")+"/"+
1424            (rules == null ? "??" : rules.asStringValue())+" "+discriminator.toString();
1425      }
1426    }
1427
1428    @Block()
1429    public static class ElementDefinitionSlicingDiscriminatorComponent extends Element implements IBaseDatatypeElement {
1430        /**
1431         * How the element value is interpreted when discrimination is evaluated.
1432         */
1433        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1434        @Description(shortDefinition="value | exists | type | profile | position", formalDefinition="How the element value is interpreted when discrimination is evaluated." )
1435        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/discriminator-type")
1436        protected Enumeration<DiscriminatorType> type;
1437
1438        /**
1439         * A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.
1440         */
1441        @Child(name = "path", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1442        @Description(shortDefinition="Path to element value", formalDefinition="A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based." )
1443        protected StringType path;
1444
1445        private static final long serialVersionUID = 1151159293L;
1446
1447    /**
1448     * Constructor
1449     */
1450      public ElementDefinitionSlicingDiscriminatorComponent() {
1451        super();
1452      }
1453
1454    /**
1455     * Constructor
1456     */
1457      public ElementDefinitionSlicingDiscriminatorComponent(DiscriminatorType type, String path) {
1458        super();
1459        this.setType(type);
1460        this.setPath(path);
1461      }
1462
1463        /**
1464         * @return {@link #type} (How the element value is interpreted when discrimination is evaluated.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1465         */
1466        public Enumeration<DiscriminatorType> getTypeElement() { 
1467          if (this.type == null)
1468            if (Configuration.errorOnAutoCreate())
1469              throw new Error("Attempt to auto-create ElementDefinitionSlicingDiscriminatorComponent.type");
1470            else if (Configuration.doAutoCreate())
1471              this.type = new Enumeration<DiscriminatorType>(new DiscriminatorTypeEnumFactory()); // bb
1472          return this.type;
1473        }
1474
1475        public boolean hasTypeElement() { 
1476          return this.type != null && !this.type.isEmpty();
1477        }
1478
1479        public boolean hasType() { 
1480          return this.type != null && !this.type.isEmpty();
1481        }
1482
1483        /**
1484         * @param value {@link #type} (How the element value is interpreted when discrimination is evaluated.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1485         */
1486        public ElementDefinitionSlicingDiscriminatorComponent setTypeElement(Enumeration<DiscriminatorType> value) { 
1487          this.type = value;
1488          return this;
1489        }
1490
1491        /**
1492         * @return How the element value is interpreted when discrimination is evaluated.
1493         */
1494        public DiscriminatorType getType() { 
1495          return this.type == null ? null : this.type.getValue();
1496        }
1497
1498        /**
1499         * @param value How the element value is interpreted when discrimination is evaluated.
1500         */
1501        public ElementDefinitionSlicingDiscriminatorComponent setType(DiscriminatorType value) { 
1502            if (this.type == null)
1503              this.type = new Enumeration<DiscriminatorType>(new DiscriminatorTypeEnumFactory());
1504            this.type.setValue(value);
1505          return this;
1506        }
1507
1508        /**
1509         * @return {@link #path} (A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1510         */
1511        public StringType getPathElement() { 
1512          if (this.path == null)
1513            if (Configuration.errorOnAutoCreate())
1514              throw new Error("Attempt to auto-create ElementDefinitionSlicingDiscriminatorComponent.path");
1515            else if (Configuration.doAutoCreate())
1516              this.path = new StringType(); // bb
1517          return this.path;
1518        }
1519
1520        public boolean hasPathElement() { 
1521          return this.path != null && !this.path.isEmpty();
1522        }
1523
1524        public boolean hasPath() { 
1525          return this.path != null && !this.path.isEmpty();
1526        }
1527
1528        /**
1529         * @param value {@link #path} (A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1530         */
1531        public ElementDefinitionSlicingDiscriminatorComponent setPathElement(StringType value) { 
1532          this.path = value;
1533          return this;
1534        }
1535
1536        /**
1537         * @return A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.
1538         */
1539        public String getPath() { 
1540          return this.path == null ? null : this.path.getValue();
1541        }
1542
1543        /**
1544         * @param value A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.
1545         */
1546        public ElementDefinitionSlicingDiscriminatorComponent setPath(String value) { 
1547            if (this.path == null)
1548              this.path = new StringType();
1549            this.path.setValue(value);
1550          return this;
1551        }
1552
1553        protected void listChildren(List<Property> children) {
1554          super.listChildren(children);
1555          children.add(new Property("type", "code", "How the element value is interpreted when discrimination is evaluated.", 0, 1, type));
1556          children.add(new Property("path", "string", "A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.", 0, 1, path));
1557        }
1558
1559        @Override
1560        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1561          switch (_hash) {
1562          case 3575610: /*type*/  return new Property("type", "code", "How the element value is interpreted when discrimination is evaluated.", 0, 1, type);
1563          case 3433509: /*path*/  return new Property("path", "string", "A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.", 0, 1, path);
1564          default: return super.getNamedProperty(_hash, _name, _checkValid);
1565          }
1566
1567        }
1568
1569      @Override
1570      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1571        switch (hash) {
1572        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DiscriminatorType>
1573        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1574        default: return super.getProperty(hash, name, checkValid);
1575        }
1576
1577      }
1578
1579      @Override
1580      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1581        switch (hash) {
1582        case 3575610: // type
1583          value = new DiscriminatorTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1584          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1585          return value;
1586        case 3433509: // path
1587          this.path = TypeConvertor.castToString(value); // StringType
1588          return value;
1589        default: return super.setProperty(hash, name, value);
1590        }
1591
1592      }
1593
1594      @Override
1595      public Base setProperty(String name, Base value) throws FHIRException {
1596        if (name.equals("type")) {
1597          value = new DiscriminatorTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1598          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1599        } else if (name.equals("path")) {
1600          this.path = TypeConvertor.castToString(value); // StringType
1601        } else
1602          return super.setProperty(name, value);
1603        return value;
1604      }
1605
1606      @Override
1607      public Base makeProperty(int hash, String name) throws FHIRException {
1608        switch (hash) {
1609        case 3575610:  return getTypeElement();
1610        case 3433509:  return getPathElement();
1611        default: return super.makeProperty(hash, name);
1612        }
1613
1614      }
1615
1616      @Override
1617      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1618        switch (hash) {
1619        case 3575610: /*type*/ return new String[] {"code"};
1620        case 3433509: /*path*/ return new String[] {"string"};
1621        default: return super.getTypesForProperty(hash, name);
1622        }
1623
1624      }
1625
1626      @Override
1627      public Base addChild(String name) throws FHIRException {
1628        if (name.equals("type")) {
1629          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.discriminator.type");
1630        }
1631        else if (name.equals("path")) {
1632          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.slicing.discriminator.path");
1633        }
1634        else
1635          return super.addChild(name);
1636      }
1637
1638      public ElementDefinitionSlicingDiscriminatorComponent copy() {
1639        ElementDefinitionSlicingDiscriminatorComponent dst = new ElementDefinitionSlicingDiscriminatorComponent();
1640        copyValues(dst);
1641        return dst;
1642      }
1643
1644      public void copyValues(ElementDefinitionSlicingDiscriminatorComponent dst) {
1645        super.copyValues(dst);
1646        dst.type = type == null ? null : type.copy();
1647        dst.path = path == null ? null : path.copy();
1648      }
1649
1650      @Override
1651      public boolean equalsDeep(Base other_) {
1652        if (!super.equalsDeep(other_))
1653          return false;
1654        if (!(other_ instanceof ElementDefinitionSlicingDiscriminatorComponent))
1655          return false;
1656        ElementDefinitionSlicingDiscriminatorComponent o = (ElementDefinitionSlicingDiscriminatorComponent) other_;
1657        return compareDeep(type, o.type, true) && compareDeep(path, o.path, true);
1658      }
1659
1660      @Override
1661      public boolean equalsShallow(Base other_) {
1662        if (!super.equalsShallow(other_))
1663          return false;
1664        if (!(other_ instanceof ElementDefinitionSlicingDiscriminatorComponent))
1665          return false;
1666        ElementDefinitionSlicingDiscriminatorComponent o = (ElementDefinitionSlicingDiscriminatorComponent) other_;
1667        return compareValues(type, o.type, true) && compareValues(path, o.path, true);
1668      }
1669
1670      public boolean isEmpty() {
1671        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, path);
1672      }
1673
1674  public String fhirType() {
1675    return "ElementDefinition.slicing.discriminator";
1676
1677  }
1678
1679  @Override
1680  public String toString() {
1681    return (type == null ? "??" : type.getCode()) + "="+(path == null ? "??" : path.asStringValue());
1682  }
1683
1684  }
1685
1686    @Block()
1687    public static class ElementDefinitionBaseComponent extends Element implements IBaseDatatypeElement {
1688        /**
1689         * The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.
1690         */
1691        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1692        @Description(shortDefinition="Path that identifies the base element", formalDefinition="The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base." )
1693        protected StringType path;
1694
1695        /**
1696         * Minimum cardinality of the base element identified by the path.
1697         */
1698        @Child(name = "min", type = {UnsignedIntType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1699        @Description(shortDefinition="Min cardinality of the base element", formalDefinition="Minimum cardinality of the base element identified by the path." )
1700        protected UnsignedIntType min;
1701
1702        /**
1703         * Maximum cardinality of the base element identified by the path.
1704         */
1705        @Child(name = "max", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1706        @Description(shortDefinition="Max cardinality of the base element", formalDefinition="Maximum cardinality of the base element identified by the path." )
1707        protected StringType max;
1708
1709        private static final long serialVersionUID = -1412704221L;
1710
1711    /**
1712     * Constructor
1713     */
1714      public ElementDefinitionBaseComponent() {
1715        super();
1716      }
1717
1718    /**
1719     * Constructor
1720     */
1721      public ElementDefinitionBaseComponent(String path, int min, String max) {
1722        super();
1723        this.setPath(path);
1724        this.setMin(min);
1725        this.setMax(max);
1726      }
1727
1728        /**
1729         * @return {@link #path} (The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1730         */
1731        public StringType getPathElement() { 
1732          if (this.path == null)
1733            if (Configuration.errorOnAutoCreate())
1734              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.path");
1735            else if (Configuration.doAutoCreate())
1736              this.path = new StringType(); // bb
1737          return this.path;
1738        }
1739
1740        public boolean hasPathElement() { 
1741          return this.path != null && !this.path.isEmpty();
1742        }
1743
1744        public boolean hasPath() { 
1745          return this.path != null && !this.path.isEmpty();
1746        }
1747
1748        /**
1749         * @param value {@link #path} (The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1750         */
1751        public ElementDefinitionBaseComponent setPathElement(StringType value) { 
1752          this.path = value;
1753          return this;
1754        }
1755
1756        /**
1757         * @return The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.
1758         */
1759        public String getPath() { 
1760          return this.path == null ? null : this.path.getValue();
1761        }
1762
1763        /**
1764         * @param value The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.
1765         */
1766        public ElementDefinitionBaseComponent setPath(String value) { 
1767            if (this.path == null)
1768              this.path = new StringType();
1769            this.path.setValue(value);
1770          return this;
1771        }
1772
1773        /**
1774         * @return {@link #min} (Minimum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
1775         */
1776        public UnsignedIntType getMinElement() { 
1777          if (this.min == null)
1778            if (Configuration.errorOnAutoCreate())
1779              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.min");
1780            else if (Configuration.doAutoCreate())
1781              this.min = new UnsignedIntType(); // bb
1782          return this.min;
1783        }
1784
1785        public boolean hasMinElement() { 
1786          return this.min != null && !this.min.isEmpty();
1787        }
1788
1789        public boolean hasMin() { 
1790          return this.min != null && !this.min.isEmpty();
1791        }
1792
1793        /**
1794         * @param value {@link #min} (Minimum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
1795         */
1796        public ElementDefinitionBaseComponent setMinElement(UnsignedIntType value) { 
1797          this.min = value;
1798          return this;
1799        }
1800
1801        /**
1802         * @return Minimum cardinality of the base element identified by the path.
1803         */
1804        public int getMin() { 
1805          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
1806        }
1807
1808        /**
1809         * @param value Minimum cardinality of the base element identified by the path.
1810         */
1811        public ElementDefinitionBaseComponent setMin(int value) { 
1812            if (this.min == null)
1813              this.min = new UnsignedIntType();
1814            this.min.setValue(value);
1815          return this;
1816        }
1817
1818        /**
1819         * @return {@link #max} (Maximum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
1820         */
1821        public StringType getMaxElement() { 
1822          if (this.max == null)
1823            if (Configuration.errorOnAutoCreate())
1824              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.max");
1825            else if (Configuration.doAutoCreate())
1826              this.max = new StringType(); // bb
1827          return this.max;
1828        }
1829
1830        public boolean hasMaxElement() { 
1831          return this.max != null && !this.max.isEmpty();
1832        }
1833
1834        public boolean hasMax() { 
1835          return this.max != null && !this.max.isEmpty();
1836        }
1837
1838        /**
1839         * @param value {@link #max} (Maximum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
1840         */
1841        public ElementDefinitionBaseComponent setMaxElement(StringType value) { 
1842          this.max = value;
1843          return this;
1844        }
1845
1846        /**
1847         * @return Maximum cardinality of the base element identified by the path.
1848         */
1849        public String getMax() { 
1850          return this.max == null ? null : this.max.getValue();
1851        }
1852
1853        /**
1854         * @param value Maximum cardinality of the base element identified by the path.
1855         */
1856        public ElementDefinitionBaseComponent setMax(String value) { 
1857            if (this.max == null)
1858              this.max = new StringType();
1859            this.max.setValue(value);
1860          return this;
1861        }
1862
1863        protected void listChildren(List<Property> children) {
1864          super.listChildren(children);
1865          children.add(new Property("path", "string", "The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.", 0, 1, path));
1866          children.add(new Property("min", "unsignedInt", "Minimum cardinality of the base element identified by the path.", 0, 1, min));
1867          children.add(new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, 1, max));
1868        }
1869
1870        @Override
1871        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1872          switch (_hash) {
1873          case 3433509: /*path*/  return new Property("path", "string", "The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [StructureDefinition](structuredefinition.html#) without a StructureDefinition.base.", 0, 1, path);
1874          case 108114: /*min*/  return new Property("min", "unsignedInt", "Minimum cardinality of the base element identified by the path.", 0, 1, min);
1875          case 107876: /*max*/  return new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, 1, max);
1876          default: return super.getNamedProperty(_hash, _name, _checkValid);
1877          }
1878
1879        }
1880
1881      @Override
1882      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1883        switch (hash) {
1884        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1885        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // UnsignedIntType
1886        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
1887        default: return super.getProperty(hash, name, checkValid);
1888        }
1889
1890      }
1891
1892      @Override
1893      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1894        switch (hash) {
1895        case 3433509: // path
1896          this.path = TypeConvertor.castToString(value); // StringType
1897          return value;
1898        case 108114: // min
1899          this.min = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1900          return value;
1901        case 107876: // max
1902          this.max = TypeConvertor.castToString(value); // StringType
1903          return value;
1904        default: return super.setProperty(hash, name, value);
1905        }
1906
1907      }
1908
1909      @Override
1910      public Base setProperty(String name, Base value) throws FHIRException {
1911        if (name.equals("path")) {
1912          this.path = TypeConvertor.castToString(value); // StringType
1913        } else if (name.equals("min")) {
1914          this.min = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1915        } else if (name.equals("max")) {
1916          this.max = TypeConvertor.castToString(value); // StringType
1917        } else
1918          return super.setProperty(name, value);
1919        return value;
1920      }
1921
1922      @Override
1923      public Base makeProperty(int hash, String name) throws FHIRException {
1924        switch (hash) {
1925        case 3433509:  return getPathElement();
1926        case 108114:  return getMinElement();
1927        case 107876:  return getMaxElement();
1928        default: return super.makeProperty(hash, name);
1929        }
1930
1931      }
1932
1933      @Override
1934      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1935        switch (hash) {
1936        case 3433509: /*path*/ return new String[] {"string"};
1937        case 108114: /*min*/ return new String[] {"unsignedInt"};
1938        case 107876: /*max*/ return new String[] {"string"};
1939        default: return super.getTypesForProperty(hash, name);
1940        }
1941
1942      }
1943
1944      @Override
1945      public Base addChild(String name) throws FHIRException {
1946        if (name.equals("path")) {
1947          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.base.path");
1948        }
1949        else if (name.equals("min")) {
1950          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.base.min");
1951        }
1952        else if (name.equals("max")) {
1953          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.base.max");
1954        }
1955        else
1956          return super.addChild(name);
1957      }
1958
1959      public ElementDefinitionBaseComponent copy() {
1960        ElementDefinitionBaseComponent dst = new ElementDefinitionBaseComponent();
1961        copyValues(dst);
1962        return dst;
1963      }
1964
1965      public void copyValues(ElementDefinitionBaseComponent dst) {
1966        super.copyValues(dst);
1967        dst.path = path == null ? null : path.copy();
1968        dst.min = min == null ? null : min.copy();
1969        dst.max = max == null ? null : max.copy();
1970      }
1971
1972      @Override
1973      public boolean equalsDeep(Base other_) {
1974        if (!super.equalsDeep(other_))
1975          return false;
1976        if (!(other_ instanceof ElementDefinitionBaseComponent))
1977          return false;
1978        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other_;
1979        return compareDeep(path, o.path, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
1980          ;
1981      }
1982
1983      @Override
1984      public boolean equalsShallow(Base other_) {
1985        if (!super.equalsShallow(other_))
1986          return false;
1987        if (!(other_ instanceof ElementDefinitionBaseComponent))
1988          return false;
1989        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other_;
1990        return compareValues(path, o.path, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
1991          ;
1992      }
1993
1994      public boolean isEmpty() {
1995        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, min, max);
1996      }
1997
1998  public String fhirType() {
1999    return "ElementDefinition.base";
2000
2001  }
2002
2003  }
2004
2005    @Block()
2006    public static class TypeRefComponent extends Element implements IBaseDatatypeElement {
2007        /**
2008         * URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.
2009         */
2010        @Child(name = "code", type = {UriType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2011        @Description(shortDefinition="Data type or Resource (reference to definition)", formalDefinition="URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models." )
2012        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/elementdefinition-types")
2013        protected UriType code;
2014
2015        /**
2016         * Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.
2017         */
2018        @Child(name = "profile", type = {CanonicalType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2019        @Description(shortDefinition="Profiles (StructureDefinition or IG) - one must apply", formalDefinition="Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide." )
2020        protected List<CanonicalType> profile;
2021
2022        /**
2023         * Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.
2024         */
2025        @Child(name = "targetProfile", type = {CanonicalType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2026        @Description(shortDefinition="Profile (StructureDefinition or IG) on the Reference/canonical target - one must apply", formalDefinition="Used when the type is \"Reference\" or \"canonical\", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide." )
2027        protected List<CanonicalType> targetProfile;
2028
2029        /**
2030         * If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.
2031         */
2032        @Child(name = "aggregation", type = {CodeType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2033        @Description(shortDefinition="contained | referenced | bundled - how aggregated", formalDefinition="If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle." )
2034        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-aggregation-mode")
2035        protected List<Enumeration<AggregationMode>> aggregation;
2036
2037        /**
2038         * Whether this reference needs to be version specific or version independent, or whether either can be used.
2039         */
2040        @Child(name = "versioning", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
2041        @Description(shortDefinition="either | independent | specific", formalDefinition="Whether this reference needs to be version specific or version independent, or whether either can be used." )
2042        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/reference-version-rules")
2043        protected Enumeration<ReferenceVersionRules> versioning;
2044
2045        private static final long serialVersionUID = 957891653L;
2046
2047    /**
2048     * Constructor
2049     */
2050      public TypeRefComponent() {
2051        super();
2052      }
2053
2054    /**
2055     * Constructor
2056     */
2057      public TypeRefComponent(String code) {
2058        super();
2059        this.setCode(code);
2060      }
2061
2062        /**
2063         * @return {@link #code} (URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
2064         */
2065        public UriType getCodeElement() { 
2066          if (this.code == null)
2067            if (Configuration.errorOnAutoCreate())
2068              throw new Error("Attempt to auto-create TypeRefComponent.code");
2069            else if (Configuration.doAutoCreate())
2070              this.code = new UriType(); // bb
2071          return this.code;
2072        }
2073
2074        public boolean hasCodeElement() { 
2075          return this.code != null && !this.code.isEmpty();
2076        }
2077
2078        public boolean hasCode() { 
2079          return this.code != null && !this.code.isEmpty();
2080        }
2081
2082        /**
2083         * @param value {@link #code} (URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
2084         */
2085        public TypeRefComponent setCodeElement(UriType value) { 
2086          this.code = value;
2087          return this;
2088        }
2089
2090        /**
2091         * @return URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.
2092         */
2093        public String getCode() { 
2094          return this.code == null ? null : this.code.getValue();
2095        }
2096
2097        /**
2098         * @param value URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. "string" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.
2099         */
2100        public TypeRefComponent setCode(String value) { 
2101            if (this.code == null)
2102              this.code = new UriType();
2103            this.code.setValue(value);
2104          return this;
2105        }
2106
2107        /**
2108         * @return {@link #profile} (Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.)
2109         */
2110        public List<CanonicalType> getProfile() { 
2111          if (this.profile == null)
2112            this.profile = new ArrayList<CanonicalType>();
2113          return this.profile;
2114        }
2115
2116        /**
2117         * @return Returns a reference to <code>this</code> for easy method chaining
2118         */
2119        public TypeRefComponent setProfile(List<CanonicalType> theProfile) { 
2120          this.profile = theProfile;
2121          return this;
2122        }
2123
2124        public boolean hasProfile() { 
2125          if (this.profile == null)
2126            return false;
2127          for (CanonicalType item : this.profile)
2128            if (!item.isEmpty())
2129              return true;
2130          return false;
2131        }
2132
2133        /**
2134         * @return {@link #profile} (Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.)
2135         */
2136        public CanonicalType addProfileElement() {//2 
2137          CanonicalType t = new CanonicalType();
2138          if (this.profile == null)
2139            this.profile = new ArrayList<CanonicalType>();
2140          this.profile.add(t);
2141          return t;
2142        }
2143
2144        /**
2145         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.)
2146         */
2147        public TypeRefComponent addProfile(String value) { //1
2148          CanonicalType t = new CanonicalType();
2149          t.setValue(value);
2150          if (this.profile == null)
2151            this.profile = new ArrayList<CanonicalType>();
2152          this.profile.add(t);
2153          return this;
2154        }
2155
2156        /**
2157         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.)
2158         */
2159        public boolean hasProfile(String value) { 
2160          if (this.profile == null)
2161            return false;
2162          for (CanonicalType v : this.profile)
2163            if (v.getValue().equals(value)) // canonical
2164              return true;
2165          return false;
2166        }
2167
2168        /**
2169         * @return {@link #targetProfile} (Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.)
2170         */
2171        public List<CanonicalType> getTargetProfile() { 
2172          if (this.targetProfile == null)
2173            this.targetProfile = new ArrayList<CanonicalType>();
2174          return this.targetProfile;
2175        }
2176
2177        /**
2178         * @return Returns a reference to <code>this</code> for easy method chaining
2179         */
2180        public TypeRefComponent setTargetProfile(List<CanonicalType> theTargetProfile) { 
2181          this.targetProfile = theTargetProfile;
2182          return this;
2183        }
2184
2185        public boolean hasTargetProfile() { 
2186          if (this.targetProfile == null)
2187            return false;
2188          for (CanonicalType item : this.targetProfile)
2189            if (!item.isEmpty())
2190              return true;
2191          return false;
2192        }
2193
2194        /**
2195         * @return {@link #targetProfile} (Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.)
2196         */
2197        public CanonicalType addTargetProfileElement() {//2 
2198          CanonicalType t = new CanonicalType();
2199          if (this.targetProfile == null)
2200            this.targetProfile = new ArrayList<CanonicalType>();
2201          this.targetProfile.add(t);
2202          return t;
2203        }
2204
2205        /**
2206         * @param value {@link #targetProfile} (Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.)
2207         */
2208        public TypeRefComponent addTargetProfile(String value) { //1
2209          CanonicalType t = new CanonicalType();
2210          t.setValue(value);
2211          if (this.targetProfile == null)
2212            this.targetProfile = new ArrayList<CanonicalType>();
2213          this.targetProfile.add(t);
2214          return this;
2215        }
2216
2217        /**
2218         * @param value {@link #targetProfile} (Used when the type is "Reference" or "canonical", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.)
2219         */
2220        public boolean hasTargetProfile(String value) { 
2221          if (this.targetProfile == null)
2222            return false;
2223          for (CanonicalType v : this.targetProfile)
2224            if (v.getValue().equals(value)) // canonical
2225              return true;
2226          return false;
2227        }
2228
2229        /**
2230         * @return {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
2231         */
2232        public List<Enumeration<AggregationMode>> getAggregation() { 
2233          if (this.aggregation == null)
2234            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2235          return this.aggregation;
2236        }
2237
2238        /**
2239         * @return Returns a reference to <code>this</code> for easy method chaining
2240         */
2241        public TypeRefComponent setAggregation(List<Enumeration<AggregationMode>> theAggregation) { 
2242          this.aggregation = theAggregation;
2243          return this;
2244        }
2245
2246        public boolean hasAggregation() { 
2247          if (this.aggregation == null)
2248            return false;
2249          for (Enumeration<AggregationMode> item : this.aggregation)
2250            if (!item.isEmpty())
2251              return true;
2252          return false;
2253        }
2254
2255        /**
2256         * @return {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
2257         */
2258        public Enumeration<AggregationMode> addAggregationElement() {//2 
2259          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
2260          if (this.aggregation == null)
2261            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2262          this.aggregation.add(t);
2263          return t;
2264        }
2265
2266        /**
2267         * @param value {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
2268         */
2269        public TypeRefComponent addAggregation(AggregationMode value) { //1
2270          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
2271          t.setValue(value);
2272          if (this.aggregation == null)
2273            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2274          this.aggregation.add(t);
2275          return this;
2276        }
2277
2278        /**
2279         * @param value {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
2280         */
2281        public boolean hasAggregation(AggregationMode value) { 
2282          if (this.aggregation == null)
2283            return false;
2284          for (Enumeration<AggregationMode> v : this.aggregation)
2285            if (v.getValue().equals(value)) // code
2286              return true;
2287          return false;
2288        }
2289
2290        /**
2291         * @return {@link #versioning} (Whether this reference needs to be version specific or version independent, or whether either can be used.). This is the underlying object with id, value and extensions. The accessor "getVersioning" gives direct access to the value
2292         */
2293        public Enumeration<ReferenceVersionRules> getVersioningElement() { 
2294          if (this.versioning == null)
2295            if (Configuration.errorOnAutoCreate())
2296              throw new Error("Attempt to auto-create TypeRefComponent.versioning");
2297            else if (Configuration.doAutoCreate())
2298              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory()); // bb
2299          return this.versioning;
2300        }
2301
2302        public boolean hasVersioningElement() { 
2303          return this.versioning != null && !this.versioning.isEmpty();
2304        }
2305
2306        public boolean hasVersioning() { 
2307          return this.versioning != null && !this.versioning.isEmpty();
2308        }
2309
2310        /**
2311         * @param value {@link #versioning} (Whether this reference needs to be version specific or version independent, or whether either can be used.). This is the underlying object with id, value and extensions. The accessor "getVersioning" gives direct access to the value
2312         */
2313        public TypeRefComponent setVersioningElement(Enumeration<ReferenceVersionRules> value) { 
2314          this.versioning = value;
2315          return this;
2316        }
2317
2318        /**
2319         * @return Whether this reference needs to be version specific or version independent, or whether either can be used.
2320         */
2321        public ReferenceVersionRules getVersioning() { 
2322          return this.versioning == null ? null : this.versioning.getValue();
2323        }
2324
2325        /**
2326         * @param value Whether this reference needs to be version specific or version independent, or whether either can be used.
2327         */
2328        public TypeRefComponent setVersioning(ReferenceVersionRules value) { 
2329          if (value == null)
2330            this.versioning = null;
2331          else {
2332            if (this.versioning == null)
2333              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory());
2334            this.versioning.setValue(value);
2335          }
2336          return this;
2337        }
2338
2339        protected void listChildren(List<Property> children) {
2340          super.listChildren(children);
2341          children.add(new Property("code", "uri", "URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.", 0, 1, code));
2342          children.add(new Property("profile", "canonical(StructureDefinition|ImplementationGuide)", "Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, profile));
2343          children.add(new Property("targetProfile", "canonical(StructureDefinition|ImplementationGuide)", "Used when the type is \"Reference\" or \"canonical\", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, targetProfile));
2344          children.add(new Property("aggregation", "code", "If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.", 0, java.lang.Integer.MAX_VALUE, aggregation));
2345          children.add(new Property("versioning", "code", "Whether this reference needs to be version specific or version independent, or whether either can be used.", 0, 1, versioning));
2346        }
2347
2348        @Override
2349        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2350          switch (_hash) {
2351          case 3059181: /*code*/  return new Property("code", "uri", "URL of Data type or Resource that is a(or the) type used for this element. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition e.g. \"string\" is a reference to http://hl7.org/fhir/StructureDefinition/string. Absolute URLs are only allowed in logical models.", 0, 1, code);
2352          case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition|ImplementationGuide)", "Identifies a profile structure or implementation Guide that applies to the datatype this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the type SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, profile);
2353          case 1994521304: /*targetProfile*/  return new Property("targetProfile", "canonical(StructureDefinition|ImplementationGuide)", "Used when the type is \"Reference\" or \"canonical\", and identifies a profile structure or implementation Guide that applies to the target of the reference this element refers to. If any profiles are specified, then the content must conform to at least one of them. The URL can be a local reference - to a contained StructureDefinition, or a reference to another StructureDefinition or Implementation Guide by a canonical URL. When an implementation guide is specified, the target resource SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, targetProfile);
2354          case 841524962: /*aggregation*/  return new Property("aggregation", "code", "If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.", 0, java.lang.Integer.MAX_VALUE, aggregation);
2355          case -670487542: /*versioning*/  return new Property("versioning", "code", "Whether this reference needs to be version specific or version independent, or whether either can be used.", 0, 1, versioning);
2356          default: return super.getNamedProperty(_hash, _name, _checkValid);
2357          }
2358
2359        }
2360
2361      @Override
2362      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2363        switch (hash) {
2364        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // UriType
2365        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
2366        case 1994521304: /*targetProfile*/ return this.targetProfile == null ? new Base[0] : this.targetProfile.toArray(new Base[this.targetProfile.size()]); // CanonicalType
2367        case 841524962: /*aggregation*/ return this.aggregation == null ? new Base[0] : this.aggregation.toArray(new Base[this.aggregation.size()]); // Enumeration<AggregationMode>
2368        case -670487542: /*versioning*/ return this.versioning == null ? new Base[0] : new Base[] {this.versioning}; // Enumeration<ReferenceVersionRules>
2369        default: return super.getProperty(hash, name, checkValid);
2370        }
2371
2372      }
2373
2374      @Override
2375      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2376        switch (hash) {
2377        case 3059181: // code
2378          this.code = TypeConvertor.castToUri(value); // UriType
2379          return value;
2380        case -309425751: // profile
2381          this.getProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2382          return value;
2383        case 1994521304: // targetProfile
2384          this.getTargetProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2385          return value;
2386        case 841524962: // aggregation
2387          value = new AggregationModeEnumFactory().fromType(TypeConvertor.castToCode(value));
2388          this.getAggregation().add((Enumeration) value); // Enumeration<AggregationMode>
2389          return value;
2390        case -670487542: // versioning
2391          value = new ReferenceVersionRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
2392          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2393          return value;
2394        default: return super.setProperty(hash, name, value);
2395        }
2396
2397      }
2398
2399      @Override
2400      public Base setProperty(String name, Base value) throws FHIRException {
2401        if (name.equals("code")) {
2402          this.code = TypeConvertor.castToUri(value); // UriType
2403        } else if (name.equals("profile")) {
2404          this.getProfile().add(TypeConvertor.castToCanonical(value));
2405        } else if (name.equals("targetProfile")) {
2406          this.getTargetProfile().add(TypeConvertor.castToCanonical(value));
2407        } else if (name.equals("aggregation")) {
2408          value = new AggregationModeEnumFactory().fromType(TypeConvertor.castToCode(value));
2409          this.getAggregation().add((Enumeration) value);
2410        } else if (name.equals("versioning")) {
2411          value = new ReferenceVersionRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
2412          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2413        } else
2414          return super.setProperty(name, value);
2415        return value;
2416      }
2417
2418      @Override
2419      public Base makeProperty(int hash, String name) throws FHIRException {
2420        switch (hash) {
2421        case 3059181:  return getCodeElement();
2422        case -309425751:  return addProfileElement();
2423        case 1994521304:  return addTargetProfileElement();
2424        case 841524962:  return addAggregationElement();
2425        case -670487542:  return getVersioningElement();
2426        default: return super.makeProperty(hash, name);
2427        }
2428
2429      }
2430
2431      @Override
2432      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2433        switch (hash) {
2434        case 3059181: /*code*/ return new String[] {"uri"};
2435        case -309425751: /*profile*/ return new String[] {"canonical"};
2436        case 1994521304: /*targetProfile*/ return new String[] {"canonical"};
2437        case 841524962: /*aggregation*/ return new String[] {"code"};
2438        case -670487542: /*versioning*/ return new String[] {"code"};
2439        default: return super.getTypesForProperty(hash, name);
2440        }
2441
2442      }
2443
2444      @Override
2445      public Base addChild(String name) throws FHIRException {
2446        if (name.equals("code")) {
2447          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.code");
2448        }
2449        else if (name.equals("profile")) {
2450          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.profile");
2451        }
2452        else if (name.equals("targetProfile")) {
2453          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.targetProfile");
2454        }
2455        else if (name.equals("aggregation")) {
2456          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.aggregation");
2457        }
2458        else if (name.equals("versioning")) {
2459          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.type.versioning");
2460        }
2461        else
2462          return super.addChild(name);
2463      }
2464
2465      public TypeRefComponent copy() {
2466        TypeRefComponent dst = new TypeRefComponent();
2467        copyValues(dst);
2468        return dst;
2469      }
2470
2471      public void copyValues(TypeRefComponent dst) {
2472        super.copyValues(dst);
2473        dst.code = code == null ? null : code.copy();
2474        if (profile != null) {
2475          dst.profile = new ArrayList<CanonicalType>();
2476          for (CanonicalType i : profile)
2477            dst.profile.add(i.copy());
2478        };
2479        if (targetProfile != null) {
2480          dst.targetProfile = new ArrayList<CanonicalType>();
2481          for (CanonicalType i : targetProfile)
2482            dst.targetProfile.add(i.copy());
2483        };
2484        if (aggregation != null) {
2485          dst.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2486          for (Enumeration<AggregationMode> i : aggregation)
2487            dst.aggregation.add(i.copy());
2488        };
2489        dst.versioning = versioning == null ? null : versioning.copy();
2490      }
2491
2492      @Override
2493      public boolean equalsDeep(Base other_) {
2494        if (!super.equalsDeep(other_))
2495          return false;
2496        if (!(other_ instanceof TypeRefComponent))
2497          return false;
2498        TypeRefComponent o = (TypeRefComponent) other_;
2499        return compareDeep(code, o.code, true) && compareDeep(profile, o.profile, true) && compareDeep(targetProfile, o.targetProfile, true)
2500           && compareDeep(aggregation, o.aggregation, true) && compareDeep(versioning, o.versioning, true)
2501          ;
2502      }
2503
2504      @Override
2505      public boolean equalsShallow(Base other_) {
2506        if (!super.equalsShallow(other_))
2507          return false;
2508        if (!(other_ instanceof TypeRefComponent))
2509          return false;
2510        TypeRefComponent o = (TypeRefComponent) other_;
2511        return compareValues(code, o.code, true) && compareValues(profile, o.profile, true) && compareValues(targetProfile, o.targetProfile, true)
2512           && compareValues(aggregation, o.aggregation, true) && compareValues(versioning, o.versioning, true)
2513          ;
2514      }
2515
2516      public boolean isEmpty() {
2517        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, profile, targetProfile
2518          , aggregation, versioning);
2519      }
2520
2521  public String fhirType() {
2522    return "ElementDefinition.type";
2523
2524  }
2525
2526// added from java-adornments.txt:
2527public boolean hasTarget() {
2528    return Utilities.existsInList(getCode(), "Reference", "canonical", "CodeableReference");
2529  }
2530  
2531    /**
2532   * This code checks for the system prefix and returns the FHIR type
2533   * 
2534   * @return
2535   */
2536  public String getWorkingCode() {
2537    if (hasExtension(ToolingExtensions.EXT_FHIR_TYPE))
2538      return getExtensionString(ToolingExtensions.EXT_FHIR_TYPE);
2539    if (!hasCodeElement()) 
2540      return null;
2541    if (getCodeElement().hasExtension(ToolingExtensions.EXT_XML_TYPE)) {
2542      String s = getCodeElement().getExtensionString(ToolingExtensions.EXT_XML_TYPE);
2543      if ("xsd:gYear OR xsd:gYearMonth OR xsd:date OR xsd:dateTime".equalsIgnoreCase(s))
2544        return "dateTime";
2545      if ("xsd:gYear OR xsd:gYearMonth OR xsd:date".equalsIgnoreCase(s))
2546        return "date";
2547      if ("xsd:dateTime".equalsIgnoreCase(s))
2548        return "instant";
2549      if ("xsd:token".equals(s))
2550        return "code";
2551      if ("xsd:boolean".equals(s))
2552        return "boolean";
2553      if ("xsd:string".equals(s))
2554        return "string";
2555      if ("xsd:time".equals(s))
2556        return "time";
2557      if ("xsd:int".equals(s))
2558        return "integer";
2559      if ("xsd:decimal OR xsd:double".equals(s))
2560        return "decimal";
2561      if ("xsd:decimal".equalsIgnoreCase(s))
2562        return "decimal";
2563      if ("xsd:base64Binary".equalsIgnoreCase(s))
2564        return "base64Binary";
2565      if ("xsd:positiveInteger".equalsIgnoreCase(s))
2566        return "positiveInt";
2567      if ("xsd:nonNegativeInteger".equalsIgnoreCase(s))
2568        return "unsignedInt";
2569      if ("xsd:anyURI".equalsIgnoreCase(s))
2570        return "uri";
2571      
2572      throw new Error("Unknown xml type '"+s+"'");
2573    }
2574    return getCode();
2575  }
2576
2577  @Override
2578  public String toString() {
2579    String res = getCode();
2580    if (hasProfile()) {
2581      res = res + "{";
2582      boolean first = true;
2583      for (CanonicalType s : getProfile()) {
2584        if (first) first = false; else res = res + "|";
2585        res = res + s.getValue();
2586      }
2587      res = res + "}";
2588    }
2589    if (hasTargetProfile()) {
2590      res = res + "->(";
2591      boolean first = true;
2592      for (CanonicalType s : getTargetProfile()) {
2593        if (first) first = false; else res = res + "|";
2594        res = res + s.getValue();
2595      }
2596      res = res + ")";
2597    }    
2598    return res;
2599  }
2600
2601  public String getName() {
2602    return getWorkingCode();
2603  }
2604
2605  public boolean isResourceReference() {
2606    return "Reference".equals(getCode()) && hasTargetProfile();
2607  }
2608// end addition
2609  }
2610
2611    @Block()
2612    public static class ElementDefinitionExampleComponent extends Element implements IBaseDatatypeElement {
2613        /**
2614         * Describes the purpose of this example among the set of examples.
2615         */
2616        @Child(name = "label", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2617        @Description(shortDefinition="Describes the purpose of this example", formalDefinition="Describes the purpose of this example among the set of examples." )
2618        protected StringType label;
2619
2620        /**
2621         * The actual value for the element, which must be one of the types allowed for this element.
2622         */
2623        @Child(name = "value", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Availability.class, ExtendedContactDetail.class, Dosage.class, Meta.class}, order=2, min=1, max=1, modifier=false, summary=true)
2624        @Description(shortDefinition="Value of Example (one of allowed types)", formalDefinition="The actual value for the element, which must be one of the types allowed for this element." )
2625        protected DataType value;
2626
2627        private static final long serialVersionUID = 463190922L;
2628
2629    /**
2630     * Constructor
2631     */
2632      public ElementDefinitionExampleComponent() {
2633        super();
2634      }
2635
2636    /**
2637     * Constructor
2638     */
2639      public ElementDefinitionExampleComponent(String label, DataType value) {
2640        super();
2641        this.setLabel(label);
2642        this.setValue(value);
2643      }
2644
2645        /**
2646         * @return {@link #label} (Describes the purpose of this example among the set of examples.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
2647         */
2648        public StringType getLabelElement() { 
2649          if (this.label == null)
2650            if (Configuration.errorOnAutoCreate())
2651              throw new Error("Attempt to auto-create ElementDefinitionExampleComponent.label");
2652            else if (Configuration.doAutoCreate())
2653              this.label = new StringType(); // bb
2654          return this.label;
2655        }
2656
2657        public boolean hasLabelElement() { 
2658          return this.label != null && !this.label.isEmpty();
2659        }
2660
2661        public boolean hasLabel() { 
2662          return this.label != null && !this.label.isEmpty();
2663        }
2664
2665        /**
2666         * @param value {@link #label} (Describes the purpose of this example among the set of examples.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
2667         */
2668        public ElementDefinitionExampleComponent setLabelElement(StringType value) { 
2669          this.label = value;
2670          return this;
2671        }
2672
2673        /**
2674         * @return Describes the purpose of this example among the set of examples.
2675         */
2676        public String getLabel() { 
2677          return this.label == null ? null : this.label.getValue();
2678        }
2679
2680        /**
2681         * @param value Describes the purpose of this example among the set of examples.
2682         */
2683        public ElementDefinitionExampleComponent setLabel(String value) { 
2684            if (this.label == null)
2685              this.label = new StringType();
2686            this.label.setValue(value);
2687          return this;
2688        }
2689
2690        /**
2691         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2692         */
2693        public DataType getValue() { 
2694          return this.value;
2695        }
2696
2697        /**
2698         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2699         */
2700        public Base64BinaryType getValueBase64BinaryType() throws FHIRException { 
2701          if (this.value == null)
2702            this.value = new Base64BinaryType();
2703          if (!(this.value instanceof Base64BinaryType))
2704            throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.value.getClass().getName()+" was encountered");
2705          return (Base64BinaryType) this.value;
2706        }
2707
2708        public boolean hasValueBase64BinaryType() { 
2709          return this != null && this.value instanceof Base64BinaryType;
2710        }
2711
2712        /**
2713         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2714         */
2715        public BooleanType getValueBooleanType() throws FHIRException { 
2716          if (this.value == null)
2717            this.value = new BooleanType();
2718          if (!(this.value instanceof BooleanType))
2719            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
2720          return (BooleanType) this.value;
2721        }
2722
2723        public boolean hasValueBooleanType() { 
2724          return this != null && this.value instanceof BooleanType;
2725        }
2726
2727        /**
2728         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2729         */
2730        public CanonicalType getValueCanonicalType() throws FHIRException { 
2731          if (this.value == null)
2732            this.value = new CanonicalType();
2733          if (!(this.value instanceof CanonicalType))
2734            throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.value.getClass().getName()+" was encountered");
2735          return (CanonicalType) this.value;
2736        }
2737
2738        public boolean hasValueCanonicalType() { 
2739          return this != null && this.value instanceof CanonicalType;
2740        }
2741
2742        /**
2743         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2744         */
2745        public CodeType getValueCodeType() throws FHIRException { 
2746          if (this.value == null)
2747            this.value = new CodeType();
2748          if (!(this.value instanceof CodeType))
2749            throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.value.getClass().getName()+" was encountered");
2750          return (CodeType) this.value;
2751        }
2752
2753        public boolean hasValueCodeType() { 
2754          return this != null && this.value instanceof CodeType;
2755        }
2756
2757        /**
2758         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2759         */
2760        public DateType getValueDateType() throws FHIRException { 
2761          if (this.value == null)
2762            this.value = new DateType();
2763          if (!(this.value instanceof DateType))
2764            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2765          return (DateType) this.value;
2766        }
2767
2768        public boolean hasValueDateType() { 
2769          return this != null && this.value instanceof DateType;
2770        }
2771
2772        /**
2773         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2774         */
2775        public DateTimeType getValueDateTimeType() throws FHIRException { 
2776          if (this.value == null)
2777            this.value = new DateTimeType();
2778          if (!(this.value instanceof DateTimeType))
2779            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2780          return (DateTimeType) this.value;
2781        }
2782
2783        public boolean hasValueDateTimeType() { 
2784          return this != null && this.value instanceof DateTimeType;
2785        }
2786
2787        /**
2788         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2789         */
2790        public DecimalType getValueDecimalType() throws FHIRException { 
2791          if (this.value == null)
2792            this.value = new DecimalType();
2793          if (!(this.value instanceof DecimalType))
2794            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
2795          return (DecimalType) this.value;
2796        }
2797
2798        public boolean hasValueDecimalType() { 
2799          return this != null && this.value instanceof DecimalType;
2800        }
2801
2802        /**
2803         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2804         */
2805        public IdType getValueIdType() throws FHIRException { 
2806          if (this.value == null)
2807            this.value = new IdType();
2808          if (!(this.value instanceof IdType))
2809            throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.value.getClass().getName()+" was encountered");
2810          return (IdType) this.value;
2811        }
2812
2813        public boolean hasValueIdType() { 
2814          return this != null && this.value instanceof IdType;
2815        }
2816
2817        /**
2818         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2819         */
2820        public InstantType getValueInstantType() throws FHIRException { 
2821          if (this.value == null)
2822            this.value = new InstantType();
2823          if (!(this.value instanceof InstantType))
2824            throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.value.getClass().getName()+" was encountered");
2825          return (InstantType) this.value;
2826        }
2827
2828        public boolean hasValueInstantType() { 
2829          return this != null && this.value instanceof InstantType;
2830        }
2831
2832        /**
2833         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2834         */
2835        public IntegerType getValueIntegerType() throws FHIRException { 
2836          if (this.value == null)
2837            this.value = new IntegerType();
2838          if (!(this.value instanceof IntegerType))
2839            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2840          return (IntegerType) this.value;
2841        }
2842
2843        public boolean hasValueIntegerType() { 
2844          return this != null && this.value instanceof IntegerType;
2845        }
2846
2847        /**
2848         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2849         */
2850        public Integer64Type getValueInteger64Type() throws FHIRException { 
2851          if (this.value == null)
2852            this.value = new Integer64Type();
2853          if (!(this.value instanceof Integer64Type))
2854            throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.value.getClass().getName()+" was encountered");
2855          return (Integer64Type) this.value;
2856        }
2857
2858        public boolean hasValueInteger64Type() { 
2859          return this != null && this.value instanceof Integer64Type;
2860        }
2861
2862        /**
2863         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2864         */
2865        public MarkdownType getValueMarkdownType() throws FHIRException { 
2866          if (this.value == null)
2867            this.value = new MarkdownType();
2868          if (!(this.value instanceof MarkdownType))
2869            throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.value.getClass().getName()+" was encountered");
2870          return (MarkdownType) this.value;
2871        }
2872
2873        public boolean hasValueMarkdownType() { 
2874          return this != null && this.value instanceof MarkdownType;
2875        }
2876
2877        /**
2878         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2879         */
2880        public OidType getValueOidType() throws FHIRException { 
2881          if (this.value == null)
2882            this.value = new OidType();
2883          if (!(this.value instanceof OidType))
2884            throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.value.getClass().getName()+" was encountered");
2885          return (OidType) this.value;
2886        }
2887
2888        public boolean hasValueOidType() { 
2889          return this != null && this.value instanceof OidType;
2890        }
2891
2892        /**
2893         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2894         */
2895        public PositiveIntType getValuePositiveIntType() throws FHIRException { 
2896          if (this.value == null)
2897            this.value = new PositiveIntType();
2898          if (!(this.value instanceof PositiveIntType))
2899            throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.value.getClass().getName()+" was encountered");
2900          return (PositiveIntType) this.value;
2901        }
2902
2903        public boolean hasValuePositiveIntType() { 
2904          return this != null && this.value instanceof PositiveIntType;
2905        }
2906
2907        /**
2908         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2909         */
2910        public StringType getValueStringType() throws FHIRException { 
2911          if (this.value == null)
2912            this.value = new StringType();
2913          if (!(this.value instanceof StringType))
2914            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2915          return (StringType) this.value;
2916        }
2917
2918        public boolean hasValueStringType() { 
2919          return this != null && this.value instanceof StringType;
2920        }
2921
2922        /**
2923         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2924         */
2925        public TimeType getValueTimeType() throws FHIRException { 
2926          if (this.value == null)
2927            this.value = new TimeType();
2928          if (!(this.value instanceof TimeType))
2929            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2930          return (TimeType) this.value;
2931        }
2932
2933        public boolean hasValueTimeType() { 
2934          return this != null && this.value instanceof TimeType;
2935        }
2936
2937        /**
2938         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2939         */
2940        public UnsignedIntType getValueUnsignedIntType() throws FHIRException { 
2941          if (this.value == null)
2942            this.value = new UnsignedIntType();
2943          if (!(this.value instanceof UnsignedIntType))
2944            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.value.getClass().getName()+" was encountered");
2945          return (UnsignedIntType) this.value;
2946        }
2947
2948        public boolean hasValueUnsignedIntType() { 
2949          return this != null && this.value instanceof UnsignedIntType;
2950        }
2951
2952        /**
2953         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2954         */
2955        public UriType getValueUriType() throws FHIRException { 
2956          if (this.value == null)
2957            this.value = new UriType();
2958          if (!(this.value instanceof UriType))
2959            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
2960          return (UriType) this.value;
2961        }
2962
2963        public boolean hasValueUriType() { 
2964          return this != null && this.value instanceof UriType;
2965        }
2966
2967        /**
2968         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2969         */
2970        public UrlType getValueUrlType() throws FHIRException { 
2971          if (this.value == null)
2972            this.value = new UrlType();
2973          if (!(this.value instanceof UrlType))
2974            throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.value.getClass().getName()+" was encountered");
2975          return (UrlType) this.value;
2976        }
2977
2978        public boolean hasValueUrlType() { 
2979          return this != null && this.value instanceof UrlType;
2980        }
2981
2982        /**
2983         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2984         */
2985        public UuidType getValueUuidType() throws FHIRException { 
2986          if (this.value == null)
2987            this.value = new UuidType();
2988          if (!(this.value instanceof UuidType))
2989            throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.value.getClass().getName()+" was encountered");
2990          return (UuidType) this.value;
2991        }
2992
2993        public boolean hasValueUuidType() { 
2994          return this != null && this.value instanceof UuidType;
2995        }
2996
2997        /**
2998         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2999         */
3000        public Address getValueAddress() throws FHIRException { 
3001          if (this.value == null)
3002            this.value = new Address();
3003          if (!(this.value instanceof Address))
3004            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.value.getClass().getName()+" was encountered");
3005          return (Address) this.value;
3006        }
3007
3008        public boolean hasValueAddress() { 
3009          return this != null && this.value instanceof Address;
3010        }
3011
3012        /**
3013         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3014         */
3015        public Age getValueAge() throws FHIRException { 
3016          if (this.value == null)
3017            this.value = new Age();
3018          if (!(this.value instanceof Age))
3019            throw new FHIRException("Type mismatch: the type Age was expected, but "+this.value.getClass().getName()+" was encountered");
3020          return (Age) this.value;
3021        }
3022
3023        public boolean hasValueAge() { 
3024          return this != null && this.value instanceof Age;
3025        }
3026
3027        /**
3028         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3029         */
3030        public Annotation getValueAnnotation() throws FHIRException { 
3031          if (this.value == null)
3032            this.value = new Annotation();
3033          if (!(this.value instanceof Annotation))
3034            throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.value.getClass().getName()+" was encountered");
3035          return (Annotation) this.value;
3036        }
3037
3038        public boolean hasValueAnnotation() { 
3039          return this != null && this.value instanceof Annotation;
3040        }
3041
3042        /**
3043         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3044         */
3045        public Attachment getValueAttachment() throws FHIRException { 
3046          if (this.value == null)
3047            this.value = new Attachment();
3048          if (!(this.value instanceof Attachment))
3049            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3050          return (Attachment) this.value;
3051        }
3052
3053        public boolean hasValueAttachment() { 
3054          return this != null && this.value instanceof Attachment;
3055        }
3056
3057        /**
3058         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3059         */
3060        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
3061          if (this.value == null)
3062            this.value = new CodeableConcept();
3063          if (!(this.value instanceof CodeableConcept))
3064            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
3065          return (CodeableConcept) this.value;
3066        }
3067
3068        public boolean hasValueCodeableConcept() { 
3069          return this != null && this.value instanceof CodeableConcept;
3070        }
3071
3072        /**
3073         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3074         */
3075        public CodeableReference getValueCodeableReference() throws FHIRException { 
3076          if (this.value == null)
3077            this.value = new CodeableReference();
3078          if (!(this.value instanceof CodeableReference))
3079            throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.value.getClass().getName()+" was encountered");
3080          return (CodeableReference) this.value;
3081        }
3082
3083        public boolean hasValueCodeableReference() { 
3084          return this != null && this.value instanceof CodeableReference;
3085        }
3086
3087        /**
3088         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3089         */
3090        public Coding getValueCoding() throws FHIRException { 
3091          if (this.value == null)
3092            this.value = new Coding();
3093          if (!(this.value instanceof Coding))
3094            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
3095          return (Coding) this.value;
3096        }
3097
3098        public boolean hasValueCoding() { 
3099          return this != null && this.value instanceof Coding;
3100        }
3101
3102        /**
3103         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3104         */
3105        public ContactPoint getValueContactPoint() throws FHIRException { 
3106          if (this.value == null)
3107            this.value = new ContactPoint();
3108          if (!(this.value instanceof ContactPoint))
3109            throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.value.getClass().getName()+" was encountered");
3110          return (ContactPoint) this.value;
3111        }
3112
3113        public boolean hasValueContactPoint() { 
3114          return this != null && this.value instanceof ContactPoint;
3115        }
3116
3117        /**
3118         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3119         */
3120        public Count getValueCount() throws FHIRException { 
3121          if (this.value == null)
3122            this.value = new Count();
3123          if (!(this.value instanceof Count))
3124            throw new FHIRException("Type mismatch: the type Count was expected, but "+this.value.getClass().getName()+" was encountered");
3125          return (Count) this.value;
3126        }
3127
3128        public boolean hasValueCount() { 
3129          return this != null && this.value instanceof Count;
3130        }
3131
3132        /**
3133         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3134         */
3135        public Distance getValueDistance() throws FHIRException { 
3136          if (this.value == null)
3137            this.value = new Distance();
3138          if (!(this.value instanceof Distance))
3139            throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.value.getClass().getName()+" was encountered");
3140          return (Distance) this.value;
3141        }
3142
3143        public boolean hasValueDistance() { 
3144          return this != null && this.value instanceof Distance;
3145        }
3146
3147        /**
3148         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3149         */
3150        public Duration getValueDuration() throws FHIRException { 
3151          if (this.value == null)
3152            this.value = new Duration();
3153          if (!(this.value instanceof Duration))
3154            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
3155          return (Duration) this.value;
3156        }
3157
3158        public boolean hasValueDuration() { 
3159          return this != null && this.value instanceof Duration;
3160        }
3161
3162        /**
3163         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3164         */
3165        public HumanName getValueHumanName() throws FHIRException { 
3166          if (this.value == null)
3167            this.value = new HumanName();
3168          if (!(this.value instanceof HumanName))
3169            throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.value.getClass().getName()+" was encountered");
3170          return (HumanName) this.value;
3171        }
3172
3173        public boolean hasValueHumanName() { 
3174          return this != null && this.value instanceof HumanName;
3175        }
3176
3177        /**
3178         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3179         */
3180        public Identifier getValueIdentifier() throws FHIRException { 
3181          if (this.value == null)
3182            this.value = new Identifier();
3183          if (!(this.value instanceof Identifier))
3184            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.value.getClass().getName()+" was encountered");
3185          return (Identifier) this.value;
3186        }
3187
3188        public boolean hasValueIdentifier() { 
3189          return this != null && this.value instanceof Identifier;
3190        }
3191
3192        /**
3193         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3194         */
3195        public Money getValueMoney() throws FHIRException { 
3196          if (this.value == null)
3197            this.value = new Money();
3198          if (!(this.value instanceof Money))
3199            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.value.getClass().getName()+" was encountered");
3200          return (Money) this.value;
3201        }
3202
3203        public boolean hasValueMoney() { 
3204          return this != null && this.value instanceof Money;
3205        }
3206
3207        /**
3208         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3209         */
3210        public Period getValuePeriod() throws FHIRException { 
3211          if (this.value == null)
3212            this.value = new Period();
3213          if (!(this.value instanceof Period))
3214            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
3215          return (Period) this.value;
3216        }
3217
3218        public boolean hasValuePeriod() { 
3219          return this != null && this.value instanceof Period;
3220        }
3221
3222        /**
3223         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3224         */
3225        public Quantity getValueQuantity() throws FHIRException { 
3226          if (this.value == null)
3227            this.value = new Quantity();
3228          if (!(this.value instanceof Quantity))
3229            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3230          return (Quantity) this.value;
3231        }
3232
3233        public boolean hasValueQuantity() { 
3234          return this != null && this.value instanceof Quantity;
3235        }
3236
3237        /**
3238         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3239         */
3240        public Range getValueRange() throws FHIRException { 
3241          if (this.value == null)
3242            this.value = new Range();
3243          if (!(this.value instanceof Range))
3244            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
3245          return (Range) this.value;
3246        }
3247
3248        public boolean hasValueRange() { 
3249          return this != null && this.value instanceof Range;
3250        }
3251
3252        /**
3253         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3254         */
3255        public Ratio getValueRatio() throws FHIRException { 
3256          if (this.value == null)
3257            this.value = new Ratio();
3258          if (!(this.value instanceof Ratio))
3259            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
3260          return (Ratio) this.value;
3261        }
3262
3263        public boolean hasValueRatio() { 
3264          return this != null && this.value instanceof Ratio;
3265        }
3266
3267        /**
3268         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3269         */
3270        public RatioRange getValueRatioRange() throws FHIRException { 
3271          if (this.value == null)
3272            this.value = new RatioRange();
3273          if (!(this.value instanceof RatioRange))
3274            throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.value.getClass().getName()+" was encountered");
3275          return (RatioRange) this.value;
3276        }
3277
3278        public boolean hasValueRatioRange() { 
3279          return this != null && this.value instanceof RatioRange;
3280        }
3281
3282        /**
3283         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3284         */
3285        public Reference getValueReference() throws FHIRException { 
3286          if (this.value == null)
3287            this.value = new Reference();
3288          if (!(this.value instanceof Reference))
3289            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3290          return (Reference) this.value;
3291        }
3292
3293        public boolean hasValueReference() { 
3294          return this != null && this.value instanceof Reference;
3295        }
3296
3297        /**
3298         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3299         */
3300        public SampledData getValueSampledData() throws FHIRException { 
3301          if (this.value == null)
3302            this.value = new SampledData();
3303          if (!(this.value instanceof SampledData))
3304            throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered");
3305          return (SampledData) this.value;
3306        }
3307
3308        public boolean hasValueSampledData() { 
3309          return this != null && this.value instanceof SampledData;
3310        }
3311
3312        /**
3313         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3314         */
3315        public Signature getValueSignature() throws FHIRException { 
3316          if (this.value == null)
3317            this.value = new Signature();
3318          if (!(this.value instanceof Signature))
3319            throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.value.getClass().getName()+" was encountered");
3320          return (Signature) this.value;
3321        }
3322
3323        public boolean hasValueSignature() { 
3324          return this != null && this.value instanceof Signature;
3325        }
3326
3327        /**
3328         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3329         */
3330        public Timing getValueTiming() throws FHIRException { 
3331          if (this.value == null)
3332            this.value = new Timing();
3333          if (!(this.value instanceof Timing))
3334            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.value.getClass().getName()+" was encountered");
3335          return (Timing) this.value;
3336        }
3337
3338        public boolean hasValueTiming() { 
3339          return this != null && this.value instanceof Timing;
3340        }
3341
3342        /**
3343         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3344         */
3345        public ContactDetail getValueContactDetail() throws FHIRException { 
3346          if (this.value == null)
3347            this.value = new ContactDetail();
3348          if (!(this.value instanceof ContactDetail))
3349            throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.value.getClass().getName()+" was encountered");
3350          return (ContactDetail) this.value;
3351        }
3352
3353        public boolean hasValueContactDetail() { 
3354          return this != null && this.value instanceof ContactDetail;
3355        }
3356
3357        /**
3358         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3359         */
3360        public DataRequirement getValueDataRequirement() throws FHIRException { 
3361          if (this.value == null)
3362            this.value = new DataRequirement();
3363          if (!(this.value instanceof DataRequirement))
3364            throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.value.getClass().getName()+" was encountered");
3365          return (DataRequirement) this.value;
3366        }
3367
3368        public boolean hasValueDataRequirement() { 
3369          return this != null && this.value instanceof DataRequirement;
3370        }
3371
3372        /**
3373         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3374         */
3375        public Expression getValueExpression() throws FHIRException { 
3376          if (this.value == null)
3377            this.value = new Expression();
3378          if (!(this.value instanceof Expression))
3379            throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.value.getClass().getName()+" was encountered");
3380          return (Expression) this.value;
3381        }
3382
3383        public boolean hasValueExpression() { 
3384          return this != null && this.value instanceof Expression;
3385        }
3386
3387        /**
3388         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3389         */
3390        public ParameterDefinition getValueParameterDefinition() throws FHIRException { 
3391          if (this.value == null)
3392            this.value = new ParameterDefinition();
3393          if (!(this.value instanceof ParameterDefinition))
3394            throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
3395          return (ParameterDefinition) this.value;
3396        }
3397
3398        public boolean hasValueParameterDefinition() { 
3399          return this != null && this.value instanceof ParameterDefinition;
3400        }
3401
3402        /**
3403         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3404         */
3405        public RelatedArtifact getValueRelatedArtifact() throws FHIRException { 
3406          if (this.value == null)
3407            this.value = new RelatedArtifact();
3408          if (!(this.value instanceof RelatedArtifact))
3409            throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.value.getClass().getName()+" was encountered");
3410          return (RelatedArtifact) this.value;
3411        }
3412
3413        public boolean hasValueRelatedArtifact() { 
3414          return this != null && this.value instanceof RelatedArtifact;
3415        }
3416
3417        /**
3418         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3419         */
3420        public TriggerDefinition getValueTriggerDefinition() throws FHIRException { 
3421          if (this.value == null)
3422            this.value = new TriggerDefinition();
3423          if (!(this.value instanceof TriggerDefinition))
3424            throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
3425          return (TriggerDefinition) this.value;
3426        }
3427
3428        public boolean hasValueTriggerDefinition() { 
3429          return this != null && this.value instanceof TriggerDefinition;
3430        }
3431
3432        /**
3433         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3434         */
3435        public UsageContext getValueUsageContext() throws FHIRException { 
3436          if (this.value == null)
3437            this.value = new UsageContext();
3438          if (!(this.value instanceof UsageContext))
3439            throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.value.getClass().getName()+" was encountered");
3440          return (UsageContext) this.value;
3441        }
3442
3443        public boolean hasValueUsageContext() { 
3444          return this != null && this.value instanceof UsageContext;
3445        }
3446
3447        /**
3448         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3449         */
3450        public Availability getValueAvailability() throws FHIRException { 
3451          if (this.value == null)
3452            this.value = new Availability();
3453          if (!(this.value instanceof Availability))
3454            throw new FHIRException("Type mismatch: the type Availability was expected, but "+this.value.getClass().getName()+" was encountered");
3455          return (Availability) this.value;
3456        }
3457
3458        public boolean hasValueAvailability() { 
3459          return this != null && this.value instanceof Availability;
3460        }
3461
3462        /**
3463         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3464         */
3465        public ExtendedContactDetail getValueExtendedContactDetail() throws FHIRException { 
3466          if (this.value == null)
3467            this.value = new ExtendedContactDetail();
3468          if (!(this.value instanceof ExtendedContactDetail))
3469            throw new FHIRException("Type mismatch: the type ExtendedContactDetail was expected, but "+this.value.getClass().getName()+" was encountered");
3470          return (ExtendedContactDetail) this.value;
3471        }
3472
3473        public boolean hasValueExtendedContactDetail() { 
3474          return this != null && this.value instanceof ExtendedContactDetail;
3475        }
3476
3477        /**
3478         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3479         */
3480        public Dosage getValueDosage() throws FHIRException { 
3481          if (this.value == null)
3482            this.value = new Dosage();
3483          if (!(this.value instanceof Dosage))
3484            throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.value.getClass().getName()+" was encountered");
3485          return (Dosage) this.value;
3486        }
3487
3488        public boolean hasValueDosage() { 
3489          return this != null && this.value instanceof Dosage;
3490        }
3491
3492        /**
3493         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3494         */
3495        public Meta getValueMeta() throws FHIRException { 
3496          if (this.value == null)
3497            this.value = new Meta();
3498          if (!(this.value instanceof Meta))
3499            throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.value.getClass().getName()+" was encountered");
3500          return (Meta) this.value;
3501        }
3502
3503        public boolean hasValueMeta() { 
3504          return this != null && this.value instanceof Meta;
3505        }
3506
3507        public boolean hasValue() { 
3508          return this.value != null && !this.value.isEmpty();
3509        }
3510
3511        /**
3512         * @param value {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3513         */
3514        public ElementDefinitionExampleComponent setValue(DataType value) { 
3515          if (value != null && !(value instanceof Base64BinaryType || value instanceof BooleanType || value instanceof CanonicalType || value instanceof CodeType || value instanceof DateType || value instanceof DateTimeType || value instanceof DecimalType || value instanceof IdType || value instanceof InstantType || value instanceof IntegerType || value instanceof Integer64Type || value instanceof MarkdownType || value instanceof OidType || value instanceof PositiveIntType || value instanceof StringType || value instanceof TimeType || value instanceof UnsignedIntType || value instanceof UriType || value instanceof UrlType || value instanceof UuidType || value instanceof Address || value instanceof Age || value instanceof Annotation || value instanceof Attachment || value instanceof CodeableConcept || value instanceof CodeableReference || value instanceof Coding || value instanceof ContactPoint || value instanceof Count || value instanceof Distance || value instanceof Duration || value instanceof HumanName || value instanceof Identifier || value instanceof Money || value instanceof Period || value instanceof Quantity || value instanceof Range || value instanceof Ratio || value instanceof RatioRange || value instanceof Reference || value instanceof SampledData || value instanceof Signature || value instanceof Timing || value instanceof ContactDetail || value instanceof DataRequirement || value instanceof Expression || value instanceof ParameterDefinition || value instanceof RelatedArtifact || value instanceof TriggerDefinition || value instanceof UsageContext || value instanceof Availability || value instanceof ExtendedContactDetail || value instanceof Dosage || value instanceof Meta))
3516            throw new FHIRException("Not the right type for ElementDefinition.example.value[x]: "+value.fhirType());
3517          this.value = value;
3518          return this;
3519        }
3520
3521        protected void listChildren(List<Property> children) {
3522          super.listChildren(children);
3523          children.add(new Property("label", "string", "Describes the purpose of this example among the set of examples.", 0, 1, label));
3524          children.add(new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Availability|ExtendedContactDetail|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value));
3525        }
3526
3527        @Override
3528        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3529          switch (_hash) {
3530          case 102727412: /*label*/  return new Property("label", "string", "Describes the purpose of this example among the set of examples.", 0, 1, label);
3531          case -1410166417: /*value[x]*/  return new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Availability|ExtendedContactDetail|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3532          case 111972721: /*value*/  return new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Availability|ExtendedContactDetail|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3533          case -1535024575: /*valueBase64Binary*/  return new Property("value[x]", "base64Binary", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3534          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3535          case -786218365: /*valueCanonical*/  return new Property("value[x]", "canonical", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3536          case -766209282: /*valueCode*/  return new Property("value[x]", "code", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3537          case -766192449: /*valueDate*/  return new Property("value[x]", "date", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3538          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3539          case -2083993440: /*valueDecimal*/  return new Property("value[x]", "decimal", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3540          case 231604844: /*valueId*/  return new Property("value[x]", "id", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3541          case -1668687056: /*valueInstant*/  return new Property("value[x]", "instant", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3542          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3543          case -1122120181: /*valueInteger64*/  return new Property("value[x]", "integer64", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3544          case -497880704: /*valueMarkdown*/  return new Property("value[x]", "markdown", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3545          case -1410178407: /*valueOid*/  return new Property("value[x]", "oid", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3546          case -1249932027: /*valuePositiveInt*/  return new Property("value[x]", "positiveInt", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3547          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3548          case -765708322: /*valueTime*/  return new Property("value[x]", "time", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3549          case 26529417: /*valueUnsignedInt*/  return new Property("value[x]", "unsignedInt", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3550          case -1410172357: /*valueUri*/  return new Property("value[x]", "uri", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3551          case -1410172354: /*valueUrl*/  return new Property("value[x]", "url", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3552          case -765667124: /*valueUuid*/  return new Property("value[x]", "uuid", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3553          case -478981821: /*valueAddress*/  return new Property("value[x]", "Address", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3554          case -1410191922: /*valueAge*/  return new Property("value[x]", "Age", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3555          case -67108992: /*valueAnnotation*/  return new Property("value[x]", "Annotation", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3556          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3557          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3558          case -257955629: /*valueCodeableReference*/  return new Property("value[x]", "CodeableReference", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3559          case -1887705029: /*valueCoding*/  return new Property("value[x]", "Coding", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3560          case 944904545: /*valueContactPoint*/  return new Property("value[x]", "ContactPoint", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3561          case 2017332766: /*valueCount*/  return new Property("value[x]", "Count", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3562          case -456359802: /*valueDistance*/  return new Property("value[x]", "Distance", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3563          case 1558135333: /*valueDuration*/  return new Property("value[x]", "Duration", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3564          case -2026205465: /*valueHumanName*/  return new Property("value[x]", "HumanName", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3565          case -130498310: /*valueIdentifier*/  return new Property("value[x]", "Identifier", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3566          case 2026560975: /*valueMoney*/  return new Property("value[x]", "Money", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3567          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "Period", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3568          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3569          case 2030761548: /*valueRange*/  return new Property("value[x]", "Range", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3570          case 2030767386: /*valueRatio*/  return new Property("value[x]", "Ratio", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3571          case -706454461: /*valueRatioRange*/  return new Property("value[x]", "RatioRange", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3572          case 1755241690: /*valueReference*/  return new Property("value[x]", "Reference", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3573          case -962229101: /*valueSampledData*/  return new Property("value[x]", "SampledData", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3574          case -540985785: /*valueSignature*/  return new Property("value[x]", "Signature", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3575          case -1406282469: /*valueTiming*/  return new Property("value[x]", "Timing", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3576          case -1125200224: /*valueContactDetail*/  return new Property("value[x]", "ContactDetail", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3577          case 1710554248: /*valueDataRequirement*/  return new Property("value[x]", "DataRequirement", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3578          case -307517719: /*valueExpression*/  return new Property("value[x]", "Expression", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3579          case 1387478187: /*valueParameterDefinition*/  return new Property("value[x]", "ParameterDefinition", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3580          case 1748214124: /*valueRelatedArtifact*/  return new Property("value[x]", "RelatedArtifact", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3581          case 976830394: /*valueTriggerDefinition*/  return new Property("value[x]", "TriggerDefinition", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3582          case 588000479: /*valueUsageContext*/  return new Property("value[x]", "UsageContext", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3583          case 1678530924: /*valueAvailability*/  return new Property("value[x]", "Availability", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3584          case -1567222041: /*valueExtendedContactDetail*/  return new Property("value[x]", "ExtendedContactDetail", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3585          case -1858636920: /*valueDosage*/  return new Property("value[x]", "Dosage", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3586          case -765920490: /*valueMeta*/  return new Property("value[x]", "Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3587          default: return super.getNamedProperty(_hash, _name, _checkValid);
3588          }
3589
3590        }
3591
3592      @Override
3593      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3594        switch (hash) {
3595        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
3596        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3597        default: return super.getProperty(hash, name, checkValid);
3598        }
3599
3600      }
3601
3602      @Override
3603      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3604        switch (hash) {
3605        case 102727412: // label
3606          this.label = TypeConvertor.castToString(value); // StringType
3607          return value;
3608        case 111972721: // value
3609          this.value = TypeConvertor.castToType(value); // DataType
3610          return value;
3611        default: return super.setProperty(hash, name, value);
3612        }
3613
3614      }
3615
3616      @Override
3617      public Base setProperty(String name, Base value) throws FHIRException {
3618        if (name.equals("label")) {
3619          this.label = TypeConvertor.castToString(value); // StringType
3620        } else if (name.equals("value[x]")) {
3621          this.value = TypeConvertor.castToType(value); // DataType
3622        } else
3623          return super.setProperty(name, value);
3624        return value;
3625      }
3626
3627      @Override
3628      public Base makeProperty(int hash, String name) throws FHIRException {
3629        switch (hash) {
3630        case 102727412:  return getLabelElement();
3631        case -1410166417:  return getValue();
3632        case 111972721:  return getValue();
3633        default: return super.makeProperty(hash, name);
3634        }
3635
3636      }
3637
3638      @Override
3639      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3640        switch (hash) {
3641        case 102727412: /*label*/ return new String[] {"string"};
3642        case 111972721: /*value*/ return new String[] {"base64Binary", "boolean", "canonical", "code", "date", "dateTime", "decimal", "id", "instant", "integer", "integer64", "markdown", "oid", "positiveInt", "string", "time", "unsignedInt", "uri", "url", "uuid", "Address", "Age", "Annotation", "Attachment", "CodeableConcept", "CodeableReference", "Coding", "ContactPoint", "Count", "Distance", "Duration", "HumanName", "Identifier", "Money", "Period", "Quantity", "Range", "Ratio", "RatioRange", "Reference", "SampledData", "Signature", "Timing", "ContactDetail", "DataRequirement", "Expression", "ParameterDefinition", "RelatedArtifact", "TriggerDefinition", "UsageContext", "Availability", "ExtendedContactDetail", "Dosage", "Meta"};
3643        default: return super.getTypesForProperty(hash, name);
3644        }
3645
3646      }
3647
3648      @Override
3649      public Base addChild(String name) throws FHIRException {
3650        if (name.equals("label")) {
3651          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.example.label");
3652        }
3653        else if (name.equals("valueBase64Binary")) {
3654          this.value = new Base64BinaryType();
3655          return this.value;
3656        }
3657        else if (name.equals("valueBoolean")) {
3658          this.value = new BooleanType();
3659          return this.value;
3660        }
3661        else if (name.equals("valueCanonical")) {
3662          this.value = new CanonicalType();
3663          return this.value;
3664        }
3665        else if (name.equals("valueCode")) {
3666          this.value = new CodeType();
3667          return this.value;
3668        }
3669        else if (name.equals("valueDate")) {
3670          this.value = new DateType();
3671          return this.value;
3672        }
3673        else if (name.equals("valueDateTime")) {
3674          this.value = new DateTimeType();
3675          return this.value;
3676        }
3677        else if (name.equals("valueDecimal")) {
3678          this.value = new DecimalType();
3679          return this.value;
3680        }
3681        else if (name.equals("valueId")) {
3682          this.value = new IdType();
3683          return this.value;
3684        }
3685        else if (name.equals("valueInstant")) {
3686          this.value = new InstantType();
3687          return this.value;
3688        }
3689        else if (name.equals("valueInteger")) {
3690          this.value = new IntegerType();
3691          return this.value;
3692        }
3693        else if (name.equals("valueInteger64")) {
3694          this.value = new Integer64Type();
3695          return this.value;
3696        }
3697        else if (name.equals("valueMarkdown")) {
3698          this.value = new MarkdownType();
3699          return this.value;
3700        }
3701        else if (name.equals("valueOid")) {
3702          this.value = new OidType();
3703          return this.value;
3704        }
3705        else if (name.equals("valuePositiveInt")) {
3706          this.value = new PositiveIntType();
3707          return this.value;
3708        }
3709        else if (name.equals("valueString")) {
3710          this.value = new StringType();
3711          return this.value;
3712        }
3713        else if (name.equals("valueTime")) {
3714          this.value = new TimeType();
3715          return this.value;
3716        }
3717        else if (name.equals("valueUnsignedInt")) {
3718          this.value = new UnsignedIntType();
3719          return this.value;
3720        }
3721        else if (name.equals("valueUri")) {
3722          this.value = new UriType();
3723          return this.value;
3724        }
3725        else if (name.equals("valueUrl")) {
3726          this.value = new UrlType();
3727          return this.value;
3728        }
3729        else if (name.equals("valueUuid")) {
3730          this.value = new UuidType();
3731          return this.value;
3732        }
3733        else if (name.equals("valueAddress")) {
3734          this.value = new Address();
3735          return this.value;
3736        }
3737        else if (name.equals("valueAge")) {
3738          this.value = new Age();
3739          return this.value;
3740        }
3741        else if (name.equals("valueAnnotation")) {
3742          this.value = new Annotation();
3743          return this.value;
3744        }
3745        else if (name.equals("valueAttachment")) {
3746          this.value = new Attachment();
3747          return this.value;
3748        }
3749        else if (name.equals("valueCodeableConcept")) {
3750          this.value = new CodeableConcept();
3751          return this.value;
3752        }
3753        else if (name.equals("valueCodeableReference")) {
3754          this.value = new CodeableReference();
3755          return this.value;
3756        }
3757        else if (name.equals("valueCoding")) {
3758          this.value = new Coding();
3759          return this.value;
3760        }
3761        else if (name.equals("valueContactPoint")) {
3762          this.value = new ContactPoint();
3763          return this.value;
3764        }
3765        else if (name.equals("valueCount")) {
3766          this.value = new Count();
3767          return this.value;
3768        }
3769        else if (name.equals("valueDistance")) {
3770          this.value = new Distance();
3771          return this.value;
3772        }
3773        else if (name.equals("valueDuration")) {
3774          this.value = new Duration();
3775          return this.value;
3776        }
3777        else if (name.equals("valueHumanName")) {
3778          this.value = new HumanName();
3779          return this.value;
3780        }
3781        else if (name.equals("valueIdentifier")) {
3782          this.value = new Identifier();
3783          return this.value;
3784        }
3785        else if (name.equals("valueMoney")) {
3786          this.value = new Money();
3787          return this.value;
3788        }
3789        else if (name.equals("valuePeriod")) {
3790          this.value = new Period();
3791          return this.value;
3792        }
3793        else if (name.equals("valueQuantity")) {
3794          this.value = new Quantity();
3795          return this.value;
3796        }
3797        else if (name.equals("valueRange")) {
3798          this.value = new Range();
3799          return this.value;
3800        }
3801        else if (name.equals("valueRatio")) {
3802          this.value = new Ratio();
3803          return this.value;
3804        }
3805        else if (name.equals("valueRatioRange")) {
3806          this.value = new RatioRange();
3807          return this.value;
3808        }
3809        else if (name.equals("valueReference")) {
3810          this.value = new Reference();
3811          return this.value;
3812        }
3813        else if (name.equals("valueSampledData")) {
3814          this.value = new SampledData();
3815          return this.value;
3816        }
3817        else if (name.equals("valueSignature")) {
3818          this.value = new Signature();
3819          return this.value;
3820        }
3821        else if (name.equals("valueTiming")) {
3822          this.value = new Timing();
3823          return this.value;
3824        }
3825        else if (name.equals("valueContactDetail")) {
3826          this.value = new ContactDetail();
3827          return this.value;
3828        }
3829        else if (name.equals("valueDataRequirement")) {
3830          this.value = new DataRequirement();
3831          return this.value;
3832        }
3833        else if (name.equals("valueExpression")) {
3834          this.value = new Expression();
3835          return this.value;
3836        }
3837        else if (name.equals("valueParameterDefinition")) {
3838          this.value = new ParameterDefinition();
3839          return this.value;
3840        }
3841        else if (name.equals("valueRelatedArtifact")) {
3842          this.value = new RelatedArtifact();
3843          return this.value;
3844        }
3845        else if (name.equals("valueTriggerDefinition")) {
3846          this.value = new TriggerDefinition();
3847          return this.value;
3848        }
3849        else if (name.equals("valueUsageContext")) {
3850          this.value = new UsageContext();
3851          return this.value;
3852        }
3853        else if (name.equals("valueAvailability")) {
3854          this.value = new Availability();
3855          return this.value;
3856        }
3857        else if (name.equals("valueExtendedContactDetail")) {
3858          this.value = new ExtendedContactDetail();
3859          return this.value;
3860        }
3861        else if (name.equals("valueDosage")) {
3862          this.value = new Dosage();
3863          return this.value;
3864        }
3865        else if (name.equals("valueMeta")) {
3866          this.value = new Meta();
3867          return this.value;
3868        }
3869        else
3870          return super.addChild(name);
3871      }
3872
3873      public ElementDefinitionExampleComponent copy() {
3874        ElementDefinitionExampleComponent dst = new ElementDefinitionExampleComponent();
3875        copyValues(dst);
3876        return dst;
3877      }
3878
3879      public void copyValues(ElementDefinitionExampleComponent dst) {
3880        super.copyValues(dst);
3881        dst.label = label == null ? null : label.copy();
3882        dst.value = value == null ? null : value.copy();
3883      }
3884
3885      @Override
3886      public boolean equalsDeep(Base other_) {
3887        if (!super.equalsDeep(other_))
3888          return false;
3889        if (!(other_ instanceof ElementDefinitionExampleComponent))
3890          return false;
3891        ElementDefinitionExampleComponent o = (ElementDefinitionExampleComponent) other_;
3892        return compareDeep(label, o.label, true) && compareDeep(value, o.value, true);
3893      }
3894
3895      @Override
3896      public boolean equalsShallow(Base other_) {
3897        if (!super.equalsShallow(other_))
3898          return false;
3899        if (!(other_ instanceof ElementDefinitionExampleComponent))
3900          return false;
3901        ElementDefinitionExampleComponent o = (ElementDefinitionExampleComponent) other_;
3902        return compareValues(label, o.label, true);
3903      }
3904
3905      public boolean isEmpty() {
3906        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(label, value);
3907      }
3908
3909  public String fhirType() {
3910    return "ElementDefinition.example";
3911
3912  }
3913
3914  }
3915
3916    @Block()
3917    public static class ElementDefinitionConstraintComponent extends Element implements IBaseDatatypeElement {
3918        /**
3919         * Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
3920         */
3921        @Child(name = "key", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
3922        @Description(shortDefinition="Target of 'condition' reference above", formalDefinition="Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality." )
3923        protected IdType key;
3924
3925        /**
3926         * Description of why this constraint is necessary or appropriate.
3927         */
3928        @Child(name = "requirements", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=true)
3929        @Description(shortDefinition="Why this constraint is necessary or appropriate", formalDefinition="Description of why this constraint is necessary or appropriate." )
3930        protected MarkdownType requirements;
3931
3932        /**
3933         * Identifies the impact constraint violation has on the conformance of the instance.
3934         */
3935        @Child(name = "severity", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
3936        @Description(shortDefinition="error | warning", formalDefinition="Identifies the impact constraint violation has on the conformance of the instance." )
3937        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/constraint-severity")
3938        protected Enumeration<ConstraintSeverity> severity;
3939
3940        /**
3941         * If true, indicates that the warning or best practice guideline should be suppressed.
3942         */
3943        @Child(name = "suppress", type = {BooleanType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3944        @Description(shortDefinition="Suppress warning or hint in profile", formalDefinition="If true, indicates that the warning or best practice guideline should be suppressed." )
3945        protected BooleanType suppress;
3946
3947        /**
3948         * Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
3949         */
3950        @Child(name = "human", type = {StringType.class}, order=5, min=1, max=1, modifier=false, summary=true)
3951        @Description(shortDefinition="Human description of constraint", formalDefinition="Text that can be used to describe the constraint in messages identifying that the constraint has been violated." )
3952        protected StringType human;
3953
3954        /**
3955         * A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
3956         */
3957        @Child(name = "expression", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
3958        @Description(shortDefinition="FHIRPath expression of constraint", formalDefinition="A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met." )
3959        protected StringType expression;
3960
3961        /**
3962         * A reference to the original source of the constraint, for traceability purposes.
3963         */
3964        @Child(name = "source", type = {CanonicalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3965        @Description(shortDefinition="Reference to original source of constraint", formalDefinition="A reference to the original source of the constraint, for traceability purposes." )
3966        protected CanonicalType source;
3967
3968        private static final long serialVersionUID = 1642607838L;
3969
3970    /**
3971     * Constructor
3972     */
3973      public ElementDefinitionConstraintComponent() {
3974        super();
3975      }
3976
3977    /**
3978     * Constructor
3979     */
3980      public ElementDefinitionConstraintComponent(String key, ConstraintSeverity severity, String human) {
3981        super();
3982        this.setKey(key);
3983        this.setSeverity(severity);
3984        this.setHuman(human);
3985      }
3986
3987        /**
3988         * @return {@link #key} (Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.). This is the underlying object with id, value and extensions. The accessor "getKey" gives direct access to the value
3989         */
3990        public IdType getKeyElement() { 
3991          if (this.key == null)
3992            if (Configuration.errorOnAutoCreate())
3993              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.key");
3994            else if (Configuration.doAutoCreate())
3995              this.key = new IdType(); // bb
3996          return this.key;
3997        }
3998
3999        public boolean hasKeyElement() { 
4000          return this.key != null && !this.key.isEmpty();
4001        }
4002
4003        public boolean hasKey() { 
4004          return this.key != null && !this.key.isEmpty();
4005        }
4006
4007        /**
4008         * @param value {@link #key} (Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.). This is the underlying object with id, value and extensions. The accessor "getKey" gives direct access to the value
4009         */
4010        public ElementDefinitionConstraintComponent setKeyElement(IdType value) { 
4011          this.key = value;
4012          return this;
4013        }
4014
4015        /**
4016         * @return Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
4017         */
4018        public String getKey() { 
4019          return this.key == null ? null : this.key.getValue();
4020        }
4021
4022        /**
4023         * @param value Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
4024         */
4025        public ElementDefinitionConstraintComponent setKey(String value) { 
4026            if (this.key == null)
4027              this.key = new IdType();
4028            this.key.setValue(value);
4029          return this;
4030        }
4031
4032        /**
4033         * @return {@link #requirements} (Description of why this constraint is necessary or appropriate.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
4034         */
4035        public MarkdownType getRequirementsElement() { 
4036          if (this.requirements == null)
4037            if (Configuration.errorOnAutoCreate())
4038              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.requirements");
4039            else if (Configuration.doAutoCreate())
4040              this.requirements = new MarkdownType(); // bb
4041          return this.requirements;
4042        }
4043
4044        public boolean hasRequirementsElement() { 
4045          return this.requirements != null && !this.requirements.isEmpty();
4046        }
4047
4048        public boolean hasRequirements() { 
4049          return this.requirements != null && !this.requirements.isEmpty();
4050        }
4051
4052        /**
4053         * @param value {@link #requirements} (Description of why this constraint is necessary or appropriate.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
4054         */
4055        public ElementDefinitionConstraintComponent setRequirementsElement(MarkdownType value) { 
4056          this.requirements = value;
4057          return this;
4058        }
4059
4060        /**
4061         * @return Description of why this constraint is necessary or appropriate.
4062         */
4063        public String getRequirements() { 
4064          return this.requirements == null ? null : this.requirements.getValue();
4065        }
4066
4067        /**
4068         * @param value Description of why this constraint is necessary or appropriate.
4069         */
4070        public ElementDefinitionConstraintComponent setRequirements(String value) { 
4071          if (Utilities.noString(value))
4072            this.requirements = null;
4073          else {
4074            if (this.requirements == null)
4075              this.requirements = new MarkdownType();
4076            this.requirements.setValue(value);
4077          }
4078          return this;
4079        }
4080
4081        /**
4082         * @return {@link #severity} (Identifies the impact constraint violation has on the conformance of the instance.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
4083         */
4084        public Enumeration<ConstraintSeverity> getSeverityElement() { 
4085          if (this.severity == null)
4086            if (Configuration.errorOnAutoCreate())
4087              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.severity");
4088            else if (Configuration.doAutoCreate())
4089              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory()); // bb
4090          return this.severity;
4091        }
4092
4093        public boolean hasSeverityElement() { 
4094          return this.severity != null && !this.severity.isEmpty();
4095        }
4096
4097        public boolean hasSeverity() { 
4098          return this.severity != null && !this.severity.isEmpty();
4099        }
4100
4101        /**
4102         * @param value {@link #severity} (Identifies the impact constraint violation has on the conformance of the instance.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
4103         */
4104        public ElementDefinitionConstraintComponent setSeverityElement(Enumeration<ConstraintSeverity> value) { 
4105          this.severity = value;
4106          return this;
4107        }
4108
4109        /**
4110         * @return Identifies the impact constraint violation has on the conformance of the instance.
4111         */
4112        public ConstraintSeverity getSeverity() { 
4113          return this.severity == null ? null : this.severity.getValue();
4114        }
4115
4116        /**
4117         * @param value Identifies the impact constraint violation has on the conformance of the instance.
4118         */
4119        public ElementDefinitionConstraintComponent setSeverity(ConstraintSeverity value) { 
4120            if (this.severity == null)
4121              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory());
4122            this.severity.setValue(value);
4123          return this;
4124        }
4125
4126        /**
4127         * @return {@link #suppress} (If true, indicates that the warning or best practice guideline should be suppressed.). This is the underlying object with id, value and extensions. The accessor "getSuppress" gives direct access to the value
4128         */
4129        public BooleanType getSuppressElement() { 
4130          if (this.suppress == null)
4131            if (Configuration.errorOnAutoCreate())
4132              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.suppress");
4133            else if (Configuration.doAutoCreate())
4134              this.suppress = new BooleanType(); // bb
4135          return this.suppress;
4136        }
4137
4138        public boolean hasSuppressElement() { 
4139          return this.suppress != null && !this.suppress.isEmpty();
4140        }
4141
4142        public boolean hasSuppress() { 
4143          return this.suppress != null && !this.suppress.isEmpty();
4144        }
4145
4146        /**
4147         * @param value {@link #suppress} (If true, indicates that the warning or best practice guideline should be suppressed.). This is the underlying object with id, value and extensions. The accessor "getSuppress" gives direct access to the value
4148         */
4149        public ElementDefinitionConstraintComponent setSuppressElement(BooleanType value) { 
4150          this.suppress = value;
4151          return this;
4152        }
4153
4154        /**
4155         * @return If true, indicates that the warning or best practice guideline should be suppressed.
4156         */
4157        public boolean getSuppress() { 
4158          return this.suppress == null || this.suppress.isEmpty() ? false : this.suppress.getValue();
4159        }
4160
4161        /**
4162         * @param value If true, indicates that the warning or best practice guideline should be suppressed.
4163         */
4164        public ElementDefinitionConstraintComponent setSuppress(boolean value) { 
4165            if (this.suppress == null)
4166              this.suppress = new BooleanType();
4167            this.suppress.setValue(value);
4168          return this;
4169        }
4170
4171        /**
4172         * @return {@link #human} (Text that can be used to describe the constraint in messages identifying that the constraint has been violated.). This is the underlying object with id, value and extensions. The accessor "getHuman" gives direct access to the value
4173         */
4174        public StringType getHumanElement() { 
4175          if (this.human == null)
4176            if (Configuration.errorOnAutoCreate())
4177              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.human");
4178            else if (Configuration.doAutoCreate())
4179              this.human = new StringType(); // bb
4180          return this.human;
4181        }
4182
4183        public boolean hasHumanElement() { 
4184          return this.human != null && !this.human.isEmpty();
4185        }
4186
4187        public boolean hasHuman() { 
4188          return this.human != null && !this.human.isEmpty();
4189        }
4190
4191        /**
4192         * @param value {@link #human} (Text that can be used to describe the constraint in messages identifying that the constraint has been violated.). This is the underlying object with id, value and extensions. The accessor "getHuman" gives direct access to the value
4193         */
4194        public ElementDefinitionConstraintComponent setHumanElement(StringType value) { 
4195          this.human = value;
4196          return this;
4197        }
4198
4199        /**
4200         * @return Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
4201         */
4202        public String getHuman() { 
4203          return this.human == null ? null : this.human.getValue();
4204        }
4205
4206        /**
4207         * @param value Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
4208         */
4209        public ElementDefinitionConstraintComponent setHuman(String value) { 
4210            if (this.human == null)
4211              this.human = new StringType();
4212            this.human.setValue(value);
4213          return this;
4214        }
4215
4216        /**
4217         * @return {@link #expression} (A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
4218         */
4219        public StringType getExpressionElement() { 
4220          if (this.expression == null)
4221            if (Configuration.errorOnAutoCreate())
4222              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.expression");
4223            else if (Configuration.doAutoCreate())
4224              this.expression = new StringType(); // bb
4225          return this.expression;
4226        }
4227
4228        public boolean hasExpressionElement() { 
4229          return this.expression != null && !this.expression.isEmpty();
4230        }
4231
4232        public boolean hasExpression() { 
4233          return this.expression != null && !this.expression.isEmpty();
4234        }
4235
4236        /**
4237         * @param value {@link #expression} (A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
4238         */
4239        public ElementDefinitionConstraintComponent setExpressionElement(StringType value) { 
4240          this.expression = value;
4241          return this;
4242        }
4243
4244        /**
4245         * @return A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
4246         */
4247        public String getExpression() { 
4248          return this.expression == null ? null : this.expression.getValue();
4249        }
4250
4251        /**
4252         * @param value A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
4253         */
4254        public ElementDefinitionConstraintComponent setExpression(String value) { 
4255          if (Utilities.noString(value))
4256            this.expression = null;
4257          else {
4258            if (this.expression == null)
4259              this.expression = new StringType();
4260            this.expression.setValue(value);
4261          }
4262          return this;
4263        }
4264
4265        /**
4266         * @return {@link #source} (A reference to the original source of the constraint, for traceability purposes.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
4267         */
4268        public CanonicalType getSourceElement() { 
4269          if (this.source == null)
4270            if (Configuration.errorOnAutoCreate())
4271              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.source");
4272            else if (Configuration.doAutoCreate())
4273              this.source = new CanonicalType(); // bb
4274          return this.source;
4275        }
4276
4277        public boolean hasSourceElement() { 
4278          return this.source != null && !this.source.isEmpty();
4279        }
4280
4281        public boolean hasSource() { 
4282          return this.source != null && !this.source.isEmpty();
4283        }
4284
4285        /**
4286         * @param value {@link #source} (A reference to the original source of the constraint, for traceability purposes.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
4287         */
4288        public ElementDefinitionConstraintComponent setSourceElement(CanonicalType value) { 
4289          this.source = value;
4290          return this;
4291        }
4292
4293        /**
4294         * @return A reference to the original source of the constraint, for traceability purposes.
4295         */
4296        public String getSource() { 
4297          return this.source == null ? null : this.source.getValue();
4298        }
4299
4300        /**
4301         * @param value A reference to the original source of the constraint, for traceability purposes.
4302         */
4303        public ElementDefinitionConstraintComponent setSource(String value) { 
4304          if (Utilities.noString(value))
4305            this.source = null;
4306          else {
4307            if (this.source == null)
4308              this.source = new CanonicalType();
4309            this.source.setValue(value);
4310          }
4311          return this;
4312        }
4313
4314        protected void listChildren(List<Property> children) {
4315          super.listChildren(children);
4316          children.add(new Property("key", "id", "Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.", 0, 1, key));
4317          children.add(new Property("requirements", "markdown", "Description of why this constraint is necessary or appropriate.", 0, 1, requirements));
4318          children.add(new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, 1, severity));
4319          children.add(new Property("suppress", "boolean", "If true, indicates that the warning or best practice guideline should be suppressed.", 0, 1, suppress));
4320          children.add(new Property("human", "string", "Text that can be used to describe the constraint in messages identifying that the constraint has been violated.", 0, 1, human));
4321          children.add(new Property("expression", "string", "A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.", 0, 1, expression));
4322          children.add(new Property("source", "canonical(StructureDefinition)", "A reference to the original source of the constraint, for traceability purposes.", 0, 1, source));
4323        }
4324
4325        @Override
4326        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4327          switch (_hash) {
4328          case 106079: /*key*/  return new Property("key", "id", "Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.", 0, 1, key);
4329          case -1619874672: /*requirements*/  return new Property("requirements", "markdown", "Description of why this constraint is necessary or appropriate.", 0, 1, requirements);
4330          case 1478300413: /*severity*/  return new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, 1, severity);
4331          case -1663129931: /*suppress*/  return new Property("suppress", "boolean", "If true, indicates that the warning or best practice guideline should be suppressed.", 0, 1, suppress);
4332          case 99639597: /*human*/  return new Property("human", "string", "Text that can be used to describe the constraint in messages identifying that the constraint has been violated.", 0, 1, human);
4333          case -1795452264: /*expression*/  return new Property("expression", "string", "A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.", 0, 1, expression);
4334          case -896505829: /*source*/  return new Property("source", "canonical(StructureDefinition)", "A reference to the original source of the constraint, for traceability purposes.", 0, 1, source);
4335          default: return super.getNamedProperty(_hash, _name, _checkValid);
4336          }
4337
4338        }
4339
4340      @Override
4341      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4342        switch (hash) {
4343        case 106079: /*key*/ return this.key == null ? new Base[0] : new Base[] {this.key}; // IdType
4344        case -1619874672: /*requirements*/ return this.requirements == null ? new Base[0] : new Base[] {this.requirements}; // MarkdownType
4345        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<ConstraintSeverity>
4346        case -1663129931: /*suppress*/ return this.suppress == null ? new Base[0] : new Base[] {this.suppress}; // BooleanType
4347        case 99639597: /*human*/ return this.human == null ? new Base[0] : new Base[] {this.human}; // StringType
4348        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
4349        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // CanonicalType
4350        default: return super.getProperty(hash, name, checkValid);
4351        }
4352
4353      }
4354
4355      @Override
4356      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4357        switch (hash) {
4358        case 106079: // key
4359          this.key = TypeConvertor.castToId(value); // IdType
4360          return value;
4361        case -1619874672: // requirements
4362          this.requirements = TypeConvertor.castToMarkdown(value); // MarkdownType
4363          return value;
4364        case 1478300413: // severity
4365          value = new ConstraintSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
4366          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
4367          return value;
4368        case -1663129931: // suppress
4369          this.suppress = TypeConvertor.castToBoolean(value); // BooleanType
4370          return value;
4371        case 99639597: // human
4372          this.human = TypeConvertor.castToString(value); // StringType
4373          return value;
4374        case -1795452264: // expression
4375          this.expression = TypeConvertor.castToString(value); // StringType
4376          return value;
4377        case -896505829: // source
4378          this.source = TypeConvertor.castToCanonical(value); // CanonicalType
4379          return value;
4380        default: return super.setProperty(hash, name, value);
4381        }
4382
4383      }
4384
4385      @Override
4386      public Base setProperty(String name, Base value) throws FHIRException {
4387        if (name.equals("key")) {
4388          this.key = TypeConvertor.castToId(value); // IdType
4389        } else if (name.equals("requirements")) {
4390          this.requirements = TypeConvertor.castToMarkdown(value); // MarkdownType
4391        } else if (name.equals("severity")) {
4392          value = new ConstraintSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
4393          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
4394        } else if (name.equals("suppress")) {
4395          this.suppress = TypeConvertor.castToBoolean(value); // BooleanType
4396        } else if (name.equals("human")) {
4397          this.human = TypeConvertor.castToString(value); // StringType
4398        } else if (name.equals("expression")) {
4399          this.expression = TypeConvertor.castToString(value); // StringType
4400        } else if (name.equals("source")) {
4401          this.source = TypeConvertor.castToCanonical(value); // CanonicalType
4402        } else
4403          return super.setProperty(name, value);
4404        return value;
4405      }
4406
4407      @Override
4408      public Base makeProperty(int hash, String name) throws FHIRException {
4409        switch (hash) {
4410        case 106079:  return getKeyElement();
4411        case -1619874672:  return getRequirementsElement();
4412        case 1478300413:  return getSeverityElement();
4413        case -1663129931:  return getSuppressElement();
4414        case 99639597:  return getHumanElement();
4415        case -1795452264:  return getExpressionElement();
4416        case -896505829:  return getSourceElement();
4417        default: return super.makeProperty(hash, name);
4418        }
4419
4420      }
4421
4422      @Override
4423      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4424        switch (hash) {
4425        case 106079: /*key*/ return new String[] {"id"};
4426        case -1619874672: /*requirements*/ return new String[] {"markdown"};
4427        case 1478300413: /*severity*/ return new String[] {"code"};
4428        case -1663129931: /*suppress*/ return new String[] {"boolean"};
4429        case 99639597: /*human*/ return new String[] {"string"};
4430        case -1795452264: /*expression*/ return new String[] {"string"};
4431        case -896505829: /*source*/ return new String[] {"canonical"};
4432        default: return super.getTypesForProperty(hash, name);
4433        }
4434
4435      }
4436
4437      @Override
4438      public Base addChild(String name) throws FHIRException {
4439        if (name.equals("key")) {
4440          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.key");
4441        }
4442        else if (name.equals("requirements")) {
4443          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.requirements");
4444        }
4445        else if (name.equals("severity")) {
4446          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.severity");
4447        }
4448        else if (name.equals("suppress")) {
4449          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.suppress");
4450        }
4451        else if (name.equals("human")) {
4452          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.human");
4453        }
4454        else if (name.equals("expression")) {
4455          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.expression");
4456        }
4457        else if (name.equals("source")) {
4458          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.constraint.source");
4459        }
4460        else
4461          return super.addChild(name);
4462      }
4463
4464      public ElementDefinitionConstraintComponent copy() {
4465        ElementDefinitionConstraintComponent dst = new ElementDefinitionConstraintComponent();
4466        copyValues(dst);
4467        return dst;
4468      }
4469
4470      public void copyValues(ElementDefinitionConstraintComponent dst) {
4471        super.copyValues(dst);
4472        dst.key = key == null ? null : key.copy();
4473        dst.requirements = requirements == null ? null : requirements.copy();
4474        dst.severity = severity == null ? null : severity.copy();
4475        dst.suppress = suppress == null ? null : suppress.copy();
4476        dst.human = human == null ? null : human.copy();
4477        dst.expression = expression == null ? null : expression.copy();
4478        dst.source = source == null ? null : source.copy();
4479      }
4480
4481      @Override
4482      public boolean equalsDeep(Base other_) {
4483        if (!super.equalsDeep(other_))
4484          return false;
4485        if (!(other_ instanceof ElementDefinitionConstraintComponent))
4486          return false;
4487        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other_;
4488        return compareDeep(key, o.key, true) && compareDeep(requirements, o.requirements, true) && compareDeep(severity, o.severity, true)
4489           && compareDeep(suppress, o.suppress, true) && compareDeep(human, o.human, true) && compareDeep(expression, o.expression, true)
4490           && compareDeep(source, o.source, true);
4491      }
4492
4493      @Override
4494      public boolean equalsShallow(Base other_) {
4495        if (!super.equalsShallow(other_))
4496          return false;
4497        if (!(other_ instanceof ElementDefinitionConstraintComponent))
4498          return false;
4499        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other_;
4500        return compareValues(key, o.key, true) && compareValues(requirements, o.requirements, true) && compareValues(severity, o.severity, true)
4501           && compareValues(suppress, o.suppress, true) && compareValues(human, o.human, true) && compareValues(expression, o.expression, true)
4502           && compareValues(source, o.source, true);
4503      }
4504
4505      public boolean isEmpty() {
4506        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(key, requirements, severity
4507          , suppress, human, expression, source);
4508      }
4509
4510  public String fhirType() {
4511    return "ElementDefinition.constraint";
4512
4513  }
4514
4515  }
4516
4517    @Block()
4518    public static class ElementDefinitionBindingComponent extends Element implements IBaseDatatypeElement {
4519        /**
4520         * Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
4521         */
4522        @Child(name = "strength", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4523        @Description(shortDefinition="required | extensible | preferred | example", formalDefinition="Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances." )
4524        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/binding-strength")
4525        protected Enumeration<BindingStrength> strength;
4526
4527        /**
4528         * Describes the intended use of this particular set of codes.
4529         */
4530        @Child(name = "description", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4531        @Description(shortDefinition="Intended use of codes in the bound value set", formalDefinition="Describes the intended use of this particular set of codes." )
4532        protected MarkdownType description;
4533
4534        /**
4535         * Refers to the value set that identifies the set of codes the binding refers to.
4536         */
4537        @Child(name = "valueSet", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
4538        @Description(shortDefinition="Source of value set", formalDefinition="Refers to the value set that identifies the set of codes the binding refers to." )
4539        protected CanonicalType valueSet;
4540
4541        /**
4542         * Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context.
4543         */
4544        @Child(name = "additional", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4545        @Description(shortDefinition="Additional Bindings - more rules about the binding", formalDefinition="Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context." )
4546        protected List<ElementDefinitionBindingAdditionalComponent> additional;
4547
4548        private static final long serialVersionUID = 16276611L;
4549
4550    /**
4551     * Constructor
4552     */
4553      public ElementDefinitionBindingComponent() {
4554        super();
4555      }
4556
4557    /**
4558     * Constructor
4559     */
4560      public ElementDefinitionBindingComponent(BindingStrength strength) {
4561        super();
4562        this.setStrength(strength);
4563      }
4564
4565        /**
4566         * @return {@link #strength} (Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.). This is the underlying object with id, value and extensions. The accessor "getStrength" gives direct access to the value
4567         */
4568        public Enumeration<BindingStrength> getStrengthElement() { 
4569          if (this.strength == null)
4570            if (Configuration.errorOnAutoCreate())
4571              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.strength");
4572            else if (Configuration.doAutoCreate())
4573              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory()); // bb
4574          return this.strength;
4575        }
4576
4577        public boolean hasStrengthElement() { 
4578          return this.strength != null && !this.strength.isEmpty();
4579        }
4580
4581        public boolean hasStrength() { 
4582          return this.strength != null && !this.strength.isEmpty();
4583        }
4584
4585        /**
4586         * @param value {@link #strength} (Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.). This is the underlying object with id, value and extensions. The accessor "getStrength" gives direct access to the value
4587         */
4588        public ElementDefinitionBindingComponent setStrengthElement(Enumeration<BindingStrength> value) { 
4589          this.strength = value;
4590          return this;
4591        }
4592
4593        /**
4594         * @return Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
4595         */
4596        public BindingStrength getStrength() { 
4597          return this.strength == null ? null : this.strength.getValue();
4598        }
4599
4600        /**
4601         * @param value Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
4602         */
4603        public ElementDefinitionBindingComponent setStrength(BindingStrength value) { 
4604            if (this.strength == null)
4605              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory());
4606            this.strength.setValue(value);
4607          return this;
4608        }
4609
4610        /**
4611         * @return {@link #description} (Describes the intended use of this particular set of codes.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4612         */
4613        public MarkdownType getDescriptionElement() { 
4614          if (this.description == null)
4615            if (Configuration.errorOnAutoCreate())
4616              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.description");
4617            else if (Configuration.doAutoCreate())
4618              this.description = new MarkdownType(); // bb
4619          return this.description;
4620        }
4621
4622        public boolean hasDescriptionElement() { 
4623          return this.description != null && !this.description.isEmpty();
4624        }
4625
4626        public boolean hasDescription() { 
4627          return this.description != null && !this.description.isEmpty();
4628        }
4629
4630        /**
4631         * @param value {@link #description} (Describes the intended use of this particular set of codes.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4632         */
4633        public ElementDefinitionBindingComponent setDescriptionElement(MarkdownType value) { 
4634          this.description = value;
4635          return this;
4636        }
4637
4638        /**
4639         * @return Describes the intended use of this particular set of codes.
4640         */
4641        public String getDescription() { 
4642          return this.description == null ? null : this.description.getValue();
4643        }
4644
4645        /**
4646         * @param value Describes the intended use of this particular set of codes.
4647         */
4648        public ElementDefinitionBindingComponent setDescription(String value) { 
4649          if (Utilities.noString(value))
4650            this.description = null;
4651          else {
4652            if (this.description == null)
4653              this.description = new MarkdownType();
4654            this.description.setValue(value);
4655          }
4656          return this;
4657        }
4658
4659        /**
4660         * @return {@link #valueSet} (Refers to the value set that identifies the set of codes the binding refers to.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
4661         */
4662        public CanonicalType getValueSetElement() { 
4663          if (this.valueSet == null)
4664            if (Configuration.errorOnAutoCreate())
4665              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.valueSet");
4666            else if (Configuration.doAutoCreate())
4667              this.valueSet = new CanonicalType(); // bb
4668          return this.valueSet;
4669        }
4670
4671        public boolean hasValueSetElement() { 
4672          return this.valueSet != null && !this.valueSet.isEmpty();
4673        }
4674
4675        public boolean hasValueSet() { 
4676          return this.valueSet != null && !this.valueSet.isEmpty();
4677        }
4678
4679        /**
4680         * @param value {@link #valueSet} (Refers to the value set that identifies the set of codes the binding refers to.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
4681         */
4682        public ElementDefinitionBindingComponent setValueSetElement(CanonicalType value) { 
4683          this.valueSet = value;
4684          return this;
4685        }
4686
4687        /**
4688         * @return Refers to the value set that identifies the set of codes the binding refers to.
4689         */
4690        public String getValueSet() { 
4691          return this.valueSet == null ? null : this.valueSet.getValue();
4692        }
4693
4694        /**
4695         * @param value Refers to the value set that identifies the set of codes the binding refers to.
4696         */
4697        public ElementDefinitionBindingComponent setValueSet(String value) { 
4698          if (Utilities.noString(value))
4699            this.valueSet = null;
4700          else {
4701            if (this.valueSet == null)
4702              this.valueSet = new CanonicalType();
4703            this.valueSet.setValue(value);
4704          }
4705          return this;
4706        }
4707
4708        /**
4709         * @return {@link #additional} (Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context.)
4710         */
4711        public List<ElementDefinitionBindingAdditionalComponent> getAdditional() { 
4712          if (this.additional == null)
4713            this.additional = new ArrayList<ElementDefinitionBindingAdditionalComponent>();
4714          return this.additional;
4715        }
4716
4717        /**
4718         * @return Returns a reference to <code>this</code> for easy method chaining
4719         */
4720        public ElementDefinitionBindingComponent setAdditional(List<ElementDefinitionBindingAdditionalComponent> theAdditional) { 
4721          this.additional = theAdditional;
4722          return this;
4723        }
4724
4725        public boolean hasAdditional() { 
4726          if (this.additional == null)
4727            return false;
4728          for (ElementDefinitionBindingAdditionalComponent item : this.additional)
4729            if (!item.isEmpty())
4730              return true;
4731          return false;
4732        }
4733
4734        public ElementDefinitionBindingAdditionalComponent addAdditional() { //3
4735          ElementDefinitionBindingAdditionalComponent t = new ElementDefinitionBindingAdditionalComponent();
4736          if (this.additional == null)
4737            this.additional = new ArrayList<ElementDefinitionBindingAdditionalComponent>();
4738          this.additional.add(t);
4739          return t;
4740        }
4741
4742        public ElementDefinitionBindingComponent addAdditional(ElementDefinitionBindingAdditionalComponent t) { //3
4743          if (t == null)
4744            return this;
4745          if (this.additional == null)
4746            this.additional = new ArrayList<ElementDefinitionBindingAdditionalComponent>();
4747          this.additional.add(t);
4748          return this;
4749        }
4750
4751        /**
4752         * @return The first repetition of repeating field {@link #additional}, creating it if it does not already exist {3}
4753         */
4754        public ElementDefinitionBindingAdditionalComponent getAdditionalFirstRep() { 
4755          if (getAdditional().isEmpty()) {
4756            addAdditional();
4757          }
4758          return getAdditional().get(0);
4759        }
4760
4761        protected void listChildren(List<Property> children) {
4762          super.listChildren(children);
4763          children.add(new Property("strength", "code", "Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.", 0, 1, strength));
4764          children.add(new Property("description", "markdown", "Describes the intended use of this particular set of codes.", 0, 1, description));
4765          children.add(new Property("valueSet", "canonical(ValueSet)", "Refers to the value set that identifies the set of codes the binding refers to.", 0, 1, valueSet));
4766          children.add(new Property("additional", "", "Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context.", 0, java.lang.Integer.MAX_VALUE, additional));
4767        }
4768
4769        @Override
4770        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4771          switch (_hash) {
4772          case 1791316033: /*strength*/  return new Property("strength", "code", "Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.", 0, 1, strength);
4773          case -1724546052: /*description*/  return new Property("description", "markdown", "Describes the intended use of this particular set of codes.", 0, 1, description);
4774          case -1410174671: /*valueSet*/  return new Property("valueSet", "canonical(ValueSet)", "Refers to the value set that identifies the set of codes the binding refers to.", 0, 1, valueSet);
4775          case -1931413465: /*additional*/  return new Property("additional", "", "Additional bindings that help applications implementing this element. Additional bindings do not replace the main binding but provide more information and/or context.", 0, java.lang.Integer.MAX_VALUE, additional);
4776          default: return super.getNamedProperty(_hash, _name, _checkValid);
4777          }
4778
4779        }
4780
4781      @Override
4782      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4783        switch (hash) {
4784        case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // Enumeration<BindingStrength>
4785        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
4786        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // CanonicalType
4787        case -1931413465: /*additional*/ return this.additional == null ? new Base[0] : this.additional.toArray(new Base[this.additional.size()]); // ElementDefinitionBindingAdditionalComponent
4788        default: return super.getProperty(hash, name, checkValid);
4789        }
4790
4791      }
4792
4793      @Override
4794      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4795        switch (hash) {
4796        case 1791316033: // strength
4797          value = new BindingStrengthEnumFactory().fromType(TypeConvertor.castToCode(value));
4798          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
4799          return value;
4800        case -1724546052: // description
4801          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
4802          return value;
4803        case -1410174671: // valueSet
4804          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
4805          return value;
4806        case -1931413465: // additional
4807          this.getAdditional().add((ElementDefinitionBindingAdditionalComponent) value); // ElementDefinitionBindingAdditionalComponent
4808          return value;
4809        default: return super.setProperty(hash, name, value);
4810        }
4811
4812      }
4813
4814      @Override
4815      public Base setProperty(String name, Base value) throws FHIRException {
4816        if (name.equals("strength")) {
4817          value = new BindingStrengthEnumFactory().fromType(TypeConvertor.castToCode(value));
4818          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
4819        } else if (name.equals("description")) {
4820          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
4821        } else if (name.equals("valueSet")) {
4822          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
4823        } else if (name.equals("additional")) {
4824          this.getAdditional().add((ElementDefinitionBindingAdditionalComponent) value);
4825        } else
4826          return super.setProperty(name, value);
4827        return value;
4828      }
4829
4830      @Override
4831      public Base makeProperty(int hash, String name) throws FHIRException {
4832        switch (hash) {
4833        case 1791316033:  return getStrengthElement();
4834        case -1724546052:  return getDescriptionElement();
4835        case -1410174671:  return getValueSetElement();
4836        case -1931413465:  return addAdditional(); 
4837        default: return super.makeProperty(hash, name);
4838        }
4839
4840      }
4841
4842      @Override
4843      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4844        switch (hash) {
4845        case 1791316033: /*strength*/ return new String[] {"code"};
4846        case -1724546052: /*description*/ return new String[] {"markdown"};
4847        case -1410174671: /*valueSet*/ return new String[] {"canonical"};
4848        case -1931413465: /*additional*/ return new String[] {};
4849        default: return super.getTypesForProperty(hash, name);
4850        }
4851
4852      }
4853
4854      @Override
4855      public Base addChild(String name) throws FHIRException {
4856        if (name.equals("strength")) {
4857          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.strength");
4858        }
4859        else if (name.equals("description")) {
4860          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.description");
4861        }
4862        else if (name.equals("valueSet")) {
4863          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.valueSet");
4864        }
4865        else if (name.equals("additional")) {
4866          return addAdditional();
4867        }
4868        else
4869          return super.addChild(name);
4870      }
4871
4872      public ElementDefinitionBindingComponent copy() {
4873        ElementDefinitionBindingComponent dst = new ElementDefinitionBindingComponent();
4874        copyValues(dst);
4875        return dst;
4876      }
4877
4878      public void copyValues(ElementDefinitionBindingComponent dst) {
4879        super.copyValues(dst);
4880        dst.strength = strength == null ? null : strength.copy();
4881        dst.description = description == null ? null : description.copy();
4882        dst.valueSet = valueSet == null ? null : valueSet.copy();
4883        if (additional != null) {
4884          dst.additional = new ArrayList<ElementDefinitionBindingAdditionalComponent>();
4885          for (ElementDefinitionBindingAdditionalComponent i : additional)
4886            dst.additional.add(i.copy());
4887        };
4888      }
4889
4890      @Override
4891      public boolean equalsDeep(Base other_) {
4892        if (!super.equalsDeep(other_))
4893          return false;
4894        if (!(other_ instanceof ElementDefinitionBindingComponent))
4895          return false;
4896        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other_;
4897        return compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
4898           && compareDeep(valueSet, o.valueSet, true) && compareDeep(additional, o.additional, true);
4899      }
4900
4901      @Override
4902      public boolean equalsShallow(Base other_) {
4903        if (!super.equalsShallow(other_))
4904          return false;
4905        if (!(other_ instanceof ElementDefinitionBindingComponent))
4906          return false;
4907        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other_;
4908        return compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
4909           && compareValues(valueSet, o.valueSet, true);
4910      }
4911
4912      public boolean isEmpty() {
4913        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(strength, description, valueSet
4914          , additional);
4915      }
4916
4917  public String fhirType() {
4918    return "ElementDefinition.binding";
4919
4920  }
4921
4922  public boolean hasAdditional(ElementDefinitionBindingAdditionalComponent ab) {
4923    if (hasAdditional()) {
4924      for (ElementDefinitionBindingAdditionalComponent t : getAdditional()) {
4925        if (Base.compareDeep(t, ab, false)) {
4926          return true;
4927        }
4928      }
4929    }
4930    return false;
4931  }
4932
4933  }
4934
4935    @Block()
4936    public static class ElementDefinitionBindingAdditionalComponent extends Element implements IBaseDatatypeElement {
4937        /**
4938         * The use of this additional binding.
4939         */
4940        @Child(name = "purpose", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4941        @Description(shortDefinition="maximum | minimum | required | extensible | candidate | current | preferred | ui | starter | component", formalDefinition="The use of this additional binding." )
4942        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/additional-binding-purpose")
4943        protected Enumeration<AdditionalBindingPurposeVS> purpose;
4944
4945        /**
4946         * The valueSet that is being bound for the purpose.
4947         */
4948        @Child(name = "valueSet", type = {CanonicalType.class}, order=2, min=1, max=1, modifier=false, summary=true)
4949        @Description(shortDefinition="The value set for the additional binding", formalDefinition="The valueSet that is being bound for the purpose." )
4950        protected CanonicalType valueSet;
4951
4952        /**
4953         * Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.
4954         */
4955        @Child(name = "documentation", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=true)
4956        @Description(shortDefinition="Documentation of the purpose of use of the binding", formalDefinition="Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used." )
4957        protected MarkdownType documentation;
4958
4959        /**
4960         * Concise documentation - for summary tables.
4961         */
4962        @Child(name = "shortDoco", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
4963        @Description(shortDefinition="Concise documentation - for summary tables", formalDefinition="Concise documentation - for summary tables." )
4964        protected StringType shortDoco;
4965
4966        /**
4967         * Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling.
4968         */
4969        @Child(name = "usage", type = {UsageContext.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4970        @Description(shortDefinition="Qualifies the usage - jurisdiction, gender, workflow status etc.", formalDefinition="Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling." )
4971        protected List<UsageContext> usage;
4972
4973        /**
4974         * Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.
4975         */
4976        @Child(name = "any", type = {BooleanType.class}, order=6, min=0, max=1, modifier=false, summary=true)
4977        @Description(shortDefinition="Whether binding can applies to all repeats, or just one", formalDefinition="Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat." )
4978        protected BooleanType any;
4979
4980        private static final long serialVersionUID = -1312796441L;
4981
4982    /**
4983     * Constructor
4984     */
4985      public ElementDefinitionBindingAdditionalComponent() {
4986        super();
4987      }
4988
4989    /**
4990     * Constructor
4991     */
4992      public ElementDefinitionBindingAdditionalComponent(AdditionalBindingPurposeVS purpose, String valueSet) {
4993        super();
4994        this.setPurpose(purpose);
4995        this.setValueSet(valueSet);
4996      }
4997
4998        /**
4999         * @return {@link #purpose} (The use of this additional binding.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
5000         */
5001        public Enumeration<AdditionalBindingPurposeVS> getPurposeElement() { 
5002          if (this.purpose == null)
5003            if (Configuration.errorOnAutoCreate())
5004              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.purpose");
5005            else if (Configuration.doAutoCreate())
5006              this.purpose = new Enumeration<AdditionalBindingPurposeVS>(new AdditionalBindingPurposeVSEnumFactory()); // bb
5007          return this.purpose;
5008        }
5009
5010        public boolean hasPurposeElement() { 
5011          return this.purpose != null && !this.purpose.isEmpty();
5012        }
5013
5014        public boolean hasPurpose() { 
5015          return this.purpose != null && !this.purpose.isEmpty();
5016        }
5017
5018        /**
5019         * @param value {@link #purpose} (The use of this additional binding.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
5020         */
5021        public ElementDefinitionBindingAdditionalComponent setPurposeElement(Enumeration<AdditionalBindingPurposeVS> value) { 
5022          this.purpose = value;
5023          return this;
5024        }
5025
5026        /**
5027         * @return The use of this additional binding.
5028         */
5029        public AdditionalBindingPurposeVS getPurpose() { 
5030          return this.purpose == null ? null : this.purpose.getValue();
5031        }
5032
5033        /**
5034         * @param value The use of this additional binding.
5035         */
5036        public ElementDefinitionBindingAdditionalComponent setPurpose(AdditionalBindingPurposeVS value) { 
5037            if (this.purpose == null)
5038              this.purpose = new Enumeration<AdditionalBindingPurposeVS>(new AdditionalBindingPurposeVSEnumFactory());
5039            this.purpose.setValue(value);
5040          return this;
5041        }
5042
5043        /**
5044         * @return {@link #valueSet} (The valueSet that is being bound for the purpose.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
5045         */
5046        public CanonicalType getValueSetElement() { 
5047          if (this.valueSet == null)
5048            if (Configuration.errorOnAutoCreate())
5049              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.valueSet");
5050            else if (Configuration.doAutoCreate())
5051              this.valueSet = new CanonicalType(); // bb
5052          return this.valueSet;
5053        }
5054
5055        public boolean hasValueSetElement() { 
5056          return this.valueSet != null && !this.valueSet.isEmpty();
5057        }
5058
5059        public boolean hasValueSet() { 
5060          return this.valueSet != null && !this.valueSet.isEmpty();
5061        }
5062
5063        /**
5064         * @param value {@link #valueSet} (The valueSet that is being bound for the purpose.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
5065         */
5066        public ElementDefinitionBindingAdditionalComponent setValueSetElement(CanonicalType value) { 
5067          this.valueSet = value;
5068          return this;
5069        }
5070
5071        /**
5072         * @return The valueSet that is being bound for the purpose.
5073         */
5074        public String getValueSet() { 
5075          return this.valueSet == null ? null : this.valueSet.getValue();
5076        }
5077
5078        /**
5079         * @param value The valueSet that is being bound for the purpose.
5080         */
5081        public ElementDefinitionBindingAdditionalComponent setValueSet(String value) { 
5082            if (this.valueSet == null)
5083              this.valueSet = new CanonicalType();
5084            this.valueSet.setValue(value);
5085          return this;
5086        }
5087
5088        /**
5089         * @return {@link #documentation} (Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
5090         */
5091        public MarkdownType getDocumentationElement() { 
5092          if (this.documentation == null)
5093            if (Configuration.errorOnAutoCreate())
5094              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.documentation");
5095            else if (Configuration.doAutoCreate())
5096              this.documentation = new MarkdownType(); // bb
5097          return this.documentation;
5098        }
5099
5100        public boolean hasDocumentationElement() { 
5101          return this.documentation != null && !this.documentation.isEmpty();
5102        }
5103
5104        public boolean hasDocumentation() { 
5105          return this.documentation != null && !this.documentation.isEmpty();
5106        }
5107
5108        /**
5109         * @param value {@link #documentation} (Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
5110         */
5111        public ElementDefinitionBindingAdditionalComponent setDocumentationElement(MarkdownType value) { 
5112          this.documentation = value;
5113          return this;
5114        }
5115
5116        /**
5117         * @return Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.
5118         */
5119        public String getDocumentation() { 
5120          return this.documentation == null ? null : this.documentation.getValue();
5121        }
5122
5123        /**
5124         * @param value Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.
5125         */
5126        public ElementDefinitionBindingAdditionalComponent setDocumentation(String value) { 
5127          if (Utilities.noString(value))
5128            this.documentation = null;
5129          else {
5130            if (this.documentation == null)
5131              this.documentation = new MarkdownType();
5132            this.documentation.setValue(value);
5133          }
5134          return this;
5135        }
5136
5137        /**
5138         * @return {@link #shortDoco} (Concise documentation - for summary tables.). This is the underlying object with id, value and extensions. The accessor "getShortDoco" gives direct access to the value
5139         */
5140        public StringType getShortDocoElement() { 
5141          if (this.shortDoco == null)
5142            if (Configuration.errorOnAutoCreate())
5143              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.shortDoco");
5144            else if (Configuration.doAutoCreate())
5145              this.shortDoco = new StringType(); // bb
5146          return this.shortDoco;
5147        }
5148
5149        public boolean hasShortDocoElement() { 
5150          return this.shortDoco != null && !this.shortDoco.isEmpty();
5151        }
5152
5153        public boolean hasShortDoco() { 
5154          return this.shortDoco != null && !this.shortDoco.isEmpty();
5155        }
5156
5157        /**
5158         * @param value {@link #shortDoco} (Concise documentation - for summary tables.). This is the underlying object with id, value and extensions. The accessor "getShortDoco" gives direct access to the value
5159         */
5160        public ElementDefinitionBindingAdditionalComponent setShortDocoElement(StringType value) { 
5161          this.shortDoco = value;
5162          return this;
5163        }
5164
5165        /**
5166         * @return Concise documentation - for summary tables.
5167         */
5168        public String getShortDoco() { 
5169          return this.shortDoco == null ? null : this.shortDoco.getValue();
5170        }
5171
5172        /**
5173         * @param value Concise documentation - for summary tables.
5174         */
5175        public ElementDefinitionBindingAdditionalComponent setShortDoco(String value) { 
5176          if (Utilities.noString(value))
5177            this.shortDoco = null;
5178          else {
5179            if (this.shortDoco == null)
5180              this.shortDoco = new StringType();
5181            this.shortDoco.setValue(value);
5182          }
5183          return this;
5184        }
5185
5186        /**
5187         * @return {@link #usage} (Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling.)
5188         */
5189        public List<UsageContext> getUsage() { 
5190          if (this.usage == null)
5191            this.usage = new ArrayList<UsageContext>();
5192          return this.usage;
5193        }
5194
5195        /**
5196         * @return Returns a reference to <code>this</code> for easy method chaining
5197         */
5198        public ElementDefinitionBindingAdditionalComponent setUsage(List<UsageContext> theUsage) { 
5199          this.usage = theUsage;
5200          return this;
5201        }
5202
5203        public boolean hasUsage() { 
5204          if (this.usage == null)
5205            return false;
5206          for (UsageContext item : this.usage)
5207            if (!item.isEmpty())
5208              return true;
5209          return false;
5210        }
5211
5212        public UsageContext addUsage() { //3
5213          UsageContext t = new UsageContext();
5214          if (this.usage == null)
5215            this.usage = new ArrayList<UsageContext>();
5216          this.usage.add(t);
5217          return t;
5218        }
5219
5220        public ElementDefinitionBindingAdditionalComponent addUsage(UsageContext t) { //3
5221          if (t == null)
5222            return this;
5223          if (this.usage == null)
5224            this.usage = new ArrayList<UsageContext>();
5225          this.usage.add(t);
5226          return this;
5227        }
5228
5229        /**
5230         * @return The first repetition of repeating field {@link #usage}, creating it if it does not already exist {3}
5231         */
5232        public UsageContext getUsageFirstRep() { 
5233          if (getUsage().isEmpty()) {
5234            addUsage();
5235          }
5236          return getUsage().get(0);
5237        }
5238
5239        /**
5240         * @return {@link #any} (Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.). This is the underlying object with id, value and extensions. The accessor "getAny" gives direct access to the value
5241         */
5242        public BooleanType getAnyElement() { 
5243          if (this.any == null)
5244            if (Configuration.errorOnAutoCreate())
5245              throw new Error("Attempt to auto-create ElementDefinitionBindingAdditionalComponent.any");
5246            else if (Configuration.doAutoCreate())
5247              this.any = new BooleanType(); // bb
5248          return this.any;
5249        }
5250
5251        public boolean hasAnyElement() { 
5252          return this.any != null && !this.any.isEmpty();
5253        }
5254
5255        public boolean hasAny() { 
5256          return this.any != null && !this.any.isEmpty();
5257        }
5258
5259        /**
5260         * @param value {@link #any} (Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.). This is the underlying object with id, value and extensions. The accessor "getAny" gives direct access to the value
5261         */
5262        public ElementDefinitionBindingAdditionalComponent setAnyElement(BooleanType value) { 
5263          this.any = value;
5264          return this;
5265        }
5266
5267        /**
5268         * @return Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.
5269         */
5270        public boolean getAny() { 
5271          return this.any == null || this.any.isEmpty() ? false : this.any.getValue();
5272        }
5273
5274        /**
5275         * @param value Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.
5276         */
5277        public ElementDefinitionBindingAdditionalComponent setAny(boolean value) { 
5278            if (this.any == null)
5279              this.any = new BooleanType();
5280            this.any.setValue(value);
5281          return this;
5282        }
5283
5284        protected void listChildren(List<Property> children) {
5285          super.listChildren(children);
5286          children.add(new Property("purpose", "code", "The use of this additional binding.", 0, 1, purpose));
5287          children.add(new Property("valueSet", "canonical(ValueSet)", "The valueSet that is being bound for the purpose.", 0, 1, valueSet));
5288          children.add(new Property("documentation", "markdown", "Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.", 0, 1, documentation));
5289          children.add(new Property("shortDoco", "string", "Concise documentation - for summary tables.", 0, 1, shortDoco));
5290          children.add(new Property("usage", "UsageContext", "Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling.", 0, java.lang.Integer.MAX_VALUE, usage));
5291          children.add(new Property("any", "boolean", "Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.", 0, 1, any));
5292        }
5293
5294        @Override
5295        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5296          switch (_hash) {
5297          case -220463842: /*purpose*/  return new Property("purpose", "code", "The use of this additional binding.", 0, 1, purpose);
5298          case -1410174671: /*valueSet*/  return new Property("valueSet", "canonical(ValueSet)", "The valueSet that is being bound for the purpose.", 0, 1, valueSet);
5299          case 1587405498: /*documentation*/  return new Property("documentation", "markdown", "Documentation of the purpose of use of the bindingproviding additional information about how it is intended to be used.", 0, 1, documentation);
5300          case -2028503853: /*shortDoco*/  return new Property("shortDoco", "string", "Concise documentation - for summary tables.", 0, 1, shortDoco);
5301          case 111574433: /*usage*/  return new Property("usage", "UsageContext", "Qualifies the usage of the binding. Typically bindings are qualified by jurisdiction, but they may also be qualified by gender, workflow status, clinical domain etc. The information to decide whether a usege context applies is usually outside the resource, determined by context, and this might present challenges for validation tooling.", 0, java.lang.Integer.MAX_VALUE, usage);
5302          case 96748: /*any*/  return new Property("any", "boolean", "Whether the binding applies to all repeats, or just to any one of them. This is only relevant for elements that can repeat.", 0, 1, any);
5303          default: return super.getNamedProperty(_hash, _name, _checkValid);
5304          }
5305
5306        }
5307
5308      @Override
5309      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5310        switch (hash) {
5311        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // Enumeration<AdditionalBindingPurposeVS>
5312        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // CanonicalType
5313        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // MarkdownType
5314        case -2028503853: /*shortDoco*/ return this.shortDoco == null ? new Base[0] : new Base[] {this.shortDoco}; // StringType
5315        case 111574433: /*usage*/ return this.usage == null ? new Base[0] : this.usage.toArray(new Base[this.usage.size()]); // UsageContext
5316        case 96748: /*any*/ return this.any == null ? new Base[0] : new Base[] {this.any}; // BooleanType
5317        default: return super.getProperty(hash, name, checkValid);
5318        }
5319
5320      }
5321
5322      @Override
5323      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5324        switch (hash) {
5325        case -220463842: // purpose
5326          value = new AdditionalBindingPurposeVSEnumFactory().fromType(TypeConvertor.castToCode(value));
5327          this.purpose = (Enumeration) value; // Enumeration<AdditionalBindingPurposeVS>
5328          return value;
5329        case -1410174671: // valueSet
5330          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
5331          return value;
5332        case 1587405498: // documentation
5333          this.documentation = TypeConvertor.castToMarkdown(value); // MarkdownType
5334          return value;
5335        case -2028503853: // shortDoco
5336          this.shortDoco = TypeConvertor.castToString(value); // StringType
5337          return value;
5338        case 111574433: // usage
5339          this.getUsage().add(TypeConvertor.castToUsageContext(value)); // UsageContext
5340          return value;
5341        case 96748: // any
5342          this.any = TypeConvertor.castToBoolean(value); // BooleanType
5343          return value;
5344        default: return super.setProperty(hash, name, value);
5345        }
5346
5347      }
5348
5349      @Override
5350      public Base setProperty(String name, Base value) throws FHIRException {
5351        if (name.equals("purpose")) {
5352          value = new AdditionalBindingPurposeVSEnumFactory().fromType(TypeConvertor.castToCode(value));
5353          this.purpose = (Enumeration) value; // Enumeration<AdditionalBindingPurposeVS>
5354        } else if (name.equals("valueSet")) {
5355          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
5356        } else if (name.equals("documentation")) {
5357          this.documentation = TypeConvertor.castToMarkdown(value); // MarkdownType
5358        } else if (name.equals("shortDoco")) {
5359          this.shortDoco = TypeConvertor.castToString(value); // StringType
5360        } else if (name.equals("usage")) {
5361          this.getUsage().add(TypeConvertor.castToUsageContext(value));
5362        } else if (name.equals("any")) {
5363          this.any = TypeConvertor.castToBoolean(value); // BooleanType
5364        } else
5365          return super.setProperty(name, value);
5366        return value;
5367      }
5368
5369      @Override
5370      public Base makeProperty(int hash, String name) throws FHIRException {
5371        switch (hash) {
5372        case -220463842:  return getPurposeElement();
5373        case -1410174671:  return getValueSetElement();
5374        case 1587405498:  return getDocumentationElement();
5375        case -2028503853:  return getShortDocoElement();
5376        case 111574433:  return addUsage(); 
5377        case 96748:  return getAnyElement();
5378        default: return super.makeProperty(hash, name);
5379        }
5380
5381      }
5382
5383      @Override
5384      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5385        switch (hash) {
5386        case -220463842: /*purpose*/ return new String[] {"code"};
5387        case -1410174671: /*valueSet*/ return new String[] {"canonical"};
5388        case 1587405498: /*documentation*/ return new String[] {"markdown"};
5389        case -2028503853: /*shortDoco*/ return new String[] {"string"};
5390        case 111574433: /*usage*/ return new String[] {"UsageContext"};
5391        case 96748: /*any*/ return new String[] {"boolean"};
5392        default: return super.getTypesForProperty(hash, name);
5393        }
5394
5395      }
5396
5397      @Override
5398      public Base addChild(String name) throws FHIRException {
5399        if (name.equals("purpose")) {
5400          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.purpose");
5401        }
5402        else if (name.equals("valueSet")) {
5403          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.valueSet");
5404        }
5405        else if (name.equals("documentation")) {
5406          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.documentation");
5407        }
5408        else if (name.equals("shortDoco")) {
5409          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.shortDoco");
5410        }
5411        else if (name.equals("usage")) {
5412          return addUsage();
5413        }
5414        else if (name.equals("any")) {
5415          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.binding.additional.any");
5416        }
5417        else
5418          return super.addChild(name);
5419      }
5420
5421      public ElementDefinitionBindingAdditionalComponent copy() {
5422        ElementDefinitionBindingAdditionalComponent dst = new ElementDefinitionBindingAdditionalComponent();
5423        copyValues(dst);
5424        return dst;
5425      }
5426
5427      public void copyValues(ElementDefinitionBindingAdditionalComponent dst) {
5428        super.copyValues(dst);
5429        dst.purpose = purpose == null ? null : purpose.copy();
5430        dst.valueSet = valueSet == null ? null : valueSet.copy();
5431        dst.documentation = documentation == null ? null : documentation.copy();
5432        dst.shortDoco = shortDoco == null ? null : shortDoco.copy();
5433        if (usage != null) {
5434          dst.usage = new ArrayList<UsageContext>();
5435          for (UsageContext i : usage)
5436            dst.usage.add(i.copy());
5437        };
5438        dst.any = any == null ? null : any.copy();
5439      }
5440
5441      @Override
5442      public boolean equalsDeep(Base other_) {
5443        if (!super.equalsDeep(other_))
5444          return false;
5445        if (!(other_ instanceof ElementDefinitionBindingAdditionalComponent))
5446          return false;
5447        ElementDefinitionBindingAdditionalComponent o = (ElementDefinitionBindingAdditionalComponent) other_;
5448        return compareDeep(purpose, o.purpose, true) && compareDeep(valueSet, o.valueSet, true) && compareDeep(documentation, o.documentation, true)
5449           && compareDeep(shortDoco, o.shortDoco, true) && compareDeep(usage, o.usage, true) && compareDeep(any, o.any, true)
5450          ;
5451      }
5452
5453      @Override
5454      public boolean equalsShallow(Base other_) {
5455        if (!super.equalsShallow(other_))
5456          return false;
5457        if (!(other_ instanceof ElementDefinitionBindingAdditionalComponent))
5458          return false;
5459        ElementDefinitionBindingAdditionalComponent o = (ElementDefinitionBindingAdditionalComponent) other_;
5460        return compareValues(purpose, o.purpose, true) && compareValues(valueSet, o.valueSet, true) && compareValues(documentation, o.documentation, true)
5461           && compareValues(shortDoco, o.shortDoco, true) && compareValues(any, o.any, true);
5462      }
5463
5464      public boolean isEmpty() {
5465        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(purpose, valueSet, documentation
5466          , shortDoco, usage, any);
5467      }
5468
5469  public String fhirType() {
5470    return "ElementDefinition.binding.additional";
5471
5472  }
5473
5474  }
5475
5476    @Block()
5477    public static class ElementDefinitionMappingComponent extends Element implements IBaseDatatypeElement {
5478        /**
5479         * An internal reference to the definition of a mapping.
5480         */
5481        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
5482        @Description(shortDefinition="Reference to mapping declaration", formalDefinition="An internal reference to the definition of a mapping." )
5483        protected IdType identity;
5484
5485        /**
5486         * Identifies the computable language in which mapping.map is expressed.
5487         */
5488        @Child(name = "language", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
5489        @Description(shortDefinition="Computable language of mapping", formalDefinition="Identifies the computable language in which mapping.map is expressed." )
5490        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
5491        protected CodeType language;
5492
5493        /**
5494         * Expresses what part of the target specification corresponds to this element.
5495         */
5496        @Child(name = "map", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
5497        @Description(shortDefinition="Details of the mapping", formalDefinition="Expresses what part of the target specification corresponds to this element." )
5498        protected StringType map;
5499
5500        /**
5501         * Comments that provide information about the mapping or its use.
5502         */
5503        @Child(name = "comment", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=true)
5504        @Description(shortDefinition="Comments about the mapping or its use", formalDefinition="Comments that provide information about the mapping or its use." )
5505        protected MarkdownType comment;
5506
5507        private static final long serialVersionUID = -582458727L;
5508
5509    /**
5510     * Constructor
5511     */
5512      public ElementDefinitionMappingComponent() {
5513        super();
5514      }
5515
5516    /**
5517     * Constructor
5518     */
5519      public ElementDefinitionMappingComponent(String identity, String map) {
5520        super();
5521        this.setIdentity(identity);
5522        this.setMap(map);
5523      }
5524
5525        /**
5526         * @return {@link #identity} (An internal reference to the definition of a mapping.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
5527         */
5528        public IdType getIdentityElement() { 
5529          if (this.identity == null)
5530            if (Configuration.errorOnAutoCreate())
5531              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.identity");
5532            else if (Configuration.doAutoCreate())
5533              this.identity = new IdType(); // bb
5534          return this.identity;
5535        }
5536
5537        public boolean hasIdentityElement() { 
5538          return this.identity != null && !this.identity.isEmpty();
5539        }
5540
5541        public boolean hasIdentity() { 
5542          return this.identity != null && !this.identity.isEmpty();
5543        }
5544
5545        /**
5546         * @param value {@link #identity} (An internal reference to the definition of a mapping.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
5547         */
5548        public ElementDefinitionMappingComponent setIdentityElement(IdType value) { 
5549          this.identity = value;
5550          return this;
5551        }
5552
5553        /**
5554         * @return An internal reference to the definition of a mapping.
5555         */
5556        public String getIdentity() { 
5557          return this.identity == null ? null : this.identity.getValue();
5558        }
5559
5560        /**
5561         * @param value An internal reference to the definition of a mapping.
5562         */
5563        public ElementDefinitionMappingComponent setIdentity(String value) { 
5564            if (this.identity == null)
5565              this.identity = new IdType();
5566            this.identity.setValue(value);
5567          return this;
5568        }
5569
5570        /**
5571         * @return {@link #language} (Identifies the computable language in which mapping.map is expressed.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
5572         */
5573        public CodeType getLanguageElement() { 
5574          if (this.language == null)
5575            if (Configuration.errorOnAutoCreate())
5576              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.language");
5577            else if (Configuration.doAutoCreate())
5578              this.language = new CodeType(); // bb
5579          return this.language;
5580        }
5581
5582        public boolean hasLanguageElement() { 
5583          return this.language != null && !this.language.isEmpty();
5584        }
5585
5586        public boolean hasLanguage() { 
5587          return this.language != null && !this.language.isEmpty();
5588        }
5589
5590        /**
5591         * @param value {@link #language} (Identifies the computable language in which mapping.map is expressed.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
5592         */
5593        public ElementDefinitionMappingComponent setLanguageElement(CodeType value) { 
5594          this.language = value;
5595          return this;
5596        }
5597
5598        /**
5599         * @return Identifies the computable language in which mapping.map is expressed.
5600         */
5601        public String getLanguage() { 
5602          return this.language == null ? null : this.language.getValue();
5603        }
5604
5605        /**
5606         * @param value Identifies the computable language in which mapping.map is expressed.
5607         */
5608        public ElementDefinitionMappingComponent setLanguage(String value) { 
5609          if (Utilities.noString(value))
5610            this.language = null;
5611          else {
5612            if (this.language == null)
5613              this.language = new CodeType();
5614            this.language.setValue(value);
5615          }
5616          return this;
5617        }
5618
5619        /**
5620         * @return {@link #map} (Expresses what part of the target specification corresponds to this element.). This is the underlying object with id, value and extensions. The accessor "getMap" gives direct access to the value
5621         */
5622        public StringType getMapElement() { 
5623          if (this.map == null)
5624            if (Configuration.errorOnAutoCreate())
5625              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.map");
5626            else if (Configuration.doAutoCreate())
5627              this.map = new StringType(); // bb
5628          return this.map;
5629        }
5630
5631        public boolean hasMapElement() { 
5632          return this.map != null && !this.map.isEmpty();
5633        }
5634
5635        public boolean hasMap() { 
5636          return this.map != null && !this.map.isEmpty();
5637        }
5638
5639        /**
5640         * @param value {@link #map} (Expresses what part of the target specification corresponds to this element.). This is the underlying object with id, value and extensions. The accessor "getMap" gives direct access to the value
5641         */
5642        public ElementDefinitionMappingComponent setMapElement(StringType value) { 
5643          this.map = value;
5644          return this;
5645        }
5646
5647        /**
5648         * @return Expresses what part of the target specification corresponds to this element.
5649         */
5650        public String getMap() { 
5651          return this.map == null ? null : this.map.getValue();
5652        }
5653
5654        /**
5655         * @param value Expresses what part of the target specification corresponds to this element.
5656         */
5657        public ElementDefinitionMappingComponent setMap(String value) { 
5658            if (this.map == null)
5659              this.map = new StringType();
5660            this.map.setValue(value);
5661          return this;
5662        }
5663
5664        /**
5665         * @return {@link #comment} (Comments that provide information about the mapping or its use.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
5666         */
5667        public MarkdownType getCommentElement() { 
5668          if (this.comment == null)
5669            if (Configuration.errorOnAutoCreate())
5670              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.comment");
5671            else if (Configuration.doAutoCreate())
5672              this.comment = new MarkdownType(); // bb
5673          return this.comment;
5674        }
5675
5676        public boolean hasCommentElement() { 
5677          return this.comment != null && !this.comment.isEmpty();
5678        }
5679
5680        public boolean hasComment() { 
5681          return this.comment != null && !this.comment.isEmpty();
5682        }
5683
5684        /**
5685         * @param value {@link #comment} (Comments that provide information about the mapping or its use.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
5686         */
5687        public ElementDefinitionMappingComponent setCommentElement(MarkdownType value) { 
5688          this.comment = value;
5689          return this;
5690        }
5691
5692        /**
5693         * @return Comments that provide information about the mapping or its use.
5694         */
5695        public String getComment() { 
5696          return this.comment == null ? null : this.comment.getValue();
5697        }
5698
5699        /**
5700         * @param value Comments that provide information about the mapping or its use.
5701         */
5702        public ElementDefinitionMappingComponent setComment(String value) { 
5703          if (Utilities.noString(value))
5704            this.comment = null;
5705          else {
5706            if (this.comment == null)
5707              this.comment = new MarkdownType();
5708            this.comment.setValue(value);
5709          }
5710          return this;
5711        }
5712
5713        protected void listChildren(List<Property> children) {
5714          super.listChildren(children);
5715          children.add(new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, 1, identity));
5716          children.add(new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, 1, language));
5717          children.add(new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, 1, map));
5718          children.add(new Property("comment", "markdown", "Comments that provide information about the mapping or its use.", 0, 1, comment));
5719        }
5720
5721        @Override
5722        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5723          switch (_hash) {
5724          case -135761730: /*identity*/  return new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, 1, identity);
5725          case -1613589672: /*language*/  return new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, 1, language);
5726          case 107868: /*map*/  return new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, 1, map);
5727          case 950398559: /*comment*/  return new Property("comment", "markdown", "Comments that provide information about the mapping or its use.", 0, 1, comment);
5728          default: return super.getNamedProperty(_hash, _name, _checkValid);
5729          }
5730
5731        }
5732
5733      @Override
5734      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5735        switch (hash) {
5736        case -135761730: /*identity*/ return this.identity == null ? new Base[0] : new Base[] {this.identity}; // IdType
5737        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType
5738        case 107868: /*map*/ return this.map == null ? new Base[0] : new Base[] {this.map}; // StringType
5739        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // MarkdownType
5740        default: return super.getProperty(hash, name, checkValid);
5741        }
5742
5743      }
5744
5745      @Override
5746      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5747        switch (hash) {
5748        case -135761730: // identity
5749          this.identity = TypeConvertor.castToId(value); // IdType
5750          return value;
5751        case -1613589672: // language
5752          this.language = TypeConvertor.castToCode(value); // CodeType
5753          return value;
5754        case 107868: // map
5755          this.map = TypeConvertor.castToString(value); // StringType
5756          return value;
5757        case 950398559: // comment
5758          this.comment = TypeConvertor.castToMarkdown(value); // MarkdownType
5759          return value;
5760        default: return super.setProperty(hash, name, value);
5761        }
5762
5763      }
5764
5765      @Override
5766      public Base setProperty(String name, Base value) throws FHIRException {
5767        if (name.equals("identity")) {
5768          this.identity = TypeConvertor.castToId(value); // IdType
5769        } else if (name.equals("language")) {
5770          this.language = TypeConvertor.castToCode(value); // CodeType
5771        } else if (name.equals("map")) {
5772          this.map = TypeConvertor.castToString(value); // StringType
5773        } else if (name.equals("comment")) {
5774          this.comment = TypeConvertor.castToMarkdown(value); // MarkdownType
5775        } else
5776          return super.setProperty(name, value);
5777        return value;
5778      }
5779
5780      @Override
5781      public Base makeProperty(int hash, String name) throws FHIRException {
5782        switch (hash) {
5783        case -135761730:  return getIdentityElement();
5784        case -1613589672:  return getLanguageElement();
5785        case 107868:  return getMapElement();
5786        case 950398559:  return getCommentElement();
5787        default: return super.makeProperty(hash, name);
5788        }
5789
5790      }
5791
5792      @Override
5793      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5794        switch (hash) {
5795        case -135761730: /*identity*/ return new String[] {"id"};
5796        case -1613589672: /*language*/ return new String[] {"code"};
5797        case 107868: /*map*/ return new String[] {"string"};
5798        case 950398559: /*comment*/ return new String[] {"markdown"};
5799        default: return super.getTypesForProperty(hash, name);
5800        }
5801
5802      }
5803
5804      @Override
5805      public Base addChild(String name) throws FHIRException {
5806        if (name.equals("identity")) {
5807          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.mapping.identity");
5808        }
5809        else if (name.equals("language")) {
5810          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.mapping.language");
5811        }
5812        else if (name.equals("map")) {
5813          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.mapping.map");
5814        }
5815        else if (name.equals("comment")) {
5816          throw new FHIRException("Cannot call addChild on a singleton property ElementDefinition.mapping.comment");
5817        }
5818        else
5819          return super.addChild(name);
5820      }
5821
5822      public ElementDefinitionMappingComponent copy() {
5823        ElementDefinitionMappingComponent dst = new ElementDefinitionMappingComponent();
5824        copyValues(dst);
5825        return dst;
5826      }
5827
5828      public void copyValues(ElementDefinitionMappingComponent dst) {
5829        super.copyValues(dst);
5830        dst.identity = identity == null ? null : identity.copy();
5831        dst.language = language == null ? null : language.copy();
5832        dst.map = map == null ? null : map.copy();
5833        dst.comment = comment == null ? null : comment.copy();
5834      }
5835
5836      @Override
5837      public boolean equalsDeep(Base other_) {
5838        if (!super.equalsDeep(other_))
5839          return false;
5840        if (!(other_ instanceof ElementDefinitionMappingComponent))
5841          return false;
5842        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other_;
5843        return compareDeep(identity, o.identity, true) && compareDeep(language, o.language, true) && compareDeep(map, o.map, true)
5844           && compareDeep(comment, o.comment, true);
5845      }
5846
5847      @Override
5848      public boolean equalsShallow(Base other_) {
5849        if (!super.equalsShallow(other_))
5850          return false;
5851        if (!(other_ instanceof ElementDefinitionMappingComponent))
5852          return false;
5853        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other_;
5854        return compareValues(identity, o.identity, true) && compareValues(language, o.language, true) && compareValues(map, o.map, true)
5855           && compareValues(comment, o.comment, true);
5856      }
5857
5858      public boolean isEmpty() {
5859        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identity, language, map
5860          , comment);
5861      }
5862
5863  public String fhirType() {
5864    return "ElementDefinition.mapping";
5865
5866  }
5867
5868  }
5869
5870    /**
5871     * The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
5872     */
5873    @Child(name = "path", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=true)
5874    @Description(shortDefinition="Path of the element in the hierarchy of elements", formalDefinition="The path identifies the element and is expressed as a \".\"-separated list of ancestor elements, beginning with the name of the resource or extension." )
5875    protected StringType path;
5876
5877    /**
5878     * Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.
5879     */
5880    @Child(name = "representation", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5881    @Description(shortDefinition="xmlAttr | xmlText | typeAttr | cdaText | xhtml", formalDefinition="Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used." )
5882    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/property-representation")
5883    protected List<Enumeration<PropertyRepresentation>> representation;
5884
5885    /**
5886     * The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.
5887     */
5888    @Child(name = "sliceName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
5889    @Description(shortDefinition="Name for this particular element (in a set of slices)", formalDefinition="The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element." )
5890    protected StringType sliceName;
5891
5892    /**
5893     * If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.
5894     */
5895    @Child(name = "sliceIsConstraining", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
5896    @Description(shortDefinition="If this slice definition constrains an inherited slice definition (or not)", formalDefinition="If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName." )
5897    protected BooleanType sliceIsConstraining;
5898
5899    /**
5900     * A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
5901     */
5902    @Child(name = "label", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
5903    @Description(shortDefinition="Name for element to display with or prompt for element", formalDefinition="A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form." )
5904    protected StringType label;
5905
5906    /**
5907     * A code that has the same meaning as the element in a particular terminology.
5908     */
5909    @Child(name = "code", type = {Coding.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5910    @Description(shortDefinition="Corresponding codes in terminologies", formalDefinition="A code that has the same meaning as the element in a particular terminology." )
5911    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://loinc.org/vs")
5912    protected List<Coding> code;
5913
5914    /**
5915     * Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).
5916     */
5917    @Child(name = "slicing", type = {}, order=6, min=0, max=1, modifier=false, summary=true)
5918    @Description(shortDefinition="This element is sliced - slices follow", formalDefinition="Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set)." )
5919    protected ElementDefinitionSlicingComponent slicing;
5920
5921    /**
5922     * A concise description of what this element means (e.g. for use in autogenerated summaries).
5923     */
5924    @Child(name = "short", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
5925    @Description(shortDefinition="Concise definition for space-constrained presentation", formalDefinition="A concise description of what this element means (e.g. for use in autogenerated summaries)." )
5926    protected StringType short_;
5927
5928    /**
5929     * Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).
5930     */
5931    @Child(name = "definition", type = {MarkdownType.class}, order=8, min=0, max=1, modifier=false, summary=true)
5932    @Description(shortDefinition="Full formal definition as narrative text", formalDefinition="Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition)." )
5933    protected MarkdownType definition;
5934
5935    /**
5936     * Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).
5937     */
5938    @Child(name = "comment", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=true)
5939    @Description(shortDefinition="Comments about the use of this element", formalDefinition="Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment)." )
5940    protected MarkdownType comment;
5941
5942    /**
5943     * This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
5944     */
5945    @Child(name = "requirements", type = {MarkdownType.class}, order=10, min=0, max=1, modifier=false, summary=true)
5946    @Description(shortDefinition="Why this resource has been created", formalDefinition="This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element." )
5947    protected MarkdownType requirements;
5948
5949    /**
5950     * Identifies additional names by which this element might also be known.
5951     */
5952    @Child(name = "alias", type = {StringType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5953    @Description(shortDefinition="Other names", formalDefinition="Identifies additional names by which this element might also be known." )
5954    protected List<StringType> alias;
5955
5956    /**
5957     * The minimum number of times this element SHALL appear in the instance.
5958     */
5959    @Child(name = "min", type = {UnsignedIntType.class}, order=12, min=0, max=1, modifier=false, summary=true)
5960    @Description(shortDefinition="Minimum Cardinality", formalDefinition="The minimum number of times this element SHALL appear in the instance." )
5961    protected UnsignedIntType min;
5962
5963    /**
5964     * The maximum number of times this element is permitted to appear in the instance.
5965     */
5966    @Child(name = "max", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=true)
5967    @Description(shortDefinition="Maximum Cardinality (a number or *)", formalDefinition="The maximum number of times this element is permitted to appear in the instance." )
5968    protected StringType max;
5969
5970    /**
5971     * Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the derived and related profiles. When the element definition is not the original definition of an element - e.g. either in a constraint on another type, or for elements from a super type in a snap shot - then the information in provided in the element definition may be different to the base definition. On the original definition of the element, it will be same.
5972     */
5973    @Child(name = "base", type = {}, order=14, min=0, max=1, modifier=false, summary=true)
5974    @Description(shortDefinition="Base definition information for tools", formalDefinition="Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the derived and related profiles. When the element definition is not the original definition of an element - e.g. either in a constraint on another type, or for elements from a super type in a snap shot - then the information in provided in the element definition may be different to the base definition. On the original definition of the element, it will be same." )
5975    protected ElementDefinitionBaseComponent base;
5976
5977    /**
5978     * Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.
5979     */
5980    @Child(name = "contentReference", type = {UriType.class}, order=15, min=0, max=1, modifier=false, summary=true)
5981    @Description(shortDefinition="Reference to definition of content for the element", formalDefinition="Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc." )
5982    protected UriType contentReference;
5983
5984    /**
5985     * The data type or resource that the value of this element is permitted to be.
5986     */
5987    @Child(name = "type", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5988    @Description(shortDefinition="Data type and Profile for this element", formalDefinition="The data type or resource that the value of this element is permitted to be." )
5989    protected List<TypeRefComponent> type;
5990
5991    /**
5992     * The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').
5993     */
5994    @Child(name = "defaultValue", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Availability.class, ExtendedContactDetail.class, Dosage.class, Meta.class}, order=17, min=0, max=1, modifier=false, summary=true)
5995    @Description(shortDefinition="Specified value if missing from instance", formalDefinition="The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false')." )
5996    protected DataType defaultValue;
5997
5998    /**
5999     * The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').
6000     */
6001    @Child(name = "meaningWhenMissing", type = {MarkdownType.class}, order=18, min=0, max=1, modifier=false, summary=true)
6002    @Description(shortDefinition="Implicit meaning when this element is missing", formalDefinition="The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing')." )
6003    protected MarkdownType meaningWhenMissing;
6004
6005    /**
6006     * If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.
6007     */
6008    @Child(name = "orderMeaning", type = {StringType.class}, order=19, min=0, max=1, modifier=false, summary=true)
6009    @Description(shortDefinition="What the order of the elements means", formalDefinition="If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning." )
6010    protected StringType orderMeaning;
6011
6012    /**
6013     * Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.
6014     */
6015    @Child(name = "fixed", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Availability.class, ExtendedContactDetail.class, Dosage.class, Meta.class}, order=20, min=0, max=1, modifier=false, summary=true)
6016    @Description(shortDefinition="Value must be exactly this", formalDefinition="Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing." )
6017    protected DataType fixed;
6018
6019    /**
6020     * Specifies a value that each occurrence of the element in the instance SHALL follow - that is, any value in the pattern must be found in the instance, if the element has a value. Other additional values may be found too. This is effectively constraint by example.  
6021
6022When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
6023
6024When an element within a pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] must (recursively) match at least one element from the instance array.
6025
6026When pattern[x] is used to constrain a complex object, it means that each property in the pattern must be present in the complex object, and its value must recursively match -- i.e.,
6027
60281. If primitive: it must match exactly the pattern value
60292. If a complex object: it must match (recursively) the pattern value
60303. If an array: it must match (recursively) the pattern value
6031
6032If a pattern[x] is declared on a repeating element, the pattern applies to all repetitions.  If the desire is for a pattern to apply to only one element or a subset of elements, slicing must be used. See [Examples of Patterns](elementdefinition-examples.html#pattern-examples) for examples of pattern usage and the effect it will have.
6033     */
6034    @Child(name = "pattern", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Availability.class, ExtendedContactDetail.class, Dosage.class, Meta.class}, order=21, min=0, max=1, modifier=false, summary=true)
6035    @Description(shortDefinition="Value must have at least these property values", formalDefinition="Specifies a value that each occurrence of the element in the instance SHALL follow - that is, any value in the pattern must be found in the instance, if the element has a value. Other additional values may be found too. This is effectively constraint by example.  \n\nWhen pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.\n\nWhen an element within a pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] must (recursively) match at least one element from the instance array.\n\nWhen pattern[x] is used to constrain a complex object, it means that each property in the pattern must be present in the complex object, and its value must recursively match -- i.e.,\n\n1. If primitive: it must match exactly the pattern value\n2. If a complex object: it must match (recursively) the pattern value\n3. If an array: it must match (recursively) the pattern value\n\nIf a pattern[x] is declared on a repeating element, the pattern applies to all repetitions.  If the desire is for a pattern to apply to only one element or a subset of elements, slicing must be used. See [Examples of Patterns](elementdefinition-examples.html#pattern-examples) for examples of pattern usage and the effect it will have." )
6036    protected DataType pattern;
6037
6038    /**
6039     * A sample value for this element demonstrating the type of information that would typically be found in the element.
6040     */
6041    @Child(name = "example", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6042    @Description(shortDefinition="Example value (as defined for type)", formalDefinition="A sample value for this element demonstrating the type of information that would typically be found in the element." )
6043    protected List<ElementDefinitionExampleComponent> example;
6044
6045    /**
6046     * The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.
6047     */
6048    @Child(name = "minValue", type = {DateType.class, DateTimeType.class, InstantType.class, TimeType.class, DecimalType.class, IntegerType.class, Integer64Type.class, PositiveIntType.class, UnsignedIntType.class, Quantity.class}, order=23, min=0, max=1, modifier=false, summary=true)
6049    @Description(shortDefinition="Minimum Allowed Value (for some types)", formalDefinition="The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity." )
6050    protected DataType minValue;
6051
6052    /**
6053     * The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.
6054     */
6055    @Child(name = "maxValue", type = {DateType.class, DateTimeType.class, InstantType.class, TimeType.class, DecimalType.class, IntegerType.class, Integer64Type.class, PositiveIntType.class, UnsignedIntType.class, Quantity.class}, order=24, min=0, max=1, modifier=false, summary=true)
6056    @Description(shortDefinition="Maximum Allowed Value (for some types)", formalDefinition="The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity." )
6057    protected DataType maxValue;
6058
6059    /**
6060     * Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element. ```maxLength``` SHOULD only be used on primitive data types that have a string representation (see [http://hl7.org/fhir/StructureDefinition/structuredefinition-type-characteristics](https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-structuredefinition-type-characteristics.html)).
6061     */
6062    @Child(name = "maxLength", type = {IntegerType.class}, order=25, min=0, max=1, modifier=false, summary=true)
6063    @Description(shortDefinition="Max length for string type data", formalDefinition="Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element. ```maxLength``` SHOULD only be used on primitive data types that have a string representation (see [http://hl7.org/fhir/StructureDefinition/structuredefinition-type-characteristics](https://build.fhir.org/ig/HL7/fhir-extensions/StructureDefinition-structuredefinition-type-characteristics.html))." )
6064    protected IntegerType maxLength;
6065
6066    /**
6067     * A reference to an invariant that may make additional statements about the cardinality or value in the instance.
6068     */
6069    @Child(name = "condition", type = {IdType.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6070    @Description(shortDefinition="Reference to invariant about presence", formalDefinition="A reference to an invariant that may make additional statements about the cardinality or value in the instance." )
6071    protected List<IdType> condition;
6072
6073    /**
6074     * Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.
6075     */
6076    @Child(name = "constraint", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6077    @Description(shortDefinition="Condition that must evaluate to true", formalDefinition="Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance." )
6078    protected List<ElementDefinitionConstraintComponent> constraint;
6079
6080    /**
6081     * Specifies for a primitive data type that the value of the data type cannot be replaced by an extension.
6082     */
6083    @Child(name = "mustHaveValue", type = {BooleanType.class}, order=28, min=0, max=1, modifier=false, summary=true)
6084    @Description(shortDefinition="For primitives, that a value must be present - not replaced by an extension", formalDefinition="Specifies for a primitive data type that the value of the data type cannot be replaced by an extension." )
6085    protected BooleanType mustHaveValue;
6086
6087    /**
6088     * Specifies a list of extensions that can appear in place of a primitive value.
6089     */
6090    @Child(name = "valueAlternatives", type = {CanonicalType.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6091    @Description(shortDefinition="Extensions that are allowed to replace a primitive value", formalDefinition="Specifies a list of extensions that can appear in place of a primitive value." )
6092    protected List<CanonicalType> valueAlternatives;
6093
6094    /**
6095     * If true, implementations that produce or consume resources SHALL provide "support" for the element in some meaningful way. Note that this is being phased out and replaced by obligations (see below).  If false, the element may be ignored and not supported. If false, whether to populate or use the data element in any way is at the discretion of the implementation.
6096     */
6097    @Child(name = "mustSupport", type = {BooleanType.class}, order=30, min=0, max=1, modifier=false, summary=true)
6098    @Description(shortDefinition="If the element must be supported (discouraged - see obligations)", formalDefinition="If true, implementations that produce or consume resources SHALL provide \"support\" for the element in some meaningful way. Note that this is being phased out and replaced by obligations (see below).  If false, the element may be ignored and not supported. If false, whether to populate or use the data element in any way is at the discretion of the implementation." )
6099    protected BooleanType mustSupport;
6100
6101    /**
6102     * If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system. When used on the root element in an extension definition, this indicates whether or not the extension is a modifier extension.
6103     */
6104    @Child(name = "isModifier", type = {BooleanType.class}, order=31, min=0, max=1, modifier=false, summary=true)
6105    @Description(shortDefinition="If this modifies the meaning of other elements", formalDefinition="If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system. When used on the root element in an extension definition, this indicates whether or not the extension is a modifier extension." )
6106    protected BooleanType isModifier;
6107
6108    /**
6109     * Explains how that element affects the interpretation of the resource or element that contains it.
6110     */
6111    @Child(name = "isModifierReason", type = {StringType.class}, order=32, min=0, max=1, modifier=false, summary=true)
6112    @Description(shortDefinition="Reason that this element is marked as a modifier", formalDefinition="Explains how that element affects the interpretation of the resource or element that contains it." )
6113    protected StringType isModifierReason;
6114
6115    /**
6116     * Whether the element should be included if a client requests a search with the parameter _summary=true.
6117     */
6118    @Child(name = "isSummary", type = {BooleanType.class}, order=33, min=0, max=1, modifier=false, summary=true)
6119    @Description(shortDefinition="Include when _summary = true?", formalDefinition="Whether the element should be included if a client requests a search with the parameter _summary=true." )
6120    protected BooleanType isSummary;
6121
6122    /**
6123     * Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri).
6124     */
6125    @Child(name = "binding", type = {}, order=34, min=0, max=1, modifier=false, summary=true)
6126    @Description(shortDefinition="ValueSet details if this is coded", formalDefinition="Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri)." )
6127    protected ElementDefinitionBindingComponent binding;
6128
6129    /**
6130     * Identifies a concept from an external specification that roughly corresponds to this element.
6131     */
6132    @Child(name = "mapping", type = {}, order=35, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6133    @Description(shortDefinition="Map element to another set of definitions", formalDefinition="Identifies a concept from an external specification that roughly corresponds to this element." )
6134    protected List<ElementDefinitionMappingComponent> mapping;
6135
6136    private static final long serialVersionUID = -1474105308L;
6137
6138  /**
6139   * Constructor
6140   */
6141    public ElementDefinition() {
6142      super();
6143    }
6144
6145  /**
6146   * Constructor
6147   */
6148    public ElementDefinition(String path) {
6149      super();
6150      this.setPath(path);
6151    }
6152
6153    /**
6154     * @return {@link #path} (The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
6155     */
6156    public StringType getPathElement() { 
6157      if (this.path == null)
6158        if (Configuration.errorOnAutoCreate())
6159          throw new Error("Attempt to auto-create ElementDefinition.path");
6160        else if (Configuration.doAutoCreate())
6161          this.path = new StringType(); // bb
6162      return this.path;
6163    }
6164
6165    public boolean hasPathElement() { 
6166      return this.path != null && !this.path.isEmpty();
6167    }
6168
6169    public boolean hasPath() { 
6170      return this.path != null && !this.path.isEmpty();
6171    }
6172
6173    /**
6174     * @param value {@link #path} (The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
6175     */
6176    public ElementDefinition setPathElement(StringType value) { 
6177      this.path = value;
6178      return this;
6179    }
6180
6181    /**
6182     * @return The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
6183     */
6184    public String getPath() { 
6185      return this.path == null ? null : this.path.getValue();
6186    }
6187
6188    /**
6189     * @param value The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
6190     */
6191    public ElementDefinition setPath(String value) { 
6192        if (this.path == null)
6193          this.path = new StringType();
6194        this.path.setValue(value);
6195      return this;
6196    }
6197
6198    /**
6199     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.)
6200     */
6201    public List<Enumeration<PropertyRepresentation>> getRepresentation() { 
6202      if (this.representation == null)
6203        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
6204      return this.representation;
6205    }
6206
6207    /**
6208     * @return Returns a reference to <code>this</code> for easy method chaining
6209     */
6210    public ElementDefinition setRepresentation(List<Enumeration<PropertyRepresentation>> theRepresentation) { 
6211      this.representation = theRepresentation;
6212      return this;
6213    }
6214
6215    public boolean hasRepresentation() { 
6216      if (this.representation == null)
6217        return false;
6218      for (Enumeration<PropertyRepresentation> item : this.representation)
6219        if (!item.isEmpty())
6220          return true;
6221      return false;
6222    }
6223
6224    /**
6225     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.)
6226     */
6227    public Enumeration<PropertyRepresentation> addRepresentationElement() {//2 
6228      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
6229      if (this.representation == null)
6230        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
6231      this.representation.add(t);
6232      return t;
6233    }
6234
6235    /**
6236     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.)
6237     */
6238    public ElementDefinition addRepresentation(PropertyRepresentation value) { //1
6239      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
6240      t.setValue(value);
6241      if (this.representation == null)
6242        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
6243      this.representation.add(t);
6244      return this;
6245    }
6246
6247    /**
6248     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case. No extensions are allowed on elements with a representation of 'xmlAttr', no matter what FHIR serialization format is used.)
6249     */
6250    public boolean hasRepresentation(PropertyRepresentation value) { 
6251      if (this.representation == null)
6252        return false;
6253      for (Enumeration<PropertyRepresentation> v : this.representation)
6254        if (v.getValue().equals(value)) // code
6255          return true;
6256      return false;
6257    }
6258
6259    /**
6260     * @return {@link #sliceName} (The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.). This is the underlying object with id, value and extensions. The accessor "getSliceName" gives direct access to the value
6261     */
6262    public StringType getSliceNameElement() { 
6263      if (this.sliceName == null)
6264        if (Configuration.errorOnAutoCreate())
6265          throw new Error("Attempt to auto-create ElementDefinition.sliceName");
6266        else if (Configuration.doAutoCreate())
6267          this.sliceName = new StringType(); // bb
6268      return this.sliceName;
6269    }
6270
6271    public boolean hasSliceNameElement() { 
6272      return this.sliceName != null && !this.sliceName.isEmpty();
6273    }
6274
6275    public boolean hasSliceName() { 
6276      return this.sliceName != null && !this.sliceName.isEmpty();
6277    }
6278
6279    /**
6280     * @param value {@link #sliceName} (The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.). This is the underlying object with id, value and extensions. The accessor "getSliceName" gives direct access to the value
6281     */
6282    public ElementDefinition setSliceNameElement(StringType value) { 
6283      this.sliceName = value;
6284      return this;
6285    }
6286
6287    /**
6288     * @return The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.
6289     */
6290    public String getSliceName() { 
6291      return this.sliceName == null ? null : this.sliceName.getValue();
6292    }
6293
6294    /**
6295     * @param value The name of this element definition slice, when slicing is working. The name must be a token with no dots or spaces. This is a unique name referring to a specific set of constraints applied to this element, used to provide a name to different slices of the same element.
6296     */
6297    public ElementDefinition setSliceName(String value) { 
6298      if (Utilities.noString(value))
6299        this.sliceName = null;
6300      else {
6301        if (this.sliceName == null)
6302          this.sliceName = new StringType();
6303        this.sliceName.setValue(value);
6304      }
6305      return this;
6306    }
6307
6308    /**
6309     * @return {@link #sliceIsConstraining} (If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.). This is the underlying object with id, value and extensions. The accessor "getSliceIsConstraining" gives direct access to the value
6310     */
6311    public BooleanType getSliceIsConstrainingElement() { 
6312      if (this.sliceIsConstraining == null)
6313        if (Configuration.errorOnAutoCreate())
6314          throw new Error("Attempt to auto-create ElementDefinition.sliceIsConstraining");
6315        else if (Configuration.doAutoCreate())
6316          this.sliceIsConstraining = new BooleanType(); // bb
6317      return this.sliceIsConstraining;
6318    }
6319
6320    public boolean hasSliceIsConstrainingElement() { 
6321      return this.sliceIsConstraining != null && !this.sliceIsConstraining.isEmpty();
6322    }
6323
6324    public boolean hasSliceIsConstraining() { 
6325      return this.sliceIsConstraining != null && !this.sliceIsConstraining.isEmpty();
6326    }
6327
6328    /**
6329     * @param value {@link #sliceIsConstraining} (If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.). This is the underlying object with id, value and extensions. The accessor "getSliceIsConstraining" gives direct access to the value
6330     */
6331    public ElementDefinition setSliceIsConstrainingElement(BooleanType value) { 
6332      this.sliceIsConstraining = value;
6333      return this;
6334    }
6335
6336    /**
6337     * @return If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.
6338     */
6339    public boolean getSliceIsConstraining() { 
6340      return this.sliceIsConstraining == null || this.sliceIsConstraining.isEmpty() ? false : this.sliceIsConstraining.getValue();
6341    }
6342
6343    /**
6344     * @param value If true, indicates that this slice definition is constraining a slice definition with the same name in an inherited profile. If false, the slice is not overriding any slice in an inherited profile. If missing, the slice might or might not be overriding a slice in an inherited profile, depending on the sliceName.
6345     */
6346    public ElementDefinition setSliceIsConstraining(boolean value) { 
6347        if (this.sliceIsConstraining == null)
6348          this.sliceIsConstraining = new BooleanType();
6349        this.sliceIsConstraining.setValue(value);
6350      return this;
6351    }
6352
6353    /**
6354     * @return {@link #label} (A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
6355     */
6356    public StringType getLabelElement() { 
6357      if (this.label == null)
6358        if (Configuration.errorOnAutoCreate())
6359          throw new Error("Attempt to auto-create ElementDefinition.label");
6360        else if (Configuration.doAutoCreate())
6361          this.label = new StringType(); // bb
6362      return this.label;
6363    }
6364
6365    public boolean hasLabelElement() { 
6366      return this.label != null && !this.label.isEmpty();
6367    }
6368
6369    public boolean hasLabel() { 
6370      return this.label != null && !this.label.isEmpty();
6371    }
6372
6373    /**
6374     * @param value {@link #label} (A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
6375     */
6376    public ElementDefinition setLabelElement(StringType value) { 
6377      this.label = value;
6378      return this;
6379    }
6380
6381    /**
6382     * @return A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
6383     */
6384    public String getLabel() { 
6385      return this.label == null ? null : this.label.getValue();
6386    }
6387
6388    /**
6389     * @param value A single preferred label which is the text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
6390     */
6391    public ElementDefinition setLabel(String value) { 
6392      if (Utilities.noString(value))
6393        this.label = null;
6394      else {
6395        if (this.label == null)
6396          this.label = new StringType();
6397        this.label.setValue(value);
6398      }
6399      return this;
6400    }
6401
6402    /**
6403     * @return {@link #code} (A code that has the same meaning as the element in a particular terminology.)
6404     */
6405    public List<Coding> getCode() { 
6406      if (this.code == null)
6407        this.code = new ArrayList<Coding>();
6408      return this.code;
6409    }
6410
6411    /**
6412     * @return Returns a reference to <code>this</code> for easy method chaining
6413     */
6414    public ElementDefinition setCode(List<Coding> theCode) { 
6415      this.code = theCode;
6416      return this;
6417    }
6418
6419    public boolean hasCode() { 
6420      if (this.code == null)
6421        return false;
6422      for (Coding item : this.code)
6423        if (!item.isEmpty())
6424          return true;
6425      return false;
6426    }
6427
6428    public Coding addCode() { //3
6429      Coding t = new Coding();
6430      if (this.code == null)
6431        this.code = new ArrayList<Coding>();
6432      this.code.add(t);
6433      return t;
6434    }
6435
6436    public ElementDefinition addCode(Coding t) { //3
6437      if (t == null)
6438        return this;
6439      if (this.code == null)
6440        this.code = new ArrayList<Coding>();
6441      this.code.add(t);
6442      return this;
6443    }
6444
6445    /**
6446     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
6447     */
6448    public Coding getCodeFirstRep() { 
6449      if (getCode().isEmpty()) {
6450        addCode();
6451      }
6452      return getCode().get(0);
6453    }
6454
6455    /**
6456     * @return {@link #slicing} (Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).)
6457     */
6458    public ElementDefinitionSlicingComponent getSlicing() { 
6459      if (this.slicing == null)
6460        if (Configuration.errorOnAutoCreate())
6461          throw new Error("Attempt to auto-create ElementDefinition.slicing");
6462        else if (Configuration.doAutoCreate())
6463          this.slicing = new ElementDefinitionSlicingComponent(); // cc
6464      return this.slicing;
6465    }
6466
6467    public boolean hasSlicing() { 
6468      return this.slicing != null && !this.slicing.isEmpty();
6469    }
6470
6471    /**
6472     * @param value {@link #slicing} (Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).)
6473     */
6474    public ElementDefinition setSlicing(ElementDefinitionSlicingComponent value) { 
6475      this.slicing = value;
6476      return this;
6477    }
6478
6479    /**
6480     * @return {@link #short_} (A concise description of what this element means (e.g. for use in autogenerated summaries).). This is the underlying object with id, value and extensions. The accessor "getShort" gives direct access to the value
6481     */
6482    public StringType getShortElement() { 
6483      if (this.short_ == null)
6484        if (Configuration.errorOnAutoCreate())
6485          throw new Error("Attempt to auto-create ElementDefinition.short_");
6486        else if (Configuration.doAutoCreate())
6487          this.short_ = new StringType(); // bb
6488      return this.short_;
6489    }
6490
6491    public boolean hasShortElement() { 
6492      return this.short_ != null && !this.short_.isEmpty();
6493    }
6494
6495    public boolean hasShort() { 
6496      return this.short_ != null && !this.short_.isEmpty();
6497    }
6498
6499    /**
6500     * @param value {@link #short_} (A concise description of what this element means (e.g. for use in autogenerated summaries).). This is the underlying object with id, value and extensions. The accessor "getShort" gives direct access to the value
6501     */
6502    public ElementDefinition setShortElement(StringType value) { 
6503      this.short_ = value;
6504      return this;
6505    }
6506
6507    /**
6508     * @return A concise description of what this element means (e.g. for use in autogenerated summaries).
6509     */
6510    public String getShort() { 
6511      return this.short_ == null ? null : this.short_.getValue();
6512    }
6513
6514    /**
6515     * @param value A concise description of what this element means (e.g. for use in autogenerated summaries).
6516     */
6517    public ElementDefinition setShort(String value) { 
6518      if (Utilities.noString(value))
6519        this.short_ = null;
6520      else {
6521        if (this.short_ == null)
6522          this.short_ = new StringType();
6523        this.short_.setValue(value);
6524      }
6525      return this;
6526    }
6527
6528    /**
6529     * @return {@link #definition} (Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
6530     */
6531    public MarkdownType getDefinitionElement() { 
6532      if (this.definition == null)
6533        if (Configuration.errorOnAutoCreate())
6534          throw new Error("Attempt to auto-create ElementDefinition.definition");
6535        else if (Configuration.doAutoCreate())
6536          this.definition = new MarkdownType(); // bb
6537      return this.definition;
6538    }
6539
6540    public boolean hasDefinitionElement() { 
6541      return this.definition != null && !this.definition.isEmpty();
6542    }
6543
6544    public boolean hasDefinition() { 
6545      return this.definition != null && !this.definition.isEmpty();
6546    }
6547
6548    /**
6549     * @param value {@link #definition} (Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
6550     */
6551    public ElementDefinition setDefinitionElement(MarkdownType value) { 
6552      this.definition = value;
6553      return this;
6554    }
6555
6556    /**
6557     * @return Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).
6558     */
6559    public String getDefinition() { 
6560      return this.definition == null ? null : this.definition.getValue();
6561    }
6562
6563    /**
6564     * @param value Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource. (Note: The text you are reading is specified in ElementDefinition.definition).
6565     */
6566    public ElementDefinition setDefinition(String value) { 
6567      if (Utilities.noString(value))
6568        this.definition = null;
6569      else {
6570        if (this.definition == null)
6571          this.definition = new MarkdownType();
6572        this.definition.setValue(value);
6573      }
6574      return this;
6575    }
6576
6577    /**
6578     * @return {@link #comment} (Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
6579     */
6580    public MarkdownType getCommentElement() { 
6581      if (this.comment == null)
6582        if (Configuration.errorOnAutoCreate())
6583          throw new Error("Attempt to auto-create ElementDefinition.comment");
6584        else if (Configuration.doAutoCreate())
6585          this.comment = new MarkdownType(); // bb
6586      return this.comment;
6587    }
6588
6589    public boolean hasCommentElement() { 
6590      return this.comment != null && !this.comment.isEmpty();
6591    }
6592
6593    public boolean hasComment() { 
6594      return this.comment != null && !this.comment.isEmpty();
6595    }
6596
6597    /**
6598     * @param value {@link #comment} (Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
6599     */
6600    public ElementDefinition setCommentElement(MarkdownType value) { 
6601      this.comment = value;
6602      return this;
6603    }
6604
6605    /**
6606     * @return Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).
6607     */
6608    public String getComment() { 
6609      return this.comment == null ? null : this.comment.getValue();
6610    }
6611
6612    /**
6613     * @param value Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc. (Note: The text you are reading is specified in ElementDefinition.comment).
6614     */
6615    public ElementDefinition setComment(String value) { 
6616      if (Utilities.noString(value))
6617        this.comment = null;
6618      else {
6619        if (this.comment == null)
6620          this.comment = new MarkdownType();
6621        this.comment.setValue(value);
6622      }
6623      return this;
6624    }
6625
6626    /**
6627     * @return {@link #requirements} (This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
6628     */
6629    public MarkdownType getRequirementsElement() { 
6630      if (this.requirements == null)
6631        if (Configuration.errorOnAutoCreate())
6632          throw new Error("Attempt to auto-create ElementDefinition.requirements");
6633        else if (Configuration.doAutoCreate())
6634          this.requirements = new MarkdownType(); // bb
6635      return this.requirements;
6636    }
6637
6638    public boolean hasRequirementsElement() { 
6639      return this.requirements != null && !this.requirements.isEmpty();
6640    }
6641
6642    public boolean hasRequirements() { 
6643      return this.requirements != null && !this.requirements.isEmpty();
6644    }
6645
6646    /**
6647     * @param value {@link #requirements} (This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
6648     */
6649    public ElementDefinition setRequirementsElement(MarkdownType value) { 
6650      this.requirements = value;
6651      return this;
6652    }
6653
6654    /**
6655     * @return This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
6656     */
6657    public String getRequirements() { 
6658      return this.requirements == null ? null : this.requirements.getValue();
6659    }
6660
6661    /**
6662     * @param value This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
6663     */
6664    public ElementDefinition setRequirements(String value) { 
6665      if (Utilities.noString(value))
6666        this.requirements = null;
6667      else {
6668        if (this.requirements == null)
6669          this.requirements = new MarkdownType();
6670        this.requirements.setValue(value);
6671      }
6672      return this;
6673    }
6674
6675    /**
6676     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
6677     */
6678    public List<StringType> getAlias() { 
6679      if (this.alias == null)
6680        this.alias = new ArrayList<StringType>();
6681      return this.alias;
6682    }
6683
6684    /**
6685     * @return Returns a reference to <code>this</code> for easy method chaining
6686     */
6687    public ElementDefinition setAlias(List<StringType> theAlias) { 
6688      this.alias = theAlias;
6689      return this;
6690    }
6691
6692    public boolean hasAlias() { 
6693      if (this.alias == null)
6694        return false;
6695      for (StringType item : this.alias)
6696        if (!item.isEmpty())
6697          return true;
6698      return false;
6699    }
6700
6701    /**
6702     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
6703     */
6704    public StringType addAliasElement() {//2 
6705      StringType t = new StringType();
6706      if (this.alias == null)
6707        this.alias = new ArrayList<StringType>();
6708      this.alias.add(t);
6709      return t;
6710    }
6711
6712    /**
6713     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
6714     */
6715    public ElementDefinition addAlias(String value) { //1
6716      StringType t = new StringType();
6717      t.setValue(value);
6718      if (this.alias == null)
6719        this.alias = new ArrayList<StringType>();
6720      this.alias.add(t);
6721      return this;
6722    }
6723
6724    /**
6725     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
6726     */
6727    public boolean hasAlias(String value) { 
6728      if (this.alias == null)
6729        return false;
6730      for (StringType v : this.alias)
6731        if (v.getValue().equals(value)) // string
6732          return true;
6733      return false;
6734    }
6735
6736    /**
6737     * @return {@link #min} (The minimum number of times this element SHALL appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
6738     */
6739    public UnsignedIntType getMinElement() { 
6740      if (this.min == null)
6741        if (Configuration.errorOnAutoCreate())
6742          throw new Error("Attempt to auto-create ElementDefinition.min");
6743        else if (Configuration.doAutoCreate())
6744          this.min = new UnsignedIntType(); // bb
6745      return this.min;
6746    }
6747
6748    public boolean hasMinElement() { 
6749      return this.min != null && !this.min.isEmpty();
6750    }
6751
6752    public boolean hasMin() { 
6753      return this.min != null && !this.min.isEmpty();
6754    }
6755
6756    /**
6757     * @param value {@link #min} (The minimum number of times this element SHALL appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
6758     */
6759    public ElementDefinition setMinElement(UnsignedIntType value) { 
6760      this.min = value;
6761      return this;
6762    }
6763
6764    /**
6765     * @return The minimum number of times this element SHALL appear in the instance.
6766     */
6767    public int getMin() { 
6768      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
6769    }
6770
6771    /**
6772     * @param value The minimum number of times this element SHALL appear in the instance.
6773     */
6774    public ElementDefinition setMin(int value) { 
6775        if (this.min == null)
6776          this.min = new UnsignedIntType();
6777        this.min.setValue(value);
6778      return this;
6779    }
6780
6781    /**
6782     * @return {@link #max} (The maximum number of times this element is permitted to appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
6783     */
6784    public StringType getMaxElement() { 
6785      if (this.max == null)
6786        if (Configuration.errorOnAutoCreate())
6787          throw new Error("Attempt to auto-create ElementDefinition.max");
6788        else if (Configuration.doAutoCreate())
6789          this.max = new StringType(); // bb
6790      return this.max;
6791    }
6792
6793    public boolean hasMaxElement() { 
6794      return this.max != null && !this.max.isEmpty();
6795    }
6796
6797    public boolean hasMax() { 
6798      return this.max != null && !this.max.isEmpty();
6799    }
6800
6801    /**
6802     * @param value {@link #max} (The maximum number of times this element is permitted to appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
6803     */
6804    public ElementDefinition setMaxElement(StringType value) { 
6805      this.max = value;
6806      return this;
6807    }
6808
6809    /**
6810     * @return The maximum number of times this element is permitted to appear in the instance.
6811     */
6812    public String getMax() { 
6813      return this.max == null ? null : this.max.getValue();
6814    }
6815
6816    /**
6817     * @param value The maximum number of times this element is permitted to appear in the instance.
6818     */
6819    public ElementDefinition setMax(String value) { 
6820      if (Utilities.noString(value))
6821        this.max = null;
6822      else {
6823        if (this.max == null)
6824          this.max = new StringType();
6825        this.max.setValue(value);
6826      }
6827      return this;
6828    }
6829
6830    /**
6831     * @return {@link #base} (Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the derived and related profiles. When the element definition is not the original definition of an element - e.g. either in a constraint on another type, or for elements from a super type in a snap shot - then the information in provided in the element definition may be different to the base definition. On the original definition of the element, it will be same.)
6832     */
6833    public ElementDefinitionBaseComponent getBase() { 
6834      if (this.base == null)
6835        if (Configuration.errorOnAutoCreate())
6836          throw new Error("Attempt to auto-create ElementDefinition.base");
6837        else if (Configuration.doAutoCreate())
6838          this.base = new ElementDefinitionBaseComponent(); // cc
6839      return this.base;
6840    }
6841
6842    public boolean hasBase() { 
6843      return this.base != null && !this.base.isEmpty();
6844    }
6845
6846    /**
6847     * @param value {@link #base} (Information about the base definition of the element, provided to make it unnecessary for tools to trace the deviation of the element through the derived and related profiles. When the element definition is not the original definition of an element - e.g. either in a constraint on another type, or for elements from a super type in a snap shot - then the information in provided in the element definition may be different to the base definition. On the original definition of the element, it will be same.)
6848     */
6849    public ElementDefinition setBase(ElementDefinitionBaseComponent value) { 
6850      this.base = value;
6851      return this;
6852    }
6853
6854    /**
6855     * @return {@link #contentReference} (Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.). This is the underlying object with id, value and extensions. The accessor "getContentReference" gives direct access to the value
6856     */
6857    public UriType getContentReferenceElement() { 
6858      if (this.contentReference == null)
6859        if (Configuration.errorOnAutoCreate())
6860          throw new Error("Attempt to auto-create ElementDefinition.contentReference");
6861        else if (Configuration.doAutoCreate())
6862          this.contentReference = new UriType(); // bb
6863      return this.contentReference;
6864    }
6865
6866    public boolean hasContentReferenceElement() { 
6867      return this.contentReference != null && !this.contentReference.isEmpty();
6868    }
6869
6870    public boolean hasContentReference() { 
6871      return this.contentReference != null && !this.contentReference.isEmpty();
6872    }
6873
6874    /**
6875     * @param value {@link #contentReference} (Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.). This is the underlying object with id, value and extensions. The accessor "getContentReference" gives direct access to the value
6876     */
6877    public ElementDefinition setContentReferenceElement(UriType value) { 
6878      this.contentReference = value;
6879      return this;
6880    }
6881
6882    /**
6883     * @return Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.
6884     */
6885    public String getContentReference() { 
6886      return this.contentReference == null ? null : this.contentReference.getValue();
6887    }
6888
6889    /**
6890     * @param value Identifies an element defined elsewhere in the definition whose content rules should be applied to the current element. ContentReferences bring across all the rules that are in the ElementDefinition for the element, including definitions, cardinality constraints, bindings, invariants etc.
6891     */
6892    public ElementDefinition setContentReference(String value) { 
6893      if (Utilities.noString(value))
6894        this.contentReference = null;
6895      else {
6896        if (this.contentReference == null)
6897          this.contentReference = new UriType();
6898        this.contentReference.setValue(value);
6899      }
6900      return this;
6901    }
6902
6903    /**
6904     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
6905     */
6906    public List<TypeRefComponent> getType() { 
6907      if (this.type == null)
6908        this.type = new ArrayList<TypeRefComponent>();
6909      return this.type;
6910    }
6911
6912    /**
6913     * @return Returns a reference to <code>this</code> for easy method chaining
6914     */
6915    public ElementDefinition setType(List<TypeRefComponent> theType) { 
6916      this.type = theType;
6917      return this;
6918    }
6919
6920    public boolean hasType() { 
6921      if (this.type == null)
6922        return false;
6923      for (TypeRefComponent item : this.type)
6924        if (!item.isEmpty())
6925          return true;
6926      return false;
6927    }
6928
6929    public TypeRefComponent addType() { //3
6930      TypeRefComponent t = new TypeRefComponent();
6931      if (this.type == null)
6932        this.type = new ArrayList<TypeRefComponent>();
6933      this.type.add(t);
6934      return t;
6935    }
6936
6937    public ElementDefinition addType(TypeRefComponent t) { //3
6938      if (t == null)
6939        return this;
6940      if (this.type == null)
6941        this.type = new ArrayList<TypeRefComponent>();
6942      this.type.add(t);
6943      return this;
6944    }
6945
6946    /**
6947     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
6948     */
6949    public TypeRefComponent getTypeFirstRep() { 
6950      if (getType().isEmpty()) {
6951        addType();
6952      }
6953      return getType().get(0);
6954    }
6955
6956    /**
6957     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
6958     */
6959    public DataType getDefaultValue() { 
6960      return this.defaultValue;
6961    }
6962
6963    /**
6964     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
6965     */
6966    public Base64BinaryType getDefaultValueBase64BinaryType() throws FHIRException { 
6967      if (this.defaultValue == null)
6968        this.defaultValue = new Base64BinaryType();
6969      if (!(this.defaultValue instanceof Base64BinaryType))
6970        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6971      return (Base64BinaryType) this.defaultValue;
6972    }
6973
6974    public boolean hasDefaultValueBase64BinaryType() { 
6975      return this != null && this.defaultValue instanceof Base64BinaryType;
6976    }
6977
6978    /**
6979     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
6980     */
6981    public BooleanType getDefaultValueBooleanType() throws FHIRException { 
6982      if (this.defaultValue == null)
6983        this.defaultValue = new BooleanType();
6984      if (!(this.defaultValue instanceof BooleanType))
6985        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6986      return (BooleanType) this.defaultValue;
6987    }
6988
6989    public boolean hasDefaultValueBooleanType() { 
6990      return this != null && this.defaultValue instanceof BooleanType;
6991    }
6992
6993    /**
6994     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
6995     */
6996    public CanonicalType getDefaultValueCanonicalType() throws FHIRException { 
6997      if (this.defaultValue == null)
6998        this.defaultValue = new CanonicalType();
6999      if (!(this.defaultValue instanceof CanonicalType))
7000        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7001      return (CanonicalType) this.defaultValue;
7002    }
7003
7004    public boolean hasDefaultValueCanonicalType() { 
7005      return this != null && this.defaultValue instanceof CanonicalType;
7006    }
7007
7008    /**
7009     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7010     */
7011    public CodeType getDefaultValueCodeType() throws FHIRException { 
7012      if (this.defaultValue == null)
7013        this.defaultValue = new CodeType();
7014      if (!(this.defaultValue instanceof CodeType))
7015        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7016      return (CodeType) this.defaultValue;
7017    }
7018
7019    public boolean hasDefaultValueCodeType() { 
7020      return this != null && this.defaultValue instanceof CodeType;
7021    }
7022
7023    /**
7024     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7025     */
7026    public DateType getDefaultValueDateType() throws FHIRException { 
7027      if (this.defaultValue == null)
7028        this.defaultValue = new DateType();
7029      if (!(this.defaultValue instanceof DateType))
7030        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7031      return (DateType) this.defaultValue;
7032    }
7033
7034    public boolean hasDefaultValueDateType() { 
7035      return this != null && this.defaultValue instanceof DateType;
7036    }
7037
7038    /**
7039     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7040     */
7041    public DateTimeType getDefaultValueDateTimeType() throws FHIRException { 
7042      if (this.defaultValue == null)
7043        this.defaultValue = new DateTimeType();
7044      if (!(this.defaultValue instanceof DateTimeType))
7045        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7046      return (DateTimeType) this.defaultValue;
7047    }
7048
7049    public boolean hasDefaultValueDateTimeType() { 
7050      return this != null && this.defaultValue instanceof DateTimeType;
7051    }
7052
7053    /**
7054     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7055     */
7056    public DecimalType getDefaultValueDecimalType() throws FHIRException { 
7057      if (this.defaultValue == null)
7058        this.defaultValue = new DecimalType();
7059      if (!(this.defaultValue instanceof DecimalType))
7060        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7061      return (DecimalType) this.defaultValue;
7062    }
7063
7064    public boolean hasDefaultValueDecimalType() { 
7065      return this != null && this.defaultValue instanceof DecimalType;
7066    }
7067
7068    /**
7069     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7070     */
7071    public IdType getDefaultValueIdType() throws FHIRException { 
7072      if (this.defaultValue == null)
7073        this.defaultValue = new IdType();
7074      if (!(this.defaultValue instanceof IdType))
7075        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7076      return (IdType) this.defaultValue;
7077    }
7078
7079    public boolean hasDefaultValueIdType() { 
7080      return this != null && this.defaultValue instanceof IdType;
7081    }
7082
7083    /**
7084     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7085     */
7086    public InstantType getDefaultValueInstantType() throws FHIRException { 
7087      if (this.defaultValue == null)
7088        this.defaultValue = new InstantType();
7089      if (!(this.defaultValue instanceof InstantType))
7090        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7091      return (InstantType) this.defaultValue;
7092    }
7093
7094    public boolean hasDefaultValueInstantType() { 
7095      return this != null && this.defaultValue instanceof InstantType;
7096    }
7097
7098    /**
7099     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7100     */
7101    public IntegerType getDefaultValueIntegerType() throws FHIRException { 
7102      if (this.defaultValue == null)
7103        this.defaultValue = new IntegerType();
7104      if (!(this.defaultValue instanceof IntegerType))
7105        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7106      return (IntegerType) this.defaultValue;
7107    }
7108
7109    public boolean hasDefaultValueIntegerType() { 
7110      return this != null && this.defaultValue instanceof IntegerType;
7111    }
7112
7113    /**
7114     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7115     */
7116    public Integer64Type getDefaultValueInteger64Type() throws FHIRException { 
7117      if (this.defaultValue == null)
7118        this.defaultValue = new Integer64Type();
7119      if (!(this.defaultValue instanceof Integer64Type))
7120        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7121      return (Integer64Type) this.defaultValue;
7122    }
7123
7124    public boolean hasDefaultValueInteger64Type() { 
7125      return this != null && this.defaultValue instanceof Integer64Type;
7126    }
7127
7128    /**
7129     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7130     */
7131    public MarkdownType getDefaultValueMarkdownType() throws FHIRException { 
7132      if (this.defaultValue == null)
7133        this.defaultValue = new MarkdownType();
7134      if (!(this.defaultValue instanceof MarkdownType))
7135        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7136      return (MarkdownType) this.defaultValue;
7137    }
7138
7139    public boolean hasDefaultValueMarkdownType() { 
7140      return this != null && this.defaultValue instanceof MarkdownType;
7141    }
7142
7143    /**
7144     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7145     */
7146    public OidType getDefaultValueOidType() throws FHIRException { 
7147      if (this.defaultValue == null)
7148        this.defaultValue = new OidType();
7149      if (!(this.defaultValue instanceof OidType))
7150        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7151      return (OidType) this.defaultValue;
7152    }
7153
7154    public boolean hasDefaultValueOidType() { 
7155      return this != null && this.defaultValue instanceof OidType;
7156    }
7157
7158    /**
7159     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7160     */
7161    public PositiveIntType getDefaultValuePositiveIntType() throws FHIRException { 
7162      if (this.defaultValue == null)
7163        this.defaultValue = new PositiveIntType();
7164      if (!(this.defaultValue instanceof PositiveIntType))
7165        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7166      return (PositiveIntType) this.defaultValue;
7167    }
7168
7169    public boolean hasDefaultValuePositiveIntType() { 
7170      return this != null && this.defaultValue instanceof PositiveIntType;
7171    }
7172
7173    /**
7174     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7175     */
7176    public StringType getDefaultValueStringType() throws FHIRException { 
7177      if (this.defaultValue == null)
7178        this.defaultValue = new StringType();
7179      if (!(this.defaultValue instanceof StringType))
7180        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7181      return (StringType) this.defaultValue;
7182    }
7183
7184    public boolean hasDefaultValueStringType() { 
7185      return this != null && this.defaultValue instanceof StringType;
7186    }
7187
7188    /**
7189     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7190     */
7191    public TimeType getDefaultValueTimeType() throws FHIRException { 
7192      if (this.defaultValue == null)
7193        this.defaultValue = new TimeType();
7194      if (!(this.defaultValue instanceof TimeType))
7195        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7196      return (TimeType) this.defaultValue;
7197    }
7198
7199    public boolean hasDefaultValueTimeType() { 
7200      return this != null && this.defaultValue instanceof TimeType;
7201    }
7202
7203    /**
7204     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7205     */
7206    public UnsignedIntType getDefaultValueUnsignedIntType() throws FHIRException { 
7207      if (this.defaultValue == null)
7208        this.defaultValue = new UnsignedIntType();
7209      if (!(this.defaultValue instanceof UnsignedIntType))
7210        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7211      return (UnsignedIntType) this.defaultValue;
7212    }
7213
7214    public boolean hasDefaultValueUnsignedIntType() { 
7215      return this != null && this.defaultValue instanceof UnsignedIntType;
7216    }
7217
7218    /**
7219     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7220     */
7221    public UriType getDefaultValueUriType() throws FHIRException { 
7222      if (this.defaultValue == null)
7223        this.defaultValue = new UriType();
7224      if (!(this.defaultValue instanceof UriType))
7225        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7226      return (UriType) this.defaultValue;
7227    }
7228
7229    public boolean hasDefaultValueUriType() { 
7230      return this != null && this.defaultValue instanceof UriType;
7231    }
7232
7233    /**
7234     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7235     */
7236    public UrlType getDefaultValueUrlType() throws FHIRException { 
7237      if (this.defaultValue == null)
7238        this.defaultValue = new UrlType();
7239      if (!(this.defaultValue instanceof UrlType))
7240        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7241      return (UrlType) this.defaultValue;
7242    }
7243
7244    public boolean hasDefaultValueUrlType() { 
7245      return this != null && this.defaultValue instanceof UrlType;
7246    }
7247
7248    /**
7249     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7250     */
7251    public UuidType getDefaultValueUuidType() throws FHIRException { 
7252      if (this.defaultValue == null)
7253        this.defaultValue = new UuidType();
7254      if (!(this.defaultValue instanceof UuidType))
7255        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7256      return (UuidType) this.defaultValue;
7257    }
7258
7259    public boolean hasDefaultValueUuidType() { 
7260      return this != null && this.defaultValue instanceof UuidType;
7261    }
7262
7263    /**
7264     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7265     */
7266    public Address getDefaultValueAddress() throws FHIRException { 
7267      if (this.defaultValue == null)
7268        this.defaultValue = new Address();
7269      if (!(this.defaultValue instanceof Address))
7270        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7271      return (Address) this.defaultValue;
7272    }
7273
7274    public boolean hasDefaultValueAddress() { 
7275      return this != null && this.defaultValue instanceof Address;
7276    }
7277
7278    /**
7279     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7280     */
7281    public Age getDefaultValueAge() throws FHIRException { 
7282      if (this.defaultValue == null)
7283        this.defaultValue = new Age();
7284      if (!(this.defaultValue instanceof Age))
7285        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7286      return (Age) this.defaultValue;
7287    }
7288
7289    public boolean hasDefaultValueAge() { 
7290      return this != null && this.defaultValue instanceof Age;
7291    }
7292
7293    /**
7294     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7295     */
7296    public Annotation getDefaultValueAnnotation() throws FHIRException { 
7297      if (this.defaultValue == null)
7298        this.defaultValue = new Annotation();
7299      if (!(this.defaultValue instanceof Annotation))
7300        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7301      return (Annotation) this.defaultValue;
7302    }
7303
7304    public boolean hasDefaultValueAnnotation() { 
7305      return this != null && this.defaultValue instanceof Annotation;
7306    }
7307
7308    /**
7309     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7310     */
7311    public Attachment getDefaultValueAttachment() throws FHIRException { 
7312      if (this.defaultValue == null)
7313        this.defaultValue = new Attachment();
7314      if (!(this.defaultValue instanceof Attachment))
7315        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7316      return (Attachment) this.defaultValue;
7317    }
7318
7319    public boolean hasDefaultValueAttachment() { 
7320      return this != null && this.defaultValue instanceof Attachment;
7321    }
7322
7323    /**
7324     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7325     */
7326    public CodeableConcept getDefaultValueCodeableConcept() throws FHIRException { 
7327      if (this.defaultValue == null)
7328        this.defaultValue = new CodeableConcept();
7329      if (!(this.defaultValue instanceof CodeableConcept))
7330        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7331      return (CodeableConcept) this.defaultValue;
7332    }
7333
7334    public boolean hasDefaultValueCodeableConcept() { 
7335      return this != null && this.defaultValue instanceof CodeableConcept;
7336    }
7337
7338    /**
7339     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7340     */
7341    public CodeableReference getDefaultValueCodeableReference() throws FHIRException { 
7342      if (this.defaultValue == null)
7343        this.defaultValue = new CodeableReference();
7344      if (!(this.defaultValue instanceof CodeableReference))
7345        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7346      return (CodeableReference) this.defaultValue;
7347    }
7348
7349    public boolean hasDefaultValueCodeableReference() { 
7350      return this != null && this.defaultValue instanceof CodeableReference;
7351    }
7352
7353    /**
7354     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7355     */
7356    public Coding getDefaultValueCoding() throws FHIRException { 
7357      if (this.defaultValue == null)
7358        this.defaultValue = new Coding();
7359      if (!(this.defaultValue instanceof Coding))
7360        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7361      return (Coding) this.defaultValue;
7362    }
7363
7364    public boolean hasDefaultValueCoding() { 
7365      return this != null && this.defaultValue instanceof Coding;
7366    }
7367
7368    /**
7369     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7370     */
7371    public ContactPoint getDefaultValueContactPoint() throws FHIRException { 
7372      if (this.defaultValue == null)
7373        this.defaultValue = new ContactPoint();
7374      if (!(this.defaultValue instanceof ContactPoint))
7375        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7376      return (ContactPoint) this.defaultValue;
7377    }
7378
7379    public boolean hasDefaultValueContactPoint() { 
7380      return this != null && this.defaultValue instanceof ContactPoint;
7381    }
7382
7383    /**
7384     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7385     */
7386    public Count getDefaultValueCount() throws FHIRException { 
7387      if (this.defaultValue == null)
7388        this.defaultValue = new Count();
7389      if (!(this.defaultValue instanceof Count))
7390        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7391      return (Count) this.defaultValue;
7392    }
7393
7394    public boolean hasDefaultValueCount() { 
7395      return this != null && this.defaultValue instanceof Count;
7396    }
7397
7398    /**
7399     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7400     */
7401    public Distance getDefaultValueDistance() throws FHIRException { 
7402      if (this.defaultValue == null)
7403        this.defaultValue = new Distance();
7404      if (!(this.defaultValue instanceof Distance))
7405        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7406      return (Distance) this.defaultValue;
7407    }
7408
7409    public boolean hasDefaultValueDistance() { 
7410      return this != null && this.defaultValue instanceof Distance;
7411    }
7412
7413    /**
7414     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7415     */
7416    public Duration getDefaultValueDuration() throws FHIRException { 
7417      if (this.defaultValue == null)
7418        this.defaultValue = new Duration();
7419      if (!(this.defaultValue instanceof Duration))
7420        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7421      return (Duration) this.defaultValue;
7422    }
7423
7424    public boolean hasDefaultValueDuration() { 
7425      return this != null && this.defaultValue instanceof Duration;
7426    }
7427
7428    /**
7429     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7430     */
7431    public HumanName getDefaultValueHumanName() throws FHIRException { 
7432      if (this.defaultValue == null)
7433        this.defaultValue = new HumanName();
7434      if (!(this.defaultValue instanceof HumanName))
7435        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7436      return (HumanName) this.defaultValue;
7437    }
7438
7439    public boolean hasDefaultValueHumanName() { 
7440      return this != null && this.defaultValue instanceof HumanName;
7441    }
7442
7443    /**
7444     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7445     */
7446    public Identifier getDefaultValueIdentifier() throws FHIRException { 
7447      if (this.defaultValue == null)
7448        this.defaultValue = new Identifier();
7449      if (!(this.defaultValue instanceof Identifier))
7450        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7451      return (Identifier) this.defaultValue;
7452    }
7453
7454    public boolean hasDefaultValueIdentifier() { 
7455      return this != null && this.defaultValue instanceof Identifier;
7456    }
7457
7458    /**
7459     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7460     */
7461    public Money getDefaultValueMoney() throws FHIRException { 
7462      if (this.defaultValue == null)
7463        this.defaultValue = new Money();
7464      if (!(this.defaultValue instanceof Money))
7465        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7466      return (Money) this.defaultValue;
7467    }
7468
7469    public boolean hasDefaultValueMoney() { 
7470      return this != null && this.defaultValue instanceof Money;
7471    }
7472
7473    /**
7474     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7475     */
7476    public Period getDefaultValuePeriod() throws FHIRException { 
7477      if (this.defaultValue == null)
7478        this.defaultValue = new Period();
7479      if (!(this.defaultValue instanceof Period))
7480        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7481      return (Period) this.defaultValue;
7482    }
7483
7484    public boolean hasDefaultValuePeriod() { 
7485      return this != null && this.defaultValue instanceof Period;
7486    }
7487
7488    /**
7489     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7490     */
7491    public Quantity getDefaultValueQuantity() throws FHIRException { 
7492      if (this.defaultValue == null)
7493        this.defaultValue = new Quantity();
7494      if (!(this.defaultValue instanceof Quantity))
7495        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7496      return (Quantity) this.defaultValue;
7497    }
7498
7499    public boolean hasDefaultValueQuantity() { 
7500      return this != null && this.defaultValue instanceof Quantity;
7501    }
7502
7503    /**
7504     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7505     */
7506    public Range getDefaultValueRange() throws FHIRException { 
7507      if (this.defaultValue == null)
7508        this.defaultValue = new Range();
7509      if (!(this.defaultValue instanceof Range))
7510        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7511      return (Range) this.defaultValue;
7512    }
7513
7514    public boolean hasDefaultValueRange() { 
7515      return this != null && this.defaultValue instanceof Range;
7516    }
7517
7518    /**
7519     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7520     */
7521    public Ratio getDefaultValueRatio() throws FHIRException { 
7522      if (this.defaultValue == null)
7523        this.defaultValue = new Ratio();
7524      if (!(this.defaultValue instanceof Ratio))
7525        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7526      return (Ratio) this.defaultValue;
7527    }
7528
7529    public boolean hasDefaultValueRatio() { 
7530      return this != null && this.defaultValue instanceof Ratio;
7531    }
7532
7533    /**
7534     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7535     */
7536    public RatioRange getDefaultValueRatioRange() throws FHIRException { 
7537      if (this.defaultValue == null)
7538        this.defaultValue = new RatioRange();
7539      if (!(this.defaultValue instanceof RatioRange))
7540        throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7541      return (RatioRange) this.defaultValue;
7542    }
7543
7544    public boolean hasDefaultValueRatioRange() { 
7545      return this != null && this.defaultValue instanceof RatioRange;
7546    }
7547
7548    /**
7549     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7550     */
7551    public Reference getDefaultValueReference() throws FHIRException { 
7552      if (this.defaultValue == null)
7553        this.defaultValue = new Reference();
7554      if (!(this.defaultValue instanceof Reference))
7555        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7556      return (Reference) this.defaultValue;
7557    }
7558
7559    public boolean hasDefaultValueReference() { 
7560      return this != null && this.defaultValue instanceof Reference;
7561    }
7562
7563    /**
7564     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7565     */
7566    public SampledData getDefaultValueSampledData() throws FHIRException { 
7567      if (this.defaultValue == null)
7568        this.defaultValue = new SampledData();
7569      if (!(this.defaultValue instanceof SampledData))
7570        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7571      return (SampledData) this.defaultValue;
7572    }
7573
7574    public boolean hasDefaultValueSampledData() { 
7575      return this != null && this.defaultValue instanceof SampledData;
7576    }
7577
7578    /**
7579     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7580     */
7581    public Signature getDefaultValueSignature() throws FHIRException { 
7582      if (this.defaultValue == null)
7583        this.defaultValue = new Signature();
7584      if (!(this.defaultValue instanceof Signature))
7585        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7586      return (Signature) this.defaultValue;
7587    }
7588
7589    public boolean hasDefaultValueSignature() { 
7590      return this != null && this.defaultValue instanceof Signature;
7591    }
7592
7593    /**
7594     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7595     */
7596    public Timing getDefaultValueTiming() throws FHIRException { 
7597      if (this.defaultValue == null)
7598        this.defaultValue = new Timing();
7599      if (!(this.defaultValue instanceof Timing))
7600        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7601      return (Timing) this.defaultValue;
7602    }
7603
7604    public boolean hasDefaultValueTiming() { 
7605      return this != null && this.defaultValue instanceof Timing;
7606    }
7607
7608    /**
7609     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7610     */
7611    public ContactDetail getDefaultValueContactDetail() throws FHIRException { 
7612      if (this.defaultValue == null)
7613        this.defaultValue = new ContactDetail();
7614      if (!(this.defaultValue instanceof ContactDetail))
7615        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7616      return (ContactDetail) this.defaultValue;
7617    }
7618
7619    public boolean hasDefaultValueContactDetail() { 
7620      return this != null && this.defaultValue instanceof ContactDetail;
7621    }
7622
7623    /**
7624     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7625     */
7626    public DataRequirement getDefaultValueDataRequirement() throws FHIRException { 
7627      if (this.defaultValue == null)
7628        this.defaultValue = new DataRequirement();
7629      if (!(this.defaultValue instanceof DataRequirement))
7630        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7631      return (DataRequirement) this.defaultValue;
7632    }
7633
7634    public boolean hasDefaultValueDataRequirement() { 
7635      return this != null && this.defaultValue instanceof DataRequirement;
7636    }
7637
7638    /**
7639     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7640     */
7641    public Expression getDefaultValueExpression() throws FHIRException { 
7642      if (this.defaultValue == null)
7643        this.defaultValue = new Expression();
7644      if (!(this.defaultValue instanceof Expression))
7645        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7646      return (Expression) this.defaultValue;
7647    }
7648
7649    public boolean hasDefaultValueExpression() { 
7650      return this != null && this.defaultValue instanceof Expression;
7651    }
7652
7653    /**
7654     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7655     */
7656    public ParameterDefinition getDefaultValueParameterDefinition() throws FHIRException { 
7657      if (this.defaultValue == null)
7658        this.defaultValue = new ParameterDefinition();
7659      if (!(this.defaultValue instanceof ParameterDefinition))
7660        throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7661      return (ParameterDefinition) this.defaultValue;
7662    }
7663
7664    public boolean hasDefaultValueParameterDefinition() { 
7665      return this != null && this.defaultValue instanceof ParameterDefinition;
7666    }
7667
7668    /**
7669     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7670     */
7671    public RelatedArtifact getDefaultValueRelatedArtifact() throws FHIRException { 
7672      if (this.defaultValue == null)
7673        this.defaultValue = new RelatedArtifact();
7674      if (!(this.defaultValue instanceof RelatedArtifact))
7675        throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7676      return (RelatedArtifact) this.defaultValue;
7677    }
7678
7679    public boolean hasDefaultValueRelatedArtifact() { 
7680      return this != null && this.defaultValue instanceof RelatedArtifact;
7681    }
7682
7683    /**
7684     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7685     */
7686    public TriggerDefinition getDefaultValueTriggerDefinition() throws FHIRException { 
7687      if (this.defaultValue == null)
7688        this.defaultValue = new TriggerDefinition();
7689      if (!(this.defaultValue instanceof TriggerDefinition))
7690        throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7691      return (TriggerDefinition) this.defaultValue;
7692    }
7693
7694    public boolean hasDefaultValueTriggerDefinition() { 
7695      return this != null && this.defaultValue instanceof TriggerDefinition;
7696    }
7697
7698    /**
7699     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7700     */
7701    public UsageContext getDefaultValueUsageContext() throws FHIRException { 
7702      if (this.defaultValue == null)
7703        this.defaultValue = new UsageContext();
7704      if (!(this.defaultValue instanceof UsageContext))
7705        throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7706      return (UsageContext) this.defaultValue;
7707    }
7708
7709    public boolean hasDefaultValueUsageContext() { 
7710      return this != null && this.defaultValue instanceof UsageContext;
7711    }
7712
7713    /**
7714     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7715     */
7716    public Availability getDefaultValueAvailability() throws FHIRException { 
7717      if (this.defaultValue == null)
7718        this.defaultValue = new Availability();
7719      if (!(this.defaultValue instanceof Availability))
7720        throw new FHIRException("Type mismatch: the type Availability was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7721      return (Availability) this.defaultValue;
7722    }
7723
7724    public boolean hasDefaultValueAvailability() { 
7725      return this != null && this.defaultValue instanceof Availability;
7726    }
7727
7728    /**
7729     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7730     */
7731    public ExtendedContactDetail getDefaultValueExtendedContactDetail() throws FHIRException { 
7732      if (this.defaultValue == null)
7733        this.defaultValue = new ExtendedContactDetail();
7734      if (!(this.defaultValue instanceof ExtendedContactDetail))
7735        throw new FHIRException("Type mismatch: the type ExtendedContactDetail was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7736      return (ExtendedContactDetail) this.defaultValue;
7737    }
7738
7739    public boolean hasDefaultValueExtendedContactDetail() { 
7740      return this != null && this.defaultValue instanceof ExtendedContactDetail;
7741    }
7742
7743    /**
7744     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7745     */
7746    public Dosage getDefaultValueDosage() throws FHIRException { 
7747      if (this.defaultValue == null)
7748        this.defaultValue = new Dosage();
7749      if (!(this.defaultValue instanceof Dosage))
7750        throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7751      return (Dosage) this.defaultValue;
7752    }
7753
7754    public boolean hasDefaultValueDosage() { 
7755      return this != null && this.defaultValue instanceof Dosage;
7756    }
7757
7758    /**
7759     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7760     */
7761    public Meta getDefaultValueMeta() throws FHIRException { 
7762      if (this.defaultValue == null)
7763        this.defaultValue = new Meta();
7764      if (!(this.defaultValue instanceof Meta))
7765        throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
7766      return (Meta) this.defaultValue;
7767    }
7768
7769    public boolean hasDefaultValueMeta() { 
7770      return this != null && this.defaultValue instanceof Meta;
7771    }
7772
7773    public boolean hasDefaultValue() { 
7774      return this.defaultValue != null && !this.defaultValue.isEmpty();
7775    }
7776
7777    /**
7778     * @param value {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
7779     */
7780    public ElementDefinition setDefaultValue(DataType value) { 
7781      if (value != null && !(value instanceof Base64BinaryType || value instanceof BooleanType || value instanceof CanonicalType || value instanceof CodeType || value instanceof DateType || value instanceof DateTimeType || value instanceof DecimalType || value instanceof IdType || value instanceof InstantType || value instanceof IntegerType || value instanceof Integer64Type || value instanceof MarkdownType || value instanceof OidType || value instanceof PositiveIntType || value instanceof StringType || value instanceof TimeType || value instanceof UnsignedIntType || value instanceof UriType || value instanceof UrlType || value instanceof UuidType || value instanceof Address || value instanceof Age || value instanceof Annotation || value instanceof Attachment || value instanceof CodeableConcept || value instanceof CodeableReference || value instanceof Coding || value instanceof ContactPoint || value instanceof Count || value instanceof Distance || value instanceof Duration || value instanceof HumanName || value instanceof Identifier || value instanceof Money || value instanceof Period || value instanceof Quantity || value instanceof Range || value instanceof Ratio || value instanceof RatioRange || value instanceof Reference || value instanceof SampledData || value instanceof Signature || value instanceof Timing || value instanceof ContactDetail || value instanceof DataRequirement || value instanceof Expression || value instanceof ParameterDefinition || value instanceof RelatedArtifact || value instanceof TriggerDefinition || value instanceof UsageContext || value instanceof Availability || value instanceof ExtendedContactDetail || value instanceof Dosage || value instanceof Meta))
7782        throw new FHIRException("Not the right type for ElementDefinition.defaultValue[x]: "+value.fhirType());
7783      this.defaultValue = value;
7784      return this;
7785    }
7786
7787    /**
7788     * @return {@link #meaningWhenMissing} (The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').). This is the underlying object with id, value and extensions. The accessor "getMeaningWhenMissing" gives direct access to the value
7789     */
7790    public MarkdownType getMeaningWhenMissingElement() { 
7791      if (this.meaningWhenMissing == null)
7792        if (Configuration.errorOnAutoCreate())
7793          throw new Error("Attempt to auto-create ElementDefinition.meaningWhenMissing");
7794        else if (Configuration.doAutoCreate())
7795          this.meaningWhenMissing = new MarkdownType(); // bb
7796      return this.meaningWhenMissing;
7797    }
7798
7799    public boolean hasMeaningWhenMissingElement() { 
7800      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
7801    }
7802
7803    public boolean hasMeaningWhenMissing() { 
7804      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
7805    }
7806
7807    /**
7808     * @param value {@link #meaningWhenMissing} (The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').). This is the underlying object with id, value and extensions. The accessor "getMeaningWhenMissing" gives direct access to the value
7809     */
7810    public ElementDefinition setMeaningWhenMissingElement(MarkdownType value) { 
7811      this.meaningWhenMissing = value;
7812      return this;
7813    }
7814
7815    /**
7816     * @return The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').
7817     */
7818    public String getMeaningWhenMissing() { 
7819      return this.meaningWhenMissing == null ? null : this.meaningWhenMissing.getValue();
7820    }
7821
7822    /**
7823     * @param value The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').
7824     */
7825    public ElementDefinition setMeaningWhenMissing(String value) { 
7826      if (Utilities.noString(value))
7827        this.meaningWhenMissing = null;
7828      else {
7829        if (this.meaningWhenMissing == null)
7830          this.meaningWhenMissing = new MarkdownType();
7831        this.meaningWhenMissing.setValue(value);
7832      }
7833      return this;
7834    }
7835
7836    /**
7837     * @return {@link #orderMeaning} (If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.). This is the underlying object with id, value and extensions. The accessor "getOrderMeaning" gives direct access to the value
7838     */
7839    public StringType getOrderMeaningElement() { 
7840      if (this.orderMeaning == null)
7841        if (Configuration.errorOnAutoCreate())
7842          throw new Error("Attempt to auto-create ElementDefinition.orderMeaning");
7843        else if (Configuration.doAutoCreate())
7844          this.orderMeaning = new StringType(); // bb
7845      return this.orderMeaning;
7846    }
7847
7848    public boolean hasOrderMeaningElement() { 
7849      return this.orderMeaning != null && !this.orderMeaning.isEmpty();
7850    }
7851
7852    public boolean hasOrderMeaning() { 
7853      return this.orderMeaning != null && !this.orderMeaning.isEmpty();
7854    }
7855
7856    /**
7857     * @param value {@link #orderMeaning} (If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.). This is the underlying object with id, value and extensions. The accessor "getOrderMeaning" gives direct access to the value
7858     */
7859    public ElementDefinition setOrderMeaningElement(StringType value) { 
7860      this.orderMeaning = value;
7861      return this;
7862    }
7863
7864    /**
7865     * @return If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.
7866     */
7867    public String getOrderMeaning() { 
7868      return this.orderMeaning == null ? null : this.orderMeaning.getValue();
7869    }
7870
7871    /**
7872     * @param value If present, indicates that the order of the repeating element has meaning and describes what that meaning is.  If absent, it means that the order of the element has no meaning.
7873     */
7874    public ElementDefinition setOrderMeaning(String value) { 
7875      if (Utilities.noString(value))
7876        this.orderMeaning = null;
7877      else {
7878        if (this.orderMeaning == null)
7879          this.orderMeaning = new StringType();
7880        this.orderMeaning.setValue(value);
7881      }
7882      return this;
7883    }
7884
7885    /**
7886     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7887     */
7888    public DataType getFixed() { 
7889      return this.fixed;
7890    }
7891
7892    /**
7893     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7894     */
7895    public Base64BinaryType getFixedBase64BinaryType() throws FHIRException { 
7896      if (this.fixed == null)
7897        this.fixed = new Base64BinaryType();
7898      if (!(this.fixed instanceof Base64BinaryType))
7899        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7900      return (Base64BinaryType) this.fixed;
7901    }
7902
7903    public boolean hasFixedBase64BinaryType() { 
7904      return this != null && this.fixed instanceof Base64BinaryType;
7905    }
7906
7907    /**
7908     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7909     */
7910    public BooleanType getFixedBooleanType() throws FHIRException { 
7911      if (this.fixed == null)
7912        this.fixed = new BooleanType();
7913      if (!(this.fixed instanceof BooleanType))
7914        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7915      return (BooleanType) this.fixed;
7916    }
7917
7918    public boolean hasFixedBooleanType() { 
7919      return this != null && this.fixed instanceof BooleanType;
7920    }
7921
7922    /**
7923     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7924     */
7925    public CanonicalType getFixedCanonicalType() throws FHIRException { 
7926      if (this.fixed == null)
7927        this.fixed = new CanonicalType();
7928      if (!(this.fixed instanceof CanonicalType))
7929        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7930      return (CanonicalType) this.fixed;
7931    }
7932
7933    public boolean hasFixedCanonicalType() { 
7934      return this != null && this.fixed instanceof CanonicalType;
7935    }
7936
7937    /**
7938     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7939     */
7940    public CodeType getFixedCodeType() throws FHIRException { 
7941      if (this.fixed == null)
7942        this.fixed = new CodeType();
7943      if (!(this.fixed instanceof CodeType))
7944        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7945      return (CodeType) this.fixed;
7946    }
7947
7948    public boolean hasFixedCodeType() { 
7949      return this != null && this.fixed instanceof CodeType;
7950    }
7951
7952    /**
7953     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7954     */
7955    public DateType getFixedDateType() throws FHIRException { 
7956      if (this.fixed == null)
7957        this.fixed = new DateType();
7958      if (!(this.fixed instanceof DateType))
7959        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7960      return (DateType) this.fixed;
7961    }
7962
7963    public boolean hasFixedDateType() { 
7964      return this != null && this.fixed instanceof DateType;
7965    }
7966
7967    /**
7968     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7969     */
7970    public DateTimeType getFixedDateTimeType() throws FHIRException { 
7971      if (this.fixed == null)
7972        this.fixed = new DateTimeType();
7973      if (!(this.fixed instanceof DateTimeType))
7974        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7975      return (DateTimeType) this.fixed;
7976    }
7977
7978    public boolean hasFixedDateTimeType() { 
7979      return this != null && this.fixed instanceof DateTimeType;
7980    }
7981
7982    /**
7983     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7984     */
7985    public DecimalType getFixedDecimalType() throws FHIRException { 
7986      if (this.fixed == null)
7987        this.fixed = new DecimalType();
7988      if (!(this.fixed instanceof DecimalType))
7989        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7990      return (DecimalType) this.fixed;
7991    }
7992
7993    public boolean hasFixedDecimalType() { 
7994      return this != null && this.fixed instanceof DecimalType;
7995    }
7996
7997    /**
7998     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
7999     */
8000    public IdType getFixedIdType() throws FHIRException { 
8001      if (this.fixed == null)
8002        this.fixed = new IdType();
8003      if (!(this.fixed instanceof IdType))
8004        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8005      return (IdType) this.fixed;
8006    }
8007
8008    public boolean hasFixedIdType() { 
8009      return this != null && this.fixed instanceof IdType;
8010    }
8011
8012    /**
8013     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8014     */
8015    public InstantType getFixedInstantType() throws FHIRException { 
8016      if (this.fixed == null)
8017        this.fixed = new InstantType();
8018      if (!(this.fixed instanceof InstantType))
8019        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8020      return (InstantType) this.fixed;
8021    }
8022
8023    public boolean hasFixedInstantType() { 
8024      return this != null && this.fixed instanceof InstantType;
8025    }
8026
8027    /**
8028     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8029     */
8030    public IntegerType getFixedIntegerType() throws FHIRException { 
8031      if (this.fixed == null)
8032        this.fixed = new IntegerType();
8033      if (!(this.fixed instanceof IntegerType))
8034        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8035      return (IntegerType) this.fixed;
8036    }
8037
8038    public boolean hasFixedIntegerType() { 
8039      return this != null && this.fixed instanceof IntegerType;
8040    }
8041
8042    /**
8043     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8044     */
8045    public Integer64Type getFixedInteger64Type() throws FHIRException { 
8046      if (this.fixed == null)
8047        this.fixed = new Integer64Type();
8048      if (!(this.fixed instanceof Integer64Type))
8049        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.fixed.getClass().getName()+" was encountered");
8050      return (Integer64Type) this.fixed;
8051    }
8052
8053    public boolean hasFixedInteger64Type() { 
8054      return this != null && this.fixed instanceof Integer64Type;
8055    }
8056
8057    /**
8058     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8059     */
8060    public MarkdownType getFixedMarkdownType() throws FHIRException { 
8061      if (this.fixed == null)
8062        this.fixed = new MarkdownType();
8063      if (!(this.fixed instanceof MarkdownType))
8064        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8065      return (MarkdownType) this.fixed;
8066    }
8067
8068    public boolean hasFixedMarkdownType() { 
8069      return this != null && this.fixed instanceof MarkdownType;
8070    }
8071
8072    /**
8073     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8074     */
8075    public OidType getFixedOidType() throws FHIRException { 
8076      if (this.fixed == null)
8077        this.fixed = new OidType();
8078      if (!(this.fixed instanceof OidType))
8079        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8080      return (OidType) this.fixed;
8081    }
8082
8083    public boolean hasFixedOidType() { 
8084      return this != null && this.fixed instanceof OidType;
8085    }
8086
8087    /**
8088     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8089     */
8090    public PositiveIntType getFixedPositiveIntType() throws FHIRException { 
8091      if (this.fixed == null)
8092        this.fixed = new PositiveIntType();
8093      if (!(this.fixed instanceof PositiveIntType))
8094        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8095      return (PositiveIntType) this.fixed;
8096    }
8097
8098    public boolean hasFixedPositiveIntType() { 
8099      return this != null && this.fixed instanceof PositiveIntType;
8100    }
8101
8102    /**
8103     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8104     */
8105    public StringType getFixedStringType() throws FHIRException { 
8106      if (this.fixed == null)
8107        this.fixed = new StringType();
8108      if (!(this.fixed instanceof StringType))
8109        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8110      return (StringType) this.fixed;
8111    }
8112
8113    public boolean hasFixedStringType() { 
8114      return this != null && this.fixed instanceof StringType;
8115    }
8116
8117    /**
8118     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8119     */
8120    public TimeType getFixedTimeType() throws FHIRException { 
8121      if (this.fixed == null)
8122        this.fixed = new TimeType();
8123      if (!(this.fixed instanceof TimeType))
8124        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8125      return (TimeType) this.fixed;
8126    }
8127
8128    public boolean hasFixedTimeType() { 
8129      return this != null && this.fixed instanceof TimeType;
8130    }
8131
8132    /**
8133     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8134     */
8135    public UnsignedIntType getFixedUnsignedIntType() throws FHIRException { 
8136      if (this.fixed == null)
8137        this.fixed = new UnsignedIntType();
8138      if (!(this.fixed instanceof UnsignedIntType))
8139        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8140      return (UnsignedIntType) this.fixed;
8141    }
8142
8143    public boolean hasFixedUnsignedIntType() { 
8144      return this != null && this.fixed instanceof UnsignedIntType;
8145    }
8146
8147    /**
8148     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8149     */
8150    public UriType getFixedUriType() throws FHIRException { 
8151      if (this.fixed == null)
8152        this.fixed = new UriType();
8153      if (!(this.fixed instanceof UriType))
8154        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8155      return (UriType) this.fixed;
8156    }
8157
8158    public boolean hasFixedUriType() { 
8159      return this != null && this.fixed instanceof UriType;
8160    }
8161
8162    /**
8163     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8164     */
8165    public UrlType getFixedUrlType() throws FHIRException { 
8166      if (this.fixed == null)
8167        this.fixed = new UrlType();
8168      if (!(this.fixed instanceof UrlType))
8169        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8170      return (UrlType) this.fixed;
8171    }
8172
8173    public boolean hasFixedUrlType() { 
8174      return this != null && this.fixed instanceof UrlType;
8175    }
8176
8177    /**
8178     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8179     */
8180    public UuidType getFixedUuidType() throws FHIRException { 
8181      if (this.fixed == null)
8182        this.fixed = new UuidType();
8183      if (!(this.fixed instanceof UuidType))
8184        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.fixed.getClass().getName()+" was encountered");
8185      return (UuidType) this.fixed;
8186    }
8187
8188    public boolean hasFixedUuidType() { 
8189      return this != null && this.fixed instanceof UuidType;
8190    }
8191
8192    /**
8193     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8194     */
8195    public Address getFixedAddress() throws FHIRException { 
8196      if (this.fixed == null)
8197        this.fixed = new Address();
8198      if (!(this.fixed instanceof Address))
8199        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.fixed.getClass().getName()+" was encountered");
8200      return (Address) this.fixed;
8201    }
8202
8203    public boolean hasFixedAddress() { 
8204      return this != null && this.fixed instanceof Address;
8205    }
8206
8207    /**
8208     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8209     */
8210    public Age getFixedAge() throws FHIRException { 
8211      if (this.fixed == null)
8212        this.fixed = new Age();
8213      if (!(this.fixed instanceof Age))
8214        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.fixed.getClass().getName()+" was encountered");
8215      return (Age) this.fixed;
8216    }
8217
8218    public boolean hasFixedAge() { 
8219      return this != null && this.fixed instanceof Age;
8220    }
8221
8222    /**
8223     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8224     */
8225    public Annotation getFixedAnnotation() throws FHIRException { 
8226      if (this.fixed == null)
8227        this.fixed = new Annotation();
8228      if (!(this.fixed instanceof Annotation))
8229        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.fixed.getClass().getName()+" was encountered");
8230      return (Annotation) this.fixed;
8231    }
8232
8233    public boolean hasFixedAnnotation() { 
8234      return this != null && this.fixed instanceof Annotation;
8235    }
8236
8237    /**
8238     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8239     */
8240    public Attachment getFixedAttachment() throws FHIRException { 
8241      if (this.fixed == null)
8242        this.fixed = new Attachment();
8243      if (!(this.fixed instanceof Attachment))
8244        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.fixed.getClass().getName()+" was encountered");
8245      return (Attachment) this.fixed;
8246    }
8247
8248    public boolean hasFixedAttachment() { 
8249      return this != null && this.fixed instanceof Attachment;
8250    }
8251
8252    /**
8253     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8254     */
8255    public CodeableConcept getFixedCodeableConcept() throws FHIRException { 
8256      if (this.fixed == null)
8257        this.fixed = new CodeableConcept();
8258      if (!(this.fixed instanceof CodeableConcept))
8259        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.fixed.getClass().getName()+" was encountered");
8260      return (CodeableConcept) this.fixed;
8261    }
8262
8263    public boolean hasFixedCodeableConcept() { 
8264      return this != null && this.fixed instanceof CodeableConcept;
8265    }
8266
8267    /**
8268     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8269     */
8270    public CodeableReference getFixedCodeableReference() throws FHIRException { 
8271      if (this.fixed == null)
8272        this.fixed = new CodeableReference();
8273      if (!(this.fixed instanceof CodeableReference))
8274        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.fixed.getClass().getName()+" was encountered");
8275      return (CodeableReference) this.fixed;
8276    }
8277
8278    public boolean hasFixedCodeableReference() { 
8279      return this != null && this.fixed instanceof CodeableReference;
8280    }
8281
8282    /**
8283     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8284     */
8285    public Coding getFixedCoding() throws FHIRException { 
8286      if (this.fixed == null)
8287        this.fixed = new Coding();
8288      if (!(this.fixed instanceof Coding))
8289        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.fixed.getClass().getName()+" was encountered");
8290      return (Coding) this.fixed;
8291    }
8292
8293    public boolean hasFixedCoding() { 
8294      return this != null && this.fixed instanceof Coding;
8295    }
8296
8297    /**
8298     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8299     */
8300    public ContactPoint getFixedContactPoint() throws FHIRException { 
8301      if (this.fixed == null)
8302        this.fixed = new ContactPoint();
8303      if (!(this.fixed instanceof ContactPoint))
8304        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.fixed.getClass().getName()+" was encountered");
8305      return (ContactPoint) this.fixed;
8306    }
8307
8308    public boolean hasFixedContactPoint() { 
8309      return this != null && this.fixed instanceof ContactPoint;
8310    }
8311
8312    /**
8313     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8314     */
8315    public Count getFixedCount() throws FHIRException { 
8316      if (this.fixed == null)
8317        this.fixed = new Count();
8318      if (!(this.fixed instanceof Count))
8319        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.fixed.getClass().getName()+" was encountered");
8320      return (Count) this.fixed;
8321    }
8322
8323    public boolean hasFixedCount() { 
8324      return this != null && this.fixed instanceof Count;
8325    }
8326
8327    /**
8328     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8329     */
8330    public Distance getFixedDistance() throws FHIRException { 
8331      if (this.fixed == null)
8332        this.fixed = new Distance();
8333      if (!(this.fixed instanceof Distance))
8334        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.fixed.getClass().getName()+" was encountered");
8335      return (Distance) this.fixed;
8336    }
8337
8338    public boolean hasFixedDistance() { 
8339      return this != null && this.fixed instanceof Distance;
8340    }
8341
8342    /**
8343     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8344     */
8345    public Duration getFixedDuration() throws FHIRException { 
8346      if (this.fixed == null)
8347        this.fixed = new Duration();
8348      if (!(this.fixed instanceof Duration))
8349        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.fixed.getClass().getName()+" was encountered");
8350      return (Duration) this.fixed;
8351    }
8352
8353    public boolean hasFixedDuration() { 
8354      return this != null && this.fixed instanceof Duration;
8355    }
8356
8357    /**
8358     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8359     */
8360    public HumanName getFixedHumanName() throws FHIRException { 
8361      if (this.fixed == null)
8362        this.fixed = new HumanName();
8363      if (!(this.fixed instanceof HumanName))
8364        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.fixed.getClass().getName()+" was encountered");
8365      return (HumanName) this.fixed;
8366    }
8367
8368    public boolean hasFixedHumanName() { 
8369      return this != null && this.fixed instanceof HumanName;
8370    }
8371
8372    /**
8373     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8374     */
8375    public Identifier getFixedIdentifier() throws FHIRException { 
8376      if (this.fixed == null)
8377        this.fixed = new Identifier();
8378      if (!(this.fixed instanceof Identifier))
8379        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.fixed.getClass().getName()+" was encountered");
8380      return (Identifier) this.fixed;
8381    }
8382
8383    public boolean hasFixedIdentifier() { 
8384      return this != null && this.fixed instanceof Identifier;
8385    }
8386
8387    /**
8388     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8389     */
8390    public Money getFixedMoney() throws FHIRException { 
8391      if (this.fixed == null)
8392        this.fixed = new Money();
8393      if (!(this.fixed instanceof Money))
8394        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.fixed.getClass().getName()+" was encountered");
8395      return (Money) this.fixed;
8396    }
8397
8398    public boolean hasFixedMoney() { 
8399      return this != null && this.fixed instanceof Money;
8400    }
8401
8402    /**
8403     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8404     */
8405    public Period getFixedPeriod() throws FHIRException { 
8406      if (this.fixed == null)
8407        this.fixed = new Period();
8408      if (!(this.fixed instanceof Period))
8409        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.fixed.getClass().getName()+" was encountered");
8410      return (Period) this.fixed;
8411    }
8412
8413    public boolean hasFixedPeriod() { 
8414      return this != null && this.fixed instanceof Period;
8415    }
8416
8417    /**
8418     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8419     */
8420    public Quantity getFixedQuantity() throws FHIRException { 
8421      if (this.fixed == null)
8422        this.fixed = new Quantity();
8423      if (!(this.fixed instanceof Quantity))
8424        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.fixed.getClass().getName()+" was encountered");
8425      return (Quantity) this.fixed;
8426    }
8427
8428    public boolean hasFixedQuantity() { 
8429      return this != null && this.fixed instanceof Quantity;
8430    }
8431
8432    /**
8433     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8434     */
8435    public Range getFixedRange() throws FHIRException { 
8436      if (this.fixed == null)
8437        this.fixed = new Range();
8438      if (!(this.fixed instanceof Range))
8439        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.fixed.getClass().getName()+" was encountered");
8440      return (Range) this.fixed;
8441    }
8442
8443    public boolean hasFixedRange() { 
8444      return this != null && this.fixed instanceof Range;
8445    }
8446
8447    /**
8448     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8449     */
8450    public Ratio getFixedRatio() throws FHIRException { 
8451      if (this.fixed == null)
8452        this.fixed = new Ratio();
8453      if (!(this.fixed instanceof Ratio))
8454        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.fixed.getClass().getName()+" was encountered");
8455      return (Ratio) this.fixed;
8456    }
8457
8458    public boolean hasFixedRatio() { 
8459      return this != null && this.fixed instanceof Ratio;
8460    }
8461
8462    /**
8463     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8464     */
8465    public RatioRange getFixedRatioRange() throws FHIRException { 
8466      if (this.fixed == null)
8467        this.fixed = new RatioRange();
8468      if (!(this.fixed instanceof RatioRange))
8469        throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.fixed.getClass().getName()+" was encountered");
8470      return (RatioRange) this.fixed;
8471    }
8472
8473    public boolean hasFixedRatioRange() { 
8474      return this != null && this.fixed instanceof RatioRange;
8475    }
8476
8477    /**
8478     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8479     */
8480    public Reference getFixedReference() throws FHIRException { 
8481      if (this.fixed == null)
8482        this.fixed = new Reference();
8483      if (!(this.fixed instanceof Reference))
8484        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.fixed.getClass().getName()+" was encountered");
8485      return (Reference) this.fixed;
8486    }
8487
8488    public boolean hasFixedReference() { 
8489      return this != null && this.fixed instanceof Reference;
8490    }
8491
8492    /**
8493     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8494     */
8495    public SampledData getFixedSampledData() throws FHIRException { 
8496      if (this.fixed == null)
8497        this.fixed = new SampledData();
8498      if (!(this.fixed instanceof SampledData))
8499        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.fixed.getClass().getName()+" was encountered");
8500      return (SampledData) this.fixed;
8501    }
8502
8503    public boolean hasFixedSampledData() { 
8504      return this != null && this.fixed instanceof SampledData;
8505    }
8506
8507    /**
8508     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8509     */
8510    public Signature getFixedSignature() throws FHIRException { 
8511      if (this.fixed == null)
8512        this.fixed = new Signature();
8513      if (!(this.fixed instanceof Signature))
8514        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.fixed.getClass().getName()+" was encountered");
8515      return (Signature) this.fixed;
8516    }
8517
8518    public boolean hasFixedSignature() { 
8519      return this != null && this.fixed instanceof Signature;
8520    }
8521
8522    /**
8523     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8524     */
8525    public Timing getFixedTiming() throws FHIRException { 
8526      if (this.fixed == null)
8527        this.fixed = new Timing();
8528      if (!(this.fixed instanceof Timing))
8529        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.fixed.getClass().getName()+" was encountered");
8530      return (Timing) this.fixed;
8531    }
8532
8533    public boolean hasFixedTiming() { 
8534      return this != null && this.fixed instanceof Timing;
8535    }
8536
8537    /**
8538     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8539     */
8540    public ContactDetail getFixedContactDetail() throws FHIRException { 
8541      if (this.fixed == null)
8542        this.fixed = new ContactDetail();
8543      if (!(this.fixed instanceof ContactDetail))
8544        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.fixed.getClass().getName()+" was encountered");
8545      return (ContactDetail) this.fixed;
8546    }
8547
8548    public boolean hasFixedContactDetail() { 
8549      return this != null && this.fixed instanceof ContactDetail;
8550    }
8551
8552    /**
8553     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8554     */
8555    public DataRequirement getFixedDataRequirement() throws FHIRException { 
8556      if (this.fixed == null)
8557        this.fixed = new DataRequirement();
8558      if (!(this.fixed instanceof DataRequirement))
8559        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.fixed.getClass().getName()+" was encountered");
8560      return (DataRequirement) this.fixed;
8561    }
8562
8563    public boolean hasFixedDataRequirement() { 
8564      return this != null && this.fixed instanceof DataRequirement;
8565    }
8566
8567    /**
8568     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8569     */
8570    public Expression getFixedExpression() throws FHIRException { 
8571      if (this.fixed == null)
8572        this.fixed = new Expression();
8573      if (!(this.fixed instanceof Expression))
8574        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.fixed.getClass().getName()+" was encountered");
8575      return (Expression) this.fixed;
8576    }
8577
8578    public boolean hasFixedExpression() { 
8579      return this != null && this.fixed instanceof Expression;
8580    }
8581
8582    /**
8583     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8584     */
8585    public ParameterDefinition getFixedParameterDefinition() throws FHIRException { 
8586      if (this.fixed == null)
8587        this.fixed = new ParameterDefinition();
8588      if (!(this.fixed instanceof ParameterDefinition))
8589        throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.fixed.getClass().getName()+" was encountered");
8590      return (ParameterDefinition) this.fixed;
8591    }
8592
8593    public boolean hasFixedParameterDefinition() { 
8594      return this != null && this.fixed instanceof ParameterDefinition;
8595    }
8596
8597    /**
8598     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8599     */
8600    public RelatedArtifact getFixedRelatedArtifact() throws FHIRException { 
8601      if (this.fixed == null)
8602        this.fixed = new RelatedArtifact();
8603      if (!(this.fixed instanceof RelatedArtifact))
8604        throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.fixed.getClass().getName()+" was encountered");
8605      return (RelatedArtifact) this.fixed;
8606    }
8607
8608    public boolean hasFixedRelatedArtifact() { 
8609      return this != null && this.fixed instanceof RelatedArtifact;
8610    }
8611
8612    /**
8613     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8614     */
8615    public TriggerDefinition getFixedTriggerDefinition() throws FHIRException { 
8616      if (this.fixed == null)
8617        this.fixed = new TriggerDefinition();
8618      if (!(this.fixed instanceof TriggerDefinition))
8619        throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.fixed.getClass().getName()+" was encountered");
8620      return (TriggerDefinition) this.fixed;
8621    }
8622
8623    public boolean hasFixedTriggerDefinition() { 
8624      return this != null && this.fixed instanceof TriggerDefinition;
8625    }
8626
8627    /**
8628     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8629     */
8630    public UsageContext getFixedUsageContext() throws FHIRException { 
8631      if (this.fixed == null)
8632        this.fixed = new UsageContext();
8633      if (!(this.fixed instanceof UsageContext))
8634        throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.fixed.getClass().getName()+" was encountered");
8635      return (UsageContext) this.fixed;
8636    }
8637
8638    public boolean hasFixedUsageContext() { 
8639      return this != null && this.fixed instanceof UsageContext;
8640    }
8641
8642    /**
8643     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8644     */
8645    public Availability getFixedAvailability() throws FHIRException { 
8646      if (this.fixed == null)
8647        this.fixed = new Availability();
8648      if (!(this.fixed instanceof Availability))
8649        throw new FHIRException("Type mismatch: the type Availability was expected, but "+this.fixed.getClass().getName()+" was encountered");
8650      return (Availability) this.fixed;
8651    }
8652
8653    public boolean hasFixedAvailability() { 
8654      return this != null && this.fixed instanceof Availability;
8655    }
8656
8657    /**
8658     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8659     */
8660    public ExtendedContactDetail getFixedExtendedContactDetail() throws FHIRException { 
8661      if (this.fixed == null)
8662        this.fixed = new ExtendedContactDetail();
8663      if (!(this.fixed instanceof ExtendedContactDetail))
8664        throw new FHIRException("Type mismatch: the type ExtendedContactDetail was expected, but "+this.fixed.getClass().getName()+" was encountered");
8665      return (ExtendedContactDetail) this.fixed;
8666    }
8667
8668    public boolean hasFixedExtendedContactDetail() { 
8669      return this != null && this.fixed instanceof ExtendedContactDetail;
8670    }
8671
8672    /**
8673     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8674     */
8675    public Dosage getFixedDosage() throws FHIRException { 
8676      if (this.fixed == null)
8677        this.fixed = new Dosage();
8678      if (!(this.fixed instanceof Dosage))
8679        throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.fixed.getClass().getName()+" was encountered");
8680      return (Dosage) this.fixed;
8681    }
8682
8683    public boolean hasFixedDosage() { 
8684      return this != null && this.fixed instanceof Dosage;
8685    }
8686
8687    /**
8688     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8689     */
8690    public Meta getFixedMeta() throws FHIRException { 
8691      if (this.fixed == null)
8692        this.fixed = new Meta();
8693      if (!(this.fixed instanceof Meta))
8694        throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.fixed.getClass().getName()+" was encountered");
8695      return (Meta) this.fixed;
8696    }
8697
8698    public boolean hasFixedMeta() { 
8699      return this != null && this.fixed instanceof Meta;
8700    }
8701
8702    public boolean hasFixed() { 
8703      return this.fixed != null && !this.fixed.isEmpty();
8704    }
8705
8706    /**
8707     * @param value {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance, if present. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
8708     */
8709    public ElementDefinition setFixed(DataType value) { 
8710      if (value != null && !(value instanceof Base64BinaryType || value instanceof BooleanType || value instanceof CanonicalType || value instanceof CodeType || value instanceof DateType || value instanceof DateTimeType || value instanceof DecimalType || value instanceof IdType || value instanceof InstantType || value instanceof IntegerType || value instanceof Integer64Type || value instanceof MarkdownType || value instanceof OidType || value instanceof PositiveIntType || value instanceof StringType || value instanceof TimeType || value instanceof UnsignedIntType || value instanceof UriType || value instanceof UrlType || value instanceof UuidType || value instanceof Address || value instanceof Age || value instanceof Annotation || value instanceof Attachment || value instanceof CodeableConcept || value instanceof CodeableReference || value instanceof Coding || value instanceof ContactPoint || value instanceof Count || value instanceof Distance || value instanceof Duration || value instanceof HumanName || value instanceof Identifier || value instanceof Money || value instanceof Period || val