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 Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
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 * Base StructureDefinition for 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 AggregationMode {
061        /**
062         * The reference is a local reference to a contained resource.
063         */
064        CONTAINED, 
065        /**
066         * The reference to a resource that has to be resolved externally to the resource that includes the reference.
067         */
068        REFERENCED, 
069        /**
070         * The resource the reference points to will be found in the same bundle as the resource that includes the reference.
071         */
072        BUNDLED, 
073        /**
074         * added to help the parsers with the generic types
075         */
076        NULL;
077        public static AggregationMode fromCode(String codeString) throws FHIRException {
078            if (codeString == null || "".equals(codeString))
079                return null;
080        if ("contained".equals(codeString))
081          return CONTAINED;
082        if ("referenced".equals(codeString))
083          return REFERENCED;
084        if ("bundled".equals(codeString))
085          return BUNDLED;
086        if (Configuration.isAcceptInvalidEnums())
087          return null;
088        else
089          throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
090        }
091        public String toCode() {
092          switch (this) {
093            case CONTAINED: return "contained";
094            case REFERENCED: return "referenced";
095            case BUNDLED: return "bundled";
096            case NULL: return null;
097            default: return "?";
098          }
099        }
100        public String getSystem() {
101          switch (this) {
102            case CONTAINED: return "http://hl7.org/fhir/resource-aggregation-mode";
103            case REFERENCED: return "http://hl7.org/fhir/resource-aggregation-mode";
104            case BUNDLED: return "http://hl7.org/fhir/resource-aggregation-mode";
105            case NULL: return null;
106            default: return "?";
107          }
108        }
109        public String getDefinition() {
110          switch (this) {
111            case CONTAINED: return "The reference is a local reference to a contained resource.";
112            case REFERENCED: return "The reference to a resource that has to be resolved externally to the resource that includes the reference.";
113            case BUNDLED: return "The resource the reference points to will be found in the same bundle as the resource that includes the reference.";
114            case NULL: return null;
115            default: return "?";
116          }
117        }
118        public String getDisplay() {
119          switch (this) {
120            case CONTAINED: return "Contained";
121            case REFERENCED: return "Referenced";
122            case BUNDLED: return "Bundled";
123            case NULL: return null;
124            default: return "?";
125          }
126        }
127    }
128
129  public static class AggregationModeEnumFactory implements EnumFactory<AggregationMode> {
130    public AggregationMode fromCode(String codeString) throws IllegalArgumentException {
131      if (codeString == null || "".equals(codeString))
132            if (codeString == null || "".equals(codeString))
133                return null;
134        if ("contained".equals(codeString))
135          return AggregationMode.CONTAINED;
136        if ("referenced".equals(codeString))
137          return AggregationMode.REFERENCED;
138        if ("bundled".equals(codeString))
139          return AggregationMode.BUNDLED;
140        throw new IllegalArgumentException("Unknown AggregationMode code '"+codeString+"'");
141        }
142        public Enumeration<AggregationMode> fromType(Base code) throws FHIRException {
143          if (code == null)
144            return null;
145          if (code.isEmpty())
146            return new Enumeration<AggregationMode>(this);
147          String codeString = ((PrimitiveType) code).asStringValue();
148          if (codeString == null || "".equals(codeString))
149            return null;
150        if ("contained".equals(codeString))
151          return new Enumeration<AggregationMode>(this, AggregationMode.CONTAINED);
152        if ("referenced".equals(codeString))
153          return new Enumeration<AggregationMode>(this, AggregationMode.REFERENCED);
154        if ("bundled".equals(codeString))
155          return new Enumeration<AggregationMode>(this, AggregationMode.BUNDLED);
156        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
157        }
158    public String toCode(AggregationMode code) {
159      if (code == AggregationMode.CONTAINED)
160        return "contained";
161      if (code == AggregationMode.REFERENCED)
162        return "referenced";
163      if (code == AggregationMode.BUNDLED)
164        return "bundled";
165      return "?";
166      }
167    public String toSystem(AggregationMode code) {
168      return code.getSystem();
169      }
170    }
171
172    public enum ConstraintSeverity {
173        /**
174         * If the constraint is violated, the resource is not conformant.
175         */
176        ERROR, 
177        /**
178         * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.
179         */
180        WARNING, 
181        /**
182         * added to help the parsers with the generic types
183         */
184        NULL;
185        public static ConstraintSeverity fromCode(String codeString) throws FHIRException {
186            if (codeString == null || "".equals(codeString))
187                return null;
188        if ("error".equals(codeString))
189          return ERROR;
190        if ("warning".equals(codeString))
191          return WARNING;
192        if (Configuration.isAcceptInvalidEnums())
193          return null;
194        else
195          throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
196        }
197        public String toCode() {
198          switch (this) {
199            case ERROR: return "error";
200            case WARNING: return "warning";
201            case NULL: return null;
202            default: return "?";
203          }
204        }
205        public String getSystem() {
206          switch (this) {
207            case ERROR: return "http://hl7.org/fhir/constraint-severity";
208            case WARNING: return "http://hl7.org/fhir/constraint-severity";
209            case NULL: return null;
210            default: return "?";
211          }
212        }
213        public String getDefinition() {
214          switch (this) {
215            case ERROR: return "If the constraint is violated, the resource is not conformant.";
216            case WARNING: return "If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.";
217            case NULL: return null;
218            default: return "?";
219          }
220        }
221        public String getDisplay() {
222          switch (this) {
223            case ERROR: return "Error";
224            case WARNING: return "Warning";
225            case NULL: return null;
226            default: return "?";
227          }
228        }
229    }
230
231  public static class ConstraintSeverityEnumFactory implements EnumFactory<ConstraintSeverity> {
232    public ConstraintSeverity fromCode(String codeString) throws IllegalArgumentException {
233      if (codeString == null || "".equals(codeString))
234            if (codeString == null || "".equals(codeString))
235                return null;
236        if ("error".equals(codeString))
237          return ConstraintSeverity.ERROR;
238        if ("warning".equals(codeString))
239          return ConstraintSeverity.WARNING;
240        throw new IllegalArgumentException("Unknown ConstraintSeverity code '"+codeString+"'");
241        }
242        public Enumeration<ConstraintSeverity> fromType(Base code) throws FHIRException {
243          if (code == null)
244            return null;
245          if (code.isEmpty())
246            return new Enumeration<ConstraintSeverity>(this);
247          String codeString = ((PrimitiveType) code).asStringValue();
248          if (codeString == null || "".equals(codeString))
249            return null;
250        if ("error".equals(codeString))
251          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.ERROR);
252        if ("warning".equals(codeString))
253          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.WARNING);
254        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
255        }
256    public String toCode(ConstraintSeverity code) {
257      if (code == ConstraintSeverity.ERROR)
258        return "error";
259      if (code == ConstraintSeverity.WARNING)
260        return "warning";
261      return "?";
262      }
263    public String toSystem(ConstraintSeverity code) {
264      return code.getSystem();
265      }
266    }
267
268    public enum DiscriminatorType {
269        /**
270         * The slices have different values in the nominated element.
271         */
272        VALUE, 
273        /**
274         * The slices are differentiated by the presence or absence of the nominated element.
275         */
276        EXISTS, 
277        /**
278         * The slices have different values in the nominated element, as determined by testing them against the applicable ElementDefinition.pattern[x].
279         */
280        PATTERN, 
281        /**
282         * The slices are differentiated by type of the nominated element.
283         */
284        TYPE, 
285        /**
286         * 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.
287         */
288        PROFILE, 
289        /**
290         * added to help the parsers with the generic types
291         */
292        NULL;
293        public static DiscriminatorType fromCode(String codeString) throws FHIRException {
294            if (codeString == null || "".equals(codeString))
295                return null;
296        if ("value".equals(codeString))
297          return VALUE;
298        if ("exists".equals(codeString))
299          return EXISTS;
300        if ("pattern".equals(codeString))
301          return PATTERN;
302        if ("type".equals(codeString))
303          return TYPE;
304        if ("profile".equals(codeString))
305          return PROFILE;
306        if (Configuration.isAcceptInvalidEnums())
307          return null;
308        else
309          throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
310        }
311        public String toCode() {
312          switch (this) {
313            case VALUE: return "value";
314            case EXISTS: return "exists";
315            case PATTERN: return "pattern";
316            case TYPE: return "type";
317            case PROFILE: return "profile";
318            case NULL: return null;
319            default: return "?";
320          }
321        }
322        public String getSystem() {
323          switch (this) {
324            case VALUE: return "http://hl7.org/fhir/discriminator-type";
325            case EXISTS: return "http://hl7.org/fhir/discriminator-type";
326            case PATTERN: return "http://hl7.org/fhir/discriminator-type";
327            case TYPE: return "http://hl7.org/fhir/discriminator-type";
328            case PROFILE: return "http://hl7.org/fhir/discriminator-type";
329            case NULL: return null;
330            default: return "?";
331          }
332        }
333        public String getDefinition() {
334          switch (this) {
335            case VALUE: return "The slices have different values in the nominated element.";
336            case EXISTS: return "The slices are differentiated by the presence or absence of the nominated element.";
337            case PATTERN: return "The slices have different values in the nominated element, as determined by testing them against the applicable ElementDefinition.pattern[x].";
338            case TYPE: return "The slices are differentiated by type of the nominated element.";
339            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.";
340            case NULL: return null;
341            default: return "?";
342          }
343        }
344        public String getDisplay() {
345          switch (this) {
346            case VALUE: return "Value";
347            case EXISTS: return "Exists";
348            case PATTERN: return "Pattern";
349            case TYPE: return "Type";
350            case PROFILE: return "Profile";
351            case NULL: return null;
352            default: return "?";
353          }
354        }
355    }
356
357  public static class DiscriminatorTypeEnumFactory implements EnumFactory<DiscriminatorType> {
358    public DiscriminatorType fromCode(String codeString) throws IllegalArgumentException {
359      if (codeString == null || "".equals(codeString))
360            if (codeString == null || "".equals(codeString))
361                return null;
362        if ("value".equals(codeString))
363          return DiscriminatorType.VALUE;
364        if ("exists".equals(codeString))
365          return DiscriminatorType.EXISTS;
366        if ("pattern".equals(codeString))
367          return DiscriminatorType.PATTERN;
368        if ("type".equals(codeString))
369          return DiscriminatorType.TYPE;
370        if ("profile".equals(codeString))
371          return DiscriminatorType.PROFILE;
372        throw new IllegalArgumentException("Unknown DiscriminatorType code '"+codeString+"'");
373        }
374        public Enumeration<DiscriminatorType> fromType(Base code) throws FHIRException {
375          if (code == null)
376            return null;
377          if (code.isEmpty())
378            return new Enumeration<DiscriminatorType>(this);
379          String codeString = ((PrimitiveType) code).asStringValue();
380          if (codeString == null || "".equals(codeString))
381            return null;
382        if ("value".equals(codeString))
383          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.VALUE);
384        if ("exists".equals(codeString))
385          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.EXISTS);
386        if ("pattern".equals(codeString))
387          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.PATTERN);
388        if ("type".equals(codeString))
389          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.TYPE);
390        if ("profile".equals(codeString))
391          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.PROFILE);
392        throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
393        }
394    public String toCode(DiscriminatorType code) {
395      if (code == DiscriminatorType.VALUE)
396        return "value";
397      if (code == DiscriminatorType.EXISTS)
398        return "exists";
399      if (code == DiscriminatorType.PATTERN)
400        return "pattern";
401      if (code == DiscriminatorType.TYPE)
402        return "type";
403      if (code == DiscriminatorType.PROFILE)
404        return "profile";
405      return "?";
406      }
407    public String toSystem(DiscriminatorType code) {
408      return code.getSystem();
409      }
410    }
411
412    public enum PropertyRepresentation {
413        /**
414         * In XML, this property is represented as an attribute not an element.
415         */
416        XMLATTR, 
417        /**
418         * This element is represented using the XML text attribute (primitives only).
419         */
420        XMLTEXT, 
421        /**
422         * The type of this element is indicated using xsi:type.
423         */
424        TYPEATTR, 
425        /**
426         * Use CDA narrative instead of XHTML.
427         */
428        CDATEXT, 
429        /**
430         * The property is represented using XHTML.
431         */
432        XHTML, 
433        /**
434         * added to help the parsers with the generic types
435         */
436        NULL;
437        public static PropertyRepresentation fromCode(String codeString) throws FHIRException {
438            if (codeString == null || "".equals(codeString))
439                return null;
440        if ("xmlAttr".equals(codeString))
441          return XMLATTR;
442        if ("xmlText".equals(codeString))
443          return XMLTEXT;
444        if ("typeAttr".equals(codeString))
445          return TYPEATTR;
446        if ("cdaText".equals(codeString))
447          return CDATEXT;
448        if ("xhtml".equals(codeString))
449          return XHTML;
450        if (Configuration.isAcceptInvalidEnums())
451          return null;
452        else
453          throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
454        }
455        public String toCode() {
456          switch (this) {
457            case XMLATTR: return "xmlAttr";
458            case XMLTEXT: return "xmlText";
459            case TYPEATTR: return "typeAttr";
460            case CDATEXT: return "cdaText";
461            case XHTML: return "xhtml";
462            case NULL: return null;
463            default: return "?";
464          }
465        }
466        public String getSystem() {
467          switch (this) {
468            case XMLATTR: return "http://hl7.org/fhir/property-representation";
469            case XMLTEXT: return "http://hl7.org/fhir/property-representation";
470            case TYPEATTR: return "http://hl7.org/fhir/property-representation";
471            case CDATEXT: return "http://hl7.org/fhir/property-representation";
472            case XHTML: return "http://hl7.org/fhir/property-representation";
473            case NULL: return null;
474            default: return "?";
475          }
476        }
477        public String getDefinition() {
478          switch (this) {
479            case XMLATTR: return "In XML, this property is represented as an attribute not an element.";
480            case XMLTEXT: return "This element is represented using the XML text attribute (primitives only).";
481            case TYPEATTR: return "The type of this element is indicated using xsi:type.";
482            case CDATEXT: return "Use CDA narrative instead of XHTML.";
483            case XHTML: return "The property is represented using XHTML.";
484            case NULL: return null;
485            default: return "?";
486          }
487        }
488        public String getDisplay() {
489          switch (this) {
490            case XMLATTR: return "XML Attribute";
491            case XMLTEXT: return "XML Text";
492            case TYPEATTR: return "Type Attribute";
493            case CDATEXT: return "CDA Text Format";
494            case XHTML: return "XHTML";
495            case NULL: return null;
496            default: return "?";
497          }
498        }
499    }
500
501  public static class PropertyRepresentationEnumFactory implements EnumFactory<PropertyRepresentation> {
502    public PropertyRepresentation fromCode(String codeString) throws IllegalArgumentException {
503      if (codeString == null || "".equals(codeString))
504            if (codeString == null || "".equals(codeString))
505                return null;
506        if ("xmlAttr".equals(codeString))
507          return PropertyRepresentation.XMLATTR;
508        if ("xmlText".equals(codeString))
509          return PropertyRepresentation.XMLTEXT;
510        if ("typeAttr".equals(codeString))
511          return PropertyRepresentation.TYPEATTR;
512        if ("cdaText".equals(codeString))
513          return PropertyRepresentation.CDATEXT;
514        if ("xhtml".equals(codeString))
515          return PropertyRepresentation.XHTML;
516        throw new IllegalArgumentException("Unknown PropertyRepresentation code '"+codeString+"'");
517        }
518        public Enumeration<PropertyRepresentation> fromType(Base code) throws FHIRException {
519          if (code == null)
520            return null;
521          if (code.isEmpty())
522            return new Enumeration<PropertyRepresentation>(this);
523          String codeString = ((PrimitiveType) code).asStringValue();
524          if (codeString == null || "".equals(codeString))
525            return null;
526        if ("xmlAttr".equals(codeString))
527          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLATTR);
528        if ("xmlText".equals(codeString))
529          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLTEXT);
530        if ("typeAttr".equals(codeString))
531          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.TYPEATTR);
532        if ("cdaText".equals(codeString))
533          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.CDATEXT);
534        if ("xhtml".equals(codeString))
535          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XHTML);
536        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
537        }
538    public String toCode(PropertyRepresentation code) {
539      if (code == PropertyRepresentation.XMLATTR)
540        return "xmlAttr";
541      if (code == PropertyRepresentation.XMLTEXT)
542        return "xmlText";
543      if (code == PropertyRepresentation.TYPEATTR)
544        return "typeAttr";
545      if (code == PropertyRepresentation.CDATEXT)
546        return "cdaText";
547      if (code == PropertyRepresentation.XHTML)
548        return "xhtml";
549      return "?";
550      }
551    public String toSystem(PropertyRepresentation code) {
552      return code.getSystem();
553      }
554    }
555
556    public enum ReferenceVersionRules {
557        /**
558         * The reference may be either version independent or version specific.
559         */
560        EITHER, 
561        /**
562         * The reference must be version independent.
563         */
564        INDEPENDENT, 
565        /**
566         * The reference must be version specific.
567         */
568        SPECIFIC, 
569        /**
570         * added to help the parsers with the generic types
571         */
572        NULL;
573        public static ReferenceVersionRules fromCode(String codeString) throws FHIRException {
574            if (codeString == null || "".equals(codeString))
575                return null;
576        if ("either".equals(codeString))
577          return EITHER;
578        if ("independent".equals(codeString))
579          return INDEPENDENT;
580        if ("specific".equals(codeString))
581          return SPECIFIC;
582        if (Configuration.isAcceptInvalidEnums())
583          return null;
584        else
585          throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
586        }
587        public String toCode() {
588          switch (this) {
589            case EITHER: return "either";
590            case INDEPENDENT: return "independent";
591            case SPECIFIC: return "specific";
592            case NULL: return null;
593            default: return "?";
594          }
595        }
596        public String getSystem() {
597          switch (this) {
598            case EITHER: return "http://hl7.org/fhir/reference-version-rules";
599            case INDEPENDENT: return "http://hl7.org/fhir/reference-version-rules";
600            case SPECIFIC: return "http://hl7.org/fhir/reference-version-rules";
601            case NULL: return null;
602            default: return "?";
603          }
604        }
605        public String getDefinition() {
606          switch (this) {
607            case EITHER: return "The reference may be either version independent or version specific.";
608            case INDEPENDENT: return "The reference must be version independent.";
609            case SPECIFIC: return "The reference must be version specific.";
610            case NULL: return null;
611            default: return "?";
612          }
613        }
614        public String getDisplay() {
615          switch (this) {
616            case EITHER: return "Either Specific or independent";
617            case INDEPENDENT: return "Version independent";
618            case SPECIFIC: return "Version Specific";
619            case NULL: return null;
620            default: return "?";
621          }
622        }
623    }
624
625  public static class ReferenceVersionRulesEnumFactory implements EnumFactory<ReferenceVersionRules> {
626    public ReferenceVersionRules fromCode(String codeString) throws IllegalArgumentException {
627      if (codeString == null || "".equals(codeString))
628            if (codeString == null || "".equals(codeString))
629                return null;
630        if ("either".equals(codeString))
631          return ReferenceVersionRules.EITHER;
632        if ("independent".equals(codeString))
633          return ReferenceVersionRules.INDEPENDENT;
634        if ("specific".equals(codeString))
635          return ReferenceVersionRules.SPECIFIC;
636        throw new IllegalArgumentException("Unknown ReferenceVersionRules code '"+codeString+"'");
637        }
638        public Enumeration<ReferenceVersionRules> fromType(Base code) throws FHIRException {
639          if (code == null)
640            return null;
641          if (code.isEmpty())
642            return new Enumeration<ReferenceVersionRules>(this);
643          String codeString = ((PrimitiveType) code).asStringValue();
644          if (codeString == null || "".equals(codeString))
645            return null;
646        if ("either".equals(codeString))
647          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.EITHER);
648        if ("independent".equals(codeString))
649          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.INDEPENDENT);
650        if ("specific".equals(codeString))
651          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.SPECIFIC);
652        throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
653        }
654    public String toCode(ReferenceVersionRules code) {
655      if (code == ReferenceVersionRules.EITHER)
656        return "either";
657      if (code == ReferenceVersionRules.INDEPENDENT)
658        return "independent";
659      if (code == ReferenceVersionRules.SPECIFIC)
660        return "specific";
661      return "?";
662      }
663    public String toSystem(ReferenceVersionRules code) {
664      return code.getSystem();
665      }
666    }
667
668    public enum SlicingRules {
669        /**
670         * No additional content is allowed other than that described by the slices in this profile.
671         */
672        CLOSED, 
673        /**
674         * Additional content is allowed anywhere in the list.
675         */
676        OPEN, 
677        /**
678         * 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.
679         */
680        OPENATEND, 
681        /**
682         * added to help the parsers with the generic types
683         */
684        NULL;
685        public static SlicingRules fromCode(String codeString) throws FHIRException {
686            if (codeString == null || "".equals(codeString))
687                return null;
688        if ("closed".equals(codeString))
689          return CLOSED;
690        if ("open".equals(codeString))
691          return OPEN;
692        if ("openAtEnd".equals(codeString))
693          return OPENATEND;
694        if (Configuration.isAcceptInvalidEnums())
695          return null;
696        else
697          throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
698        }
699        public String toCode() {
700          switch (this) {
701            case CLOSED: return "closed";
702            case OPEN: return "open";
703            case OPENATEND: return "openAtEnd";
704            case NULL: return null;
705            default: return "?";
706          }
707        }
708        public String getSystem() {
709          switch (this) {
710            case CLOSED: return "http://hl7.org/fhir/resource-slicing-rules";
711            case OPEN: return "http://hl7.org/fhir/resource-slicing-rules";
712            case OPENATEND: return "http://hl7.org/fhir/resource-slicing-rules";
713            case NULL: return null;
714            default: return "?";
715          }
716        }
717        public String getDefinition() {
718          switch (this) {
719            case CLOSED: return "No additional content is allowed other than that described by the slices in this profile.";
720            case OPEN: return "Additional content is allowed anywhere in the list.";
721            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.";
722            case NULL: return null;
723            default: return "?";
724          }
725        }
726        public String getDisplay() {
727          switch (this) {
728            case CLOSED: return "Closed";
729            case OPEN: return "Open";
730            case OPENATEND: return "Open at End";
731            case NULL: return null;
732            default: return "?";
733          }
734        }
735    }
736
737  public static class SlicingRulesEnumFactory implements EnumFactory<SlicingRules> {
738    public SlicingRules fromCode(String codeString) throws IllegalArgumentException {
739      if (codeString == null || "".equals(codeString))
740            if (codeString == null || "".equals(codeString))
741                return null;
742        if ("closed".equals(codeString))
743          return SlicingRules.CLOSED;
744        if ("open".equals(codeString))
745          return SlicingRules.OPEN;
746        if ("openAtEnd".equals(codeString))
747          return SlicingRules.OPENATEND;
748        throw new IllegalArgumentException("Unknown SlicingRules code '"+codeString+"'");
749        }
750        public Enumeration<SlicingRules> fromType(Base code) throws FHIRException {
751          if (code == null)
752            return null;
753          if (code.isEmpty())
754            return new Enumeration<SlicingRules>(this);
755          String codeString = ((PrimitiveType) code).asStringValue();
756          if (codeString == null || "".equals(codeString))
757            return null;
758        if ("closed".equals(codeString))
759          return new Enumeration<SlicingRules>(this, SlicingRules.CLOSED);
760        if ("open".equals(codeString))
761          return new Enumeration<SlicingRules>(this, SlicingRules.OPEN);
762        if ("openAtEnd".equals(codeString))
763          return new Enumeration<SlicingRules>(this, SlicingRules.OPENATEND);
764        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
765        }
766    public String toCode(SlicingRules code) {
767      if (code == SlicingRules.CLOSED)
768        return "closed";
769      if (code == SlicingRules.OPEN)
770        return "open";
771      if (code == SlicingRules.OPENATEND)
772        return "openAtEnd";
773      return "?";
774      }
775    public String toSystem(SlicingRules code) {
776      return code.getSystem();
777      }
778    }
779
780    @Block()
781    public static class ElementDefinitionSlicingComponent extends Element implements IBaseDatatypeElement {
782        /**
783         * 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.
784         */
785        @Child(name = "discriminator", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
786        @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." )
787        protected List<ElementDefinitionSlicingDiscriminatorComponent> discriminator;
788
789        /**
790         * 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.
791         */
792        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
793        @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." )
794        protected StringType description;
795
796        /**
797         * If the matching elements have to occur in the same order as defined in the profile.
798         */
799        @Child(name = "ordered", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
800        @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." )
801        protected BooleanType ordered;
802
803        /**
804         * 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.
805         */
806        @Child(name = "rules", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
807        @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." )
808        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-slicing-rules")
809        protected Enumeration<SlicingRules> rules;
810
811        private static final long serialVersionUID = -311635839L;
812
813    /**
814     * Constructor
815     */
816      public ElementDefinitionSlicingComponent() {
817        super();
818      }
819
820    /**
821     * Constructor
822     */
823      public ElementDefinitionSlicingComponent(SlicingRules rules) {
824        super();
825        this.setRules(rules);
826      }
827
828        /**
829         * @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.)
830         */
831        public List<ElementDefinitionSlicingDiscriminatorComponent> getDiscriminator() { 
832          if (this.discriminator == null)
833            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
834          return this.discriminator;
835        }
836
837        /**
838         * @return Returns a reference to <code>this</code> for easy method chaining
839         */
840        public ElementDefinitionSlicingComponent setDiscriminator(List<ElementDefinitionSlicingDiscriminatorComponent> theDiscriminator) { 
841          this.discriminator = theDiscriminator;
842          return this;
843        }
844
845        public boolean hasDiscriminator() { 
846          if (this.discriminator == null)
847            return false;
848          for (ElementDefinitionSlicingDiscriminatorComponent item : this.discriminator)
849            if (!item.isEmpty())
850              return true;
851          return false;
852        }
853
854        public ElementDefinitionSlicingDiscriminatorComponent addDiscriminator() { //3
855          ElementDefinitionSlicingDiscriminatorComponent t = new ElementDefinitionSlicingDiscriminatorComponent();
856          if (this.discriminator == null)
857            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
858          this.discriminator.add(t);
859          return t;
860        }
861
862        public ElementDefinitionSlicingComponent addDiscriminator(ElementDefinitionSlicingDiscriminatorComponent t) { //3
863          if (t == null)
864            return this;
865          if (this.discriminator == null)
866            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
867          this.discriminator.add(t);
868          return this;
869        }
870
871        /**
872         * @return The first repetition of repeating field {@link #discriminator}, creating it if it does not already exist {3}
873         */
874        public ElementDefinitionSlicingDiscriminatorComponent getDiscriminatorFirstRep() { 
875          if (getDiscriminator().isEmpty()) {
876            addDiscriminator();
877          }
878          return getDiscriminator().get(0);
879        }
880
881        /**
882         * @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
883         */
884        public StringType getDescriptionElement() { 
885          if (this.description == null)
886            if (Configuration.errorOnAutoCreate())
887              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.description");
888            else if (Configuration.doAutoCreate())
889              this.description = new StringType(); // bb
890          return this.description;
891        }
892
893        public boolean hasDescriptionElement() { 
894          return this.description != null && !this.description.isEmpty();
895        }
896
897        public boolean hasDescription() { 
898          return this.description != null && !this.description.isEmpty();
899        }
900
901        /**
902         * @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
903         */
904        public ElementDefinitionSlicingComponent setDescriptionElement(StringType value) { 
905          this.description = value;
906          return this;
907        }
908
909        /**
910         * @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.
911         */
912        public String getDescription() { 
913          return this.description == null ? null : this.description.getValue();
914        }
915
916        /**
917         * @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.
918         */
919        public ElementDefinitionSlicingComponent setDescription(String value) { 
920          if (Utilities.noString(value))
921            this.description = null;
922          else {
923            if (this.description == null)
924              this.description = new StringType();
925            this.description.setValue(value);
926          }
927          return this;
928        }
929
930        /**
931         * @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
932         */
933        public BooleanType getOrderedElement() { 
934          if (this.ordered == null)
935            if (Configuration.errorOnAutoCreate())
936              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.ordered");
937            else if (Configuration.doAutoCreate())
938              this.ordered = new BooleanType(); // bb
939          return this.ordered;
940        }
941
942        public boolean hasOrderedElement() { 
943          return this.ordered != null && !this.ordered.isEmpty();
944        }
945
946        public boolean hasOrdered() { 
947          return this.ordered != null && !this.ordered.isEmpty();
948        }
949
950        /**
951         * @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
952         */
953        public ElementDefinitionSlicingComponent setOrderedElement(BooleanType value) { 
954          this.ordered = value;
955          return this;
956        }
957
958        /**
959         * @return If the matching elements have to occur in the same order as defined in the profile.
960         */
961        public boolean getOrdered() { 
962          return this.ordered == null || this.ordered.isEmpty() ? false : this.ordered.getValue();
963        }
964
965        /**
966         * @param value If the matching elements have to occur in the same order as defined in the profile.
967         */
968        public ElementDefinitionSlicingComponent setOrdered(boolean value) { 
969            if (this.ordered == null)
970              this.ordered = new BooleanType();
971            this.ordered.setValue(value);
972          return this;
973        }
974
975        /**
976         * @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
977         */
978        public Enumeration<SlicingRules> getRulesElement() { 
979          if (this.rules == null)
980            if (Configuration.errorOnAutoCreate())
981              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.rules");
982            else if (Configuration.doAutoCreate())
983              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory()); // bb
984          return this.rules;
985        }
986
987        public boolean hasRulesElement() { 
988          return this.rules != null && !this.rules.isEmpty();
989        }
990
991        public boolean hasRules() { 
992          return this.rules != null && !this.rules.isEmpty();
993        }
994
995        /**
996         * @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
997         */
998        public ElementDefinitionSlicingComponent setRulesElement(Enumeration<SlicingRules> value) { 
999          this.rules = value;
1000          return this;
1001        }
1002
1003        /**
1004         * @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.
1005         */
1006        public SlicingRules getRules() { 
1007          return this.rules == null ? null : this.rules.getValue();
1008        }
1009
1010        /**
1011         * @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.
1012         */
1013        public ElementDefinitionSlicingComponent setRules(SlicingRules value) { 
1014            if (this.rules == null)
1015              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory());
1016            this.rules.setValue(value);
1017          return this;
1018        }
1019
1020        protected void listChildren(List<Property> children) {
1021          super.listChildren(children);
1022          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));
1023          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));
1024          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));
1025          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));
1026        }
1027
1028        @Override
1029        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1030          switch (_hash) {
1031          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);
1032          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);
1033          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);
1034          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);
1035          default: return super.getNamedProperty(_hash, _name, _checkValid);
1036          }
1037
1038        }
1039
1040      @Override
1041      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1042        switch (hash) {
1043        case -1888270692: /*discriminator*/ return this.discriminator == null ? new Base[0] : this.discriminator.toArray(new Base[this.discriminator.size()]); // ElementDefinitionSlicingDiscriminatorComponent
1044        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1045        case -1207109523: /*ordered*/ return this.ordered == null ? new Base[0] : new Base[] {this.ordered}; // BooleanType
1046        case 108873975: /*rules*/ return this.rules == null ? new Base[0] : new Base[] {this.rules}; // Enumeration<SlicingRules>
1047        default: return super.getProperty(hash, name, checkValid);
1048        }
1049
1050      }
1051
1052      @Override
1053      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1054        switch (hash) {
1055        case -1888270692: // discriminator
1056          this.getDiscriminator().add((ElementDefinitionSlicingDiscriminatorComponent) value); // ElementDefinitionSlicingDiscriminatorComponent
1057          return value;
1058        case -1724546052: // description
1059          this.description = TypeConvertor.castToString(value); // StringType
1060          return value;
1061        case -1207109523: // ordered
1062          this.ordered = TypeConvertor.castToBoolean(value); // BooleanType
1063          return value;
1064        case 108873975: // rules
1065          value = new SlicingRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
1066          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1067          return value;
1068        default: return super.setProperty(hash, name, value);
1069        }
1070
1071      }
1072
1073      @Override
1074      public Base setProperty(String name, Base value) throws FHIRException {
1075        if (name.equals("discriminator")) {
1076          this.getDiscriminator().add((ElementDefinitionSlicingDiscriminatorComponent) value);
1077        } else if (name.equals("description")) {
1078          this.description = TypeConvertor.castToString(value); // StringType
1079        } else if (name.equals("ordered")) {
1080          this.ordered = TypeConvertor.castToBoolean(value); // BooleanType
1081        } else if (name.equals("rules")) {
1082          value = new SlicingRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
1083          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1084        } else
1085          return super.setProperty(name, value);
1086        return value;
1087      }
1088
1089      @Override
1090      public Base makeProperty(int hash, String name) throws FHIRException {
1091        switch (hash) {
1092        case -1888270692:  return addDiscriminator(); 
1093        case -1724546052:  return getDescriptionElement();
1094        case -1207109523:  return getOrderedElement();
1095        case 108873975:  return getRulesElement();
1096        default: return super.makeProperty(hash, name);
1097        }
1098
1099      }
1100
1101      @Override
1102      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1103        switch (hash) {
1104        case -1888270692: /*discriminator*/ return new String[] {};
1105        case -1724546052: /*description*/ return new String[] {"string"};
1106        case -1207109523: /*ordered*/ return new String[] {"boolean"};
1107        case 108873975: /*rules*/ return new String[] {"code"};
1108        default: return super.getTypesForProperty(hash, name);
1109        }
1110
1111      }
1112
1113      @Override
1114      public Base addChild(String name) throws FHIRException {
1115        if (name.equals("discriminator")) {
1116          return addDiscriminator();
1117        }
1118        else if (name.equals("description")) {
1119          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.slicing.description");
1120        }
1121        else if (name.equals("ordered")) {
1122          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.slicing.ordered");
1123        }
1124        else if (name.equals("rules")) {
1125          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.slicing.rules");
1126        }
1127        else
1128          return super.addChild(name);
1129      }
1130
1131      public ElementDefinitionSlicingComponent copy() {
1132        ElementDefinitionSlicingComponent dst = new ElementDefinitionSlicingComponent();
1133        copyValues(dst);
1134        return dst;
1135      }
1136
1137      public void copyValues(ElementDefinitionSlicingComponent dst) {
1138        super.copyValues(dst);
1139        if (discriminator != null) {
1140          dst.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1141          for (ElementDefinitionSlicingDiscriminatorComponent i : discriminator)
1142            dst.discriminator.add(i.copy());
1143        };
1144        dst.description = description == null ? null : description.copy();
1145        dst.ordered = ordered == null ? null : ordered.copy();
1146        dst.rules = rules == null ? null : rules.copy();
1147      }
1148
1149      @Override
1150      public boolean equalsDeep(Base other_) {
1151        if (!super.equalsDeep(other_))
1152          return false;
1153        if (!(other_ instanceof ElementDefinitionSlicingComponent))
1154          return false;
1155        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other_;
1156        return compareDeep(discriminator, o.discriminator, true) && compareDeep(description, o.description, true)
1157           && compareDeep(ordered, o.ordered, true) && compareDeep(rules, o.rules, true);
1158      }
1159
1160      @Override
1161      public boolean equalsShallow(Base other_) {
1162        if (!super.equalsShallow(other_))
1163          return false;
1164        if (!(other_ instanceof ElementDefinitionSlicingComponent))
1165          return false;
1166        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other_;
1167        return compareValues(description, o.description, true) && compareValues(ordered, o.ordered, true) && compareValues(rules, o.rules, true)
1168          ;
1169      }
1170
1171      public boolean isEmpty() {
1172        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(discriminator, description
1173          , ordered, rules);
1174      }
1175
1176  public String fhirType() {
1177    return "ElementDefinition.slicing";
1178
1179  }
1180
1181  }
1182
1183    @Block()
1184    public static class ElementDefinitionSlicingDiscriminatorComponent extends Element implements IBaseDatatypeElement {
1185        /**
1186         * How the element value is interpreted when discrimination is evaluated.
1187         */
1188        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1189        @Description(shortDefinition="value | exists | pattern | type | profile", formalDefinition="How the element value is interpreted when discrimination is evaluated." )
1190        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/discriminator-type")
1191        protected Enumeration<DiscriminatorType> type;
1192
1193        /**
1194         * A FHIRPath expression, using [the simple subset of FHIRPath](fhirpath.html#simple), that is used to identify the element on which discrimination is based.
1195         */
1196        @Child(name = "path", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1197        @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." )
1198        protected StringType path;
1199
1200        private static final long serialVersionUID = 1151159293L;
1201
1202    /**
1203     * Constructor
1204     */
1205      public ElementDefinitionSlicingDiscriminatorComponent() {
1206        super();
1207      }
1208
1209    /**
1210     * Constructor
1211     */
1212      public ElementDefinitionSlicingDiscriminatorComponent(DiscriminatorType type, String path) {
1213        super();
1214        this.setType(type);
1215        this.setPath(path);
1216      }
1217
1218        /**
1219         * @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
1220         */
1221        public Enumeration<DiscriminatorType> getTypeElement() { 
1222          if (this.type == null)
1223            if (Configuration.errorOnAutoCreate())
1224              throw new Error("Attempt to auto-create ElementDefinitionSlicingDiscriminatorComponent.type");
1225            else if (Configuration.doAutoCreate())
1226              this.type = new Enumeration<DiscriminatorType>(new DiscriminatorTypeEnumFactory()); // bb
1227          return this.type;
1228        }
1229
1230        public boolean hasTypeElement() { 
1231          return this.type != null && !this.type.isEmpty();
1232        }
1233
1234        public boolean hasType() { 
1235          return this.type != null && !this.type.isEmpty();
1236        }
1237
1238        /**
1239         * @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
1240         */
1241        public ElementDefinitionSlicingDiscriminatorComponent setTypeElement(Enumeration<DiscriminatorType> value) { 
1242          this.type = value;
1243          return this;
1244        }
1245
1246        /**
1247         * @return How the element value is interpreted when discrimination is evaluated.
1248         */
1249        public DiscriminatorType getType() { 
1250          return this.type == null ? null : this.type.getValue();
1251        }
1252
1253        /**
1254         * @param value How the element value is interpreted when discrimination is evaluated.
1255         */
1256        public ElementDefinitionSlicingDiscriminatorComponent setType(DiscriminatorType value) { 
1257            if (this.type == null)
1258              this.type = new Enumeration<DiscriminatorType>(new DiscriminatorTypeEnumFactory());
1259            this.type.setValue(value);
1260          return this;
1261        }
1262
1263        /**
1264         * @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
1265         */
1266        public StringType getPathElement() { 
1267          if (this.path == null)
1268            if (Configuration.errorOnAutoCreate())
1269              throw new Error("Attempt to auto-create ElementDefinitionSlicingDiscriminatorComponent.path");
1270            else if (Configuration.doAutoCreate())
1271              this.path = new StringType(); // bb
1272          return this.path;
1273        }
1274
1275        public boolean hasPathElement() { 
1276          return this.path != null && !this.path.isEmpty();
1277        }
1278
1279        public boolean hasPath() { 
1280          return this.path != null && !this.path.isEmpty();
1281        }
1282
1283        /**
1284         * @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
1285         */
1286        public ElementDefinitionSlicingDiscriminatorComponent setPathElement(StringType value) { 
1287          this.path = value;
1288          return this;
1289        }
1290
1291        /**
1292         * @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.
1293         */
1294        public String getPath() { 
1295          return this.path == null ? null : this.path.getValue();
1296        }
1297
1298        /**
1299         * @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.
1300         */
1301        public ElementDefinitionSlicingDiscriminatorComponent setPath(String value) { 
1302            if (this.path == null)
1303              this.path = new StringType();
1304            this.path.setValue(value);
1305          return this;
1306        }
1307
1308        protected void listChildren(List<Property> children) {
1309          super.listChildren(children);
1310          children.add(new Property("type", "code", "How the element value is interpreted when discrimination is evaluated.", 0, 1, type));
1311          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));
1312        }
1313
1314        @Override
1315        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1316          switch (_hash) {
1317          case 3575610: /*type*/  return new Property("type", "code", "How the element value is interpreted when discrimination is evaluated.", 0, 1, type);
1318          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);
1319          default: return super.getNamedProperty(_hash, _name, _checkValid);
1320          }
1321
1322        }
1323
1324      @Override
1325      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1326        switch (hash) {
1327        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DiscriminatorType>
1328        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1329        default: return super.getProperty(hash, name, checkValid);
1330        }
1331
1332      }
1333
1334      @Override
1335      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1336        switch (hash) {
1337        case 3575610: // type
1338          value = new DiscriminatorTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1339          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1340          return value;
1341        case 3433509: // path
1342          this.path = TypeConvertor.castToString(value); // StringType
1343          return value;
1344        default: return super.setProperty(hash, name, value);
1345        }
1346
1347      }
1348
1349      @Override
1350      public Base setProperty(String name, Base value) throws FHIRException {
1351        if (name.equals("type")) {
1352          value = new DiscriminatorTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1353          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1354        } else if (name.equals("path")) {
1355          this.path = TypeConvertor.castToString(value); // StringType
1356        } else
1357          return super.setProperty(name, value);
1358        return value;
1359      }
1360
1361      @Override
1362      public Base makeProperty(int hash, String name) throws FHIRException {
1363        switch (hash) {
1364        case 3575610:  return getTypeElement();
1365        case 3433509:  return getPathElement();
1366        default: return super.makeProperty(hash, name);
1367        }
1368
1369      }
1370
1371      @Override
1372      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1373        switch (hash) {
1374        case 3575610: /*type*/ return new String[] {"code"};
1375        case 3433509: /*path*/ return new String[] {"string"};
1376        default: return super.getTypesForProperty(hash, name);
1377        }
1378
1379      }
1380
1381      @Override
1382      public Base addChild(String name) throws FHIRException {
1383        if (name.equals("type")) {
1384          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.slicing.discriminator.type");
1385        }
1386        else if (name.equals("path")) {
1387          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.slicing.discriminator.path");
1388        }
1389        else
1390          return super.addChild(name);
1391      }
1392
1393      public ElementDefinitionSlicingDiscriminatorComponent copy() {
1394        ElementDefinitionSlicingDiscriminatorComponent dst = new ElementDefinitionSlicingDiscriminatorComponent();
1395        copyValues(dst);
1396        return dst;
1397      }
1398
1399      public void copyValues(ElementDefinitionSlicingDiscriminatorComponent dst) {
1400        super.copyValues(dst);
1401        dst.type = type == null ? null : type.copy();
1402        dst.path = path == null ? null : path.copy();
1403      }
1404
1405      @Override
1406      public boolean equalsDeep(Base other_) {
1407        if (!super.equalsDeep(other_))
1408          return false;
1409        if (!(other_ instanceof ElementDefinitionSlicingDiscriminatorComponent))
1410          return false;
1411        ElementDefinitionSlicingDiscriminatorComponent o = (ElementDefinitionSlicingDiscriminatorComponent) other_;
1412        return compareDeep(type, o.type, true) && compareDeep(path, o.path, true);
1413      }
1414
1415      @Override
1416      public boolean equalsShallow(Base other_) {
1417        if (!super.equalsShallow(other_))
1418          return false;
1419        if (!(other_ instanceof ElementDefinitionSlicingDiscriminatorComponent))
1420          return false;
1421        ElementDefinitionSlicingDiscriminatorComponent o = (ElementDefinitionSlicingDiscriminatorComponent) other_;
1422        return compareValues(type, o.type, true) && compareValues(path, o.path, true);
1423      }
1424
1425      public boolean isEmpty() {
1426        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, path);
1427      }
1428
1429  public String fhirType() {
1430    return "ElementDefinition.slicing.discriminator";
1431
1432  }
1433
1434  }
1435
1436    @Block()
1437    public static class ElementDefinitionBaseComponent extends Element implements IBaseDatatypeElement {
1438        /**
1439         * 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.
1440         */
1441        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1442        @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." )
1443        protected StringType path;
1444
1445        /**
1446         * Minimum cardinality of the base element identified by the path.
1447         */
1448        @Child(name = "min", type = {UnsignedIntType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1449        @Description(shortDefinition="Min cardinality of the base element", formalDefinition="Minimum cardinality of the base element identified by the path." )
1450        protected UnsignedIntType min;
1451
1452        /**
1453         * Maximum cardinality of the base element identified by the path.
1454         */
1455        @Child(name = "max", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1456        @Description(shortDefinition="Max cardinality of the base element", formalDefinition="Maximum cardinality of the base element identified by the path." )
1457        protected StringType max;
1458
1459        private static final long serialVersionUID = -1412704221L;
1460
1461    /**
1462     * Constructor
1463     */
1464      public ElementDefinitionBaseComponent() {
1465        super();
1466      }
1467
1468    /**
1469     * Constructor
1470     */
1471      public ElementDefinitionBaseComponent(String path, int min, String max) {
1472        super();
1473        this.setPath(path);
1474        this.setMin(min);
1475        this.setMax(max);
1476      }
1477
1478        /**
1479         * @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
1480         */
1481        public StringType getPathElement() { 
1482          if (this.path == null)
1483            if (Configuration.errorOnAutoCreate())
1484              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.path");
1485            else if (Configuration.doAutoCreate())
1486              this.path = new StringType(); // bb
1487          return this.path;
1488        }
1489
1490        public boolean hasPathElement() { 
1491          return this.path != null && !this.path.isEmpty();
1492        }
1493
1494        public boolean hasPath() { 
1495          return this.path != null && !this.path.isEmpty();
1496        }
1497
1498        /**
1499         * @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
1500         */
1501        public ElementDefinitionBaseComponent setPathElement(StringType value) { 
1502          this.path = value;
1503          return this;
1504        }
1505
1506        /**
1507         * @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.
1508         */
1509        public String getPath() { 
1510          return this.path == null ? null : this.path.getValue();
1511        }
1512
1513        /**
1514         * @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.
1515         */
1516        public ElementDefinitionBaseComponent setPath(String value) { 
1517            if (this.path == null)
1518              this.path = new StringType();
1519            this.path.setValue(value);
1520          return this;
1521        }
1522
1523        /**
1524         * @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
1525         */
1526        public UnsignedIntType getMinElement() { 
1527          if (this.min == null)
1528            if (Configuration.errorOnAutoCreate())
1529              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.min");
1530            else if (Configuration.doAutoCreate())
1531              this.min = new UnsignedIntType(); // bb
1532          return this.min;
1533        }
1534
1535        public boolean hasMinElement() { 
1536          return this.min != null && !this.min.isEmpty();
1537        }
1538
1539        public boolean hasMin() { 
1540          return this.min != null && !this.min.isEmpty();
1541        }
1542
1543        /**
1544         * @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
1545         */
1546        public ElementDefinitionBaseComponent setMinElement(UnsignedIntType value) { 
1547          this.min = value;
1548          return this;
1549        }
1550
1551        /**
1552         * @return Minimum cardinality of the base element identified by the path.
1553         */
1554        public int getMin() { 
1555          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
1556        }
1557
1558        /**
1559         * @param value Minimum cardinality of the base element identified by the path.
1560         */
1561        public ElementDefinitionBaseComponent setMin(int value) { 
1562            if (this.min == null)
1563              this.min = new UnsignedIntType();
1564            this.min.setValue(value);
1565          return this;
1566        }
1567
1568        /**
1569         * @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
1570         */
1571        public StringType getMaxElement() { 
1572          if (this.max == null)
1573            if (Configuration.errorOnAutoCreate())
1574              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.max");
1575            else if (Configuration.doAutoCreate())
1576              this.max = new StringType(); // bb
1577          return this.max;
1578        }
1579
1580        public boolean hasMaxElement() { 
1581          return this.max != null && !this.max.isEmpty();
1582        }
1583
1584        public boolean hasMax() { 
1585          return this.max != null && !this.max.isEmpty();
1586        }
1587
1588        /**
1589         * @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
1590         */
1591        public ElementDefinitionBaseComponent setMaxElement(StringType value) { 
1592          this.max = value;
1593          return this;
1594        }
1595
1596        /**
1597         * @return Maximum cardinality of the base element identified by the path.
1598         */
1599        public String getMax() { 
1600          return this.max == null ? null : this.max.getValue();
1601        }
1602
1603        /**
1604         * @param value Maximum cardinality of the base element identified by the path.
1605         */
1606        public ElementDefinitionBaseComponent setMax(String value) { 
1607            if (this.max == null)
1608              this.max = new StringType();
1609            this.max.setValue(value);
1610          return this;
1611        }
1612
1613        protected void listChildren(List<Property> children) {
1614          super.listChildren(children);
1615          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));
1616          children.add(new Property("min", "unsignedInt", "Minimum cardinality of the base element identified by the path.", 0, 1, min));
1617          children.add(new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, 1, max));
1618        }
1619
1620        @Override
1621        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1622          switch (_hash) {
1623          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);
1624          case 108114: /*min*/  return new Property("min", "unsignedInt", "Minimum cardinality of the base element identified by the path.", 0, 1, min);
1625          case 107876: /*max*/  return new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, 1, max);
1626          default: return super.getNamedProperty(_hash, _name, _checkValid);
1627          }
1628
1629        }
1630
1631      @Override
1632      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1633        switch (hash) {
1634        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1635        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // UnsignedIntType
1636        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
1637        default: return super.getProperty(hash, name, checkValid);
1638        }
1639
1640      }
1641
1642      @Override
1643      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1644        switch (hash) {
1645        case 3433509: // path
1646          this.path = TypeConvertor.castToString(value); // StringType
1647          return value;
1648        case 108114: // min
1649          this.min = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1650          return value;
1651        case 107876: // max
1652          this.max = TypeConvertor.castToString(value); // StringType
1653          return value;
1654        default: return super.setProperty(hash, name, value);
1655        }
1656
1657      }
1658
1659      @Override
1660      public Base setProperty(String name, Base value) throws FHIRException {
1661        if (name.equals("path")) {
1662          this.path = TypeConvertor.castToString(value); // StringType
1663        } else if (name.equals("min")) {
1664          this.min = TypeConvertor.castToUnsignedInt(value); // UnsignedIntType
1665        } else if (name.equals("max")) {
1666          this.max = TypeConvertor.castToString(value); // StringType
1667        } else
1668          return super.setProperty(name, value);
1669        return value;
1670      }
1671
1672      @Override
1673      public Base makeProperty(int hash, String name) throws FHIRException {
1674        switch (hash) {
1675        case 3433509:  return getPathElement();
1676        case 108114:  return getMinElement();
1677        case 107876:  return getMaxElement();
1678        default: return super.makeProperty(hash, name);
1679        }
1680
1681      }
1682
1683      @Override
1684      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1685        switch (hash) {
1686        case 3433509: /*path*/ return new String[] {"string"};
1687        case 108114: /*min*/ return new String[] {"unsignedInt"};
1688        case 107876: /*max*/ return new String[] {"string"};
1689        default: return super.getTypesForProperty(hash, name);
1690        }
1691
1692      }
1693
1694      @Override
1695      public Base addChild(String name) throws FHIRException {
1696        if (name.equals("path")) {
1697          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.base.path");
1698        }
1699        else if (name.equals("min")) {
1700          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.base.min");
1701        }
1702        else if (name.equals("max")) {
1703          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.base.max");
1704        }
1705        else
1706          return super.addChild(name);
1707      }
1708
1709      public ElementDefinitionBaseComponent copy() {
1710        ElementDefinitionBaseComponent dst = new ElementDefinitionBaseComponent();
1711        copyValues(dst);
1712        return dst;
1713      }
1714
1715      public void copyValues(ElementDefinitionBaseComponent dst) {
1716        super.copyValues(dst);
1717        dst.path = path == null ? null : path.copy();
1718        dst.min = min == null ? null : min.copy();
1719        dst.max = max == null ? null : max.copy();
1720      }
1721
1722      @Override
1723      public boolean equalsDeep(Base other_) {
1724        if (!super.equalsDeep(other_))
1725          return false;
1726        if (!(other_ instanceof ElementDefinitionBaseComponent))
1727          return false;
1728        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other_;
1729        return compareDeep(path, o.path, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
1730          ;
1731      }
1732
1733      @Override
1734      public boolean equalsShallow(Base other_) {
1735        if (!super.equalsShallow(other_))
1736          return false;
1737        if (!(other_ instanceof ElementDefinitionBaseComponent))
1738          return false;
1739        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other_;
1740        return compareValues(path, o.path, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
1741          ;
1742      }
1743
1744      public boolean isEmpty() {
1745        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, min, max);
1746      }
1747
1748  public String fhirType() {
1749    return "ElementDefinition.base";
1750
1751  }
1752
1753  }
1754
1755    @Block()
1756    public static class TypeRefComponent extends Element implements IBaseDatatypeElement {
1757        /**
1758         * 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.
1759         */
1760        @Child(name = "code", type = {UriType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1761        @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." )
1762        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fhir-element-types")
1763        protected UriType code;
1764
1765        /**
1766         * 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.
1767         */
1768        @Child(name = "profile", type = {CanonicalType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1769        @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." )
1770        protected List<CanonicalType> profile;
1771
1772        /**
1773         * 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.
1774         */
1775        @Child(name = "targetProfile", type = {CanonicalType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1776        @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." )
1777        protected List<CanonicalType> targetProfile;
1778
1779        /**
1780         * 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.
1781         */
1782        @Child(name = "aggregation", type = {CodeType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1783        @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." )
1784        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-aggregation-mode")
1785        protected List<Enumeration<AggregationMode>> aggregation;
1786
1787        /**
1788         * Whether this reference needs to be version specific or version independent, or whether either can be used.
1789         */
1790        @Child(name = "versioning", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1791        @Description(shortDefinition="either | independent | specific", formalDefinition="Whether this reference needs to be version specific or version independent, or whether either can be used." )
1792        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/reference-version-rules")
1793        protected Enumeration<ReferenceVersionRules> versioning;
1794
1795        private static final long serialVersionUID = 957891653L;
1796
1797    /**
1798     * Constructor
1799     */
1800      public TypeRefComponent() {
1801        super();
1802      }
1803
1804    /**
1805     * Constructor
1806     */
1807      public TypeRefComponent(String code) {
1808        super();
1809        this.setCode(code);
1810      }
1811
1812        /**
1813         * @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
1814         */
1815        public UriType getCodeElement() { 
1816          if (this.code == null)
1817            if (Configuration.errorOnAutoCreate())
1818              throw new Error("Attempt to auto-create TypeRefComponent.code");
1819            else if (Configuration.doAutoCreate())
1820              this.code = new UriType(); // bb
1821          return this.code;
1822        }
1823
1824        public boolean hasCodeElement() { 
1825          return this.code != null && !this.code.isEmpty();
1826        }
1827
1828        public boolean hasCode() { 
1829          return this.code != null && !this.code.isEmpty();
1830        }
1831
1832        /**
1833         * @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
1834         */
1835        public TypeRefComponent setCodeElement(UriType value) { 
1836          this.code = value;
1837          return this;
1838        }
1839
1840        /**
1841         * @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.
1842         */
1843        public String getCode() { 
1844          return this.code == null ? null : this.code.getValue();
1845        }
1846
1847        /**
1848         * @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.
1849         */
1850        public TypeRefComponent setCode(String value) { 
1851            if (this.code == null)
1852              this.code = new UriType();
1853            this.code.setValue(value);
1854          return this;
1855        }
1856
1857        /**
1858         * @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.)
1859         */
1860        public List<CanonicalType> getProfile() { 
1861          if (this.profile == null)
1862            this.profile = new ArrayList<CanonicalType>();
1863          return this.profile;
1864        }
1865
1866        /**
1867         * @return Returns a reference to <code>this</code> for easy method chaining
1868         */
1869        public TypeRefComponent setProfile(List<CanonicalType> theProfile) { 
1870          this.profile = theProfile;
1871          return this;
1872        }
1873
1874        public boolean hasProfile() { 
1875          if (this.profile == null)
1876            return false;
1877          for (CanonicalType item : this.profile)
1878            if (!item.isEmpty())
1879              return true;
1880          return false;
1881        }
1882
1883        /**
1884         * @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.)
1885         */
1886        public CanonicalType addProfileElement() {//2 
1887          CanonicalType t = new CanonicalType();
1888          if (this.profile == null)
1889            this.profile = new ArrayList<CanonicalType>();
1890          this.profile.add(t);
1891          return t;
1892        }
1893
1894        /**
1895         * @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.)
1896         */
1897        public TypeRefComponent addProfile(String value) { //1
1898          CanonicalType t = new CanonicalType();
1899          t.setValue(value);
1900          if (this.profile == null)
1901            this.profile = new ArrayList<CanonicalType>();
1902          this.profile.add(t);
1903          return this;
1904        }
1905
1906        /**
1907         * @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.)
1908         */
1909        public boolean hasProfile(String value) { 
1910          if (this.profile == null)
1911            return false;
1912          for (CanonicalType v : this.profile)
1913            if (v.getValue().equals(value)) // canonical
1914              return true;
1915          return false;
1916        }
1917
1918        /**
1919         * @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.)
1920         */
1921        public List<CanonicalType> getTargetProfile() { 
1922          if (this.targetProfile == null)
1923            this.targetProfile = new ArrayList<CanonicalType>();
1924          return this.targetProfile;
1925        }
1926
1927        /**
1928         * @return Returns a reference to <code>this</code> for easy method chaining
1929         */
1930        public TypeRefComponent setTargetProfile(List<CanonicalType> theTargetProfile) { 
1931          this.targetProfile = theTargetProfile;
1932          return this;
1933        }
1934
1935        public boolean hasTargetProfile() { 
1936          if (this.targetProfile == null)
1937            return false;
1938          for (CanonicalType item : this.targetProfile)
1939            if (!item.isEmpty())
1940              return true;
1941          return false;
1942        }
1943
1944        /**
1945         * @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.)
1946         */
1947        public CanonicalType addTargetProfileElement() {//2 
1948          CanonicalType t = new CanonicalType();
1949          if (this.targetProfile == null)
1950            this.targetProfile = new ArrayList<CanonicalType>();
1951          this.targetProfile.add(t);
1952          return t;
1953        }
1954
1955        /**
1956         * @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.)
1957         */
1958        public TypeRefComponent addTargetProfile(String value) { //1
1959          CanonicalType t = new CanonicalType();
1960          t.setValue(value);
1961          if (this.targetProfile == null)
1962            this.targetProfile = new ArrayList<CanonicalType>();
1963          this.targetProfile.add(t);
1964          return this;
1965        }
1966
1967        /**
1968         * @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.)
1969         */
1970        public boolean hasTargetProfile(String value) { 
1971          if (this.targetProfile == null)
1972            return false;
1973          for (CanonicalType v : this.targetProfile)
1974            if (v.getValue().equals(value)) // canonical
1975              return true;
1976          return false;
1977        }
1978
1979        /**
1980         * @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.)
1981         */
1982        public List<Enumeration<AggregationMode>> getAggregation() { 
1983          if (this.aggregation == null)
1984            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1985          return this.aggregation;
1986        }
1987
1988        /**
1989         * @return Returns a reference to <code>this</code> for easy method chaining
1990         */
1991        public TypeRefComponent setAggregation(List<Enumeration<AggregationMode>> theAggregation) { 
1992          this.aggregation = theAggregation;
1993          return this;
1994        }
1995
1996        public boolean hasAggregation() { 
1997          if (this.aggregation == null)
1998            return false;
1999          for (Enumeration<AggregationMode> item : this.aggregation)
2000            if (!item.isEmpty())
2001              return true;
2002          return false;
2003        }
2004
2005        /**
2006         * @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.)
2007         */
2008        public Enumeration<AggregationMode> addAggregationElement() {//2 
2009          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
2010          if (this.aggregation == null)
2011            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2012          this.aggregation.add(t);
2013          return t;
2014        }
2015
2016        /**
2017         * @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.)
2018         */
2019        public TypeRefComponent addAggregation(AggregationMode value) { //1
2020          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
2021          t.setValue(value);
2022          if (this.aggregation == null)
2023            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2024          this.aggregation.add(t);
2025          return this;
2026        }
2027
2028        /**
2029         * @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.)
2030         */
2031        public boolean hasAggregation(AggregationMode value) { 
2032          if (this.aggregation == null)
2033            return false;
2034          for (Enumeration<AggregationMode> v : this.aggregation)
2035            if (v.getValue().equals(value)) // code
2036              return true;
2037          return false;
2038        }
2039
2040        /**
2041         * @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
2042         */
2043        public Enumeration<ReferenceVersionRules> getVersioningElement() { 
2044          if (this.versioning == null)
2045            if (Configuration.errorOnAutoCreate())
2046              throw new Error("Attempt to auto-create TypeRefComponent.versioning");
2047            else if (Configuration.doAutoCreate())
2048              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory()); // bb
2049          return this.versioning;
2050        }
2051
2052        public boolean hasVersioningElement() { 
2053          return this.versioning != null && !this.versioning.isEmpty();
2054        }
2055
2056        public boolean hasVersioning() { 
2057          return this.versioning != null && !this.versioning.isEmpty();
2058        }
2059
2060        /**
2061         * @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
2062         */
2063        public TypeRefComponent setVersioningElement(Enumeration<ReferenceVersionRules> value) { 
2064          this.versioning = value;
2065          return this;
2066        }
2067
2068        /**
2069         * @return Whether this reference needs to be version specific or version independent, or whether either can be used.
2070         */
2071        public ReferenceVersionRules getVersioning() { 
2072          return this.versioning == null ? null : this.versioning.getValue();
2073        }
2074
2075        /**
2076         * @param value Whether this reference needs to be version specific or version independent, or whether either can be used.
2077         */
2078        public TypeRefComponent setVersioning(ReferenceVersionRules value) { 
2079          if (value == null)
2080            this.versioning = null;
2081          else {
2082            if (this.versioning == null)
2083              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory());
2084            this.versioning.setValue(value);
2085          }
2086          return this;
2087        }
2088
2089        protected void listChildren(List<Property> children) {
2090          super.listChildren(children);
2091          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));
2092          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));
2093          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));
2094          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));
2095          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));
2096        }
2097
2098        @Override
2099        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2100          switch (_hash) {
2101          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);
2102          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);
2103          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);
2104          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);
2105          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);
2106          default: return super.getNamedProperty(_hash, _name, _checkValid);
2107          }
2108
2109        }
2110
2111      @Override
2112      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2113        switch (hash) {
2114        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // UriType
2115        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
2116        case 1994521304: /*targetProfile*/ return this.targetProfile == null ? new Base[0] : this.targetProfile.toArray(new Base[this.targetProfile.size()]); // CanonicalType
2117        case 841524962: /*aggregation*/ return this.aggregation == null ? new Base[0] : this.aggregation.toArray(new Base[this.aggregation.size()]); // Enumeration<AggregationMode>
2118        case -670487542: /*versioning*/ return this.versioning == null ? new Base[0] : new Base[] {this.versioning}; // Enumeration<ReferenceVersionRules>
2119        default: return super.getProperty(hash, name, checkValid);
2120        }
2121
2122      }
2123
2124      @Override
2125      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2126        switch (hash) {
2127        case 3059181: // code
2128          this.code = TypeConvertor.castToUri(value); // UriType
2129          return value;
2130        case -309425751: // profile
2131          this.getProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2132          return value;
2133        case 1994521304: // targetProfile
2134          this.getTargetProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2135          return value;
2136        case 841524962: // aggregation
2137          value = new AggregationModeEnumFactory().fromType(TypeConvertor.castToCode(value));
2138          this.getAggregation().add((Enumeration) value); // Enumeration<AggregationMode>
2139          return value;
2140        case -670487542: // versioning
2141          value = new ReferenceVersionRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
2142          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2143          return value;
2144        default: return super.setProperty(hash, name, value);
2145        }
2146
2147      }
2148
2149      @Override
2150      public Base setProperty(String name, Base value) throws FHIRException {
2151        if (name.equals("code")) {
2152          this.code = TypeConvertor.castToUri(value); // UriType
2153        } else if (name.equals("profile")) {
2154          this.getProfile().add(TypeConvertor.castToCanonical(value));
2155        } else if (name.equals("targetProfile")) {
2156          this.getTargetProfile().add(TypeConvertor.castToCanonical(value));
2157        } else if (name.equals("aggregation")) {
2158          value = new AggregationModeEnumFactory().fromType(TypeConvertor.castToCode(value));
2159          this.getAggregation().add((Enumeration) value);
2160        } else if (name.equals("versioning")) {
2161          value = new ReferenceVersionRulesEnumFactory().fromType(TypeConvertor.castToCode(value));
2162          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2163        } else
2164          return super.setProperty(name, value);
2165        return value;
2166      }
2167
2168      @Override
2169      public Base makeProperty(int hash, String name) throws FHIRException {
2170        switch (hash) {
2171        case 3059181:  return getCodeElement();
2172        case -309425751:  return addProfileElement();
2173        case 1994521304:  return addTargetProfileElement();
2174        case 841524962:  return addAggregationElement();
2175        case -670487542:  return getVersioningElement();
2176        default: return super.makeProperty(hash, name);
2177        }
2178
2179      }
2180
2181      @Override
2182      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2183        switch (hash) {
2184        case 3059181: /*code*/ return new String[] {"uri"};
2185        case -309425751: /*profile*/ return new String[] {"canonical"};
2186        case 1994521304: /*targetProfile*/ return new String[] {"canonical"};
2187        case 841524962: /*aggregation*/ return new String[] {"code"};
2188        case -670487542: /*versioning*/ return new String[] {"code"};
2189        default: return super.getTypesForProperty(hash, name);
2190        }
2191
2192      }
2193
2194      @Override
2195      public Base addChild(String name) throws FHIRException {
2196        if (name.equals("code")) {
2197          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.type.code");
2198        }
2199        else if (name.equals("profile")) {
2200          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.type.profile");
2201        }
2202        else if (name.equals("targetProfile")) {
2203          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.type.targetProfile");
2204        }
2205        else if (name.equals("aggregation")) {
2206          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.type.aggregation");
2207        }
2208        else if (name.equals("versioning")) {
2209          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.type.versioning");
2210        }
2211        else
2212          return super.addChild(name);
2213      }
2214
2215      public TypeRefComponent copy() {
2216        TypeRefComponent dst = new TypeRefComponent();
2217        copyValues(dst);
2218        return dst;
2219      }
2220
2221      public void copyValues(TypeRefComponent dst) {
2222        super.copyValues(dst);
2223        dst.code = code == null ? null : code.copy();
2224        if (profile != null) {
2225          dst.profile = new ArrayList<CanonicalType>();
2226          for (CanonicalType i : profile)
2227            dst.profile.add(i.copy());
2228        };
2229        if (targetProfile != null) {
2230          dst.targetProfile = new ArrayList<CanonicalType>();
2231          for (CanonicalType i : targetProfile)
2232            dst.targetProfile.add(i.copy());
2233        };
2234        if (aggregation != null) {
2235          dst.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2236          for (Enumeration<AggregationMode> i : aggregation)
2237            dst.aggregation.add(i.copy());
2238        };
2239        dst.versioning = versioning == null ? null : versioning.copy();
2240      }
2241
2242      @Override
2243      public boolean equalsDeep(Base other_) {
2244        if (!super.equalsDeep(other_))
2245          return false;
2246        if (!(other_ instanceof TypeRefComponent))
2247          return false;
2248        TypeRefComponent o = (TypeRefComponent) other_;
2249        return compareDeep(code, o.code, true) && compareDeep(profile, o.profile, true) && compareDeep(targetProfile, o.targetProfile, true)
2250           && compareDeep(aggregation, o.aggregation, true) && compareDeep(versioning, o.versioning, true)
2251          ;
2252      }
2253
2254      @Override
2255      public boolean equalsShallow(Base other_) {
2256        if (!super.equalsShallow(other_))
2257          return false;
2258        if (!(other_ instanceof TypeRefComponent))
2259          return false;
2260        TypeRefComponent o = (TypeRefComponent) other_;
2261        return compareValues(code, o.code, true) && compareValues(profile, o.profile, true) && compareValues(targetProfile, o.targetProfile, true)
2262           && compareValues(aggregation, o.aggregation, true) && compareValues(versioning, o.versioning, true)
2263          ;
2264      }
2265
2266      public boolean isEmpty() {
2267        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, profile, targetProfile
2268          , aggregation, versioning);
2269      }
2270
2271  public String fhirType() {
2272    return "ElementDefinition.type";
2273
2274  }
2275
2276// added from java-adornments.txt:
2277public boolean hasTarget() {
2278    return Utilities.existsInList(getCode(), "Reference", "canonical", "CodeableReference");
2279  }
2280  
2281    /**
2282   * This code checks for the system prefix and returns the FHIR type
2283   * 
2284   * @return
2285   */
2286  public String getWorkingCode() {
2287    if (hasExtension(ToolingExtensions.EXT_FHIR_TYPE))
2288      return getExtensionString(ToolingExtensions.EXT_FHIR_TYPE);
2289    if (!hasCodeElement()) 
2290      return null;
2291    if (getCodeElement().hasExtension(ToolingExtensions.EXT_XML_TYPE)) {
2292      String s = getCodeElement().getExtensionString(ToolingExtensions.EXT_XML_TYPE);
2293      if ("xsd:gYear OR xsd:gYearMonth OR xsd:date OR xsd:dateTime".equalsIgnoreCase(s))
2294        return "dateTime";
2295      if ("xsd:gYear OR xsd:gYearMonth OR xsd:date".equalsIgnoreCase(s))
2296        return "date";
2297      if ("xsd:dateTime".equalsIgnoreCase(s))
2298        return "instant";
2299      if ("xsd:token".equals(s))
2300        return "code";
2301      if ("xsd:boolean".equals(s))
2302        return "boolean";
2303      if ("xsd:string".equals(s))
2304        return "string";
2305      if ("xsd:time".equals(s))
2306        return "time";
2307      if ("xsd:int".equals(s))
2308        return "integer";
2309      if ("xsd:decimal OR xsd:double".equals(s))
2310        return "decimal";
2311      if ("xsd:decimal".equalsIgnoreCase(s))
2312        return "decimal";
2313      if ("xsd:base64Binary".equalsIgnoreCase(s))
2314        return "base64Binary";
2315      if ("xsd:positiveInteger".equalsIgnoreCase(s))
2316        return "positiveInt";
2317      if ("xsd:nonNegativeInteger".equalsIgnoreCase(s))
2318        return "unsignedInt";
2319      if ("xsd:anyURI".equalsIgnoreCase(s))
2320        return "uri";
2321      
2322      throw new Error("Unknown xml type '"+s+"'");
2323    }
2324    return getCode();
2325  }
2326
2327  @Override
2328  public String toString() {
2329    String res = getCode();
2330    if (hasProfile()) {
2331      res = res + "{";
2332      boolean first = true;
2333      for (CanonicalType s : getProfile()) {
2334        if (first) first = false; else res = res + "|";
2335        res = res + s.getValue();
2336      }
2337      res = res + "}";
2338    }
2339    if (hasTargetProfile()) {
2340      res = res + "->(";
2341      boolean first = true;
2342      for (CanonicalType s : getTargetProfile()) {
2343        if (first) first = false; else res = res + "|";
2344        res = res + s.getValue();
2345      }
2346      res = res + ")";
2347    }    
2348    return res;
2349  }
2350
2351  public String getName() {
2352    return getWorkingCode();
2353  }
2354
2355  public boolean isResourceReference() {
2356    return "Reference".equals(getCode()) && hasTargetProfile();
2357  }
2358// end addition
2359  }
2360
2361    @Block()
2362    public static class ElementDefinitionExampleComponent extends Element implements IBaseDatatypeElement {
2363        /**
2364         * Describes the purpose of this example amoung the set of examples.
2365         */
2366        @Child(name = "label", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2367        @Description(shortDefinition="Describes the purpose of this example", formalDefinition="Describes the purpose of this example amoung the set of examples." )
2368        protected StringType label;
2369
2370        /**
2371         * The actual value for the element, which must be one of the types allowed for this element.
2372         */
2373        @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, Contributor.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Dosage.class, Meta.class}, order=2, min=1, max=1, modifier=false, summary=true)
2374        @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." )
2375        protected DataType value;
2376
2377        private static final long serialVersionUID = 463190922L;
2378
2379    /**
2380     * Constructor
2381     */
2382      public ElementDefinitionExampleComponent() {
2383        super();
2384      }
2385
2386    /**
2387     * Constructor
2388     */
2389      public ElementDefinitionExampleComponent(String label, DataType value) {
2390        super();
2391        this.setLabel(label);
2392        this.setValue(value);
2393      }
2394
2395        /**
2396         * @return {@link #label} (Describes the purpose of this example amoung the set of examples.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
2397         */
2398        public StringType getLabelElement() { 
2399          if (this.label == null)
2400            if (Configuration.errorOnAutoCreate())
2401              throw new Error("Attempt to auto-create ElementDefinitionExampleComponent.label");
2402            else if (Configuration.doAutoCreate())
2403              this.label = new StringType(); // bb
2404          return this.label;
2405        }
2406
2407        public boolean hasLabelElement() { 
2408          return this.label != null && !this.label.isEmpty();
2409        }
2410
2411        public boolean hasLabel() { 
2412          return this.label != null && !this.label.isEmpty();
2413        }
2414
2415        /**
2416         * @param value {@link #label} (Describes the purpose of this example amoung the set of examples.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
2417         */
2418        public ElementDefinitionExampleComponent setLabelElement(StringType value) { 
2419          this.label = value;
2420          return this;
2421        }
2422
2423        /**
2424         * @return Describes the purpose of this example amoung the set of examples.
2425         */
2426        public String getLabel() { 
2427          return this.label == null ? null : this.label.getValue();
2428        }
2429
2430        /**
2431         * @param value Describes the purpose of this example amoung the set of examples.
2432         */
2433        public ElementDefinitionExampleComponent setLabel(String value) { 
2434            if (this.label == null)
2435              this.label = new StringType();
2436            this.label.setValue(value);
2437          return this;
2438        }
2439
2440        /**
2441         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2442         */
2443        public DataType getValue() { 
2444          return this.value;
2445        }
2446
2447        /**
2448         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2449         */
2450        public Base64BinaryType getValueBase64BinaryType() throws FHIRException { 
2451          if (this.value == null)
2452            this.value = new Base64BinaryType();
2453          if (!(this.value instanceof Base64BinaryType))
2454            throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.value.getClass().getName()+" was encountered");
2455          return (Base64BinaryType) this.value;
2456        }
2457
2458        public boolean hasValueBase64BinaryType() { 
2459          return this != null && this.value instanceof Base64BinaryType;
2460        }
2461
2462        /**
2463         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2464         */
2465        public BooleanType getValueBooleanType() throws FHIRException { 
2466          if (this.value == null)
2467            this.value = new BooleanType();
2468          if (!(this.value instanceof BooleanType))
2469            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
2470          return (BooleanType) this.value;
2471        }
2472
2473        public boolean hasValueBooleanType() { 
2474          return this != null && this.value instanceof BooleanType;
2475        }
2476
2477        /**
2478         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2479         */
2480        public CanonicalType getValueCanonicalType() throws FHIRException { 
2481          if (this.value == null)
2482            this.value = new CanonicalType();
2483          if (!(this.value instanceof CanonicalType))
2484            throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.value.getClass().getName()+" was encountered");
2485          return (CanonicalType) this.value;
2486        }
2487
2488        public boolean hasValueCanonicalType() { 
2489          return this != null && this.value instanceof CanonicalType;
2490        }
2491
2492        /**
2493         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2494         */
2495        public CodeType getValueCodeType() throws FHIRException { 
2496          if (this.value == null)
2497            this.value = new CodeType();
2498          if (!(this.value instanceof CodeType))
2499            throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.value.getClass().getName()+" was encountered");
2500          return (CodeType) this.value;
2501        }
2502
2503        public boolean hasValueCodeType() { 
2504          return this != null && this.value instanceof CodeType;
2505        }
2506
2507        /**
2508         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2509         */
2510        public DateType getValueDateType() throws FHIRException { 
2511          if (this.value == null)
2512            this.value = new DateType();
2513          if (!(this.value instanceof DateType))
2514            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
2515          return (DateType) this.value;
2516        }
2517
2518        public boolean hasValueDateType() { 
2519          return this != null && this.value instanceof DateType;
2520        }
2521
2522        /**
2523         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2524         */
2525        public DateTimeType getValueDateTimeType() throws FHIRException { 
2526          if (this.value == null)
2527            this.value = new DateTimeType();
2528          if (!(this.value instanceof DateTimeType))
2529            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2530          return (DateTimeType) this.value;
2531        }
2532
2533        public boolean hasValueDateTimeType() { 
2534          return this != null && this.value instanceof DateTimeType;
2535        }
2536
2537        /**
2538         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2539         */
2540        public DecimalType getValueDecimalType() throws FHIRException { 
2541          if (this.value == null)
2542            this.value = new DecimalType();
2543          if (!(this.value instanceof DecimalType))
2544            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
2545          return (DecimalType) this.value;
2546        }
2547
2548        public boolean hasValueDecimalType() { 
2549          return this != null && this.value instanceof DecimalType;
2550        }
2551
2552        /**
2553         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2554         */
2555        public IdType getValueIdType() throws FHIRException { 
2556          if (this.value == null)
2557            this.value = new IdType();
2558          if (!(this.value instanceof IdType))
2559            throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.value.getClass().getName()+" was encountered");
2560          return (IdType) this.value;
2561        }
2562
2563        public boolean hasValueIdType() { 
2564          return this != null && this.value instanceof IdType;
2565        }
2566
2567        /**
2568         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2569         */
2570        public InstantType getValueInstantType() throws FHIRException { 
2571          if (this.value == null)
2572            this.value = new InstantType();
2573          if (!(this.value instanceof InstantType))
2574            throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.value.getClass().getName()+" was encountered");
2575          return (InstantType) this.value;
2576        }
2577
2578        public boolean hasValueInstantType() { 
2579          return this != null && this.value instanceof InstantType;
2580        }
2581
2582        /**
2583         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2584         */
2585        public IntegerType getValueIntegerType() throws FHIRException { 
2586          if (this.value == null)
2587            this.value = new IntegerType();
2588          if (!(this.value instanceof IntegerType))
2589            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2590          return (IntegerType) this.value;
2591        }
2592
2593        public boolean hasValueIntegerType() { 
2594          return this != null && this.value instanceof IntegerType;
2595        }
2596
2597        /**
2598         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2599         */
2600        public Integer64Type getValueInteger64Type() throws FHIRException { 
2601          if (this.value == null)
2602            this.value = new Integer64Type();
2603          if (!(this.value instanceof Integer64Type))
2604            throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.value.getClass().getName()+" was encountered");
2605          return (Integer64Type) this.value;
2606        }
2607
2608        public boolean hasValueInteger64Type() { 
2609          return this != null && this.value instanceof Integer64Type;
2610        }
2611
2612        /**
2613         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2614         */
2615        public MarkdownType getValueMarkdownType() throws FHIRException { 
2616          if (this.value == null)
2617            this.value = new MarkdownType();
2618          if (!(this.value instanceof MarkdownType))
2619            throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.value.getClass().getName()+" was encountered");
2620          return (MarkdownType) this.value;
2621        }
2622
2623        public boolean hasValueMarkdownType() { 
2624          return this != null && this.value instanceof MarkdownType;
2625        }
2626
2627        /**
2628         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2629         */
2630        public OidType getValueOidType() throws FHIRException { 
2631          if (this.value == null)
2632            this.value = new OidType();
2633          if (!(this.value instanceof OidType))
2634            throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.value.getClass().getName()+" was encountered");
2635          return (OidType) this.value;
2636        }
2637
2638        public boolean hasValueOidType() { 
2639          return this != null && this.value instanceof OidType;
2640        }
2641
2642        /**
2643         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2644         */
2645        public PositiveIntType getValuePositiveIntType() throws FHIRException { 
2646          if (this.value == null)
2647            this.value = new PositiveIntType();
2648          if (!(this.value instanceof PositiveIntType))
2649            throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.value.getClass().getName()+" was encountered");
2650          return (PositiveIntType) this.value;
2651        }
2652
2653        public boolean hasValuePositiveIntType() { 
2654          return this != null && this.value instanceof PositiveIntType;
2655        }
2656
2657        /**
2658         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2659         */
2660        public StringType getValueStringType() throws FHIRException { 
2661          if (this.value == null)
2662            this.value = new StringType();
2663          if (!(this.value instanceof StringType))
2664            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2665          return (StringType) this.value;
2666        }
2667
2668        public boolean hasValueStringType() { 
2669          return this != null && this.value instanceof StringType;
2670        }
2671
2672        /**
2673         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2674         */
2675        public TimeType getValueTimeType() throws FHIRException { 
2676          if (this.value == null)
2677            this.value = new TimeType();
2678          if (!(this.value instanceof TimeType))
2679            throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2680          return (TimeType) this.value;
2681        }
2682
2683        public boolean hasValueTimeType() { 
2684          return this != null && this.value instanceof TimeType;
2685        }
2686
2687        /**
2688         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2689         */
2690        public UnsignedIntType getValueUnsignedIntType() throws FHIRException { 
2691          if (this.value == null)
2692            this.value = new UnsignedIntType();
2693          if (!(this.value instanceof UnsignedIntType))
2694            throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.value.getClass().getName()+" was encountered");
2695          return (UnsignedIntType) this.value;
2696        }
2697
2698        public boolean hasValueUnsignedIntType() { 
2699          return this != null && this.value instanceof UnsignedIntType;
2700        }
2701
2702        /**
2703         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2704         */
2705        public UriType getValueUriType() throws FHIRException { 
2706          if (this.value == null)
2707            this.value = new UriType();
2708          if (!(this.value instanceof UriType))
2709            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
2710          return (UriType) this.value;
2711        }
2712
2713        public boolean hasValueUriType() { 
2714          return this != null && this.value instanceof UriType;
2715        }
2716
2717        /**
2718         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2719         */
2720        public UrlType getValueUrlType() throws FHIRException { 
2721          if (this.value == null)
2722            this.value = new UrlType();
2723          if (!(this.value instanceof UrlType))
2724            throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.value.getClass().getName()+" was encountered");
2725          return (UrlType) this.value;
2726        }
2727
2728        public boolean hasValueUrlType() { 
2729          return this != null && this.value instanceof UrlType;
2730        }
2731
2732        /**
2733         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2734         */
2735        public UuidType getValueUuidType() throws FHIRException { 
2736          if (this.value == null)
2737            this.value = new UuidType();
2738          if (!(this.value instanceof UuidType))
2739            throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.value.getClass().getName()+" was encountered");
2740          return (UuidType) this.value;
2741        }
2742
2743        public boolean hasValueUuidType() { 
2744          return this != null && this.value instanceof UuidType;
2745        }
2746
2747        /**
2748         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2749         */
2750        public Address getValueAddress() throws FHIRException { 
2751          if (this.value == null)
2752            this.value = new Address();
2753          if (!(this.value instanceof Address))
2754            throw new FHIRException("Type mismatch: the type Address was expected, but "+this.value.getClass().getName()+" was encountered");
2755          return (Address) this.value;
2756        }
2757
2758        public boolean hasValueAddress() { 
2759          return this != null && this.value instanceof Address;
2760        }
2761
2762        /**
2763         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2764         */
2765        public Age getValueAge() throws FHIRException { 
2766          if (this.value == null)
2767            this.value = new Age();
2768          if (!(this.value instanceof Age))
2769            throw new FHIRException("Type mismatch: the type Age was expected, but "+this.value.getClass().getName()+" was encountered");
2770          return (Age) this.value;
2771        }
2772
2773        public boolean hasValueAge() { 
2774          return this != null && this.value instanceof Age;
2775        }
2776
2777        /**
2778         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2779         */
2780        public Annotation getValueAnnotation() throws FHIRException { 
2781          if (this.value == null)
2782            this.value = new Annotation();
2783          if (!(this.value instanceof Annotation))
2784            throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.value.getClass().getName()+" was encountered");
2785          return (Annotation) this.value;
2786        }
2787
2788        public boolean hasValueAnnotation() { 
2789          return this != null && this.value instanceof Annotation;
2790        }
2791
2792        /**
2793         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2794         */
2795        public Attachment getValueAttachment() throws FHIRException { 
2796          if (this.value == null)
2797            this.value = new Attachment();
2798          if (!(this.value instanceof Attachment))
2799            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
2800          return (Attachment) this.value;
2801        }
2802
2803        public boolean hasValueAttachment() { 
2804          return this != null && this.value instanceof Attachment;
2805        }
2806
2807        /**
2808         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2809         */
2810        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
2811          if (this.value == null)
2812            this.value = new CodeableConcept();
2813          if (!(this.value instanceof CodeableConcept))
2814            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
2815          return (CodeableConcept) this.value;
2816        }
2817
2818        public boolean hasValueCodeableConcept() { 
2819          return this != null && this.value instanceof CodeableConcept;
2820        }
2821
2822        /**
2823         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2824         */
2825        public CodeableReference getValueCodeableReference() throws FHIRException { 
2826          if (this.value == null)
2827            this.value = new CodeableReference();
2828          if (!(this.value instanceof CodeableReference))
2829            throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.value.getClass().getName()+" was encountered");
2830          return (CodeableReference) this.value;
2831        }
2832
2833        public boolean hasValueCodeableReference() { 
2834          return this != null && this.value instanceof CodeableReference;
2835        }
2836
2837        /**
2838         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2839         */
2840        public Coding getValueCoding() throws FHIRException { 
2841          if (this.value == null)
2842            this.value = new Coding();
2843          if (!(this.value instanceof Coding))
2844            throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
2845          return (Coding) this.value;
2846        }
2847
2848        public boolean hasValueCoding() { 
2849          return this != null && this.value instanceof Coding;
2850        }
2851
2852        /**
2853         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2854         */
2855        public ContactPoint getValueContactPoint() throws FHIRException { 
2856          if (this.value == null)
2857            this.value = new ContactPoint();
2858          if (!(this.value instanceof ContactPoint))
2859            throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.value.getClass().getName()+" was encountered");
2860          return (ContactPoint) this.value;
2861        }
2862
2863        public boolean hasValueContactPoint() { 
2864          return this != null && this.value instanceof ContactPoint;
2865        }
2866
2867        /**
2868         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2869         */
2870        public Count getValueCount() throws FHIRException { 
2871          if (this.value == null)
2872            this.value = new Count();
2873          if (!(this.value instanceof Count))
2874            throw new FHIRException("Type mismatch: the type Count was expected, but "+this.value.getClass().getName()+" was encountered");
2875          return (Count) this.value;
2876        }
2877
2878        public boolean hasValueCount() { 
2879          return this != null && this.value instanceof Count;
2880        }
2881
2882        /**
2883         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2884         */
2885        public Distance getValueDistance() throws FHIRException { 
2886          if (this.value == null)
2887            this.value = new Distance();
2888          if (!(this.value instanceof Distance))
2889            throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.value.getClass().getName()+" was encountered");
2890          return (Distance) this.value;
2891        }
2892
2893        public boolean hasValueDistance() { 
2894          return this != null && this.value instanceof Distance;
2895        }
2896
2897        /**
2898         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2899         */
2900        public Duration getValueDuration() throws FHIRException { 
2901          if (this.value == null)
2902            this.value = new Duration();
2903          if (!(this.value instanceof Duration))
2904            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
2905          return (Duration) this.value;
2906        }
2907
2908        public boolean hasValueDuration() { 
2909          return this != null && this.value instanceof Duration;
2910        }
2911
2912        /**
2913         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2914         */
2915        public HumanName getValueHumanName() throws FHIRException { 
2916          if (this.value == null)
2917            this.value = new HumanName();
2918          if (!(this.value instanceof HumanName))
2919            throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.value.getClass().getName()+" was encountered");
2920          return (HumanName) this.value;
2921        }
2922
2923        public boolean hasValueHumanName() { 
2924          return this != null && this.value instanceof HumanName;
2925        }
2926
2927        /**
2928         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2929         */
2930        public Identifier getValueIdentifier() throws FHIRException { 
2931          if (this.value == null)
2932            this.value = new Identifier();
2933          if (!(this.value instanceof Identifier))
2934            throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.value.getClass().getName()+" was encountered");
2935          return (Identifier) this.value;
2936        }
2937
2938        public boolean hasValueIdentifier() { 
2939          return this != null && this.value instanceof Identifier;
2940        }
2941
2942        /**
2943         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2944         */
2945        public Money getValueMoney() throws FHIRException { 
2946          if (this.value == null)
2947            this.value = new Money();
2948          if (!(this.value instanceof Money))
2949            throw new FHIRException("Type mismatch: the type Money was expected, but "+this.value.getClass().getName()+" was encountered");
2950          return (Money) this.value;
2951        }
2952
2953        public boolean hasValueMoney() { 
2954          return this != null && this.value instanceof Money;
2955        }
2956
2957        /**
2958         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2959         */
2960        public Period getValuePeriod() throws FHIRException { 
2961          if (this.value == null)
2962            this.value = new Period();
2963          if (!(this.value instanceof Period))
2964            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
2965          return (Period) this.value;
2966        }
2967
2968        public boolean hasValuePeriod() { 
2969          return this != null && this.value instanceof Period;
2970        }
2971
2972        /**
2973         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2974         */
2975        public Quantity getValueQuantity() throws FHIRException { 
2976          if (this.value == null)
2977            this.value = new Quantity();
2978          if (!(this.value instanceof Quantity))
2979            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
2980          return (Quantity) this.value;
2981        }
2982
2983        public boolean hasValueQuantity() { 
2984          return this != null && this.value instanceof Quantity;
2985        }
2986
2987        /**
2988         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2989         */
2990        public Range getValueRange() throws FHIRException { 
2991          if (this.value == null)
2992            this.value = new Range();
2993          if (!(this.value instanceof Range))
2994            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
2995          return (Range) this.value;
2996        }
2997
2998        public boolean hasValueRange() { 
2999          return this != null && this.value instanceof Range;
3000        }
3001
3002        /**
3003         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3004         */
3005        public Ratio getValueRatio() throws FHIRException { 
3006          if (this.value == null)
3007            this.value = new Ratio();
3008          if (!(this.value instanceof Ratio))
3009            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
3010          return (Ratio) this.value;
3011        }
3012
3013        public boolean hasValueRatio() { 
3014          return this != null && this.value instanceof Ratio;
3015        }
3016
3017        /**
3018         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3019         */
3020        public RatioRange getValueRatioRange() throws FHIRException { 
3021          if (this.value == null)
3022            this.value = new RatioRange();
3023          if (!(this.value instanceof RatioRange))
3024            throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.value.getClass().getName()+" was encountered");
3025          return (RatioRange) this.value;
3026        }
3027
3028        public boolean hasValueRatioRange() { 
3029          return this != null && this.value instanceof RatioRange;
3030        }
3031
3032        /**
3033         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3034         */
3035        public Reference getValueReference() throws FHIRException { 
3036          if (this.value == null)
3037            this.value = new Reference();
3038          if (!(this.value instanceof Reference))
3039            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
3040          return (Reference) this.value;
3041        }
3042
3043        public boolean hasValueReference() { 
3044          return this != null && this.value instanceof Reference;
3045        }
3046
3047        /**
3048         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3049         */
3050        public SampledData getValueSampledData() throws FHIRException { 
3051          if (this.value == null)
3052            this.value = new SampledData();
3053          if (!(this.value instanceof SampledData))
3054            throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered");
3055          return (SampledData) this.value;
3056        }
3057
3058        public boolean hasValueSampledData() { 
3059          return this != null && this.value instanceof SampledData;
3060        }
3061
3062        /**
3063         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3064         */
3065        public Signature getValueSignature() throws FHIRException { 
3066          if (this.value == null)
3067            this.value = new Signature();
3068          if (!(this.value instanceof Signature))
3069            throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.value.getClass().getName()+" was encountered");
3070          return (Signature) this.value;
3071        }
3072
3073        public boolean hasValueSignature() { 
3074          return this != null && this.value instanceof Signature;
3075        }
3076
3077        /**
3078         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3079         */
3080        public Timing getValueTiming() throws FHIRException { 
3081          if (this.value == null)
3082            this.value = new Timing();
3083          if (!(this.value instanceof Timing))
3084            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.value.getClass().getName()+" was encountered");
3085          return (Timing) this.value;
3086        }
3087
3088        public boolean hasValueTiming() { 
3089          return this != null && this.value instanceof Timing;
3090        }
3091
3092        /**
3093         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3094         */
3095        public ContactDetail getValueContactDetail() throws FHIRException { 
3096          if (this.value == null)
3097            this.value = new ContactDetail();
3098          if (!(this.value instanceof ContactDetail))
3099            throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.value.getClass().getName()+" was encountered");
3100          return (ContactDetail) this.value;
3101        }
3102
3103        public boolean hasValueContactDetail() { 
3104          return this != null && this.value instanceof ContactDetail;
3105        }
3106
3107        /**
3108         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3109         */
3110        public Contributor getValueContributor() throws FHIRException { 
3111          if (this.value == null)
3112            this.value = new Contributor();
3113          if (!(this.value instanceof Contributor))
3114            throw new FHIRException("Type mismatch: the type Contributor was expected, but "+this.value.getClass().getName()+" was encountered");
3115          return (Contributor) this.value;
3116        }
3117
3118        public boolean hasValueContributor() { 
3119          return this != null && this.value instanceof Contributor;
3120        }
3121
3122        /**
3123         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3124         */
3125        public DataRequirement getValueDataRequirement() throws FHIRException { 
3126          if (this.value == null)
3127            this.value = new DataRequirement();
3128          if (!(this.value instanceof DataRequirement))
3129            throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.value.getClass().getName()+" was encountered");
3130          return (DataRequirement) this.value;
3131        }
3132
3133        public boolean hasValueDataRequirement() { 
3134          return this != null && this.value instanceof DataRequirement;
3135        }
3136
3137        /**
3138         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3139         */
3140        public Expression getValueExpression() throws FHIRException { 
3141          if (this.value == null)
3142            this.value = new Expression();
3143          if (!(this.value instanceof Expression))
3144            throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.value.getClass().getName()+" was encountered");
3145          return (Expression) this.value;
3146        }
3147
3148        public boolean hasValueExpression() { 
3149          return this != null && this.value instanceof Expression;
3150        }
3151
3152        /**
3153         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3154         */
3155        public ParameterDefinition getValueParameterDefinition() throws FHIRException { 
3156          if (this.value == null)
3157            this.value = new ParameterDefinition();
3158          if (!(this.value instanceof ParameterDefinition))
3159            throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
3160          return (ParameterDefinition) this.value;
3161        }
3162
3163        public boolean hasValueParameterDefinition() { 
3164          return this != null && this.value instanceof ParameterDefinition;
3165        }
3166
3167        /**
3168         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3169         */
3170        public RelatedArtifact getValueRelatedArtifact() throws FHIRException { 
3171          if (this.value == null)
3172            this.value = new RelatedArtifact();
3173          if (!(this.value instanceof RelatedArtifact))
3174            throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.value.getClass().getName()+" was encountered");
3175          return (RelatedArtifact) this.value;
3176        }
3177
3178        public boolean hasValueRelatedArtifact() { 
3179          return this != null && this.value instanceof RelatedArtifact;
3180        }
3181
3182        /**
3183         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3184         */
3185        public TriggerDefinition getValueTriggerDefinition() throws FHIRException { 
3186          if (this.value == null)
3187            this.value = new TriggerDefinition();
3188          if (!(this.value instanceof TriggerDefinition))
3189            throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
3190          return (TriggerDefinition) this.value;
3191        }
3192
3193        public boolean hasValueTriggerDefinition() { 
3194          return this != null && this.value instanceof TriggerDefinition;
3195        }
3196
3197        /**
3198         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3199         */
3200        public UsageContext getValueUsageContext() throws FHIRException { 
3201          if (this.value == null)
3202            this.value = new UsageContext();
3203          if (!(this.value instanceof UsageContext))
3204            throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.value.getClass().getName()+" was encountered");
3205          return (UsageContext) this.value;
3206        }
3207
3208        public boolean hasValueUsageContext() { 
3209          return this != null && this.value instanceof UsageContext;
3210        }
3211
3212        /**
3213         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3214         */
3215        public Dosage getValueDosage() throws FHIRException { 
3216          if (this.value == null)
3217            this.value = new Dosage();
3218          if (!(this.value instanceof Dosage))
3219            throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.value.getClass().getName()+" was encountered");
3220          return (Dosage) this.value;
3221        }
3222
3223        public boolean hasValueDosage() { 
3224          return this != null && this.value instanceof Dosage;
3225        }
3226
3227        /**
3228         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3229         */
3230        public Meta getValueMeta() throws FHIRException { 
3231          if (this.value == null)
3232            this.value = new Meta();
3233          if (!(this.value instanceof Meta))
3234            throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.value.getClass().getName()+" was encountered");
3235          return (Meta) this.value;
3236        }
3237
3238        public boolean hasValueMeta() { 
3239          return this != null && this.value instanceof Meta;
3240        }
3241
3242        public boolean hasValue() { 
3243          return this.value != null && !this.value.isEmpty();
3244        }
3245
3246        /**
3247         * @param value {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
3248         */
3249        public ElementDefinitionExampleComponent setValue(DataType value) { 
3250          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 Contributor || value instanceof DataRequirement || value instanceof Expression || value instanceof ParameterDefinition || value instanceof RelatedArtifact || value instanceof TriggerDefinition || value instanceof UsageContext || value instanceof Dosage || value instanceof Meta))
3251            throw new Error("Not the right type for ElementDefinition.example.value[x]: "+value.fhirType());
3252          this.value = value;
3253          return this;
3254        }
3255
3256        protected void listChildren(List<Property> children) {
3257          super.listChildren(children);
3258          children.add(new Property("label", "string", "Describes the purpose of this example amoung the set of examples.", 0, 1, label));
3259          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|Contributor|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value));
3260        }
3261
3262        @Override
3263        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3264          switch (_hash) {
3265          case 102727412: /*label*/  return new Property("label", "string", "Describes the purpose of this example amoung the set of examples.", 0, 1, label);
3266          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|Contributor|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3267          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|Contributor|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Dosage|Meta", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3268          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);
3269          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);
3270          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);
3271          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);
3272          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);
3273          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);
3274          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);
3275          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);
3276          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);
3277          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);
3278          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);
3279          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);
3280          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);
3281          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);
3282          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);
3283          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);
3284          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);
3285          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);
3286          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);
3287          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);
3288          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);
3289          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);
3290          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);
3291          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);
3292          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);
3293          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);
3294          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);
3295          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);
3296          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);
3297          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);
3298          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);
3299          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);
3300          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);
3301          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);
3302          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);
3303          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);
3304          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);
3305          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);
3306          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);
3307          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);
3308          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);
3309          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);
3310          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);
3311          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);
3312          case 1281021610: /*valueContributor*/  return new Property("value[x]", "Contributor", "The actual value for the element, which must be one of the types allowed for this element.", 0, 1, value);
3313          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);
3314          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);
3315          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);
3316          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);
3317          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);
3318          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);
3319          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);
3320          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);
3321          default: return super.getNamedProperty(_hash, _name, _checkValid);
3322          }
3323
3324        }
3325
3326      @Override
3327      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3328        switch (hash) {
3329        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
3330        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3331        default: return super.getProperty(hash, name, checkValid);
3332        }
3333
3334      }
3335
3336      @Override
3337      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3338        switch (hash) {
3339        case 102727412: // label
3340          this.label = TypeConvertor.castToString(value); // StringType
3341          return value;
3342        case 111972721: // value
3343          this.value = TypeConvertor.castToType(value); // DataType
3344          return value;
3345        default: return super.setProperty(hash, name, value);
3346        }
3347
3348      }
3349
3350      @Override
3351      public Base setProperty(String name, Base value) throws FHIRException {
3352        if (name.equals("label")) {
3353          this.label = TypeConvertor.castToString(value); // StringType
3354        } else if (name.equals("value[x]")) {
3355          this.value = TypeConvertor.castToType(value); // DataType
3356        } else
3357          return super.setProperty(name, value);
3358        return value;
3359      }
3360
3361      @Override
3362      public Base makeProperty(int hash, String name) throws FHIRException {
3363        switch (hash) {
3364        case 102727412:  return getLabelElement();
3365        case -1410166417:  return getValue();
3366        case 111972721:  return getValue();
3367        default: return super.makeProperty(hash, name);
3368        }
3369
3370      }
3371
3372      @Override
3373      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3374        switch (hash) {
3375        case 102727412: /*label*/ return new String[] {"string"};
3376        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", "Contributor", "DataRequirement", "Expression", "ParameterDefinition", "RelatedArtifact", "TriggerDefinition", "UsageContext", "Dosage", "Meta"};
3377        default: return super.getTypesForProperty(hash, name);
3378        }
3379
3380      }
3381
3382      @Override
3383      public Base addChild(String name) throws FHIRException {
3384        if (name.equals("label")) {
3385          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.example.label");
3386        }
3387        else if (name.equals("valueBase64Binary")) {
3388          this.value = new Base64BinaryType();
3389          return this.value;
3390        }
3391        else if (name.equals("valueBoolean")) {
3392          this.value = new BooleanType();
3393          return this.value;
3394        }
3395        else if (name.equals("valueCanonical")) {
3396          this.value = new CanonicalType();
3397          return this.value;
3398        }
3399        else if (name.equals("valueCode")) {
3400          this.value = new CodeType();
3401          return this.value;
3402        }
3403        else if (name.equals("valueDate")) {
3404          this.value = new DateType();
3405          return this.value;
3406        }
3407        else if (name.equals("valueDateTime")) {
3408          this.value = new DateTimeType();
3409          return this.value;
3410        }
3411        else if (name.equals("valueDecimal")) {
3412          this.value = new DecimalType();
3413          return this.value;
3414        }
3415        else if (name.equals("valueId")) {
3416          this.value = new IdType();
3417          return this.value;
3418        }
3419        else if (name.equals("valueInstant")) {
3420          this.value = new InstantType();
3421          return this.value;
3422        }
3423        else if (name.equals("valueInteger")) {
3424          this.value = new IntegerType();
3425          return this.value;
3426        }
3427        else if (name.equals("valueInteger64")) {
3428          this.value = new Integer64Type();
3429          return this.value;
3430        }
3431        else if (name.equals("valueMarkdown")) {
3432          this.value = new MarkdownType();
3433          return this.value;
3434        }
3435        else if (name.equals("valueOid")) {
3436          this.value = new OidType();
3437          return this.value;
3438        }
3439        else if (name.equals("valuePositiveInt")) {
3440          this.value = new PositiveIntType();
3441          return this.value;
3442        }
3443        else if (name.equals("valueString")) {
3444          this.value = new StringType();
3445          return this.value;
3446        }
3447        else if (name.equals("valueTime")) {
3448          this.value = new TimeType();
3449          return this.value;
3450        }
3451        else if (name.equals("valueUnsignedInt")) {
3452          this.value = new UnsignedIntType();
3453          return this.value;
3454        }
3455        else if (name.equals("valueUri")) {
3456          this.value = new UriType();
3457          return this.value;
3458        }
3459        else if (name.equals("valueUrl")) {
3460          this.value = new UrlType();
3461          return this.value;
3462        }
3463        else if (name.equals("valueUuid")) {
3464          this.value = new UuidType();
3465          return this.value;
3466        }
3467        else if (name.equals("valueAddress")) {
3468          this.value = new Address();
3469          return this.value;
3470        }
3471        else if (name.equals("valueAge")) {
3472          this.value = new Age();
3473          return this.value;
3474        }
3475        else if (name.equals("valueAnnotation")) {
3476          this.value = new Annotation();
3477          return this.value;
3478        }
3479        else if (name.equals("valueAttachment")) {
3480          this.value = new Attachment();
3481          return this.value;
3482        }
3483        else if (name.equals("valueCodeableConcept")) {
3484          this.value = new CodeableConcept();
3485          return this.value;
3486        }
3487        else if (name.equals("valueCodeableReference")) {
3488          this.value = new CodeableReference();
3489          return this.value;
3490        }
3491        else if (name.equals("valueCoding")) {
3492          this.value = new Coding();
3493          return this.value;
3494        }
3495        else if (name.equals("valueContactPoint")) {
3496          this.value = new ContactPoint();
3497          return this.value;
3498        }
3499        else if (name.equals("valueCount")) {
3500          this.value = new Count();
3501          return this.value;
3502        }
3503        else if (name.equals("valueDistance")) {
3504          this.value = new Distance();
3505          return this.value;
3506        }
3507        else if (name.equals("valueDuration")) {
3508          this.value = new Duration();
3509          return this.value;
3510        }
3511        else if (name.equals("valueHumanName")) {
3512          this.value = new HumanName();
3513          return this.value;
3514        }
3515        else if (name.equals("valueIdentifier")) {
3516          this.value = new Identifier();
3517          return this.value;
3518        }
3519        else if (name.equals("valueMoney")) {
3520          this.value = new Money();
3521          return this.value;
3522        }
3523        else if (name.equals("valuePeriod")) {
3524          this.value = new Period();
3525          return this.value;
3526        }
3527        else if (name.equals("valueQuantity")) {
3528          this.value = new Quantity();
3529          return this.value;
3530        }
3531        else if (name.equals("valueRange")) {
3532          this.value = new Range();
3533          return this.value;
3534        }
3535        else if (name.equals("valueRatio")) {
3536          this.value = new Ratio();
3537          return this.value;
3538        }
3539        else if (name.equals("valueRatioRange")) {
3540          this.value = new RatioRange();
3541          return this.value;
3542        }
3543        else if (name.equals("valueReference")) {
3544          this.value = new Reference();
3545          return this.value;
3546        }
3547        else if (name.equals("valueSampledData")) {
3548          this.value = new SampledData();
3549          return this.value;
3550        }
3551        else if (name.equals("valueSignature")) {
3552          this.value = new Signature();
3553          return this.value;
3554        }
3555        else if (name.equals("valueTiming")) {
3556          this.value = new Timing();
3557          return this.value;
3558        }
3559        else if (name.equals("valueContactDetail")) {
3560          this.value = new ContactDetail();
3561          return this.value;
3562        }
3563        else if (name.equals("valueContributor")) {
3564          this.value = new Contributor();
3565          return this.value;
3566        }
3567        else if (name.equals("valueDataRequirement")) {
3568          this.value = new DataRequirement();
3569          return this.value;
3570        }
3571        else if (name.equals("valueExpression")) {
3572          this.value = new Expression();
3573          return this.value;
3574        }
3575        else if (name.equals("valueParameterDefinition")) {
3576          this.value = new ParameterDefinition();
3577          return this.value;
3578        }
3579        else if (name.equals("valueRelatedArtifact")) {
3580          this.value = new RelatedArtifact();
3581          return this.value;
3582        }
3583        else if (name.equals("valueTriggerDefinition")) {
3584          this.value = new TriggerDefinition();
3585          return this.value;
3586        }
3587        else if (name.equals("valueUsageContext")) {
3588          this.value = new UsageContext();
3589          return this.value;
3590        }
3591        else if (name.equals("valueDosage")) {
3592          this.value = new Dosage();
3593          return this.value;
3594        }
3595        else if (name.equals("valueMeta")) {
3596          this.value = new Meta();
3597          return this.value;
3598        }
3599        else
3600          return super.addChild(name);
3601      }
3602
3603      public ElementDefinitionExampleComponent copy() {
3604        ElementDefinitionExampleComponent dst = new ElementDefinitionExampleComponent();
3605        copyValues(dst);
3606        return dst;
3607      }
3608
3609      public void copyValues(ElementDefinitionExampleComponent dst) {
3610        super.copyValues(dst);
3611        dst.label = label == null ? null : label.copy();
3612        dst.value = value == null ? null : value.copy();
3613      }
3614
3615      @Override
3616      public boolean equalsDeep(Base other_) {
3617        if (!super.equalsDeep(other_))
3618          return false;
3619        if (!(other_ instanceof ElementDefinitionExampleComponent))
3620          return false;
3621        ElementDefinitionExampleComponent o = (ElementDefinitionExampleComponent) other_;
3622        return compareDeep(label, o.label, true) && compareDeep(value, o.value, true);
3623      }
3624
3625      @Override
3626      public boolean equalsShallow(Base other_) {
3627        if (!super.equalsShallow(other_))
3628          return false;
3629        if (!(other_ instanceof ElementDefinitionExampleComponent))
3630          return false;
3631        ElementDefinitionExampleComponent o = (ElementDefinitionExampleComponent) other_;
3632        return compareValues(label, o.label, true);
3633      }
3634
3635      public boolean isEmpty() {
3636        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(label, value);
3637      }
3638
3639  public String fhirType() {
3640    return "ElementDefinition.example";
3641
3642  }
3643
3644  }
3645
3646    @Block()
3647    public static class ElementDefinitionConstraintComponent extends Element implements IBaseDatatypeElement {
3648        /**
3649         * Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
3650         */
3651        @Child(name = "key", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
3652        @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." )
3653        protected IdType key;
3654
3655        /**
3656         * Description of why this constraint is necessary or appropriate.
3657         */
3658        @Child(name = "requirements", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
3659        @Description(shortDefinition="Why this constraint is necessary or appropriate", formalDefinition="Description of why this constraint is necessary or appropriate." )
3660        protected StringType requirements;
3661
3662        /**
3663         * Identifies the impact constraint violation has on the conformance of the instance.
3664         */
3665        @Child(name = "severity", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
3666        @Description(shortDefinition="error | warning", formalDefinition="Identifies the impact constraint violation has on the conformance of the instance." )
3667        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/constraint-severity")
3668        protected Enumeration<ConstraintSeverity> severity;
3669
3670        /**
3671         * Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
3672         */
3673        @Child(name = "human", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
3674        @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." )
3675        protected StringType human;
3676
3677        /**
3678         * A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
3679         */
3680        @Child(name = "expression", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
3681        @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." )
3682        protected StringType expression;
3683
3684        /**
3685         * An XPath expression of constraint that can be executed to see if this constraint is met.
3686         */
3687        @Child(name = "xpath", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
3688        @Description(shortDefinition="XPath expression of constraint", formalDefinition="An XPath expression of constraint that can be executed to see if this constraint is met." )
3689        protected StringType xpath;
3690
3691        /**
3692         * A reference to the original source of the constraint, for traceability purposes.
3693         */
3694        @Child(name = "source", type = {CanonicalType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3695        @Description(shortDefinition="Reference to original source of constraint", formalDefinition="A reference to the original source of the constraint, for traceability purposes." )
3696        protected CanonicalType source;
3697
3698        private static final long serialVersionUID = 1048354565L;
3699
3700    /**
3701     * Constructor
3702     */
3703      public ElementDefinitionConstraintComponent() {
3704        super();
3705      }
3706
3707    /**
3708     * Constructor
3709     */
3710      public ElementDefinitionConstraintComponent(String key, ConstraintSeverity severity, String human) {
3711        super();
3712        this.setKey(key);
3713        this.setSeverity(severity);
3714        this.setHuman(human);
3715      }
3716
3717        /**
3718         * @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
3719         */
3720        public IdType getKeyElement() { 
3721          if (this.key == null)
3722            if (Configuration.errorOnAutoCreate())
3723              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.key");
3724            else if (Configuration.doAutoCreate())
3725              this.key = new IdType(); // bb
3726          return this.key;
3727        }
3728
3729        public boolean hasKeyElement() { 
3730          return this.key != null && !this.key.isEmpty();
3731        }
3732
3733        public boolean hasKey() { 
3734          return this.key != null && !this.key.isEmpty();
3735        }
3736
3737        /**
3738         * @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
3739         */
3740        public ElementDefinitionConstraintComponent setKeyElement(IdType value) { 
3741          this.key = value;
3742          return this;
3743        }
3744
3745        /**
3746         * @return Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
3747         */
3748        public String getKey() { 
3749          return this.key == null ? null : this.key.getValue();
3750        }
3751
3752        /**
3753         * @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.
3754         */
3755        public ElementDefinitionConstraintComponent setKey(String value) { 
3756            if (this.key == null)
3757              this.key = new IdType();
3758            this.key.setValue(value);
3759          return this;
3760        }
3761
3762        /**
3763         * @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
3764         */
3765        public StringType getRequirementsElement() { 
3766          if (this.requirements == null)
3767            if (Configuration.errorOnAutoCreate())
3768              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.requirements");
3769            else if (Configuration.doAutoCreate())
3770              this.requirements = new StringType(); // bb
3771          return this.requirements;
3772        }
3773
3774        public boolean hasRequirementsElement() { 
3775          return this.requirements != null && !this.requirements.isEmpty();
3776        }
3777
3778        public boolean hasRequirements() { 
3779          return this.requirements != null && !this.requirements.isEmpty();
3780        }
3781
3782        /**
3783         * @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
3784         */
3785        public ElementDefinitionConstraintComponent setRequirementsElement(StringType value) { 
3786          this.requirements = value;
3787          return this;
3788        }
3789
3790        /**
3791         * @return Description of why this constraint is necessary or appropriate.
3792         */
3793        public String getRequirements() { 
3794          return this.requirements == null ? null : this.requirements.getValue();
3795        }
3796
3797        /**
3798         * @param value Description of why this constraint is necessary or appropriate.
3799         */
3800        public ElementDefinitionConstraintComponent setRequirements(String value) { 
3801          if (Utilities.noString(value))
3802            this.requirements = null;
3803          else {
3804            if (this.requirements == null)
3805              this.requirements = new StringType();
3806            this.requirements.setValue(value);
3807          }
3808          return this;
3809        }
3810
3811        /**
3812         * @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
3813         */
3814        public Enumeration<ConstraintSeverity> getSeverityElement() { 
3815          if (this.severity == null)
3816            if (Configuration.errorOnAutoCreate())
3817              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.severity");
3818            else if (Configuration.doAutoCreate())
3819              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory()); // bb
3820          return this.severity;
3821        }
3822
3823        public boolean hasSeverityElement() { 
3824          return this.severity != null && !this.severity.isEmpty();
3825        }
3826
3827        public boolean hasSeverity() { 
3828          return this.severity != null && !this.severity.isEmpty();
3829        }
3830
3831        /**
3832         * @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
3833         */
3834        public ElementDefinitionConstraintComponent setSeverityElement(Enumeration<ConstraintSeverity> value) { 
3835          this.severity = value;
3836          return this;
3837        }
3838
3839        /**
3840         * @return Identifies the impact constraint violation has on the conformance of the instance.
3841         */
3842        public ConstraintSeverity getSeverity() { 
3843          return this.severity == null ? null : this.severity.getValue();
3844        }
3845
3846        /**
3847         * @param value Identifies the impact constraint violation has on the conformance of the instance.
3848         */
3849        public ElementDefinitionConstraintComponent setSeverity(ConstraintSeverity value) { 
3850            if (this.severity == null)
3851              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory());
3852            this.severity.setValue(value);
3853          return this;
3854        }
3855
3856        /**
3857         * @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
3858         */
3859        public StringType getHumanElement() { 
3860          if (this.human == null)
3861            if (Configuration.errorOnAutoCreate())
3862              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.human");
3863            else if (Configuration.doAutoCreate())
3864              this.human = new StringType(); // bb
3865          return this.human;
3866        }
3867
3868        public boolean hasHumanElement() { 
3869          return this.human != null && !this.human.isEmpty();
3870        }
3871
3872        public boolean hasHuman() { 
3873          return this.human != null && !this.human.isEmpty();
3874        }
3875
3876        /**
3877         * @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
3878         */
3879        public ElementDefinitionConstraintComponent setHumanElement(StringType value) { 
3880          this.human = value;
3881          return this;
3882        }
3883
3884        /**
3885         * @return Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
3886         */
3887        public String getHuman() { 
3888          return this.human == null ? null : this.human.getValue();
3889        }
3890
3891        /**
3892         * @param value Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
3893         */
3894        public ElementDefinitionConstraintComponent setHuman(String value) { 
3895            if (this.human == null)
3896              this.human = new StringType();
3897            this.human.setValue(value);
3898          return this;
3899        }
3900
3901        /**
3902         * @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
3903         */
3904        public StringType getExpressionElement() { 
3905          if (this.expression == null)
3906            if (Configuration.errorOnAutoCreate())
3907              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.expression");
3908            else if (Configuration.doAutoCreate())
3909              this.expression = new StringType(); // bb
3910          return this.expression;
3911        }
3912
3913        public boolean hasExpressionElement() { 
3914          return this.expression != null && !this.expression.isEmpty();
3915        }
3916
3917        public boolean hasExpression() { 
3918          return this.expression != null && !this.expression.isEmpty();
3919        }
3920
3921        /**
3922         * @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
3923         */
3924        public ElementDefinitionConstraintComponent setExpressionElement(StringType value) { 
3925          this.expression = value;
3926          return this;
3927        }
3928
3929        /**
3930         * @return A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
3931         */
3932        public String getExpression() { 
3933          return this.expression == null ? null : this.expression.getValue();
3934        }
3935
3936        /**
3937         * @param value A [FHIRPath](fhirpath.html) expression of constraint that can be executed to see if this constraint is met.
3938         */
3939        public ElementDefinitionConstraintComponent setExpression(String value) { 
3940          if (Utilities.noString(value))
3941            this.expression = null;
3942          else {
3943            if (this.expression == null)
3944              this.expression = new StringType();
3945            this.expression.setValue(value);
3946          }
3947          return this;
3948        }
3949
3950        /**
3951         * @return {@link #xpath} (An XPath 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 "getXpath" gives direct access to the value
3952         */
3953        public StringType getXpathElement() { 
3954          if (this.xpath == null)
3955            if (Configuration.errorOnAutoCreate())
3956              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.xpath");
3957            else if (Configuration.doAutoCreate())
3958              this.xpath = new StringType(); // bb
3959          return this.xpath;
3960        }
3961
3962        public boolean hasXpathElement() { 
3963          return this.xpath != null && !this.xpath.isEmpty();
3964        }
3965
3966        public boolean hasXpath() { 
3967          return this.xpath != null && !this.xpath.isEmpty();
3968        }
3969
3970        /**
3971         * @param value {@link #xpath} (An XPath 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 "getXpath" gives direct access to the value
3972         */
3973        public ElementDefinitionConstraintComponent setXpathElement(StringType value) { 
3974          this.xpath = value;
3975          return this;
3976        }
3977
3978        /**
3979         * @return An XPath expression of constraint that can be executed to see if this constraint is met.
3980         */
3981        public String getXpath() { 
3982          return this.xpath == null ? null : this.xpath.getValue();
3983        }
3984
3985        /**
3986         * @param value An XPath expression of constraint that can be executed to see if this constraint is met.
3987         */
3988        public ElementDefinitionConstraintComponent setXpath(String value) { 
3989          if (Utilities.noString(value))
3990            this.xpath = null;
3991          else {
3992            if (this.xpath == null)
3993              this.xpath = new StringType();
3994            this.xpath.setValue(value);
3995          }
3996          return this;
3997        }
3998
3999        /**
4000         * @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
4001         */
4002        public CanonicalType getSourceElement() { 
4003          if (this.source == null)
4004            if (Configuration.errorOnAutoCreate())
4005              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.source");
4006            else if (Configuration.doAutoCreate())
4007              this.source = new CanonicalType(); // bb
4008          return this.source;
4009        }
4010
4011        public boolean hasSourceElement() { 
4012          return this.source != null && !this.source.isEmpty();
4013        }
4014
4015        public boolean hasSource() { 
4016          return this.source != null && !this.source.isEmpty();
4017        }
4018
4019        /**
4020         * @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
4021         */
4022        public ElementDefinitionConstraintComponent setSourceElement(CanonicalType value) { 
4023          this.source = value;
4024          return this;
4025        }
4026
4027        /**
4028         * @return A reference to the original source of the constraint, for traceability purposes.
4029         */
4030        public String getSource() { 
4031          return this.source == null ? null : this.source.getValue();
4032        }
4033
4034        /**
4035         * @param value A reference to the original source of the constraint, for traceability purposes.
4036         */
4037        public ElementDefinitionConstraintComponent setSource(String value) { 
4038          if (Utilities.noString(value))
4039            this.source = null;
4040          else {
4041            if (this.source == null)
4042              this.source = new CanonicalType();
4043            this.source.setValue(value);
4044          }
4045          return this;
4046        }
4047
4048        protected void listChildren(List<Property> children) {
4049          super.listChildren(children);
4050          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));
4051          children.add(new Property("requirements", "string", "Description of why this constraint is necessary or appropriate.", 0, 1, requirements));
4052          children.add(new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, 1, severity));
4053          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));
4054          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));
4055          children.add(new Property("xpath", "string", "An XPath expression of constraint that can be executed to see if this constraint is met.", 0, 1, xpath));
4056          children.add(new Property("source", "canonical(StructureDefinition)", "A reference to the original source of the constraint, for traceability purposes.", 0, 1, source));
4057        }
4058
4059        @Override
4060        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4061          switch (_hash) {
4062          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);
4063          case -1619874672: /*requirements*/  return new Property("requirements", "string", "Description of why this constraint is necessary or appropriate.", 0, 1, requirements);
4064          case 1478300413: /*severity*/  return new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, 1, severity);
4065          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);
4066          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);
4067          case 114256029: /*xpath*/  return new Property("xpath", "string", "An XPath expression of constraint that can be executed to see if this constraint is met.", 0, 1, xpath);
4068          case -896505829: /*source*/  return new Property("source", "canonical(StructureDefinition)", "A reference to the original source of the constraint, for traceability purposes.", 0, 1, source);
4069          default: return super.getNamedProperty(_hash, _name, _checkValid);
4070          }
4071
4072        }
4073
4074      @Override
4075      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4076        switch (hash) {
4077        case 106079: /*key*/ return this.key == null ? new Base[0] : new Base[] {this.key}; // IdType
4078        case -1619874672: /*requirements*/ return this.requirements == null ? new Base[0] : new Base[] {this.requirements}; // StringType
4079        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<ConstraintSeverity>
4080        case 99639597: /*human*/ return this.human == null ? new Base[0] : new Base[] {this.human}; // StringType
4081        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
4082        case 114256029: /*xpath*/ return this.xpath == null ? new Base[0] : new Base[] {this.xpath}; // StringType
4083        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // CanonicalType
4084        default: return super.getProperty(hash, name, checkValid);
4085        }
4086
4087      }
4088
4089      @Override
4090      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4091        switch (hash) {
4092        case 106079: // key
4093          this.key = TypeConvertor.castToId(value); // IdType
4094          return value;
4095        case -1619874672: // requirements
4096          this.requirements = TypeConvertor.castToString(value); // StringType
4097          return value;
4098        case 1478300413: // severity
4099          value = new ConstraintSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
4100          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
4101          return value;
4102        case 99639597: // human
4103          this.human = TypeConvertor.castToString(value); // StringType
4104          return value;
4105        case -1795452264: // expression
4106          this.expression = TypeConvertor.castToString(value); // StringType
4107          return value;
4108        case 114256029: // xpath
4109          this.xpath = TypeConvertor.castToString(value); // StringType
4110          return value;
4111        case -896505829: // source
4112          this.source = TypeConvertor.castToCanonical(value); // CanonicalType
4113          return value;
4114        default: return super.setProperty(hash, name, value);
4115        }
4116
4117      }
4118
4119      @Override
4120      public Base setProperty(String name, Base value) throws FHIRException {
4121        if (name.equals("key")) {
4122          this.key = TypeConvertor.castToId(value); // IdType
4123        } else if (name.equals("requirements")) {
4124          this.requirements = TypeConvertor.castToString(value); // StringType
4125        } else if (name.equals("severity")) {
4126          value = new ConstraintSeverityEnumFactory().fromType(TypeConvertor.castToCode(value));
4127          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
4128        } else if (name.equals("human")) {
4129          this.human = TypeConvertor.castToString(value); // StringType
4130        } else if (name.equals("expression")) {
4131          this.expression = TypeConvertor.castToString(value); // StringType
4132        } else if (name.equals("xpath")) {
4133          this.xpath = TypeConvertor.castToString(value); // StringType
4134        } else if (name.equals("source")) {
4135          this.source = TypeConvertor.castToCanonical(value); // CanonicalType
4136        } else
4137          return super.setProperty(name, value);
4138        return value;
4139      }
4140
4141      @Override
4142      public Base makeProperty(int hash, String name) throws FHIRException {
4143        switch (hash) {
4144        case 106079:  return getKeyElement();
4145        case -1619874672:  return getRequirementsElement();
4146        case 1478300413:  return getSeverityElement();
4147        case 99639597:  return getHumanElement();
4148        case -1795452264:  return getExpressionElement();
4149        case 114256029:  return getXpathElement();
4150        case -896505829:  return getSourceElement();
4151        default: return super.makeProperty(hash, name);
4152        }
4153
4154      }
4155
4156      @Override
4157      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4158        switch (hash) {
4159        case 106079: /*key*/ return new String[] {"id"};
4160        case -1619874672: /*requirements*/ return new String[] {"string"};
4161        case 1478300413: /*severity*/ return new String[] {"code"};
4162        case 99639597: /*human*/ return new String[] {"string"};
4163        case -1795452264: /*expression*/ return new String[] {"string"};
4164        case 114256029: /*xpath*/ return new String[] {"string"};
4165        case -896505829: /*source*/ return new String[] {"canonical"};
4166        default: return super.getTypesForProperty(hash, name);
4167        }
4168
4169      }
4170
4171      @Override
4172      public Base addChild(String name) throws FHIRException {
4173        if (name.equals("key")) {
4174          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.constraint.key");
4175        }
4176        else if (name.equals("requirements")) {
4177          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.constraint.requirements");
4178        }
4179        else if (name.equals("severity")) {
4180          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.constraint.severity");
4181        }
4182        else if (name.equals("human")) {
4183          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.constraint.human");
4184        }
4185        else if (name.equals("expression")) {
4186          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.constraint.expression");
4187        }
4188        else if (name.equals("xpath")) {
4189          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.constraint.xpath");
4190        }
4191        else if (name.equals("source")) {
4192          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.constraint.source");
4193        }
4194        else
4195          return super.addChild(name);
4196      }
4197
4198      public ElementDefinitionConstraintComponent copy() {
4199        ElementDefinitionConstraintComponent dst = new ElementDefinitionConstraintComponent();
4200        copyValues(dst);
4201        return dst;
4202      }
4203
4204      public void copyValues(ElementDefinitionConstraintComponent dst) {
4205        super.copyValues(dst);
4206        dst.key = key == null ? null : key.copy();
4207        dst.requirements = requirements == null ? null : requirements.copy();
4208        dst.severity = severity == null ? null : severity.copy();
4209        dst.human = human == null ? null : human.copy();
4210        dst.expression = expression == null ? null : expression.copy();
4211        dst.xpath = xpath == null ? null : xpath.copy();
4212        dst.source = source == null ? null : source.copy();
4213      }
4214
4215      @Override
4216      public boolean equalsDeep(Base other_) {
4217        if (!super.equalsDeep(other_))
4218          return false;
4219        if (!(other_ instanceof ElementDefinitionConstraintComponent))
4220          return false;
4221        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other_;
4222        return compareDeep(key, o.key, true) && compareDeep(requirements, o.requirements, true) && compareDeep(severity, o.severity, true)
4223           && compareDeep(human, o.human, true) && compareDeep(expression, o.expression, true) && compareDeep(xpath, o.xpath, true)
4224           && compareDeep(source, o.source, true);
4225      }
4226
4227      @Override
4228      public boolean equalsShallow(Base other_) {
4229        if (!super.equalsShallow(other_))
4230          return false;
4231        if (!(other_ instanceof ElementDefinitionConstraintComponent))
4232          return false;
4233        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other_;
4234        return compareValues(key, o.key, true) && compareValues(requirements, o.requirements, true) && compareValues(severity, o.severity, true)
4235           && compareValues(human, o.human, true) && compareValues(expression, o.expression, true) && compareValues(xpath, o.xpath, true)
4236           && compareValues(source, o.source, true);
4237      }
4238
4239      public boolean isEmpty() {
4240        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(key, requirements, severity
4241          , human, expression, xpath, source);
4242      }
4243
4244  public String fhirType() {
4245    return "ElementDefinition.constraint";
4246
4247  }
4248
4249  }
4250
4251    @Block()
4252    public static class ElementDefinitionBindingComponent extends Element implements IBaseDatatypeElement {
4253        /**
4254         * 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.
4255         */
4256        @Child(name = "strength", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4257        @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." )
4258        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/binding-strength")
4259        protected Enumeration<BindingStrength> strength;
4260
4261        /**
4262         * Describes the intended use of this particular set of codes.
4263         */
4264        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4265        @Description(shortDefinition="Human explanation of the value set", formalDefinition="Describes the intended use of this particular set of codes." )
4266        protected StringType description;
4267
4268        /**
4269         * Refers to the value set that identifies the set of codes the binding refers to.
4270         */
4271        @Child(name = "valueSet", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
4272        @Description(shortDefinition="Source of value set", formalDefinition="Refers to the value set that identifies the set of codes the binding refers to." )
4273        protected CanonicalType valueSet;
4274
4275        private static final long serialVersionUID = -514477030L;
4276
4277    /**
4278     * Constructor
4279     */
4280      public ElementDefinitionBindingComponent() {
4281        super();
4282      }
4283
4284    /**
4285     * Constructor
4286     */
4287      public ElementDefinitionBindingComponent(BindingStrength strength) {
4288        super();
4289        this.setStrength(strength);
4290      }
4291
4292        /**
4293         * @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
4294         */
4295        public Enumeration<BindingStrength> getStrengthElement() { 
4296          if (this.strength == null)
4297            if (Configuration.errorOnAutoCreate())
4298              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.strength");
4299            else if (Configuration.doAutoCreate())
4300              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory()); // bb
4301          return this.strength;
4302        }
4303
4304        public boolean hasStrengthElement() { 
4305          return this.strength != null && !this.strength.isEmpty();
4306        }
4307
4308        public boolean hasStrength() { 
4309          return this.strength != null && !this.strength.isEmpty();
4310        }
4311
4312        /**
4313         * @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
4314         */
4315        public ElementDefinitionBindingComponent setStrengthElement(Enumeration<BindingStrength> value) { 
4316          this.strength = value;
4317          return this;
4318        }
4319
4320        /**
4321         * @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.
4322         */
4323        public BindingStrength getStrength() { 
4324          return this.strength == null ? null : this.strength.getValue();
4325        }
4326
4327        /**
4328         * @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.
4329         */
4330        public ElementDefinitionBindingComponent setStrength(BindingStrength value) { 
4331            if (this.strength == null)
4332              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory());
4333            this.strength.setValue(value);
4334          return this;
4335        }
4336
4337        /**
4338         * @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
4339         */
4340        public StringType getDescriptionElement() { 
4341          if (this.description == null)
4342            if (Configuration.errorOnAutoCreate())
4343              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.description");
4344            else if (Configuration.doAutoCreate())
4345              this.description = new StringType(); // bb
4346          return this.description;
4347        }
4348
4349        public boolean hasDescriptionElement() { 
4350          return this.description != null && !this.description.isEmpty();
4351        }
4352
4353        public boolean hasDescription() { 
4354          return this.description != null && !this.description.isEmpty();
4355        }
4356
4357        /**
4358         * @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
4359         */
4360        public ElementDefinitionBindingComponent setDescriptionElement(StringType value) { 
4361          this.description = value;
4362          return this;
4363        }
4364
4365        /**
4366         * @return Describes the intended use of this particular set of codes.
4367         */
4368        public String getDescription() { 
4369          return this.description == null ? null : this.description.getValue();
4370        }
4371
4372        /**
4373         * @param value Describes the intended use of this particular set of codes.
4374         */
4375        public ElementDefinitionBindingComponent setDescription(String value) { 
4376          if (Utilities.noString(value))
4377            this.description = null;
4378          else {
4379            if (this.description == null)
4380              this.description = new StringType();
4381            this.description.setValue(value);
4382          }
4383          return this;
4384        }
4385
4386        /**
4387         * @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
4388         */
4389        public CanonicalType getValueSetElement() { 
4390          if (this.valueSet == null)
4391            if (Configuration.errorOnAutoCreate())
4392              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.valueSet");
4393            else if (Configuration.doAutoCreate())
4394              this.valueSet = new CanonicalType(); // bb
4395          return this.valueSet;
4396        }
4397
4398        public boolean hasValueSetElement() { 
4399          return this.valueSet != null && !this.valueSet.isEmpty();
4400        }
4401
4402        public boolean hasValueSet() { 
4403          return this.valueSet != null && !this.valueSet.isEmpty();
4404        }
4405
4406        /**
4407         * @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
4408         */
4409        public ElementDefinitionBindingComponent setValueSetElement(CanonicalType value) { 
4410          this.valueSet = value;
4411          return this;
4412        }
4413
4414        /**
4415         * @return Refers to the value set that identifies the set of codes the binding refers to.
4416         */
4417        public String getValueSet() { 
4418          return this.valueSet == null ? null : this.valueSet.getValue();
4419        }
4420
4421        /**
4422         * @param value Refers to the value set that identifies the set of codes the binding refers to.
4423         */
4424        public ElementDefinitionBindingComponent setValueSet(String value) { 
4425          if (Utilities.noString(value))
4426            this.valueSet = null;
4427          else {
4428            if (this.valueSet == null)
4429              this.valueSet = new CanonicalType();
4430            this.valueSet.setValue(value);
4431          }
4432          return this;
4433        }
4434
4435        protected void listChildren(List<Property> children) {
4436          super.listChildren(children);
4437          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));
4438          children.add(new Property("description", "string", "Describes the intended use of this particular set of codes.", 0, 1, description));
4439          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));
4440        }
4441
4442        @Override
4443        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4444          switch (_hash) {
4445          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);
4446          case -1724546052: /*description*/  return new Property("description", "string", "Describes the intended use of this particular set of codes.", 0, 1, description);
4447          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);
4448          default: return super.getNamedProperty(_hash, _name, _checkValid);
4449          }
4450
4451        }
4452
4453      @Override
4454      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4455        switch (hash) {
4456        case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // Enumeration<BindingStrength>
4457        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
4458        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // CanonicalType
4459        default: return super.getProperty(hash, name, checkValid);
4460        }
4461
4462      }
4463
4464      @Override
4465      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4466        switch (hash) {
4467        case 1791316033: // strength
4468          value = new BindingStrengthEnumFactory().fromType(TypeConvertor.castToCode(value));
4469          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
4470          return value;
4471        case -1724546052: // description
4472          this.description = TypeConvertor.castToString(value); // StringType
4473          return value;
4474        case -1410174671: // valueSet
4475          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
4476          return value;
4477        default: return super.setProperty(hash, name, value);
4478        }
4479
4480      }
4481
4482      @Override
4483      public Base setProperty(String name, Base value) throws FHIRException {
4484        if (name.equals("strength")) {
4485          value = new BindingStrengthEnumFactory().fromType(TypeConvertor.castToCode(value));
4486          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
4487        } else if (name.equals("description")) {
4488          this.description = TypeConvertor.castToString(value); // StringType
4489        } else if (name.equals("valueSet")) {
4490          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
4491        } else
4492          return super.setProperty(name, value);
4493        return value;
4494      }
4495
4496      @Override
4497      public Base makeProperty(int hash, String name) throws FHIRException {
4498        switch (hash) {
4499        case 1791316033:  return getStrengthElement();
4500        case -1724546052:  return getDescriptionElement();
4501        case -1410174671:  return getValueSetElement();
4502        default: return super.makeProperty(hash, name);
4503        }
4504
4505      }
4506
4507      @Override
4508      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4509        switch (hash) {
4510        case 1791316033: /*strength*/ return new String[] {"code"};
4511        case -1724546052: /*description*/ return new String[] {"string"};
4512        case -1410174671: /*valueSet*/ return new String[] {"canonical"};
4513        default: return super.getTypesForProperty(hash, name);
4514        }
4515
4516      }
4517
4518      @Override
4519      public Base addChild(String name) throws FHIRException {
4520        if (name.equals("strength")) {
4521          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.binding.strength");
4522        }
4523        else if (name.equals("description")) {
4524          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.binding.description");
4525        }
4526        else if (name.equals("valueSet")) {
4527          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.binding.valueSet");
4528        }
4529        else
4530          return super.addChild(name);
4531      }
4532
4533      public ElementDefinitionBindingComponent copy() {
4534        ElementDefinitionBindingComponent dst = new ElementDefinitionBindingComponent();
4535        copyValues(dst);
4536        return dst;
4537      }
4538
4539      public void copyValues(ElementDefinitionBindingComponent dst) {
4540        super.copyValues(dst);
4541        dst.strength = strength == null ? null : strength.copy();
4542        dst.description = description == null ? null : description.copy();
4543        dst.valueSet = valueSet == null ? null : valueSet.copy();
4544      }
4545
4546      @Override
4547      public boolean equalsDeep(Base other_) {
4548        if (!super.equalsDeep(other_))
4549          return false;
4550        if (!(other_ instanceof ElementDefinitionBindingComponent))
4551          return false;
4552        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other_;
4553        return compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
4554           && compareDeep(valueSet, o.valueSet, true);
4555      }
4556
4557      @Override
4558      public boolean equalsShallow(Base other_) {
4559        if (!super.equalsShallow(other_))
4560          return false;
4561        if (!(other_ instanceof ElementDefinitionBindingComponent))
4562          return false;
4563        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other_;
4564        return compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
4565           && compareValues(valueSet, o.valueSet, true);
4566      }
4567
4568      public boolean isEmpty() {
4569        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(strength, description, valueSet
4570          );
4571      }
4572
4573  public String fhirType() {
4574    return "ElementDefinition.binding";
4575
4576  }
4577
4578  }
4579
4580    @Block()
4581    public static class ElementDefinitionMappingComponent extends Element implements IBaseDatatypeElement {
4582        /**
4583         * An internal reference to the definition of a mapping.
4584         */
4585        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
4586        @Description(shortDefinition="Reference to mapping declaration", formalDefinition="An internal reference to the definition of a mapping." )
4587        protected IdType identity;
4588
4589        /**
4590         * Identifies the computable language in which mapping.map is expressed.
4591         */
4592        @Child(name = "language", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4593        @Description(shortDefinition="Computable language of mapping", formalDefinition="Identifies the computable language in which mapping.map is expressed." )
4594        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
4595        protected CodeType language;
4596
4597        /**
4598         * Expresses what part of the target specification corresponds to this element.
4599         */
4600        @Child(name = "map", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
4601        @Description(shortDefinition="Details of the mapping", formalDefinition="Expresses what part of the target specification corresponds to this element." )
4602        protected StringType map;
4603
4604        /**
4605         * Comments that provide information about the mapping or its use.
4606         */
4607        @Child(name = "comment", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
4608        @Description(shortDefinition="Comments about the mapping or its use", formalDefinition="Comments that provide information about the mapping or its use." )
4609        protected StringType comment;
4610
4611        private static final long serialVersionUID = 1386816887L;
4612
4613    /**
4614     * Constructor
4615     */
4616      public ElementDefinitionMappingComponent() {
4617        super();
4618      }
4619
4620    /**
4621     * Constructor
4622     */
4623      public ElementDefinitionMappingComponent(String identity, String map) {
4624        super();
4625        this.setIdentity(identity);
4626        this.setMap(map);
4627      }
4628
4629        /**
4630         * @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
4631         */
4632        public IdType getIdentityElement() { 
4633          if (this.identity == null)
4634            if (Configuration.errorOnAutoCreate())
4635              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.identity");
4636            else if (Configuration.doAutoCreate())
4637              this.identity = new IdType(); // bb
4638          return this.identity;
4639        }
4640
4641        public boolean hasIdentityElement() { 
4642          return this.identity != null && !this.identity.isEmpty();
4643        }
4644
4645        public boolean hasIdentity() { 
4646          return this.identity != null && !this.identity.isEmpty();
4647        }
4648
4649        /**
4650         * @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
4651         */
4652        public ElementDefinitionMappingComponent setIdentityElement(IdType value) { 
4653          this.identity = value;
4654          return this;
4655        }
4656
4657        /**
4658         * @return An internal reference to the definition of a mapping.
4659         */
4660        public String getIdentity() { 
4661          return this.identity == null ? null : this.identity.getValue();
4662        }
4663
4664        /**
4665         * @param value An internal reference to the definition of a mapping.
4666         */
4667        public ElementDefinitionMappingComponent setIdentity(String value) { 
4668            if (this.identity == null)
4669              this.identity = new IdType();
4670            this.identity.setValue(value);
4671          return this;
4672        }
4673
4674        /**
4675         * @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
4676         */
4677        public CodeType getLanguageElement() { 
4678          if (this.language == null)
4679            if (Configuration.errorOnAutoCreate())
4680              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.language");
4681            else if (Configuration.doAutoCreate())
4682              this.language = new CodeType(); // bb
4683          return this.language;
4684        }
4685
4686        public boolean hasLanguageElement() { 
4687          return this.language != null && !this.language.isEmpty();
4688        }
4689
4690        public boolean hasLanguage() { 
4691          return this.language != null && !this.language.isEmpty();
4692        }
4693
4694        /**
4695         * @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
4696         */
4697        public ElementDefinitionMappingComponent setLanguageElement(CodeType value) { 
4698          this.language = value;
4699          return this;
4700        }
4701
4702        /**
4703         * @return Identifies the computable language in which mapping.map is expressed.
4704         */
4705        public String getLanguage() { 
4706          return this.language == null ? null : this.language.getValue();
4707        }
4708
4709        /**
4710         * @param value Identifies the computable language in which mapping.map is expressed.
4711         */
4712        public ElementDefinitionMappingComponent setLanguage(String value) { 
4713          if (Utilities.noString(value))
4714            this.language = null;
4715          else {
4716            if (this.language == null)
4717              this.language = new CodeType();
4718            this.language.setValue(value);
4719          }
4720          return this;
4721        }
4722
4723        /**
4724         * @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
4725         */
4726        public StringType getMapElement() { 
4727          if (this.map == null)
4728            if (Configuration.errorOnAutoCreate())
4729              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.map");
4730            else if (Configuration.doAutoCreate())
4731              this.map = new StringType(); // bb
4732          return this.map;
4733        }
4734
4735        public boolean hasMapElement() { 
4736          return this.map != null && !this.map.isEmpty();
4737        }
4738
4739        public boolean hasMap() { 
4740          return this.map != null && !this.map.isEmpty();
4741        }
4742
4743        /**
4744         * @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
4745         */
4746        public ElementDefinitionMappingComponent setMapElement(StringType value) { 
4747          this.map = value;
4748          return this;
4749        }
4750
4751        /**
4752         * @return Expresses what part of the target specification corresponds to this element.
4753         */
4754        public String getMap() { 
4755          return this.map == null ? null : this.map.getValue();
4756        }
4757
4758        /**
4759         * @param value Expresses what part of the target specification corresponds to this element.
4760         */
4761        public ElementDefinitionMappingComponent setMap(String value) { 
4762            if (this.map == null)
4763              this.map = new StringType();
4764            this.map.setValue(value);
4765          return this;
4766        }
4767
4768        /**
4769         * @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
4770         */
4771        public StringType getCommentElement() { 
4772          if (this.comment == null)
4773            if (Configuration.errorOnAutoCreate())
4774              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.comment");
4775            else if (Configuration.doAutoCreate())
4776              this.comment = new StringType(); // bb
4777          return this.comment;
4778        }
4779
4780        public boolean hasCommentElement() { 
4781          return this.comment != null && !this.comment.isEmpty();
4782        }
4783
4784        public boolean hasComment() { 
4785          return this.comment != null && !this.comment.isEmpty();
4786        }
4787
4788        /**
4789         * @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
4790         */
4791        public ElementDefinitionMappingComponent setCommentElement(StringType value) { 
4792          this.comment = value;
4793          return this;
4794        }
4795
4796        /**
4797         * @return Comments that provide information about the mapping or its use.
4798         */
4799        public String getComment() { 
4800          return this.comment == null ? null : this.comment.getValue();
4801        }
4802
4803        /**
4804         * @param value Comments that provide information about the mapping or its use.
4805         */
4806        public ElementDefinitionMappingComponent setComment(String value) { 
4807          if (Utilities.noString(value))
4808            this.comment = null;
4809          else {
4810            if (this.comment == null)
4811              this.comment = new StringType();
4812            this.comment.setValue(value);
4813          }
4814          return this;
4815        }
4816
4817        protected void listChildren(List<Property> children) {
4818          super.listChildren(children);
4819          children.add(new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, 1, identity));
4820          children.add(new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, 1, language));
4821          children.add(new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, 1, map));
4822          children.add(new Property("comment", "string", "Comments that provide information about the mapping or its use.", 0, 1, comment));
4823        }
4824
4825        @Override
4826        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4827          switch (_hash) {
4828          case -135761730: /*identity*/  return new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, 1, identity);
4829          case -1613589672: /*language*/  return new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, 1, language);
4830          case 107868: /*map*/  return new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, 1, map);
4831          case 950398559: /*comment*/  return new Property("comment", "string", "Comments that provide information about the mapping or its use.", 0, 1, comment);
4832          default: return super.getNamedProperty(_hash, _name, _checkValid);
4833          }
4834
4835        }
4836
4837      @Override
4838      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4839        switch (hash) {
4840        case -135761730: /*identity*/ return this.identity == null ? new Base[0] : new Base[] {this.identity}; // IdType
4841        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType
4842        case 107868: /*map*/ return this.map == null ? new Base[0] : new Base[] {this.map}; // StringType
4843        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
4844        default: return super.getProperty(hash, name, checkValid);
4845        }
4846
4847      }
4848
4849      @Override
4850      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4851        switch (hash) {
4852        case -135761730: // identity
4853          this.identity = TypeConvertor.castToId(value); // IdType
4854          return value;
4855        case -1613589672: // language
4856          this.language = TypeConvertor.castToCode(value); // CodeType
4857          return value;
4858        case 107868: // map
4859          this.map = TypeConvertor.castToString(value); // StringType
4860          return value;
4861        case 950398559: // comment
4862          this.comment = TypeConvertor.castToString(value); // StringType
4863          return value;
4864        default: return super.setProperty(hash, name, value);
4865        }
4866
4867      }
4868
4869      @Override
4870      public Base setProperty(String name, Base value) throws FHIRException {
4871        if (name.equals("identity")) {
4872          this.identity = TypeConvertor.castToId(value); // IdType
4873        } else if (name.equals("language")) {
4874          this.language = TypeConvertor.castToCode(value); // CodeType
4875        } else if (name.equals("map")) {
4876          this.map = TypeConvertor.castToString(value); // StringType
4877        } else if (name.equals("comment")) {
4878          this.comment = TypeConvertor.castToString(value); // StringType
4879        } else
4880          return super.setProperty(name, value);
4881        return value;
4882      }
4883
4884      @Override
4885      public Base makeProperty(int hash, String name) throws FHIRException {
4886        switch (hash) {
4887        case -135761730:  return getIdentityElement();
4888        case -1613589672:  return getLanguageElement();
4889        case 107868:  return getMapElement();
4890        case 950398559:  return getCommentElement();
4891        default: return super.makeProperty(hash, name);
4892        }
4893
4894      }
4895
4896      @Override
4897      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4898        switch (hash) {
4899        case -135761730: /*identity*/ return new String[] {"id"};
4900        case -1613589672: /*language*/ return new String[] {"code"};
4901        case 107868: /*map*/ return new String[] {"string"};
4902        case 950398559: /*comment*/ return new String[] {"string"};
4903        default: return super.getTypesForProperty(hash, name);
4904        }
4905
4906      }
4907
4908      @Override
4909      public Base addChild(String name) throws FHIRException {
4910        if (name.equals("identity")) {
4911          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.mapping.identity");
4912        }
4913        else if (name.equals("language")) {
4914          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.mapping.language");
4915        }
4916        else if (name.equals("map")) {
4917          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.mapping.map");
4918        }
4919        else if (name.equals("comment")) {
4920          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.mapping.comment");
4921        }
4922        else
4923          return super.addChild(name);
4924      }
4925
4926      public ElementDefinitionMappingComponent copy() {
4927        ElementDefinitionMappingComponent dst = new ElementDefinitionMappingComponent();
4928        copyValues(dst);
4929        return dst;
4930      }
4931
4932      public void copyValues(ElementDefinitionMappingComponent dst) {
4933        super.copyValues(dst);
4934        dst.identity = identity == null ? null : identity.copy();
4935        dst.language = language == null ? null : language.copy();
4936        dst.map = map == null ? null : map.copy();
4937        dst.comment = comment == null ? null : comment.copy();
4938      }
4939
4940      @Override
4941      public boolean equalsDeep(Base other_) {
4942        if (!super.equalsDeep(other_))
4943          return false;
4944        if (!(other_ instanceof ElementDefinitionMappingComponent))
4945          return false;
4946        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other_;
4947        return compareDeep(identity, o.identity, true) && compareDeep(language, o.language, true) && compareDeep(map, o.map, true)
4948           && compareDeep(comment, o.comment, true);
4949      }
4950
4951      @Override
4952      public boolean equalsShallow(Base other_) {
4953        if (!super.equalsShallow(other_))
4954          return false;
4955        if (!(other_ instanceof ElementDefinitionMappingComponent))
4956          return false;
4957        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other_;
4958        return compareValues(identity, o.identity, true) && compareValues(language, o.language, true) && compareValues(map, o.map, true)
4959           && compareValues(comment, o.comment, true);
4960      }
4961
4962      public boolean isEmpty() {
4963        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identity, language, map
4964          , comment);
4965      }
4966
4967  public String fhirType() {
4968    return "ElementDefinition.mapping";
4969
4970  }
4971
4972  }
4973
4974    /**
4975     * The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
4976     */
4977    @Child(name = "path", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=true)
4978    @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." )
4979    protected StringType path;
4980
4981    /**
4982     * Codes that define how this element is represented in instances, when the deviation varies from the normal case.
4983     */
4984    @Child(name = "representation", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4985    @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." )
4986    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/property-representation")
4987    protected List<Enumeration<PropertyRepresentation>> representation;
4988
4989    /**
4990     * 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.
4991     */
4992    @Child(name = "sliceName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
4993    @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." )
4994    protected StringType sliceName;
4995
4996    /**
4997     * 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.
4998     */
4999    @Child(name = "sliceIsConstraining", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
5000    @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." )
5001    protected BooleanType sliceIsConstraining;
5002
5003    /**
5004     * 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.
5005     */
5006    @Child(name = "label", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
5007    @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." )
5008    protected StringType label;
5009
5010    /**
5011     * A code that has the same meaning as the element in a particular terminology.
5012     */
5013    @Child(name = "code", type = {Coding.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5014    @Description(shortDefinition="Corresponding codes in terminologies", formalDefinition="A code that has the same meaning as the element in a particular terminology." )
5015    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
5016    protected List<Coding> code;
5017
5018    /**
5019     * 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).
5020     */
5021    @Child(name = "slicing", type = {}, order=6, min=0, max=1, modifier=false, summary=true)
5022    @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)." )
5023    protected ElementDefinitionSlicingComponent slicing;
5024
5025    /**
5026     * A concise description of what this element means (e.g. for use in autogenerated summaries).
5027     */
5028    @Child(name = "short", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
5029    @Description(shortDefinition="Concise definition for space-constrained presentation", formalDefinition="A concise description of what this element means (e.g. for use in autogenerated summaries)." )
5030    protected StringType short_;
5031
5032    /**
5033     * 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).
5034     */
5035    @Child(name = "definition", type = {MarkdownType.class}, order=8, min=0, max=1, modifier=false, summary=true)
5036    @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)." )
5037    protected MarkdownType definition;
5038
5039    /**
5040     * 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).
5041     */
5042    @Child(name = "comment", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=true)
5043    @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)." )
5044    protected MarkdownType comment;
5045
5046    /**
5047     * 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.
5048     */
5049    @Child(name = "requirements", type = {MarkdownType.class}, order=10, min=0, max=1, modifier=false, summary=true)
5050    @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." )
5051    protected MarkdownType requirements;
5052
5053    /**
5054     * Identifies additional names by which this element might also be known.
5055     */
5056    @Child(name = "alias", type = {StringType.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5057    @Description(shortDefinition="Other names", formalDefinition="Identifies additional names by which this element might also be known." )
5058    protected List<StringType> alias;
5059
5060    /**
5061     * The minimum number of times this element SHALL appear in the instance.
5062     */
5063    @Child(name = "min", type = {UnsignedIntType.class}, order=12, min=0, max=1, modifier=false, summary=true)
5064    @Description(shortDefinition="Minimum Cardinality", formalDefinition="The minimum number of times this element SHALL appear in the instance." )
5065    protected UnsignedIntType min;
5066
5067    /**
5068     * The maximum number of times this element is permitted to appear in the instance.
5069     */
5070    @Child(name = "max", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=true)
5071    @Description(shortDefinition="Maximum Cardinality (a number or *)", formalDefinition="The maximum number of times this element is permitted to appear in the instance." )
5072    protected StringType max;
5073
5074    /**
5075     * 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 - i.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.
5076     */
5077    @Child(name = "base", type = {}, order=14, min=0, max=1, modifier=false, summary=true)
5078    @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 - i.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." )
5079    protected ElementDefinitionBaseComponent base;
5080
5081    /**
5082     * 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.
5083     */
5084    @Child(name = "contentReference", type = {UriType.class}, order=15, min=0, max=1, modifier=false, summary=true)
5085    @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." )
5086    protected UriType contentReference;
5087
5088    /**
5089     * The data type or resource that the value of this element is permitted to be.
5090     */
5091    @Child(name = "type", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5092    @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." )
5093    protected List<TypeRefComponent> type;
5094
5095    /**
5096     * 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').
5097     */
5098    @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, Contributor.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Dosage.class, Meta.class}, order=17, min=0, max=1, modifier=false, summary=true)
5099    @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')." )
5100    protected DataType defaultValue;
5101
5102    /**
5103     * The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing').
5104     */
5105    @Child(name = "meaningWhenMissing", type = {MarkdownType.class}, order=18, min=0, max=1, modifier=false, summary=true)
5106    @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')." )
5107    protected MarkdownType meaningWhenMissing;
5108
5109    /**
5110     * 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.
5111     */
5112    @Child(name = "orderMeaning", type = {StringType.class}, order=19, min=0, max=1, modifier=false, summary=true)
5113    @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." )
5114    protected StringType orderMeaning;
5115
5116    /**
5117     * Specifies a value that SHALL be exactly the value  for this element in the instance. 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.
5118     */
5119    @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, Contributor.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Dosage.class, Meta.class}, order=20, min=0, max=1, modifier=false, summary=true)
5120    @Description(shortDefinition="Value must be exactly this", formalDefinition="Specifies a value that SHALL be exactly the value  for this element in the instance. 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." )
5121    protected DataType fixed;
5122
5123    /**
5124     * Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
5125
5126When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
5127
5128When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
5129
5130When 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.,
5131
51321. If primitive: it must match exactly the pattern value
51332. If a complex object: it must match (recursively) the pattern value
51343. If an array: it must match (recursively) the pattern value.
5135     */
5136    @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, Contributor.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Dosage.class, Meta.class}, order=21, min=0, max=1, modifier=false, summary=true)
5137    @Description(shortDefinition="Value must have at least these property values", formalDefinition="Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. 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 pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array 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." )
5138    protected DataType pattern;
5139
5140    /**
5141     * A sample value for this element demonstrating the type of information that would typically be found in the element.
5142     */
5143    @Child(name = "example", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5144    @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." )
5145    protected List<ElementDefinitionExampleComponent> example;
5146
5147    /**
5148     * 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.
5149     */
5150    @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)
5151    @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." )
5152    protected DataType minValue;
5153
5154    /**
5155     * 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.
5156     */
5157    @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)
5158    @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." )
5159    protected DataType maxValue;
5160
5161    /**
5162     * 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.
5163     */
5164    @Child(name = "maxLength", type = {IntegerType.class}, order=25, min=0, max=1, modifier=false, summary=true)
5165    @Description(shortDefinition="Max length for strings", 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." )
5166    protected IntegerType maxLength;
5167
5168    /**
5169     * A reference to an invariant that may make additional statements about the cardinality or value in the instance.
5170     */
5171    @Child(name = "condition", type = {IdType.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5172    @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." )
5173    protected List<IdType> condition;
5174
5175    /**
5176     * Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.
5177     */
5178    @Child(name = "constraint", type = {}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5179    @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." )
5180    protected List<ElementDefinitionConstraintComponent> constraint;
5181
5182    /**
5183     * If true, implementations that produce or consume resources SHALL provide "support" for the element in some meaningful way.  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.
5184     */
5185    @Child(name = "mustSupport", type = {BooleanType.class}, order=28, min=0, max=1, modifier=false, summary=true)
5186    @Description(shortDefinition="If the element must be supported", formalDefinition="If true, implementations that produce or consume resources SHALL provide \"support\" for the element in some meaningful way.  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." )
5187    protected BooleanType mustSupport;
5188
5189    /**
5190     * 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.
5191     */
5192    @Child(name = "isModifier", type = {BooleanType.class}, order=29, min=0, max=1, modifier=false, summary=true)
5193    @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." )
5194    protected BooleanType isModifier;
5195
5196    /**
5197     * Explains how that element affects the interpretation of the resource or element that contains it.
5198     */
5199    @Child(name = "isModifierReason", type = {StringType.class}, order=30, min=0, max=1, modifier=false, summary=true)
5200    @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." )
5201    protected StringType isModifierReason;
5202
5203    /**
5204     * Whether the element should be included if a client requests a search with the parameter _summary=true.
5205     */
5206    @Child(name = "isSummary", type = {BooleanType.class}, order=31, min=0, max=1, modifier=false, summary=true)
5207    @Description(shortDefinition="Include when _summary = true?", formalDefinition="Whether the element should be included if a client requests a search with the parameter _summary=true." )
5208    protected BooleanType isSummary;
5209
5210    /**
5211     * Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri).
5212     */
5213    @Child(name = "binding", type = {}, order=32, min=0, max=1, modifier=false, summary=true)
5214    @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)." )
5215    protected ElementDefinitionBindingComponent binding;
5216
5217    /**
5218     * Identifies a concept from an external specification that roughly corresponds to this element.
5219     */
5220    @Child(name = "mapping", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5221    @Description(shortDefinition="Map element to another set of definitions", formalDefinition="Identifies a concept from an external specification that roughly corresponds to this element." )
5222    protected List<ElementDefinitionMappingComponent> mapping;
5223
5224    private static final long serialVersionUID = 821951601L;
5225
5226  /**
5227   * Constructor
5228   */
5229    public ElementDefinition() {
5230      super();
5231    }
5232
5233  /**
5234   * Constructor
5235   */
5236    public ElementDefinition(String path) {
5237      super();
5238      this.setPath(path);
5239    }
5240
5241    /**
5242     * @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
5243     */
5244    public StringType getPathElement() { 
5245      if (this.path == null)
5246        if (Configuration.errorOnAutoCreate())
5247          throw new Error("Attempt to auto-create ElementDefinition.path");
5248        else if (Configuration.doAutoCreate())
5249          this.path = new StringType(); // bb
5250      return this.path;
5251    }
5252
5253    public boolean hasPathElement() { 
5254      return this.path != null && !this.path.isEmpty();
5255    }
5256
5257    public boolean hasPath() { 
5258      return this.path != null && !this.path.isEmpty();
5259    }
5260
5261    /**
5262     * @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
5263     */
5264    public ElementDefinition setPathElement(StringType value) { 
5265      this.path = value;
5266      return this;
5267    }
5268
5269    /**
5270     * @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.
5271     */
5272    public String getPath() { 
5273      return this.path == null ? null : this.path.getValue();
5274    }
5275
5276    /**
5277     * @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.
5278     */
5279    public ElementDefinition setPath(String value) { 
5280        if (this.path == null)
5281          this.path = new StringType();
5282        this.path.setValue(value);
5283      return this;
5284    }
5285
5286    /**
5287     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
5288     */
5289    public List<Enumeration<PropertyRepresentation>> getRepresentation() { 
5290      if (this.representation == null)
5291        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
5292      return this.representation;
5293    }
5294
5295    /**
5296     * @return Returns a reference to <code>this</code> for easy method chaining
5297     */
5298    public ElementDefinition setRepresentation(List<Enumeration<PropertyRepresentation>> theRepresentation) { 
5299      this.representation = theRepresentation;
5300      return this;
5301    }
5302
5303    public boolean hasRepresentation() { 
5304      if (this.representation == null)
5305        return false;
5306      for (Enumeration<PropertyRepresentation> item : this.representation)
5307        if (!item.isEmpty())
5308          return true;
5309      return false;
5310    }
5311
5312    /**
5313     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
5314     */
5315    public Enumeration<PropertyRepresentation> addRepresentationElement() {//2 
5316      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
5317      if (this.representation == null)
5318        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
5319      this.representation.add(t);
5320      return t;
5321    }
5322
5323    /**
5324     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
5325     */
5326    public ElementDefinition addRepresentation(PropertyRepresentation value) { //1
5327      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
5328      t.setValue(value);
5329      if (this.representation == null)
5330        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
5331      this.representation.add(t);
5332      return this;
5333    }
5334
5335    /**
5336     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
5337     */
5338    public boolean hasRepresentation(PropertyRepresentation value) { 
5339      if (this.representation == null)
5340        return false;
5341      for (Enumeration<PropertyRepresentation> v : this.representation)
5342        if (v.getValue().equals(value)) // code
5343          return true;
5344      return false;
5345    }
5346
5347    /**
5348     * @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
5349     */
5350    public StringType getSliceNameElement() { 
5351      if (this.sliceName == null)
5352        if (Configuration.errorOnAutoCreate())
5353          throw new Error("Attempt to auto-create ElementDefinition.sliceName");
5354        else if (Configuration.doAutoCreate())
5355          this.sliceName = new StringType(); // bb
5356      return this.sliceName;
5357    }
5358
5359    public boolean hasSliceNameElement() { 
5360      return this.sliceName != null && !this.sliceName.isEmpty();
5361    }
5362
5363    public boolean hasSliceName() { 
5364      return this.sliceName != null && !this.sliceName.isEmpty();
5365    }
5366
5367    /**
5368     * @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
5369     */
5370    public ElementDefinition setSliceNameElement(StringType value) { 
5371      this.sliceName = value;
5372      return this;
5373    }
5374
5375    /**
5376     * @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.
5377     */
5378    public String getSliceName() { 
5379      return this.sliceName == null ? null : this.sliceName.getValue();
5380    }
5381
5382    /**
5383     * @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.
5384     */
5385    public ElementDefinition setSliceName(String value) { 
5386      if (Utilities.noString(value))
5387        this.sliceName = null;
5388      else {
5389        if (this.sliceName == null)
5390          this.sliceName = new StringType();
5391        this.sliceName.setValue(value);
5392      }
5393      return this;
5394    }
5395
5396    /**
5397     * @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
5398     */
5399    public BooleanType getSliceIsConstrainingElement() { 
5400      if (this.sliceIsConstraining == null)
5401        if (Configuration.errorOnAutoCreate())
5402          throw new Error("Attempt to auto-create ElementDefinition.sliceIsConstraining");
5403        else if (Configuration.doAutoCreate())
5404          this.sliceIsConstraining = new BooleanType(); // bb
5405      return this.sliceIsConstraining;
5406    }
5407
5408    public boolean hasSliceIsConstrainingElement() { 
5409      return this.sliceIsConstraining != null && !this.sliceIsConstraining.isEmpty();
5410    }
5411
5412    public boolean hasSliceIsConstraining() { 
5413      return this.sliceIsConstraining != null && !this.sliceIsConstraining.isEmpty();
5414    }
5415
5416    /**
5417     * @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
5418     */
5419    public ElementDefinition setSliceIsConstrainingElement(BooleanType value) { 
5420      this.sliceIsConstraining = value;
5421      return this;
5422    }
5423
5424    /**
5425     * @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.
5426     */
5427    public boolean getSliceIsConstraining() { 
5428      return this.sliceIsConstraining == null || this.sliceIsConstraining.isEmpty() ? false : this.sliceIsConstraining.getValue();
5429    }
5430
5431    /**
5432     * @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.
5433     */
5434    public ElementDefinition setSliceIsConstraining(boolean value) { 
5435        if (this.sliceIsConstraining == null)
5436          this.sliceIsConstraining = new BooleanType();
5437        this.sliceIsConstraining.setValue(value);
5438      return this;
5439    }
5440
5441    /**
5442     * @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
5443     */
5444    public StringType getLabelElement() { 
5445      if (this.label == null)
5446        if (Configuration.errorOnAutoCreate())
5447          throw new Error("Attempt to auto-create ElementDefinition.label");
5448        else if (Configuration.doAutoCreate())
5449          this.label = new StringType(); // bb
5450      return this.label;
5451    }
5452
5453    public boolean hasLabelElement() { 
5454      return this.label != null && !this.label.isEmpty();
5455    }
5456
5457    public boolean hasLabel() { 
5458      return this.label != null && !this.label.isEmpty();
5459    }
5460
5461    /**
5462     * @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
5463     */
5464    public ElementDefinition setLabelElement(StringType value) { 
5465      this.label = value;
5466      return this;
5467    }
5468
5469    /**
5470     * @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.
5471     */
5472    public String getLabel() { 
5473      return this.label == null ? null : this.label.getValue();
5474    }
5475
5476    /**
5477     * @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.
5478     */
5479    public ElementDefinition setLabel(String value) { 
5480      if (Utilities.noString(value))
5481        this.label = null;
5482      else {
5483        if (this.label == null)
5484          this.label = new StringType();
5485        this.label.setValue(value);
5486      }
5487      return this;
5488    }
5489
5490    /**
5491     * @return {@link #code} (A code that has the same meaning as the element in a particular terminology.)
5492     */
5493    public List<Coding> getCode() { 
5494      if (this.code == null)
5495        this.code = new ArrayList<Coding>();
5496      return this.code;
5497    }
5498
5499    /**
5500     * @return Returns a reference to <code>this</code> for easy method chaining
5501     */
5502    public ElementDefinition setCode(List<Coding> theCode) { 
5503      this.code = theCode;
5504      return this;
5505    }
5506
5507    public boolean hasCode() { 
5508      if (this.code == null)
5509        return false;
5510      for (Coding item : this.code)
5511        if (!item.isEmpty())
5512          return true;
5513      return false;
5514    }
5515
5516    public Coding addCode() { //3
5517      Coding t = new Coding();
5518      if (this.code == null)
5519        this.code = new ArrayList<Coding>();
5520      this.code.add(t);
5521      return t;
5522    }
5523
5524    public ElementDefinition addCode(Coding t) { //3
5525      if (t == null)
5526        return this;
5527      if (this.code == null)
5528        this.code = new ArrayList<Coding>();
5529      this.code.add(t);
5530      return this;
5531    }
5532
5533    /**
5534     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
5535     */
5536    public Coding getCodeFirstRep() { 
5537      if (getCode().isEmpty()) {
5538        addCode();
5539      }
5540      return getCode().get(0);
5541    }
5542
5543    /**
5544     * @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).)
5545     */
5546    public ElementDefinitionSlicingComponent getSlicing() { 
5547      if (this.slicing == null)
5548        if (Configuration.errorOnAutoCreate())
5549          throw new Error("Attempt to auto-create ElementDefinition.slicing");
5550        else if (Configuration.doAutoCreate())
5551          this.slicing = new ElementDefinitionSlicingComponent(); // cc
5552      return this.slicing;
5553    }
5554
5555    public boolean hasSlicing() { 
5556      return this.slicing != null && !this.slicing.isEmpty();
5557    }
5558
5559    /**
5560     * @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).)
5561     */
5562    public ElementDefinition setSlicing(ElementDefinitionSlicingComponent value) { 
5563      this.slicing = value;
5564      return this;
5565    }
5566
5567    /**
5568     * @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
5569     */
5570    public StringType getShortElement() { 
5571      if (this.short_ == null)
5572        if (Configuration.errorOnAutoCreate())
5573          throw new Error("Attempt to auto-create ElementDefinition.short_");
5574        else if (Configuration.doAutoCreate())
5575          this.short_ = new StringType(); // bb
5576      return this.short_;
5577    }
5578
5579    public boolean hasShortElement() { 
5580      return this.short_ != null && !this.short_.isEmpty();
5581    }
5582
5583    public boolean hasShort() { 
5584      return this.short_ != null && !this.short_.isEmpty();
5585    }
5586
5587    /**
5588     * @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
5589     */
5590    public ElementDefinition setShortElement(StringType value) { 
5591      this.short_ = value;
5592      return this;
5593    }
5594
5595    /**
5596     * @return A concise description of what this element means (e.g. for use in autogenerated summaries).
5597     */
5598    public String getShort() { 
5599      return this.short_ == null ? null : this.short_.getValue();
5600    }
5601
5602    /**
5603     * @param value A concise description of what this element means (e.g. for use in autogenerated summaries).
5604     */
5605    public ElementDefinition setShort(String value) { 
5606      if (Utilities.noString(value))
5607        this.short_ = null;
5608      else {
5609        if (this.short_ == null)
5610          this.short_ = new StringType();
5611        this.short_.setValue(value);
5612      }
5613      return this;
5614    }
5615
5616    /**
5617     * @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
5618     */
5619    public MarkdownType getDefinitionElement() { 
5620      if (this.definition == null)
5621        if (Configuration.errorOnAutoCreate())
5622          throw new Error("Attempt to auto-create ElementDefinition.definition");
5623        else if (Configuration.doAutoCreate())
5624          this.definition = new MarkdownType(); // bb
5625      return this.definition;
5626    }
5627
5628    public boolean hasDefinitionElement() { 
5629      return this.definition != null && !this.definition.isEmpty();
5630    }
5631
5632    public boolean hasDefinition() { 
5633      return this.definition != null && !this.definition.isEmpty();
5634    }
5635
5636    /**
5637     * @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
5638     */
5639    public ElementDefinition setDefinitionElement(MarkdownType value) { 
5640      this.definition = value;
5641      return this;
5642    }
5643
5644    /**
5645     * @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).
5646     */
5647    public String getDefinition() { 
5648      return this.definition == null ? null : this.definition.getValue();
5649    }
5650
5651    /**
5652     * @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).
5653     */
5654    public ElementDefinition setDefinition(String value) { 
5655      if (value == null)
5656        this.definition = null;
5657      else {
5658        if (this.definition == null)
5659          this.definition = new MarkdownType();
5660        this.definition.setValue(value);
5661      }
5662      return this;
5663    }
5664
5665    /**
5666     * @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
5667     */
5668    public MarkdownType getCommentElement() { 
5669      if (this.comment == null)
5670        if (Configuration.errorOnAutoCreate())
5671          throw new Error("Attempt to auto-create ElementDefinition.comment");
5672        else if (Configuration.doAutoCreate())
5673          this.comment = new MarkdownType(); // bb
5674      return this.comment;
5675    }
5676
5677    public boolean hasCommentElement() { 
5678      return this.comment != null && !this.comment.isEmpty();
5679    }
5680
5681    public boolean hasComment() { 
5682      return this.comment != null && !this.comment.isEmpty();
5683    }
5684
5685    /**
5686     * @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
5687     */
5688    public ElementDefinition setCommentElement(MarkdownType value) { 
5689      this.comment = value;
5690      return this;
5691    }
5692
5693    /**
5694     * @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).
5695     */
5696    public String getComment() { 
5697      return this.comment == null ? null : this.comment.getValue();
5698    }
5699
5700    /**
5701     * @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).
5702     */
5703    public ElementDefinition setComment(String value) { 
5704      if (value == null)
5705        this.comment = null;
5706      else {
5707        if (this.comment == null)
5708          this.comment = new MarkdownType();
5709        this.comment.setValue(value);
5710      }
5711      return this;
5712    }
5713
5714    /**
5715     * @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
5716     */
5717    public MarkdownType getRequirementsElement() { 
5718      if (this.requirements == null)
5719        if (Configuration.errorOnAutoCreate())
5720          throw new Error("Attempt to auto-create ElementDefinition.requirements");
5721        else if (Configuration.doAutoCreate())
5722          this.requirements = new MarkdownType(); // bb
5723      return this.requirements;
5724    }
5725
5726    public boolean hasRequirementsElement() { 
5727      return this.requirements != null && !this.requirements.isEmpty();
5728    }
5729
5730    public boolean hasRequirements() { 
5731      return this.requirements != null && !this.requirements.isEmpty();
5732    }
5733
5734    /**
5735     * @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
5736     */
5737    public ElementDefinition setRequirementsElement(MarkdownType value) { 
5738      this.requirements = value;
5739      return this;
5740    }
5741
5742    /**
5743     * @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.
5744     */
5745    public String getRequirements() { 
5746      return this.requirements == null ? null : this.requirements.getValue();
5747    }
5748
5749    /**
5750     * @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.
5751     */
5752    public ElementDefinition setRequirements(String value) { 
5753      if (value == null)
5754        this.requirements = null;
5755      else {
5756        if (this.requirements == null)
5757          this.requirements = new MarkdownType();
5758        this.requirements.setValue(value);
5759      }
5760      return this;
5761    }
5762
5763    /**
5764     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
5765     */
5766    public List<StringType> getAlias() { 
5767      if (this.alias == null)
5768        this.alias = new ArrayList<StringType>();
5769      return this.alias;
5770    }
5771
5772    /**
5773     * @return Returns a reference to <code>this</code> for easy method chaining
5774     */
5775    public ElementDefinition setAlias(List<StringType> theAlias) { 
5776      this.alias = theAlias;
5777      return this;
5778    }
5779
5780    public boolean hasAlias() { 
5781      if (this.alias == null)
5782        return false;
5783      for (StringType item : this.alias)
5784        if (!item.isEmpty())
5785          return true;
5786      return false;
5787    }
5788
5789    /**
5790     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
5791     */
5792    public StringType addAliasElement() {//2 
5793      StringType t = new StringType();
5794      if (this.alias == null)
5795        this.alias = new ArrayList<StringType>();
5796      this.alias.add(t);
5797      return t;
5798    }
5799
5800    /**
5801     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
5802     */
5803    public ElementDefinition addAlias(String value) { //1
5804      StringType t = new StringType();
5805      t.setValue(value);
5806      if (this.alias == null)
5807        this.alias = new ArrayList<StringType>();
5808      this.alias.add(t);
5809      return this;
5810    }
5811
5812    /**
5813     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
5814     */
5815    public boolean hasAlias(String value) { 
5816      if (this.alias == null)
5817        return false;
5818      for (StringType v : this.alias)
5819        if (v.getValue().equals(value)) // string
5820          return true;
5821      return false;
5822    }
5823
5824    /**
5825     * @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
5826     */
5827    public UnsignedIntType getMinElement() { 
5828      if (this.min == null)
5829        if (Configuration.errorOnAutoCreate())
5830          throw new Error("Attempt to auto-create ElementDefinition.min");
5831        else if (Configuration.doAutoCreate())
5832          this.min = new UnsignedIntType(); // bb
5833      return this.min;
5834    }
5835
5836    public boolean hasMinElement() { 
5837      return this.min != null && !this.min.isEmpty();
5838    }
5839
5840    public boolean hasMin() { 
5841      return this.min != null && !this.min.isEmpty();
5842    }
5843
5844    /**
5845     * @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
5846     */
5847    public ElementDefinition setMinElement(UnsignedIntType value) { 
5848      this.min = value;
5849      return this;
5850    }
5851
5852    /**
5853     * @return The minimum number of times this element SHALL appear in the instance.
5854     */
5855    public int getMin() { 
5856      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
5857    }
5858
5859    /**
5860     * @param value The minimum number of times this element SHALL appear in the instance.
5861     */
5862    public ElementDefinition setMin(int value) { 
5863        if (this.min == null)
5864          this.min = new UnsignedIntType();
5865        this.min.setValue(value);
5866      return this;
5867    }
5868
5869    /**
5870     * @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
5871     */
5872    public StringType getMaxElement() { 
5873      if (this.max == null)
5874        if (Configuration.errorOnAutoCreate())
5875          throw new Error("Attempt to auto-create ElementDefinition.max");
5876        else if (Configuration.doAutoCreate())
5877          this.max = new StringType(); // bb
5878      return this.max;
5879    }
5880
5881    public boolean hasMaxElement() { 
5882      return this.max != null && !this.max.isEmpty();
5883    }
5884
5885    public boolean hasMax() { 
5886      return this.max != null && !this.max.isEmpty();
5887    }
5888
5889    /**
5890     * @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
5891     */
5892    public ElementDefinition setMaxElement(StringType value) { 
5893      this.max = value;
5894      return this;
5895    }
5896
5897    /**
5898     * @return The maximum number of times this element is permitted to appear in the instance.
5899     */
5900    public String getMax() { 
5901      return this.max == null ? null : this.max.getValue();
5902    }
5903
5904    /**
5905     * @param value The maximum number of times this element is permitted to appear in the instance.
5906     */
5907    public ElementDefinition setMax(String value) { 
5908      if (Utilities.noString(value))
5909        this.max = null;
5910      else {
5911        if (this.max == null)
5912          this.max = new StringType();
5913        this.max.setValue(value);
5914      }
5915      return this;
5916    }
5917
5918    /**
5919     * @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 - i.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.)
5920     */
5921    public ElementDefinitionBaseComponent getBase() { 
5922      if (this.base == null)
5923        if (Configuration.errorOnAutoCreate())
5924          throw new Error("Attempt to auto-create ElementDefinition.base");
5925        else if (Configuration.doAutoCreate())
5926          this.base = new ElementDefinitionBaseComponent(); // cc
5927      return this.base;
5928    }
5929
5930    public boolean hasBase() { 
5931      return this.base != null && !this.base.isEmpty();
5932    }
5933
5934    /**
5935     * @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 - i.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.)
5936     */
5937    public ElementDefinition setBase(ElementDefinitionBaseComponent value) { 
5938      this.base = value;
5939      return this;
5940    }
5941
5942    /**
5943     * @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
5944     */
5945    public UriType getContentReferenceElement() { 
5946      if (this.contentReference == null)
5947        if (Configuration.errorOnAutoCreate())
5948          throw new Error("Attempt to auto-create ElementDefinition.contentReference");
5949        else if (Configuration.doAutoCreate())
5950          this.contentReference = new UriType(); // bb
5951      return this.contentReference;
5952    }
5953
5954    public boolean hasContentReferenceElement() { 
5955      return this.contentReference != null && !this.contentReference.isEmpty();
5956    }
5957
5958    public boolean hasContentReference() { 
5959      return this.contentReference != null && !this.contentReference.isEmpty();
5960    }
5961
5962    /**
5963     * @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
5964     */
5965    public ElementDefinition setContentReferenceElement(UriType value) { 
5966      this.contentReference = value;
5967      return this;
5968    }
5969
5970    /**
5971     * @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.
5972     */
5973    public String getContentReference() { 
5974      return this.contentReference == null ? null : this.contentReference.getValue();
5975    }
5976
5977    /**
5978     * @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.
5979     */
5980    public ElementDefinition setContentReference(String value) { 
5981      if (Utilities.noString(value))
5982        this.contentReference = null;
5983      else {
5984        if (this.contentReference == null)
5985          this.contentReference = new UriType();
5986        this.contentReference.setValue(value);
5987      }
5988      return this;
5989    }
5990
5991    /**
5992     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
5993     */
5994    public List<TypeRefComponent> getType() { 
5995      if (this.type == null)
5996        this.type = new ArrayList<TypeRefComponent>();
5997      return this.type;
5998    }
5999
6000    /**
6001     * @return Returns a reference to <code>this</code> for easy method chaining
6002     */
6003    public ElementDefinition setType(List<TypeRefComponent> theType) { 
6004      this.type = theType;
6005      return this;
6006    }
6007
6008    public boolean hasType() { 
6009      if (this.type == null)
6010        return false;
6011      for (TypeRefComponent item : this.type)
6012        if (!item.isEmpty())
6013          return true;
6014      return false;
6015    }
6016
6017    public TypeRefComponent addType() { //3
6018      TypeRefComponent t = new TypeRefComponent();
6019      if (this.type == null)
6020        this.type = new ArrayList<TypeRefComponent>();
6021      this.type.add(t);
6022      return t;
6023    }
6024
6025    public ElementDefinition addType(TypeRefComponent t) { //3
6026      if (t == null)
6027        return this;
6028      if (this.type == null)
6029        this.type = new ArrayList<TypeRefComponent>();
6030      this.type.add(t);
6031      return this;
6032    }
6033
6034    /**
6035     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist {3}
6036     */
6037    public TypeRefComponent getTypeFirstRep() { 
6038      if (getType().isEmpty()) {
6039        addType();
6040      }
6041      return getType().get(0);
6042    }
6043
6044    /**
6045     * @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').)
6046     */
6047    public DataType getDefaultValue() { 
6048      return this.defaultValue;
6049    }
6050
6051    /**
6052     * @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').)
6053     */
6054    public Base64BinaryType getDefaultValueBase64BinaryType() throws FHIRException { 
6055      if (this.defaultValue == null)
6056        this.defaultValue = new Base64BinaryType();
6057      if (!(this.defaultValue instanceof Base64BinaryType))
6058        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6059      return (Base64BinaryType) this.defaultValue;
6060    }
6061
6062    public boolean hasDefaultValueBase64BinaryType() { 
6063      return this != null && this.defaultValue instanceof Base64BinaryType;
6064    }
6065
6066    /**
6067     * @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').)
6068     */
6069    public BooleanType getDefaultValueBooleanType() throws FHIRException { 
6070      if (this.defaultValue == null)
6071        this.defaultValue = new BooleanType();
6072      if (!(this.defaultValue instanceof BooleanType))
6073        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6074      return (BooleanType) this.defaultValue;
6075    }
6076
6077    public boolean hasDefaultValueBooleanType() { 
6078      return this != null && this.defaultValue instanceof BooleanType;
6079    }
6080
6081    /**
6082     * @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').)
6083     */
6084    public CanonicalType getDefaultValueCanonicalType() throws FHIRException { 
6085      if (this.defaultValue == null)
6086        this.defaultValue = new CanonicalType();
6087      if (!(this.defaultValue instanceof CanonicalType))
6088        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6089      return (CanonicalType) this.defaultValue;
6090    }
6091
6092    public boolean hasDefaultValueCanonicalType() { 
6093      return this != null && this.defaultValue instanceof CanonicalType;
6094    }
6095
6096    /**
6097     * @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').)
6098     */
6099    public CodeType getDefaultValueCodeType() throws FHIRException { 
6100      if (this.defaultValue == null)
6101        this.defaultValue = new CodeType();
6102      if (!(this.defaultValue instanceof CodeType))
6103        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6104      return (CodeType) this.defaultValue;
6105    }
6106
6107    public boolean hasDefaultValueCodeType() { 
6108      return this != null && this.defaultValue instanceof CodeType;
6109    }
6110
6111    /**
6112     * @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').)
6113     */
6114    public DateType getDefaultValueDateType() throws FHIRException { 
6115      if (this.defaultValue == null)
6116        this.defaultValue = new DateType();
6117      if (!(this.defaultValue instanceof DateType))
6118        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6119      return (DateType) this.defaultValue;
6120    }
6121
6122    public boolean hasDefaultValueDateType() { 
6123      return this != null && this.defaultValue instanceof DateType;
6124    }
6125
6126    /**
6127     * @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').)
6128     */
6129    public DateTimeType getDefaultValueDateTimeType() throws FHIRException { 
6130      if (this.defaultValue == null)
6131        this.defaultValue = new DateTimeType();
6132      if (!(this.defaultValue instanceof DateTimeType))
6133        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6134      return (DateTimeType) this.defaultValue;
6135    }
6136
6137    public boolean hasDefaultValueDateTimeType() { 
6138      return this != null && this.defaultValue instanceof DateTimeType;
6139    }
6140
6141    /**
6142     * @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').)
6143     */
6144    public DecimalType getDefaultValueDecimalType() throws FHIRException { 
6145      if (this.defaultValue == null)
6146        this.defaultValue = new DecimalType();
6147      if (!(this.defaultValue instanceof DecimalType))
6148        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6149      return (DecimalType) this.defaultValue;
6150    }
6151
6152    public boolean hasDefaultValueDecimalType() { 
6153      return this != null && this.defaultValue instanceof DecimalType;
6154    }
6155
6156    /**
6157     * @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').)
6158     */
6159    public IdType getDefaultValueIdType() throws FHIRException { 
6160      if (this.defaultValue == null)
6161        this.defaultValue = new IdType();
6162      if (!(this.defaultValue instanceof IdType))
6163        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6164      return (IdType) this.defaultValue;
6165    }
6166
6167    public boolean hasDefaultValueIdType() { 
6168      return this != null && this.defaultValue instanceof IdType;
6169    }
6170
6171    /**
6172     * @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').)
6173     */
6174    public InstantType getDefaultValueInstantType() throws FHIRException { 
6175      if (this.defaultValue == null)
6176        this.defaultValue = new InstantType();
6177      if (!(this.defaultValue instanceof InstantType))
6178        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6179      return (InstantType) this.defaultValue;
6180    }
6181
6182    public boolean hasDefaultValueInstantType() { 
6183      return this != null && this.defaultValue instanceof InstantType;
6184    }
6185
6186    /**
6187     * @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').)
6188     */
6189    public IntegerType getDefaultValueIntegerType() throws FHIRException { 
6190      if (this.defaultValue == null)
6191        this.defaultValue = new IntegerType();
6192      if (!(this.defaultValue instanceof IntegerType))
6193        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6194      return (IntegerType) this.defaultValue;
6195    }
6196
6197    public boolean hasDefaultValueIntegerType() { 
6198      return this != null && this.defaultValue instanceof IntegerType;
6199    }
6200
6201    /**
6202     * @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').)
6203     */
6204    public Integer64Type getDefaultValueInteger64Type() throws FHIRException { 
6205      if (this.defaultValue == null)
6206        this.defaultValue = new Integer64Type();
6207      if (!(this.defaultValue instanceof Integer64Type))
6208        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6209      return (Integer64Type) this.defaultValue;
6210    }
6211
6212    public boolean hasDefaultValueInteger64Type() { 
6213      return this != null && this.defaultValue instanceof Integer64Type;
6214    }
6215
6216    /**
6217     * @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').)
6218     */
6219    public MarkdownType getDefaultValueMarkdownType() throws FHIRException { 
6220      if (this.defaultValue == null)
6221        this.defaultValue = new MarkdownType();
6222      if (!(this.defaultValue instanceof MarkdownType))
6223        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6224      return (MarkdownType) this.defaultValue;
6225    }
6226
6227    public boolean hasDefaultValueMarkdownType() { 
6228      return this != null && this.defaultValue instanceof MarkdownType;
6229    }
6230
6231    /**
6232     * @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').)
6233     */
6234    public OidType getDefaultValueOidType() throws FHIRException { 
6235      if (this.defaultValue == null)
6236        this.defaultValue = new OidType();
6237      if (!(this.defaultValue instanceof OidType))
6238        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6239      return (OidType) this.defaultValue;
6240    }
6241
6242    public boolean hasDefaultValueOidType() { 
6243      return this != null && this.defaultValue instanceof OidType;
6244    }
6245
6246    /**
6247     * @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').)
6248     */
6249    public PositiveIntType getDefaultValuePositiveIntType() throws FHIRException { 
6250      if (this.defaultValue == null)
6251        this.defaultValue = new PositiveIntType();
6252      if (!(this.defaultValue instanceof PositiveIntType))
6253        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6254      return (PositiveIntType) this.defaultValue;
6255    }
6256
6257    public boolean hasDefaultValuePositiveIntType() { 
6258      return this != null && this.defaultValue instanceof PositiveIntType;
6259    }
6260
6261    /**
6262     * @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').)
6263     */
6264    public StringType getDefaultValueStringType() throws FHIRException { 
6265      if (this.defaultValue == null)
6266        this.defaultValue = new StringType();
6267      if (!(this.defaultValue instanceof StringType))
6268        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6269      return (StringType) this.defaultValue;
6270    }
6271
6272    public boolean hasDefaultValueStringType() { 
6273      return this != null && this.defaultValue instanceof StringType;
6274    }
6275
6276    /**
6277     * @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').)
6278     */
6279    public TimeType getDefaultValueTimeType() throws FHIRException { 
6280      if (this.defaultValue == null)
6281        this.defaultValue = new TimeType();
6282      if (!(this.defaultValue instanceof TimeType))
6283        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6284      return (TimeType) this.defaultValue;
6285    }
6286
6287    public boolean hasDefaultValueTimeType() { 
6288      return this != null && this.defaultValue instanceof TimeType;
6289    }
6290
6291    /**
6292     * @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').)
6293     */
6294    public UnsignedIntType getDefaultValueUnsignedIntType() throws FHIRException { 
6295      if (this.defaultValue == null)
6296        this.defaultValue = new UnsignedIntType();
6297      if (!(this.defaultValue instanceof UnsignedIntType))
6298        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6299      return (UnsignedIntType) this.defaultValue;
6300    }
6301
6302    public boolean hasDefaultValueUnsignedIntType() { 
6303      return this != null && this.defaultValue instanceof UnsignedIntType;
6304    }
6305
6306    /**
6307     * @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').)
6308     */
6309    public UriType getDefaultValueUriType() throws FHIRException { 
6310      if (this.defaultValue == null)
6311        this.defaultValue = new UriType();
6312      if (!(this.defaultValue instanceof UriType))
6313        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6314      return (UriType) this.defaultValue;
6315    }
6316
6317    public boolean hasDefaultValueUriType() { 
6318      return this != null && this.defaultValue instanceof UriType;
6319    }
6320
6321    /**
6322     * @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').)
6323     */
6324    public UrlType getDefaultValueUrlType() throws FHIRException { 
6325      if (this.defaultValue == null)
6326        this.defaultValue = new UrlType();
6327      if (!(this.defaultValue instanceof UrlType))
6328        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6329      return (UrlType) this.defaultValue;
6330    }
6331
6332    public boolean hasDefaultValueUrlType() { 
6333      return this != null && this.defaultValue instanceof UrlType;
6334    }
6335
6336    /**
6337     * @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').)
6338     */
6339    public UuidType getDefaultValueUuidType() throws FHIRException { 
6340      if (this.defaultValue == null)
6341        this.defaultValue = new UuidType();
6342      if (!(this.defaultValue instanceof UuidType))
6343        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6344      return (UuidType) this.defaultValue;
6345    }
6346
6347    public boolean hasDefaultValueUuidType() { 
6348      return this != null && this.defaultValue instanceof UuidType;
6349    }
6350
6351    /**
6352     * @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').)
6353     */
6354    public Address getDefaultValueAddress() throws FHIRException { 
6355      if (this.defaultValue == null)
6356        this.defaultValue = new Address();
6357      if (!(this.defaultValue instanceof Address))
6358        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6359      return (Address) this.defaultValue;
6360    }
6361
6362    public boolean hasDefaultValueAddress() { 
6363      return this != null && this.defaultValue instanceof Address;
6364    }
6365
6366    /**
6367     * @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').)
6368     */
6369    public Age getDefaultValueAge() throws FHIRException { 
6370      if (this.defaultValue == null)
6371        this.defaultValue = new Age();
6372      if (!(this.defaultValue instanceof Age))
6373        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6374      return (Age) this.defaultValue;
6375    }
6376
6377    public boolean hasDefaultValueAge() { 
6378      return this != null && this.defaultValue instanceof Age;
6379    }
6380
6381    /**
6382     * @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').)
6383     */
6384    public Annotation getDefaultValueAnnotation() throws FHIRException { 
6385      if (this.defaultValue == null)
6386        this.defaultValue = new Annotation();
6387      if (!(this.defaultValue instanceof Annotation))
6388        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6389      return (Annotation) this.defaultValue;
6390    }
6391
6392    public boolean hasDefaultValueAnnotation() { 
6393      return this != null && this.defaultValue instanceof Annotation;
6394    }
6395
6396    /**
6397     * @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').)
6398     */
6399    public Attachment getDefaultValueAttachment() throws FHIRException { 
6400      if (this.defaultValue == null)
6401        this.defaultValue = new Attachment();
6402      if (!(this.defaultValue instanceof Attachment))
6403        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6404      return (Attachment) this.defaultValue;
6405    }
6406
6407    public boolean hasDefaultValueAttachment() { 
6408      return this != null && this.defaultValue instanceof Attachment;
6409    }
6410
6411    /**
6412     * @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').)
6413     */
6414    public CodeableConcept getDefaultValueCodeableConcept() throws FHIRException { 
6415      if (this.defaultValue == null)
6416        this.defaultValue = new CodeableConcept();
6417      if (!(this.defaultValue instanceof CodeableConcept))
6418        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6419      return (CodeableConcept) this.defaultValue;
6420    }
6421
6422    public boolean hasDefaultValueCodeableConcept() { 
6423      return this != null && this.defaultValue instanceof CodeableConcept;
6424    }
6425
6426    /**
6427     * @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').)
6428     */
6429    public CodeableReference getDefaultValueCodeableReference() throws FHIRException { 
6430      if (this.defaultValue == null)
6431        this.defaultValue = new CodeableReference();
6432      if (!(this.defaultValue instanceof CodeableReference))
6433        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6434      return (CodeableReference) this.defaultValue;
6435    }
6436
6437    public boolean hasDefaultValueCodeableReference() { 
6438      return this != null && this.defaultValue instanceof CodeableReference;
6439    }
6440
6441    /**
6442     * @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').)
6443     */
6444    public Coding getDefaultValueCoding() throws FHIRException { 
6445      if (this.defaultValue == null)
6446        this.defaultValue = new Coding();
6447      if (!(this.defaultValue instanceof Coding))
6448        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6449      return (Coding) this.defaultValue;
6450    }
6451
6452    public boolean hasDefaultValueCoding() { 
6453      return this != null && this.defaultValue instanceof Coding;
6454    }
6455
6456    /**
6457     * @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').)
6458     */
6459    public ContactPoint getDefaultValueContactPoint() throws FHIRException { 
6460      if (this.defaultValue == null)
6461        this.defaultValue = new ContactPoint();
6462      if (!(this.defaultValue instanceof ContactPoint))
6463        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6464      return (ContactPoint) this.defaultValue;
6465    }
6466
6467    public boolean hasDefaultValueContactPoint() { 
6468      return this != null && this.defaultValue instanceof ContactPoint;
6469    }
6470
6471    /**
6472     * @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').)
6473     */
6474    public Count getDefaultValueCount() throws FHIRException { 
6475      if (this.defaultValue == null)
6476        this.defaultValue = new Count();
6477      if (!(this.defaultValue instanceof Count))
6478        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6479      return (Count) this.defaultValue;
6480    }
6481
6482    public boolean hasDefaultValueCount() { 
6483      return this != null && this.defaultValue instanceof Count;
6484    }
6485
6486    /**
6487     * @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').)
6488     */
6489    public Distance getDefaultValueDistance() throws FHIRException { 
6490      if (this.defaultValue == null)
6491        this.defaultValue = new Distance();
6492      if (!(this.defaultValue instanceof Distance))
6493        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6494      return (Distance) this.defaultValue;
6495    }
6496
6497    public boolean hasDefaultValueDistance() { 
6498      return this != null && this.defaultValue instanceof Distance;
6499    }
6500
6501    /**
6502     * @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').)
6503     */
6504    public Duration getDefaultValueDuration() throws FHIRException { 
6505      if (this.defaultValue == null)
6506        this.defaultValue = new Duration();
6507      if (!(this.defaultValue instanceof Duration))
6508        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6509      return (Duration) this.defaultValue;
6510    }
6511
6512    public boolean hasDefaultValueDuration() { 
6513      return this != null && this.defaultValue instanceof Duration;
6514    }
6515
6516    /**
6517     * @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').)
6518     */
6519    public HumanName getDefaultValueHumanName() throws FHIRException { 
6520      if (this.defaultValue == null)
6521        this.defaultValue = new HumanName();
6522      if (!(this.defaultValue instanceof HumanName))
6523        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6524      return (HumanName) this.defaultValue;
6525    }
6526
6527    public boolean hasDefaultValueHumanName() { 
6528      return this != null && this.defaultValue instanceof HumanName;
6529    }
6530
6531    /**
6532     * @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').)
6533     */
6534    public Identifier getDefaultValueIdentifier() throws FHIRException { 
6535      if (this.defaultValue == null)
6536        this.defaultValue = new Identifier();
6537      if (!(this.defaultValue instanceof Identifier))
6538        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6539      return (Identifier) this.defaultValue;
6540    }
6541
6542    public boolean hasDefaultValueIdentifier() { 
6543      return this != null && this.defaultValue instanceof Identifier;
6544    }
6545
6546    /**
6547     * @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').)
6548     */
6549    public Money getDefaultValueMoney() throws FHIRException { 
6550      if (this.defaultValue == null)
6551        this.defaultValue = new Money();
6552      if (!(this.defaultValue instanceof Money))
6553        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6554      return (Money) this.defaultValue;
6555    }
6556
6557    public boolean hasDefaultValueMoney() { 
6558      return this != null && this.defaultValue instanceof Money;
6559    }
6560
6561    /**
6562     * @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').)
6563     */
6564    public Period getDefaultValuePeriod() throws FHIRException { 
6565      if (this.defaultValue == null)
6566        this.defaultValue = new Period();
6567      if (!(this.defaultValue instanceof Period))
6568        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6569      return (Period) this.defaultValue;
6570    }
6571
6572    public boolean hasDefaultValuePeriod() { 
6573      return this != null && this.defaultValue instanceof Period;
6574    }
6575
6576    /**
6577     * @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').)
6578     */
6579    public Quantity getDefaultValueQuantity() throws FHIRException { 
6580      if (this.defaultValue == null)
6581        this.defaultValue = new Quantity();
6582      if (!(this.defaultValue instanceof Quantity))
6583        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6584      return (Quantity) this.defaultValue;
6585    }
6586
6587    public boolean hasDefaultValueQuantity() { 
6588      return this != null && this.defaultValue instanceof Quantity;
6589    }
6590
6591    /**
6592     * @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').)
6593     */
6594    public Range getDefaultValueRange() throws FHIRException { 
6595      if (this.defaultValue == null)
6596        this.defaultValue = new Range();
6597      if (!(this.defaultValue instanceof Range))
6598        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6599      return (Range) this.defaultValue;
6600    }
6601
6602    public boolean hasDefaultValueRange() { 
6603      return this != null && this.defaultValue instanceof Range;
6604    }
6605
6606    /**
6607     * @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').)
6608     */
6609    public Ratio getDefaultValueRatio() throws FHIRException { 
6610      if (this.defaultValue == null)
6611        this.defaultValue = new Ratio();
6612      if (!(this.defaultValue instanceof Ratio))
6613        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6614      return (Ratio) this.defaultValue;
6615    }
6616
6617    public boolean hasDefaultValueRatio() { 
6618      return this != null && this.defaultValue instanceof Ratio;
6619    }
6620
6621    /**
6622     * @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').)
6623     */
6624    public RatioRange getDefaultValueRatioRange() throws FHIRException { 
6625      if (this.defaultValue == null)
6626        this.defaultValue = new RatioRange();
6627      if (!(this.defaultValue instanceof RatioRange))
6628        throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6629      return (RatioRange) this.defaultValue;
6630    }
6631
6632    public boolean hasDefaultValueRatioRange() { 
6633      return this != null && this.defaultValue instanceof RatioRange;
6634    }
6635
6636    /**
6637     * @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').)
6638     */
6639    public Reference getDefaultValueReference() throws FHIRException { 
6640      if (this.defaultValue == null)
6641        this.defaultValue = new Reference();
6642      if (!(this.defaultValue instanceof Reference))
6643        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6644      return (Reference) this.defaultValue;
6645    }
6646
6647    public boolean hasDefaultValueReference() { 
6648      return this != null && this.defaultValue instanceof Reference;
6649    }
6650
6651    /**
6652     * @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').)
6653     */
6654    public SampledData getDefaultValueSampledData() throws FHIRException { 
6655      if (this.defaultValue == null)
6656        this.defaultValue = new SampledData();
6657      if (!(this.defaultValue instanceof SampledData))
6658        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6659      return (SampledData) this.defaultValue;
6660    }
6661
6662    public boolean hasDefaultValueSampledData() { 
6663      return this != null && this.defaultValue instanceof SampledData;
6664    }
6665
6666    /**
6667     * @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').)
6668     */
6669    public Signature getDefaultValueSignature() throws FHIRException { 
6670      if (this.defaultValue == null)
6671        this.defaultValue = new Signature();
6672      if (!(this.defaultValue instanceof Signature))
6673        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6674      return (Signature) this.defaultValue;
6675    }
6676
6677    public boolean hasDefaultValueSignature() { 
6678      return this != null && this.defaultValue instanceof Signature;
6679    }
6680
6681    /**
6682     * @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').)
6683     */
6684    public Timing getDefaultValueTiming() throws FHIRException { 
6685      if (this.defaultValue == null)
6686        this.defaultValue = new Timing();
6687      if (!(this.defaultValue instanceof Timing))
6688        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6689      return (Timing) this.defaultValue;
6690    }
6691
6692    public boolean hasDefaultValueTiming() { 
6693      return this != null && this.defaultValue instanceof Timing;
6694    }
6695
6696    /**
6697     * @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').)
6698     */
6699    public ContactDetail getDefaultValueContactDetail() throws FHIRException { 
6700      if (this.defaultValue == null)
6701        this.defaultValue = new ContactDetail();
6702      if (!(this.defaultValue instanceof ContactDetail))
6703        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6704      return (ContactDetail) this.defaultValue;
6705    }
6706
6707    public boolean hasDefaultValueContactDetail() { 
6708      return this != null && this.defaultValue instanceof ContactDetail;
6709    }
6710
6711    /**
6712     * @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').)
6713     */
6714    public Contributor getDefaultValueContributor() throws FHIRException { 
6715      if (this.defaultValue == null)
6716        this.defaultValue = new Contributor();
6717      if (!(this.defaultValue instanceof Contributor))
6718        throw new FHIRException("Type mismatch: the type Contributor was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6719      return (Contributor) this.defaultValue;
6720    }
6721
6722    public boolean hasDefaultValueContributor() { 
6723      return this != null && this.defaultValue instanceof Contributor;
6724    }
6725
6726    /**
6727     * @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').)
6728     */
6729    public DataRequirement getDefaultValueDataRequirement() throws FHIRException { 
6730      if (this.defaultValue == null)
6731        this.defaultValue = new DataRequirement();
6732      if (!(this.defaultValue instanceof DataRequirement))
6733        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6734      return (DataRequirement) this.defaultValue;
6735    }
6736
6737    public boolean hasDefaultValueDataRequirement() { 
6738      return this != null && this.defaultValue instanceof DataRequirement;
6739    }
6740
6741    /**
6742     * @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').)
6743     */
6744    public Expression getDefaultValueExpression() throws FHIRException { 
6745      if (this.defaultValue == null)
6746        this.defaultValue = new Expression();
6747      if (!(this.defaultValue instanceof Expression))
6748        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6749      return (Expression) this.defaultValue;
6750    }
6751
6752    public boolean hasDefaultValueExpression() { 
6753      return this != null && this.defaultValue instanceof Expression;
6754    }
6755
6756    /**
6757     * @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').)
6758     */
6759    public ParameterDefinition getDefaultValueParameterDefinition() throws FHIRException { 
6760      if (this.defaultValue == null)
6761        this.defaultValue = new ParameterDefinition();
6762      if (!(this.defaultValue instanceof ParameterDefinition))
6763        throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6764      return (ParameterDefinition) this.defaultValue;
6765    }
6766
6767    public boolean hasDefaultValueParameterDefinition() { 
6768      return this != null && this.defaultValue instanceof ParameterDefinition;
6769    }
6770
6771    /**
6772     * @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').)
6773     */
6774    public RelatedArtifact getDefaultValueRelatedArtifact() throws FHIRException { 
6775      if (this.defaultValue == null)
6776        this.defaultValue = new RelatedArtifact();
6777      if (!(this.defaultValue instanceof RelatedArtifact))
6778        throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6779      return (RelatedArtifact) this.defaultValue;
6780    }
6781
6782    public boolean hasDefaultValueRelatedArtifact() { 
6783      return this != null && this.defaultValue instanceof RelatedArtifact;
6784    }
6785
6786    /**
6787     * @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').)
6788     */
6789    public TriggerDefinition getDefaultValueTriggerDefinition() throws FHIRException { 
6790      if (this.defaultValue == null)
6791        this.defaultValue = new TriggerDefinition();
6792      if (!(this.defaultValue instanceof TriggerDefinition))
6793        throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6794      return (TriggerDefinition) this.defaultValue;
6795    }
6796
6797    public boolean hasDefaultValueTriggerDefinition() { 
6798      return this != null && this.defaultValue instanceof TriggerDefinition;
6799    }
6800
6801    /**
6802     * @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').)
6803     */
6804    public UsageContext getDefaultValueUsageContext() throws FHIRException { 
6805      if (this.defaultValue == null)
6806        this.defaultValue = new UsageContext();
6807      if (!(this.defaultValue instanceof UsageContext))
6808        throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6809      return (UsageContext) this.defaultValue;
6810    }
6811
6812    public boolean hasDefaultValueUsageContext() { 
6813      return this != null && this.defaultValue instanceof UsageContext;
6814    }
6815
6816    /**
6817     * @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').)
6818     */
6819    public Dosage getDefaultValueDosage() throws FHIRException { 
6820      if (this.defaultValue == null)
6821        this.defaultValue = new Dosage();
6822      if (!(this.defaultValue instanceof Dosage))
6823        throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6824      return (Dosage) this.defaultValue;
6825    }
6826
6827    public boolean hasDefaultValueDosage() { 
6828      return this != null && this.defaultValue instanceof Dosage;
6829    }
6830
6831    /**
6832     * @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').)
6833     */
6834    public Meta getDefaultValueMeta() throws FHIRException { 
6835      if (this.defaultValue == null)
6836        this.defaultValue = new Meta();
6837      if (!(this.defaultValue instanceof Meta))
6838        throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.defaultValue.getClass().getName()+" was encountered");
6839      return (Meta) this.defaultValue;
6840    }
6841
6842    public boolean hasDefaultValueMeta() { 
6843      return this != null && this.defaultValue instanceof Meta;
6844    }
6845
6846    public boolean hasDefaultValue() { 
6847      return this.defaultValue != null && !this.defaultValue.isEmpty();
6848    }
6849
6850    /**
6851     * @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').)
6852     */
6853    public ElementDefinition setDefaultValue(DataType value) { 
6854      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 Contributor || value instanceof DataRequirement || value instanceof Expression || value instanceof ParameterDefinition || value instanceof RelatedArtifact || value instanceof TriggerDefinition || value instanceof UsageContext || value instanceof Dosage || value instanceof Meta))
6855        throw new Error("Not the right type for ElementDefinition.defaultValue[x]: "+value.fhirType());
6856      this.defaultValue = value;
6857      return this;
6858    }
6859
6860    /**
6861     * @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
6862     */
6863    public MarkdownType getMeaningWhenMissingElement() { 
6864      if (this.meaningWhenMissing == null)
6865        if (Configuration.errorOnAutoCreate())
6866          throw new Error("Attempt to auto-create ElementDefinition.meaningWhenMissing");
6867        else if (Configuration.doAutoCreate())
6868          this.meaningWhenMissing = new MarkdownType(); // bb
6869      return this.meaningWhenMissing;
6870    }
6871
6872    public boolean hasMeaningWhenMissingElement() { 
6873      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
6874    }
6875
6876    public boolean hasMeaningWhenMissing() { 
6877      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
6878    }
6879
6880    /**
6881     * @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
6882     */
6883    public ElementDefinition setMeaningWhenMissingElement(MarkdownType value) { 
6884      this.meaningWhenMissing = value;
6885      return this;
6886    }
6887
6888    /**
6889     * @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').
6890     */
6891    public String getMeaningWhenMissing() { 
6892      return this.meaningWhenMissing == null ? null : this.meaningWhenMissing.getValue();
6893    }
6894
6895    /**
6896     * @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').
6897     */
6898    public ElementDefinition setMeaningWhenMissing(String value) { 
6899      if (value == null)
6900        this.meaningWhenMissing = null;
6901      else {
6902        if (this.meaningWhenMissing == null)
6903          this.meaningWhenMissing = new MarkdownType();
6904        this.meaningWhenMissing.setValue(value);
6905      }
6906      return this;
6907    }
6908
6909    /**
6910     * @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
6911     */
6912    public StringType getOrderMeaningElement() { 
6913      if (this.orderMeaning == null)
6914        if (Configuration.errorOnAutoCreate())
6915          throw new Error("Attempt to auto-create ElementDefinition.orderMeaning");
6916        else if (Configuration.doAutoCreate())
6917          this.orderMeaning = new StringType(); // bb
6918      return this.orderMeaning;
6919    }
6920
6921    public boolean hasOrderMeaningElement() { 
6922      return this.orderMeaning != null && !this.orderMeaning.isEmpty();
6923    }
6924
6925    public boolean hasOrderMeaning() { 
6926      return this.orderMeaning != null && !this.orderMeaning.isEmpty();
6927    }
6928
6929    /**
6930     * @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
6931     */
6932    public ElementDefinition setOrderMeaningElement(StringType value) { 
6933      this.orderMeaning = value;
6934      return this;
6935    }
6936
6937    /**
6938     * @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.
6939     */
6940    public String getOrderMeaning() { 
6941      return this.orderMeaning == null ? null : this.orderMeaning.getValue();
6942    }
6943
6944    /**
6945     * @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.
6946     */
6947    public ElementDefinition setOrderMeaning(String value) { 
6948      if (Utilities.noString(value))
6949        this.orderMeaning = null;
6950      else {
6951        if (this.orderMeaning == null)
6952          this.orderMeaning = new StringType();
6953        this.orderMeaning.setValue(value);
6954      }
6955      return this;
6956    }
6957
6958    /**
6959     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
6960     */
6961    public DataType getFixed() { 
6962      return this.fixed;
6963    }
6964
6965    /**
6966     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
6967     */
6968    public Base64BinaryType getFixedBase64BinaryType() throws FHIRException { 
6969      if (this.fixed == null)
6970        this.fixed = new Base64BinaryType();
6971      if (!(this.fixed instanceof Base64BinaryType))
6972        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.fixed.getClass().getName()+" was encountered");
6973      return (Base64BinaryType) this.fixed;
6974    }
6975
6976    public boolean hasFixedBase64BinaryType() { 
6977      return this != null && this.fixed instanceof Base64BinaryType;
6978    }
6979
6980    /**
6981     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
6982     */
6983    public BooleanType getFixedBooleanType() throws FHIRException { 
6984      if (this.fixed == null)
6985        this.fixed = new BooleanType();
6986      if (!(this.fixed instanceof BooleanType))
6987        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.fixed.getClass().getName()+" was encountered");
6988      return (BooleanType) this.fixed;
6989    }
6990
6991    public boolean hasFixedBooleanType() { 
6992      return this != null && this.fixed instanceof BooleanType;
6993    }
6994
6995    /**
6996     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
6997     */
6998    public CanonicalType getFixedCanonicalType() throws FHIRException { 
6999      if (this.fixed == null)
7000        this.fixed = new CanonicalType();
7001      if (!(this.fixed instanceof CanonicalType))
7002        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7003      return (CanonicalType) this.fixed;
7004    }
7005
7006    public boolean hasFixedCanonicalType() { 
7007      return this != null && this.fixed instanceof CanonicalType;
7008    }
7009
7010    /**
7011     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7012     */
7013    public CodeType getFixedCodeType() throws FHIRException { 
7014      if (this.fixed == null)
7015        this.fixed = new CodeType();
7016      if (!(this.fixed instanceof CodeType))
7017        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7018      return (CodeType) this.fixed;
7019    }
7020
7021    public boolean hasFixedCodeType() { 
7022      return this != null && this.fixed instanceof CodeType;
7023    }
7024
7025    /**
7026     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7027     */
7028    public DateType getFixedDateType() throws FHIRException { 
7029      if (this.fixed == null)
7030        this.fixed = new DateType();
7031      if (!(this.fixed instanceof DateType))
7032        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7033      return (DateType) this.fixed;
7034    }
7035
7036    public boolean hasFixedDateType() { 
7037      return this != null && this.fixed instanceof DateType;
7038    }
7039
7040    /**
7041     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7042     */
7043    public DateTimeType getFixedDateTimeType() throws FHIRException { 
7044      if (this.fixed == null)
7045        this.fixed = new DateTimeType();
7046      if (!(this.fixed instanceof DateTimeType))
7047        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7048      return (DateTimeType) this.fixed;
7049    }
7050
7051    public boolean hasFixedDateTimeType() { 
7052      return this != null && this.fixed instanceof DateTimeType;
7053    }
7054
7055    /**
7056     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7057     */
7058    public DecimalType getFixedDecimalType() throws FHIRException { 
7059      if (this.fixed == null)
7060        this.fixed = new DecimalType();
7061      if (!(this.fixed instanceof DecimalType))
7062        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7063      return (DecimalType) this.fixed;
7064    }
7065
7066    public boolean hasFixedDecimalType() { 
7067      return this != null && this.fixed instanceof DecimalType;
7068    }
7069
7070    /**
7071     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7072     */
7073    public IdType getFixedIdType() throws FHIRException { 
7074      if (this.fixed == null)
7075        this.fixed = new IdType();
7076      if (!(this.fixed instanceof IdType))
7077        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7078      return (IdType) this.fixed;
7079    }
7080
7081    public boolean hasFixedIdType() { 
7082      return this != null && this.fixed instanceof IdType;
7083    }
7084
7085    /**
7086     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7087     */
7088    public InstantType getFixedInstantType() throws FHIRException { 
7089      if (this.fixed == null)
7090        this.fixed = new InstantType();
7091      if (!(this.fixed instanceof InstantType))
7092        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7093      return (InstantType) this.fixed;
7094    }
7095
7096    public boolean hasFixedInstantType() { 
7097      return this != null && this.fixed instanceof InstantType;
7098    }
7099
7100    /**
7101     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7102     */
7103    public IntegerType getFixedIntegerType() throws FHIRException { 
7104      if (this.fixed == null)
7105        this.fixed = new IntegerType();
7106      if (!(this.fixed instanceof IntegerType))
7107        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7108      return (IntegerType) this.fixed;
7109    }
7110
7111    public boolean hasFixedIntegerType() { 
7112      return this != null && this.fixed instanceof IntegerType;
7113    }
7114
7115    /**
7116     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7117     */
7118    public Integer64Type getFixedInteger64Type() throws FHIRException { 
7119      if (this.fixed == null)
7120        this.fixed = new Integer64Type();
7121      if (!(this.fixed instanceof Integer64Type))
7122        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.fixed.getClass().getName()+" was encountered");
7123      return (Integer64Type) this.fixed;
7124    }
7125
7126    public boolean hasFixedInteger64Type() { 
7127      return this != null && this.fixed instanceof Integer64Type;
7128    }
7129
7130    /**
7131     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7132     */
7133    public MarkdownType getFixedMarkdownType() throws FHIRException { 
7134      if (this.fixed == null)
7135        this.fixed = new MarkdownType();
7136      if (!(this.fixed instanceof MarkdownType))
7137        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7138      return (MarkdownType) this.fixed;
7139    }
7140
7141    public boolean hasFixedMarkdownType() { 
7142      return this != null && this.fixed instanceof MarkdownType;
7143    }
7144
7145    /**
7146     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7147     */
7148    public OidType getFixedOidType() throws FHIRException { 
7149      if (this.fixed == null)
7150        this.fixed = new OidType();
7151      if (!(this.fixed instanceof OidType))
7152        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7153      return (OidType) this.fixed;
7154    }
7155
7156    public boolean hasFixedOidType() { 
7157      return this != null && this.fixed instanceof OidType;
7158    }
7159
7160    /**
7161     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7162     */
7163    public PositiveIntType getFixedPositiveIntType() throws FHIRException { 
7164      if (this.fixed == null)
7165        this.fixed = new PositiveIntType();
7166      if (!(this.fixed instanceof PositiveIntType))
7167        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7168      return (PositiveIntType) this.fixed;
7169    }
7170
7171    public boolean hasFixedPositiveIntType() { 
7172      return this != null && this.fixed instanceof PositiveIntType;
7173    }
7174
7175    /**
7176     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7177     */
7178    public StringType getFixedStringType() throws FHIRException { 
7179      if (this.fixed == null)
7180        this.fixed = new StringType();
7181      if (!(this.fixed instanceof StringType))
7182        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7183      return (StringType) this.fixed;
7184    }
7185
7186    public boolean hasFixedStringType() { 
7187      return this != null && this.fixed instanceof StringType;
7188    }
7189
7190    /**
7191     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7192     */
7193    public TimeType getFixedTimeType() throws FHIRException { 
7194      if (this.fixed == null)
7195        this.fixed = new TimeType();
7196      if (!(this.fixed instanceof TimeType))
7197        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7198      return (TimeType) this.fixed;
7199    }
7200
7201    public boolean hasFixedTimeType() { 
7202      return this != null && this.fixed instanceof TimeType;
7203    }
7204
7205    /**
7206     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7207     */
7208    public UnsignedIntType getFixedUnsignedIntType() throws FHIRException { 
7209      if (this.fixed == null)
7210        this.fixed = new UnsignedIntType();
7211      if (!(this.fixed instanceof UnsignedIntType))
7212        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7213      return (UnsignedIntType) this.fixed;
7214    }
7215
7216    public boolean hasFixedUnsignedIntType() { 
7217      return this != null && this.fixed instanceof UnsignedIntType;
7218    }
7219
7220    /**
7221     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7222     */
7223    public UriType getFixedUriType() throws FHIRException { 
7224      if (this.fixed == null)
7225        this.fixed = new UriType();
7226      if (!(this.fixed instanceof UriType))
7227        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7228      return (UriType) this.fixed;
7229    }
7230
7231    public boolean hasFixedUriType() { 
7232      return this != null && this.fixed instanceof UriType;
7233    }
7234
7235    /**
7236     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7237     */
7238    public UrlType getFixedUrlType() throws FHIRException { 
7239      if (this.fixed == null)
7240        this.fixed = new UrlType();
7241      if (!(this.fixed instanceof UrlType))
7242        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7243      return (UrlType) this.fixed;
7244    }
7245
7246    public boolean hasFixedUrlType() { 
7247      return this != null && this.fixed instanceof UrlType;
7248    }
7249
7250    /**
7251     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7252     */
7253    public UuidType getFixedUuidType() throws FHIRException { 
7254      if (this.fixed == null)
7255        this.fixed = new UuidType();
7256      if (!(this.fixed instanceof UuidType))
7257        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.fixed.getClass().getName()+" was encountered");
7258      return (UuidType) this.fixed;
7259    }
7260
7261    public boolean hasFixedUuidType() { 
7262      return this != null && this.fixed instanceof UuidType;
7263    }
7264
7265    /**
7266     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7267     */
7268    public Address getFixedAddress() throws FHIRException { 
7269      if (this.fixed == null)
7270        this.fixed = new Address();
7271      if (!(this.fixed instanceof Address))
7272        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.fixed.getClass().getName()+" was encountered");
7273      return (Address) this.fixed;
7274    }
7275
7276    public boolean hasFixedAddress() { 
7277      return this != null && this.fixed instanceof Address;
7278    }
7279
7280    /**
7281     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7282     */
7283    public Age getFixedAge() throws FHIRException { 
7284      if (this.fixed == null)
7285        this.fixed = new Age();
7286      if (!(this.fixed instanceof Age))
7287        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.fixed.getClass().getName()+" was encountered");
7288      return (Age) this.fixed;
7289    }
7290
7291    public boolean hasFixedAge() { 
7292      return this != null && this.fixed instanceof Age;
7293    }
7294
7295    /**
7296     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7297     */
7298    public Annotation getFixedAnnotation() throws FHIRException { 
7299      if (this.fixed == null)
7300        this.fixed = new Annotation();
7301      if (!(this.fixed instanceof Annotation))
7302        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.fixed.getClass().getName()+" was encountered");
7303      return (Annotation) this.fixed;
7304    }
7305
7306    public boolean hasFixedAnnotation() { 
7307      return this != null && this.fixed instanceof Annotation;
7308    }
7309
7310    /**
7311     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7312     */
7313    public Attachment getFixedAttachment() throws FHIRException { 
7314      if (this.fixed == null)
7315        this.fixed = new Attachment();
7316      if (!(this.fixed instanceof Attachment))
7317        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.fixed.getClass().getName()+" was encountered");
7318      return (Attachment) this.fixed;
7319    }
7320
7321    public boolean hasFixedAttachment() { 
7322      return this != null && this.fixed instanceof Attachment;
7323    }
7324
7325    /**
7326     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7327     */
7328    public CodeableConcept getFixedCodeableConcept() throws FHIRException { 
7329      if (this.fixed == null)
7330        this.fixed = new CodeableConcept();
7331      if (!(this.fixed instanceof CodeableConcept))
7332        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.fixed.getClass().getName()+" was encountered");
7333      return (CodeableConcept) this.fixed;
7334    }
7335
7336    public boolean hasFixedCodeableConcept() { 
7337      return this != null && this.fixed instanceof CodeableConcept;
7338    }
7339
7340    /**
7341     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7342     */
7343    public CodeableReference getFixedCodeableReference() throws FHIRException { 
7344      if (this.fixed == null)
7345        this.fixed = new CodeableReference();
7346      if (!(this.fixed instanceof CodeableReference))
7347        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.fixed.getClass().getName()+" was encountered");
7348      return (CodeableReference) this.fixed;
7349    }
7350
7351    public boolean hasFixedCodeableReference() { 
7352      return this != null && this.fixed instanceof CodeableReference;
7353    }
7354
7355    /**
7356     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7357     */
7358    public Coding getFixedCoding() throws FHIRException { 
7359      if (this.fixed == null)
7360        this.fixed = new Coding();
7361      if (!(this.fixed instanceof Coding))
7362        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.fixed.getClass().getName()+" was encountered");
7363      return (Coding) this.fixed;
7364    }
7365
7366    public boolean hasFixedCoding() { 
7367      return this != null && this.fixed instanceof Coding;
7368    }
7369
7370    /**
7371     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7372     */
7373    public ContactPoint getFixedContactPoint() throws FHIRException { 
7374      if (this.fixed == null)
7375        this.fixed = new ContactPoint();
7376      if (!(this.fixed instanceof ContactPoint))
7377        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.fixed.getClass().getName()+" was encountered");
7378      return (ContactPoint) this.fixed;
7379    }
7380
7381    public boolean hasFixedContactPoint() { 
7382      return this != null && this.fixed instanceof ContactPoint;
7383    }
7384
7385    /**
7386     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7387     */
7388    public Count getFixedCount() throws FHIRException { 
7389      if (this.fixed == null)
7390        this.fixed = new Count();
7391      if (!(this.fixed instanceof Count))
7392        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.fixed.getClass().getName()+" was encountered");
7393      return (Count) this.fixed;
7394    }
7395
7396    public boolean hasFixedCount() { 
7397      return this != null && this.fixed instanceof Count;
7398    }
7399
7400    /**
7401     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7402     */
7403    public Distance getFixedDistance() throws FHIRException { 
7404      if (this.fixed == null)
7405        this.fixed = new Distance();
7406      if (!(this.fixed instanceof Distance))
7407        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.fixed.getClass().getName()+" was encountered");
7408      return (Distance) this.fixed;
7409    }
7410
7411    public boolean hasFixedDistance() { 
7412      return this != null && this.fixed instanceof Distance;
7413    }
7414
7415    /**
7416     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7417     */
7418    public Duration getFixedDuration() throws FHIRException { 
7419      if (this.fixed == null)
7420        this.fixed = new Duration();
7421      if (!(this.fixed instanceof Duration))
7422        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.fixed.getClass().getName()+" was encountered");
7423      return (Duration) this.fixed;
7424    }
7425
7426    public boolean hasFixedDuration() { 
7427      return this != null && this.fixed instanceof Duration;
7428    }
7429
7430    /**
7431     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7432     */
7433    public HumanName getFixedHumanName() throws FHIRException { 
7434      if (this.fixed == null)
7435        this.fixed = new HumanName();
7436      if (!(this.fixed instanceof HumanName))
7437        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.fixed.getClass().getName()+" was encountered");
7438      return (HumanName) this.fixed;
7439    }
7440
7441    public boolean hasFixedHumanName() { 
7442      return this != null && this.fixed instanceof HumanName;
7443    }
7444
7445    /**
7446     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7447     */
7448    public Identifier getFixedIdentifier() throws FHIRException { 
7449      if (this.fixed == null)
7450        this.fixed = new Identifier();
7451      if (!(this.fixed instanceof Identifier))
7452        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.fixed.getClass().getName()+" was encountered");
7453      return (Identifier) this.fixed;
7454    }
7455
7456    public boolean hasFixedIdentifier() { 
7457      return this != null && this.fixed instanceof Identifier;
7458    }
7459
7460    /**
7461     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7462     */
7463    public Money getFixedMoney() throws FHIRException { 
7464      if (this.fixed == null)
7465        this.fixed = new Money();
7466      if (!(this.fixed instanceof Money))
7467        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.fixed.getClass().getName()+" was encountered");
7468      return (Money) this.fixed;
7469    }
7470
7471    public boolean hasFixedMoney() { 
7472      return this != null && this.fixed instanceof Money;
7473    }
7474
7475    /**
7476     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7477     */
7478    public Period getFixedPeriod() throws FHIRException { 
7479      if (this.fixed == null)
7480        this.fixed = new Period();
7481      if (!(this.fixed instanceof Period))
7482        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.fixed.getClass().getName()+" was encountered");
7483      return (Period) this.fixed;
7484    }
7485
7486    public boolean hasFixedPeriod() { 
7487      return this != null && this.fixed instanceof Period;
7488    }
7489
7490    /**
7491     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7492     */
7493    public Quantity getFixedQuantity() throws FHIRException { 
7494      if (this.fixed == null)
7495        this.fixed = new Quantity();
7496      if (!(this.fixed instanceof Quantity))
7497        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.fixed.getClass().getName()+" was encountered");
7498      return (Quantity) this.fixed;
7499    }
7500
7501    public boolean hasFixedQuantity() { 
7502      return this != null && this.fixed instanceof Quantity;
7503    }
7504
7505    /**
7506     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7507     */
7508    public Range getFixedRange() throws FHIRException { 
7509      if (this.fixed == null)
7510        this.fixed = new Range();
7511      if (!(this.fixed instanceof Range))
7512        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.fixed.getClass().getName()+" was encountered");
7513      return (Range) this.fixed;
7514    }
7515
7516    public boolean hasFixedRange() { 
7517      return this != null && this.fixed instanceof Range;
7518    }
7519
7520    /**
7521     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7522     */
7523    public Ratio getFixedRatio() throws FHIRException { 
7524      if (this.fixed == null)
7525        this.fixed = new Ratio();
7526      if (!(this.fixed instanceof Ratio))
7527        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.fixed.getClass().getName()+" was encountered");
7528      return (Ratio) this.fixed;
7529    }
7530
7531    public boolean hasFixedRatio() { 
7532      return this != null && this.fixed instanceof Ratio;
7533    }
7534
7535    /**
7536     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7537     */
7538    public RatioRange getFixedRatioRange() throws FHIRException { 
7539      if (this.fixed == null)
7540        this.fixed = new RatioRange();
7541      if (!(this.fixed instanceof RatioRange))
7542        throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.fixed.getClass().getName()+" was encountered");
7543      return (RatioRange) this.fixed;
7544    }
7545
7546    public boolean hasFixedRatioRange() { 
7547      return this != null && this.fixed instanceof RatioRange;
7548    }
7549
7550    /**
7551     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7552     */
7553    public Reference getFixedReference() throws FHIRException { 
7554      if (this.fixed == null)
7555        this.fixed = new Reference();
7556      if (!(this.fixed instanceof Reference))
7557        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.fixed.getClass().getName()+" was encountered");
7558      return (Reference) this.fixed;
7559    }
7560
7561    public boolean hasFixedReference() { 
7562      return this != null && this.fixed instanceof Reference;
7563    }
7564
7565    /**
7566     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7567     */
7568    public SampledData getFixedSampledData() throws FHIRException { 
7569      if (this.fixed == null)
7570        this.fixed = new SampledData();
7571      if (!(this.fixed instanceof SampledData))
7572        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.fixed.getClass().getName()+" was encountered");
7573      return (SampledData) this.fixed;
7574    }
7575
7576    public boolean hasFixedSampledData() { 
7577      return this != null && this.fixed instanceof SampledData;
7578    }
7579
7580    /**
7581     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7582     */
7583    public Signature getFixedSignature() throws FHIRException { 
7584      if (this.fixed == null)
7585        this.fixed = new Signature();
7586      if (!(this.fixed instanceof Signature))
7587        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.fixed.getClass().getName()+" was encountered");
7588      return (Signature) this.fixed;
7589    }
7590
7591    public boolean hasFixedSignature() { 
7592      return this != null && this.fixed instanceof Signature;
7593    }
7594
7595    /**
7596     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7597     */
7598    public Timing getFixedTiming() throws FHIRException { 
7599      if (this.fixed == null)
7600        this.fixed = new Timing();
7601      if (!(this.fixed instanceof Timing))
7602        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.fixed.getClass().getName()+" was encountered");
7603      return (Timing) this.fixed;
7604    }
7605
7606    public boolean hasFixedTiming() { 
7607      return this != null && this.fixed instanceof Timing;
7608    }
7609
7610    /**
7611     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7612     */
7613    public ContactDetail getFixedContactDetail() throws FHIRException { 
7614      if (this.fixed == null)
7615        this.fixed = new ContactDetail();
7616      if (!(this.fixed instanceof ContactDetail))
7617        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.fixed.getClass().getName()+" was encountered");
7618      return (ContactDetail) this.fixed;
7619    }
7620
7621    public boolean hasFixedContactDetail() { 
7622      return this != null && this.fixed instanceof ContactDetail;
7623    }
7624
7625    /**
7626     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7627     */
7628    public Contributor getFixedContributor() throws FHIRException { 
7629      if (this.fixed == null)
7630        this.fixed = new Contributor();
7631      if (!(this.fixed instanceof Contributor))
7632        throw new FHIRException("Type mismatch: the type Contributor was expected, but "+this.fixed.getClass().getName()+" was encountered");
7633      return (Contributor) this.fixed;
7634    }
7635
7636    public boolean hasFixedContributor() { 
7637      return this != null && this.fixed instanceof Contributor;
7638    }
7639
7640    /**
7641     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7642     */
7643    public DataRequirement getFixedDataRequirement() throws FHIRException { 
7644      if (this.fixed == null)
7645        this.fixed = new DataRequirement();
7646      if (!(this.fixed instanceof DataRequirement))
7647        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.fixed.getClass().getName()+" was encountered");
7648      return (DataRequirement) this.fixed;
7649    }
7650
7651    public boolean hasFixedDataRequirement() { 
7652      return this != null && this.fixed instanceof DataRequirement;
7653    }
7654
7655    /**
7656     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7657     */
7658    public Expression getFixedExpression() throws FHIRException { 
7659      if (this.fixed == null)
7660        this.fixed = new Expression();
7661      if (!(this.fixed instanceof Expression))
7662        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.fixed.getClass().getName()+" was encountered");
7663      return (Expression) this.fixed;
7664    }
7665
7666    public boolean hasFixedExpression() { 
7667      return this != null && this.fixed instanceof Expression;
7668    }
7669
7670    /**
7671     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7672     */
7673    public ParameterDefinition getFixedParameterDefinition() throws FHIRException { 
7674      if (this.fixed == null)
7675        this.fixed = new ParameterDefinition();
7676      if (!(this.fixed instanceof ParameterDefinition))
7677        throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.fixed.getClass().getName()+" was encountered");
7678      return (ParameterDefinition) this.fixed;
7679    }
7680
7681    public boolean hasFixedParameterDefinition() { 
7682      return this != null && this.fixed instanceof ParameterDefinition;
7683    }
7684
7685    /**
7686     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7687     */
7688    public RelatedArtifact getFixedRelatedArtifact() throws FHIRException { 
7689      if (this.fixed == null)
7690        this.fixed = new RelatedArtifact();
7691      if (!(this.fixed instanceof RelatedArtifact))
7692        throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.fixed.getClass().getName()+" was encountered");
7693      return (RelatedArtifact) this.fixed;
7694    }
7695
7696    public boolean hasFixedRelatedArtifact() { 
7697      return this != null && this.fixed instanceof RelatedArtifact;
7698    }
7699
7700    /**
7701     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7702     */
7703    public TriggerDefinition getFixedTriggerDefinition() throws FHIRException { 
7704      if (this.fixed == null)
7705        this.fixed = new TriggerDefinition();
7706      if (!(this.fixed instanceof TriggerDefinition))
7707        throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.fixed.getClass().getName()+" was encountered");
7708      return (TriggerDefinition) this.fixed;
7709    }
7710
7711    public boolean hasFixedTriggerDefinition() { 
7712      return this != null && this.fixed instanceof TriggerDefinition;
7713    }
7714
7715    /**
7716     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7717     */
7718    public UsageContext getFixedUsageContext() throws FHIRException { 
7719      if (this.fixed == null)
7720        this.fixed = new UsageContext();
7721      if (!(this.fixed instanceof UsageContext))
7722        throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.fixed.getClass().getName()+" was encountered");
7723      return (UsageContext) this.fixed;
7724    }
7725
7726    public boolean hasFixedUsageContext() { 
7727      return this != null && this.fixed instanceof UsageContext;
7728    }
7729
7730    /**
7731     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7732     */
7733    public Dosage getFixedDosage() throws FHIRException { 
7734      if (this.fixed == null)
7735        this.fixed = new Dosage();
7736      if (!(this.fixed instanceof Dosage))
7737        throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.fixed.getClass().getName()+" was encountered");
7738      return (Dosage) this.fixed;
7739    }
7740
7741    public boolean hasFixedDosage() { 
7742      return this != null && this.fixed instanceof Dosage;
7743    }
7744
7745    /**
7746     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7747     */
7748    public Meta getFixedMeta() throws FHIRException { 
7749      if (this.fixed == null)
7750        this.fixed = new Meta();
7751      if (!(this.fixed instanceof Meta))
7752        throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.fixed.getClass().getName()+" was encountered");
7753      return (Meta) this.fixed;
7754    }
7755
7756    public boolean hasFixedMeta() { 
7757      return this != null && this.fixed instanceof Meta;
7758    }
7759
7760    public boolean hasFixed() { 
7761      return this.fixed != null && !this.fixed.isEmpty();
7762    }
7763
7764    /**
7765     * @param value {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. 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.)
7766     */
7767    public ElementDefinition setFixed(DataType value) { 
7768      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 Contributor || value instanceof DataRequirement || value instanceof Expression || value instanceof ParameterDefinition || value instanceof RelatedArtifact || value instanceof TriggerDefinition || value instanceof UsageContext || value instanceof Dosage || value instanceof Meta))
7769        throw new Error("Not the right type for ElementDefinition.fixed[x]: "+value.fhirType());
7770      this.fixed = value;
7771      return this;
7772    }
7773
7774    /**
7775     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7776
7777When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7778
7779When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7780
7781When 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.,
7782
77831. If primitive: it must match exactly the pattern value
77842. If a complex object: it must match (recursively) the pattern value
77853. If an array: it must match (recursively) the pattern value.)
7786     */
7787    public DataType getPattern() { 
7788      return this.pattern;
7789    }
7790
7791    /**
7792     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7793
7794When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7795
7796When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7797
7798When 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.,
7799
78001. If primitive: it must match exactly the pattern value
78012. If a complex object: it must match (recursively) the pattern value
78023. If an array: it must match (recursively) the pattern value.)
7803     */
7804    public Base64BinaryType getPatternBase64BinaryType() throws FHIRException { 
7805      if (this.pattern == null)
7806        this.pattern = new Base64BinaryType();
7807      if (!(this.pattern instanceof Base64BinaryType))
7808        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.pattern.getClass().getName()+" was encountered");
7809      return (Base64BinaryType) this.pattern;
7810    }
7811
7812    public boolean hasPatternBase64BinaryType() { 
7813      return this != null && this.pattern instanceof Base64BinaryType;
7814    }
7815
7816    /**
7817     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7818
7819When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7820
7821When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7822
7823When 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.,
7824
78251. If primitive: it must match exactly the pattern value
78262. If a complex object: it must match (recursively) the pattern value
78273. If an array: it must match (recursively) the pattern value.)
7828     */
7829    public BooleanType getPatternBooleanType() throws FHIRException { 
7830      if (this.pattern == null)
7831        this.pattern = new BooleanType();
7832      if (!(this.pattern instanceof BooleanType))
7833        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.pattern.getClass().getName()+" was encountered");
7834      return (BooleanType) this.pattern;
7835    }
7836
7837    public boolean hasPatternBooleanType() { 
7838      return this != null && this.pattern instanceof BooleanType;
7839    }
7840
7841    /**
7842     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7843
7844When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7845
7846When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7847
7848When 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.,
7849
78501. If primitive: it must match exactly the pattern value
78512. If a complex object: it must match (recursively) the pattern value
78523. If an array: it must match (recursively) the pattern value.)
7853     */
7854    public CanonicalType getPatternCanonicalType() throws FHIRException { 
7855      if (this.pattern == null)
7856        this.pattern = new CanonicalType();
7857      if (!(this.pattern instanceof CanonicalType))
7858        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.pattern.getClass().getName()+" was encountered");
7859      return (CanonicalType) this.pattern;
7860    }
7861
7862    public boolean hasPatternCanonicalType() { 
7863      return this != null && this.pattern instanceof CanonicalType;
7864    }
7865
7866    /**
7867     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7868
7869When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7870
7871When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7872
7873When 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.,
7874
78751. If primitive: it must match exactly the pattern value
78762. If a complex object: it must match (recursively) the pattern value
78773. If an array: it must match (recursively) the pattern value.)
7878     */
7879    public CodeType getPatternCodeType() throws FHIRException { 
7880      if (this.pattern == null)
7881        this.pattern = new CodeType();
7882      if (!(this.pattern instanceof CodeType))
7883        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.pattern.getClass().getName()+" was encountered");
7884      return (CodeType) this.pattern;
7885    }
7886
7887    public boolean hasPatternCodeType() { 
7888      return this != null && this.pattern instanceof CodeType;
7889    }
7890
7891    /**
7892     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7893
7894When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7895
7896When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7897
7898When 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.,
7899
79001. If primitive: it must match exactly the pattern value
79012. If a complex object: it must match (recursively) the pattern value
79023. If an array: it must match (recursively) the pattern value.)
7903     */
7904    public DateType getPatternDateType() throws FHIRException { 
7905      if (this.pattern == null)
7906        this.pattern = new DateType();
7907      if (!(this.pattern instanceof DateType))
7908        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.pattern.getClass().getName()+" was encountered");
7909      return (DateType) this.pattern;
7910    }
7911
7912    public boolean hasPatternDateType() { 
7913      return this != null && this.pattern instanceof DateType;
7914    }
7915
7916    /**
7917     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7918
7919When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7920
7921When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7922
7923When 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.,
7924
79251. If primitive: it must match exactly the pattern value
79262. If a complex object: it must match (recursively) the pattern value
79273. If an array: it must match (recursively) the pattern value.)
7928     */
7929    public DateTimeType getPatternDateTimeType() throws FHIRException { 
7930      if (this.pattern == null)
7931        this.pattern = new DateTimeType();
7932      if (!(this.pattern instanceof DateTimeType))
7933        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.pattern.getClass().getName()+" was encountered");
7934      return (DateTimeType) this.pattern;
7935    }
7936
7937    public boolean hasPatternDateTimeType() { 
7938      return this != null && this.pattern instanceof DateTimeType;
7939    }
7940
7941    /**
7942     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7943
7944When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7945
7946When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7947
7948When 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.,
7949
79501. If primitive: it must match exactly the pattern value
79512. If a complex object: it must match (recursively) the pattern value
79523. If an array: it must match (recursively) the pattern value.)
7953     */
7954    public DecimalType getPatternDecimalType() throws FHIRException { 
7955      if (this.pattern == null)
7956        this.pattern = new DecimalType();
7957      if (!(this.pattern instanceof DecimalType))
7958        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.pattern.getClass().getName()+" was encountered");
7959      return (DecimalType) this.pattern;
7960    }
7961
7962    public boolean hasPatternDecimalType() { 
7963      return this != null && this.pattern instanceof DecimalType;
7964    }
7965
7966    /**
7967     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7968
7969When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7970
7971When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7972
7973When 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.,
7974
79751. If primitive: it must match exactly the pattern value
79762. If a complex object: it must match (recursively) the pattern value
79773. If an array: it must match (recursively) the pattern value.)
7978     */
7979    public IdType getPatternIdType() throws FHIRException { 
7980      if (this.pattern == null)
7981        this.pattern = new IdType();
7982      if (!(this.pattern instanceof IdType))
7983        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.pattern.getClass().getName()+" was encountered");
7984      return (IdType) this.pattern;
7985    }
7986
7987    public boolean hasPatternIdType() { 
7988      return this != null && this.pattern instanceof IdType;
7989    }
7990
7991    /**
7992     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
7993
7994When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
7995
7996When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
7997
7998When 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.,
7999
80001. If primitive: it must match exactly the pattern value
80012. If a complex object: it must match (recursively) the pattern value
80023. If an array: it must match (recursively) the pattern value.)
8003     */
8004    public InstantType getPatternInstantType() throws FHIRException { 
8005      if (this.pattern == null)
8006        this.pattern = new InstantType();
8007      if (!(this.pattern instanceof InstantType))
8008        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8009      return (InstantType) this.pattern;
8010    }
8011
8012    public boolean hasPatternInstantType() { 
8013      return this != null && this.pattern instanceof InstantType;
8014    }
8015
8016    /**
8017     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8018
8019When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8020
8021When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8022
8023When 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.,
8024
80251. If primitive: it must match exactly the pattern value
80262. If a complex object: it must match (recursively) the pattern value
80273. If an array: it must match (recursively) the pattern value.)
8028     */
8029    public IntegerType getPatternIntegerType() throws FHIRException { 
8030      if (this.pattern == null)
8031        this.pattern = new IntegerType();
8032      if (!(this.pattern instanceof IntegerType))
8033        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8034      return (IntegerType) this.pattern;
8035    }
8036
8037    public boolean hasPatternIntegerType() { 
8038      return this != null && this.pattern instanceof IntegerType;
8039    }
8040
8041    /**
8042     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8043
8044When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8045
8046When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8047
8048When 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.,
8049
80501. If primitive: it must match exactly the pattern value
80512. If a complex object: it must match (recursively) the pattern value
80523. If an array: it must match (recursively) the pattern value.)
8053     */
8054    public Integer64Type getPatternInteger64Type() throws FHIRException { 
8055      if (this.pattern == null)
8056        this.pattern = new Integer64Type();
8057      if (!(this.pattern instanceof Integer64Type))
8058        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.pattern.getClass().getName()+" was encountered");
8059      return (Integer64Type) this.pattern;
8060    }
8061
8062    public boolean hasPatternInteger64Type() { 
8063      return this != null && this.pattern instanceof Integer64Type;
8064    }
8065
8066    /**
8067     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8068
8069When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8070
8071When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8072
8073When 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.,
8074
80751. If primitive: it must match exactly the pattern value
80762. If a complex object: it must match (recursively) the pattern value
80773. If an array: it must match (recursively) the pattern value.)
8078     */
8079    public MarkdownType getPatternMarkdownType() throws FHIRException { 
8080      if (this.pattern == null)
8081        this.pattern = new MarkdownType();
8082      if (!(this.pattern instanceof MarkdownType))
8083        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8084      return (MarkdownType) this.pattern;
8085    }
8086
8087    public boolean hasPatternMarkdownType() { 
8088      return this != null && this.pattern instanceof MarkdownType;
8089    }
8090
8091    /**
8092     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8093
8094When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8095
8096When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8097
8098When 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.,
8099
81001. If primitive: it must match exactly the pattern value
81012. If a complex object: it must match (recursively) the pattern value
81023. If an array: it must match (recursively) the pattern value.)
8103     */
8104    public OidType getPatternOidType() throws FHIRException { 
8105      if (this.pattern == null)
8106        this.pattern = new OidType();
8107      if (!(this.pattern instanceof OidType))
8108        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8109      return (OidType) this.pattern;
8110    }
8111
8112    public boolean hasPatternOidType() { 
8113      return this != null && this.pattern instanceof OidType;
8114    }
8115
8116    /**
8117     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8118
8119When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8120
8121When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8122
8123When 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.,
8124
81251. If primitive: it must match exactly the pattern value
81262. If a complex object: it must match (recursively) the pattern value
81273. If an array: it must match (recursively) the pattern value.)
8128     */
8129    public PositiveIntType getPatternPositiveIntType() throws FHIRException { 
8130      if (this.pattern == null)
8131        this.pattern = new PositiveIntType();
8132      if (!(this.pattern instanceof PositiveIntType))
8133        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8134      return (PositiveIntType) this.pattern;
8135    }
8136
8137    public boolean hasPatternPositiveIntType() { 
8138      return this != null && this.pattern instanceof PositiveIntType;
8139    }
8140
8141    /**
8142     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8143
8144When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8145
8146When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8147
8148When 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.,
8149
81501. If primitive: it must match exactly the pattern value
81512. If a complex object: it must match (recursively) the pattern value
81523. If an array: it must match (recursively) the pattern value.)
8153     */
8154    public StringType getPatternStringType() throws FHIRException { 
8155      if (this.pattern == null)
8156        this.pattern = new StringType();
8157      if (!(this.pattern instanceof StringType))
8158        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8159      return (StringType) this.pattern;
8160    }
8161
8162    public boolean hasPatternStringType() { 
8163      return this != null && this.pattern instanceof StringType;
8164    }
8165
8166    /**
8167     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8168
8169When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8170
8171When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8172
8173When 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.,
8174
81751. If primitive: it must match exactly the pattern value
81762. If a complex object: it must match (recursively) the pattern value
81773. If an array: it must match (recursively) the pattern value.)
8178     */
8179    public TimeType getPatternTimeType() throws FHIRException { 
8180      if (this.pattern == null)
8181        this.pattern = new TimeType();
8182      if (!(this.pattern instanceof TimeType))
8183        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8184      return (TimeType) this.pattern;
8185    }
8186
8187    public boolean hasPatternTimeType() { 
8188      return this != null && this.pattern instanceof TimeType;
8189    }
8190
8191    /**
8192     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8193
8194When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8195
8196When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8197
8198When 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.,
8199
82001. If primitive: it must match exactly the pattern value
82012. If a complex object: it must match (recursively) the pattern value
82023. If an array: it must match (recursively) the pattern value.)
8203     */
8204    public UnsignedIntType getPatternUnsignedIntType() throws FHIRException { 
8205      if (this.pattern == null)
8206        this.pattern = new UnsignedIntType();
8207      if (!(this.pattern instanceof UnsignedIntType))
8208        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8209      return (UnsignedIntType) this.pattern;
8210    }
8211
8212    public boolean hasPatternUnsignedIntType() { 
8213      return this != null && this.pattern instanceof UnsignedIntType;
8214    }
8215
8216    /**
8217     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8218
8219When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8220
8221When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8222
8223When 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.,
8224
82251. If primitive: it must match exactly the pattern value
82262. If a complex object: it must match (recursively) the pattern value
82273. If an array: it must match (recursively) the pattern value.)
8228     */
8229    public UriType getPatternUriType() throws FHIRException { 
8230      if (this.pattern == null)
8231        this.pattern = new UriType();
8232      if (!(this.pattern instanceof UriType))
8233        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8234      return (UriType) this.pattern;
8235    }
8236
8237    public boolean hasPatternUriType() { 
8238      return this != null && this.pattern instanceof UriType;
8239    }
8240
8241    /**
8242     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8243
8244When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8245
8246When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8247
8248When 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.,
8249
82501. If primitive: it must match exactly the pattern value
82512. If a complex object: it must match (recursively) the pattern value
82523. If an array: it must match (recursively) the pattern value.)
8253     */
8254    public UrlType getPatternUrlType() throws FHIRException { 
8255      if (this.pattern == null)
8256        this.pattern = new UrlType();
8257      if (!(this.pattern instanceof UrlType))
8258        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8259      return (UrlType) this.pattern;
8260    }
8261
8262    public boolean hasPatternUrlType() { 
8263      return this != null && this.pattern instanceof UrlType;
8264    }
8265
8266    /**
8267     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8268
8269When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8270
8271When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8272
8273When 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.,
8274
82751. If primitive: it must match exactly the pattern value
82762. If a complex object: it must match (recursively) the pattern value
82773. If an array: it must match (recursively) the pattern value.)
8278     */
8279    public UuidType getPatternUuidType() throws FHIRException { 
8280      if (this.pattern == null)
8281        this.pattern = new UuidType();
8282      if (!(this.pattern instanceof UuidType))
8283        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.pattern.getClass().getName()+" was encountered");
8284      return (UuidType) this.pattern;
8285    }
8286
8287    public boolean hasPatternUuidType() { 
8288      return this != null && this.pattern instanceof UuidType;
8289    }
8290
8291    /**
8292     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8293
8294When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8295
8296When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8297
8298When 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.,
8299
83001. If primitive: it must match exactly the pattern value
83012. If a complex object: it must match (recursively) the pattern value
83023. If an array: it must match (recursively) the pattern value.)
8303     */
8304    public Address getPatternAddress() throws FHIRException { 
8305      if (this.pattern == null)
8306        this.pattern = new Address();
8307      if (!(this.pattern instanceof Address))
8308        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.pattern.getClass().getName()+" was encountered");
8309      return (Address) this.pattern;
8310    }
8311
8312    public boolean hasPatternAddress() { 
8313      return this != null && this.pattern instanceof Address;
8314    }
8315
8316    /**
8317     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8318
8319When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8320
8321When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8322
8323When 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.,
8324
83251. If primitive: it must match exactly the pattern value
83262. If a complex object: it must match (recursively) the pattern value
83273. If an array: it must match (recursively) the pattern value.)
8328     */
8329    public Age getPatternAge() throws FHIRException { 
8330      if (this.pattern == null)
8331        this.pattern = new Age();
8332      if (!(this.pattern instanceof Age))
8333        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.pattern.getClass().getName()+" was encountered");
8334      return (Age) this.pattern;
8335    }
8336
8337    public boolean hasPatternAge() { 
8338      return this != null && this.pattern instanceof Age;
8339    }
8340
8341    /**
8342     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8343
8344When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8345
8346When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8347
8348When 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.,
8349
83501. If primitive: it must match exactly the pattern value
83512. If a complex object: it must match (recursively) the pattern value
83523. If an array: it must match (recursively) the pattern value.)
8353     */
8354    public Annotation getPatternAnnotation() throws FHIRException { 
8355      if (this.pattern == null)
8356        this.pattern = new Annotation();
8357      if (!(this.pattern instanceof Annotation))
8358        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.pattern.getClass().getName()+" was encountered");
8359      return (Annotation) this.pattern;
8360    }
8361
8362    public boolean hasPatternAnnotation() { 
8363      return this != null && this.pattern instanceof Annotation;
8364    }
8365
8366    /**
8367     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8368
8369When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8370
8371When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8372
8373When 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.,
8374
83751. If primitive: it must match exactly the pattern value
83762. If a complex object: it must match (recursively) the pattern value
83773. If an array: it must match (recursively) the pattern value.)
8378     */
8379    public Attachment getPatternAttachment() throws FHIRException { 
8380      if (this.pattern == null)
8381        this.pattern = new Attachment();
8382      if (!(this.pattern instanceof Attachment))
8383        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.pattern.getClass().getName()+" was encountered");
8384      return (Attachment) this.pattern;
8385    }
8386
8387    public boolean hasPatternAttachment() { 
8388      return this != null && this.pattern instanceof Attachment;
8389    }
8390
8391    /**
8392     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8393
8394When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8395
8396When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8397
8398When 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.,
8399
84001. If primitive: it must match exactly the pattern value
84012. If a complex object: it must match (recursively) the pattern value
84023. If an array: it must match (recursively) the pattern value.)
8403     */
8404    public CodeableConcept getPatternCodeableConcept() throws FHIRException { 
8405      if (this.pattern == null)
8406        this.pattern = new CodeableConcept();
8407      if (!(this.pattern instanceof CodeableConcept))
8408        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.pattern.getClass().getName()+" was encountered");
8409      return (CodeableConcept) this.pattern;
8410    }
8411
8412    public boolean hasPatternCodeableConcept() { 
8413      return this != null && this.pattern instanceof CodeableConcept;
8414    }
8415
8416    /**
8417     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8418
8419When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8420
8421When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8422
8423When 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.,
8424
84251. If primitive: it must match exactly the pattern value
84262. If a complex object: it must match (recursively) the pattern value
84273. If an array: it must match (recursively) the pattern value.)
8428     */
8429    public CodeableReference getPatternCodeableReference() throws FHIRException { 
8430      if (this.pattern == null)
8431        this.pattern = new CodeableReference();
8432      if (!(this.pattern instanceof CodeableReference))
8433        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.pattern.getClass().getName()+" was encountered");
8434      return (CodeableReference) this.pattern;
8435    }
8436
8437    public boolean hasPatternCodeableReference() { 
8438      return this != null && this.pattern instanceof CodeableReference;
8439    }
8440
8441    /**
8442     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8443
8444When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8445
8446When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8447
8448When 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.,
8449
84501. If primitive: it must match exactly the pattern value
84512. If a complex object: it must match (recursively) the pattern value
84523. If an array: it must match (recursively) the pattern value.)
8453     */
8454    public Coding getPatternCoding() throws FHIRException { 
8455      if (this.pattern == null)
8456        this.pattern = new Coding();
8457      if (!(this.pattern instanceof Coding))
8458        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.pattern.getClass().getName()+" was encountered");
8459      return (Coding) this.pattern;
8460    }
8461
8462    public boolean hasPatternCoding() { 
8463      return this != null && this.pattern instanceof Coding;
8464    }
8465
8466    /**
8467     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8468
8469When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8470
8471When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8472
8473When 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.,
8474
84751. If primitive: it must match exactly the pattern value
84762. If a complex object: it must match (recursively) the pattern value
84773. If an array: it must match (recursively) the pattern value.)
8478     */
8479    public ContactPoint getPatternContactPoint() throws FHIRException { 
8480      if (this.pattern == null)
8481        this.pattern = new ContactPoint();
8482      if (!(this.pattern instanceof ContactPoint))
8483        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.pattern.getClass().getName()+" was encountered");
8484      return (ContactPoint) this.pattern;
8485    }
8486
8487    public boolean hasPatternContactPoint() { 
8488      return this != null && this.pattern instanceof ContactPoint;
8489    }
8490
8491    /**
8492     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8493
8494When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8495
8496When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8497
8498When 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.,
8499
85001. If primitive: it must match exactly the pattern value
85012. If a complex object: it must match (recursively) the pattern value
85023. If an array: it must match (recursively) the pattern value.)
8503     */
8504    public Count getPatternCount() throws FHIRException { 
8505      if (this.pattern == null)
8506        this.pattern = new Count();
8507      if (!(this.pattern instanceof Count))
8508        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.pattern.getClass().getName()+" was encountered");
8509      return (Count) this.pattern;
8510    }
8511
8512    public boolean hasPatternCount() { 
8513      return this != null && this.pattern instanceof Count;
8514    }
8515
8516    /**
8517     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8518
8519When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8520
8521When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8522
8523When 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.,
8524
85251. If primitive: it must match exactly the pattern value
85262. If a complex object: it must match (recursively) the pattern value
85273. If an array: it must match (recursively) the pattern value.)
8528     */
8529    public Distance getPatternDistance() throws FHIRException { 
8530      if (this.pattern == null)
8531        this.pattern = new Distance();
8532      if (!(this.pattern instanceof Distance))
8533        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.pattern.getClass().getName()+" was encountered");
8534      return (Distance) this.pattern;
8535    }
8536
8537    public boolean hasPatternDistance() { 
8538      return this != null && this.pattern instanceof Distance;
8539    }
8540
8541    /**
8542     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8543
8544When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8545
8546When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8547
8548When 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.,
8549
85501. If primitive: it must match exactly the pattern value
85512. If a complex object: it must match (recursively) the pattern value
85523. If an array: it must match (recursively) the pattern value.)
8553     */
8554    public Duration getPatternDuration() throws FHIRException { 
8555      if (this.pattern == null)
8556        this.pattern = new Duration();
8557      if (!(this.pattern instanceof Duration))
8558        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.pattern.getClass().getName()+" was encountered");
8559      return (Duration) this.pattern;
8560    }
8561
8562    public boolean hasPatternDuration() { 
8563      return this != null && this.pattern instanceof Duration;
8564    }
8565
8566    /**
8567     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8568
8569When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8570
8571When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8572
8573When 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.,
8574
85751. If primitive: it must match exactly the pattern value
85762. If a complex object: it must match (recursively) the pattern value
85773. If an array: it must match (recursively) the pattern value.)
8578     */
8579    public HumanName getPatternHumanName() throws FHIRException { 
8580      if (this.pattern == null)
8581        this.pattern = new HumanName();
8582      if (!(this.pattern instanceof HumanName))
8583        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.pattern.getClass().getName()+" was encountered");
8584      return (HumanName) this.pattern;
8585    }
8586
8587    public boolean hasPatternHumanName() { 
8588      return this != null && this.pattern instanceof HumanName;
8589    }
8590
8591    /**
8592     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8593
8594When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8595
8596When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8597
8598When 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.,
8599
86001. If primitive: it must match exactly the pattern value
86012. If a complex object: it must match (recursively) the pattern value
86023. If an array: it must match (recursively) the pattern value.)
8603     */
8604    public Identifier getPatternIdentifier() throws FHIRException { 
8605      if (this.pattern == null)
8606        this.pattern = new Identifier();
8607      if (!(this.pattern instanceof Identifier))
8608        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.pattern.getClass().getName()+" was encountered");
8609      return (Identifier) this.pattern;
8610    }
8611
8612    public boolean hasPatternIdentifier() { 
8613      return this != null && this.pattern instanceof Identifier;
8614    }
8615
8616    /**
8617     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8618
8619When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8620
8621When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8622
8623When 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.,
8624
86251. If primitive: it must match exactly the pattern value
86262. If a complex object: it must match (recursively) the pattern value
86273. If an array: it must match (recursively) the pattern value.)
8628     */
8629    public Money getPatternMoney() throws FHIRException { 
8630      if (this.pattern == null)
8631        this.pattern = new Money();
8632      if (!(this.pattern instanceof Money))
8633        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.pattern.getClass().getName()+" was encountered");
8634      return (Money) this.pattern;
8635    }
8636
8637    public boolean hasPatternMoney() { 
8638      return this != null && this.pattern instanceof Money;
8639    }
8640
8641    /**
8642     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8643
8644When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8645
8646When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8647
8648When 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.,
8649
86501. If primitive: it must match exactly the pattern value
86512. If a complex object: it must match (recursively) the pattern value
86523. If an array: it must match (recursively) the pattern value.)
8653     */
8654    public Period getPatternPeriod() throws FHIRException { 
8655      if (this.pattern == null)
8656        this.pattern = new Period();
8657      if (!(this.pattern instanceof Period))
8658        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.pattern.getClass().getName()+" was encountered");
8659      return (Period) this.pattern;
8660    }
8661
8662    public boolean hasPatternPeriod() { 
8663      return this != null && this.pattern instanceof Period;
8664    }
8665
8666    /**
8667     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8668
8669When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8670
8671When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8672
8673When 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.,
8674
86751. If primitive: it must match exactly the pattern value
86762. If a complex object: it must match (recursively) the pattern value
86773. If an array: it must match (recursively) the pattern value.)
8678     */
8679    public Quantity getPatternQuantity() throws FHIRException { 
8680      if (this.pattern == null)
8681        this.pattern = new Quantity();
8682      if (!(this.pattern instanceof Quantity))
8683        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.pattern.getClass().getName()+" was encountered");
8684      return (Quantity) this.pattern;
8685    }
8686
8687    public boolean hasPatternQuantity() { 
8688      return this != null && this.pattern instanceof Quantity;
8689    }
8690
8691    /**
8692     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  
8693
8694When pattern[x] is used to constrain a primitive, it means that the value provided in the pattern[x] must match the instance value exactly.
8695
8696When pattern[x] is used to constrain an array, it means that each element provided in the pattern[x] array must (recursively) match at least one element from the instance array.
8697
8698When 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.,
8699
87001. If primitive: it must match exactly the pattern value
87012. If a complex object: it must match (recursively) the pattern value
87023. If an array: it must match (recursively) the pattern value.)
8703     */
8704    public Range getPatternRange() throws FHIRException { 
8705