001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.ChildOrder;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.DatatypeDef;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * Captures constraints on each element within the resource, profile, or extension.
047 */
048@DatatypeDef(name="ElementDefinition")
049public class ElementDefinition extends Type implements ICompositeType {
050
051    public enum PropertyRepresentation {
052        /**
053         * In XML, this property is represented as an attribute not an element.
054         */
055        XMLATTR, 
056        /**
057         * This element is represented using the XML text attribute (primitives only)
058         */
059        XMLTEXT, 
060        /**
061         * The type of this element is indicated using xsi:type
062         */
063        TYPEATTR, 
064        /**
065         * Use CDA narrative instead of XHTML
066         */
067        CDATEXT, 
068        /**
069         * The property is represented using XHTML
070         */
071        XHTML, 
072        /**
073         * added to help the parsers with the generic types
074         */
075        NULL;
076        public static PropertyRepresentation fromCode(String codeString) throws FHIRException {
077            if (codeString == null || "".equals(codeString))
078                return null;
079        if ("xmlAttr".equals(codeString))
080          return XMLATTR;
081        if ("xmlText".equals(codeString))
082          return XMLTEXT;
083        if ("typeAttr".equals(codeString))
084          return TYPEATTR;
085        if ("cdaText".equals(codeString))
086          return CDATEXT;
087        if ("xhtml".equals(codeString))
088          return XHTML;
089        if (Configuration.isAcceptInvalidEnums())
090          return null;
091        else
092          throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
093        }
094        public String toCode() {
095          switch (this) {
096            case XMLATTR: return "xmlAttr";
097            case XMLTEXT: return "xmlText";
098            case TYPEATTR: return "typeAttr";
099            case CDATEXT: return "cdaText";
100            case XHTML: return "xhtml";
101            default: return "?";
102          }
103        }
104        public String getSystem() {
105          switch (this) {
106            case XMLATTR: return "http://hl7.org/fhir/property-representation";
107            case XMLTEXT: return "http://hl7.org/fhir/property-representation";
108            case TYPEATTR: return "http://hl7.org/fhir/property-representation";
109            case CDATEXT: return "http://hl7.org/fhir/property-representation";
110            case XHTML: return "http://hl7.org/fhir/property-representation";
111            default: return "?";
112          }
113        }
114        public String getDefinition() {
115          switch (this) {
116            case XMLATTR: return "In XML, this property is represented as an attribute not an element.";
117            case XMLTEXT: return "This element is represented using the XML text attribute (primitives only)";
118            case TYPEATTR: return "The type of this element is indicated using xsi:type";
119            case CDATEXT: return "Use CDA narrative instead of XHTML";
120            case XHTML: return "The property is represented using XHTML";
121            default: return "?";
122          }
123        }
124        public String getDisplay() {
125          switch (this) {
126            case XMLATTR: return "XML Attribute";
127            case XMLTEXT: return "XML Text";
128            case TYPEATTR: return "Type Attribute";
129            case CDATEXT: return "CDA Text Format";
130            case XHTML: return "XHTML";
131            default: return "?";
132          }
133        }
134    }
135
136  public static class PropertyRepresentationEnumFactory implements EnumFactory<PropertyRepresentation> {
137    public PropertyRepresentation fromCode(String codeString) throws IllegalArgumentException {
138      if (codeString == null || "".equals(codeString))
139            if (codeString == null || "".equals(codeString))
140                return null;
141        if ("xmlAttr".equals(codeString))
142          return PropertyRepresentation.XMLATTR;
143        if ("xmlText".equals(codeString))
144          return PropertyRepresentation.XMLTEXT;
145        if ("typeAttr".equals(codeString))
146          return PropertyRepresentation.TYPEATTR;
147        if ("cdaText".equals(codeString))
148          return PropertyRepresentation.CDATEXT;
149        if ("xhtml".equals(codeString))
150          return PropertyRepresentation.XHTML;
151        throw new IllegalArgumentException("Unknown PropertyRepresentation code '"+codeString+"'");
152        }
153        public Enumeration<PropertyRepresentation> fromType(Base code) throws FHIRException {
154          if (code == null)
155            return null;
156          if (code.isEmpty())
157            return new Enumeration<PropertyRepresentation>(this);
158          String codeString = ((PrimitiveType) code).asStringValue();
159          if (codeString == null || "".equals(codeString))
160            return null;
161        if ("xmlAttr".equals(codeString))
162          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLATTR);
163        if ("xmlText".equals(codeString))
164          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLTEXT);
165        if ("typeAttr".equals(codeString))
166          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.TYPEATTR);
167        if ("cdaText".equals(codeString))
168          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.CDATEXT);
169        if ("xhtml".equals(codeString))
170          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XHTML);
171        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
172        }
173    public String toCode(PropertyRepresentation code) {
174      if (code == PropertyRepresentation.XMLATTR)
175        return "xmlAttr";
176      if (code == PropertyRepresentation.XMLTEXT)
177        return "xmlText";
178      if (code == PropertyRepresentation.TYPEATTR)
179        return "typeAttr";
180      if (code == PropertyRepresentation.CDATEXT)
181        return "cdaText";
182      if (code == PropertyRepresentation.XHTML)
183        return "xhtml";
184      return "?";
185      }
186    public String toSystem(PropertyRepresentation code) {
187      return code.getSystem();
188      }
189    }
190
191    public enum DiscriminatorType {
192        /**
193         * The slices have different values in the nominated element
194         */
195        VALUE, 
196        /**
197         * The slices are differentiated by the presence or absence of the nominated element
198         */
199        EXISTS, 
200        /**
201         * The slices have different values in the nominated element, as determined by testing them against the applicable ElementDefinition.pattern[x]
202         */
203        PATTERN, 
204        /**
205         * The slices are differentiated by type of the nominated element to a specifed profile
206         */
207        TYPE, 
208        /**
209         * The slices are differentiated by conformance of the nominated element to a specifed profile
210         */
211        PROFILE, 
212        /**
213         * added to help the parsers with the generic types
214         */
215        NULL;
216        public static DiscriminatorType fromCode(String codeString) throws FHIRException {
217            if (codeString == null || "".equals(codeString))
218                return null;
219        if ("value".equals(codeString))
220          return VALUE;
221        if ("exists".equals(codeString))
222          return EXISTS;
223        if ("pattern".equals(codeString))
224          return PATTERN;
225        if ("type".equals(codeString))
226          return TYPE;
227        if ("profile".equals(codeString))
228          return PROFILE;
229        if (Configuration.isAcceptInvalidEnums())
230          return null;
231        else
232          throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
233        }
234        public String toCode() {
235          switch (this) {
236            case VALUE: return "value";
237            case EXISTS: return "exists";
238            case PATTERN: return "pattern";
239            case TYPE: return "type";
240            case PROFILE: return "profile";
241            default: return "?";
242          }
243        }
244        public String getSystem() {
245          switch (this) {
246            case VALUE: return "http://hl7.org/fhir/discriminator-type";
247            case EXISTS: return "http://hl7.org/fhir/discriminator-type";
248            case PATTERN: return "http://hl7.org/fhir/discriminator-type";
249            case TYPE: return "http://hl7.org/fhir/discriminator-type";
250            case PROFILE: return "http://hl7.org/fhir/discriminator-type";
251            default: return "?";
252          }
253        }
254        public String getDefinition() {
255          switch (this) {
256            case VALUE: return "The slices have different values in the nominated element";
257            case EXISTS: return "The slices are differentiated by the presence or absence of the nominated element";
258            case PATTERN: return "The slices have different values in the nominated element, as determined by testing them against the applicable ElementDefinition.pattern[x]";
259            case TYPE: return "The slices are differentiated by type of the nominated element to a specifed profile";
260            case PROFILE: return "The slices are differentiated by conformance of the nominated element to a specifed profile";
261            default: return "?";
262          }
263        }
264        public String getDisplay() {
265          switch (this) {
266            case VALUE: return "Value";
267            case EXISTS: return "Exists";
268            case PATTERN: return "Pattern";
269            case TYPE: return "Type";
270            case PROFILE: return "Profile";
271            default: return "?";
272          }
273        }
274    }
275
276  public static class DiscriminatorTypeEnumFactory implements EnumFactory<DiscriminatorType> {
277    public DiscriminatorType fromCode(String codeString) throws IllegalArgumentException {
278      if (codeString == null || "".equals(codeString))
279            if (codeString == null || "".equals(codeString))
280                return null;
281        if ("value".equals(codeString))
282          return DiscriminatorType.VALUE;
283        if ("exists".equals(codeString))
284          return DiscriminatorType.EXISTS;
285        if ("pattern".equals(codeString))
286          return DiscriminatorType.PATTERN;
287        if ("type".equals(codeString))
288          return DiscriminatorType.TYPE;
289        if ("profile".equals(codeString))
290          return DiscriminatorType.PROFILE;
291        throw new IllegalArgumentException("Unknown DiscriminatorType code '"+codeString+"'");
292        }
293        public Enumeration<DiscriminatorType> fromType(Base code) throws FHIRException {
294          if (code == null)
295            return null;
296          if (code.isEmpty())
297            return new Enumeration<DiscriminatorType>(this);
298          String codeString = ((PrimitiveType) code).asStringValue();
299          if (codeString == null || "".equals(codeString))
300            return null;
301        if ("value".equals(codeString))
302          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.VALUE);
303        if ("exists".equals(codeString))
304          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.EXISTS);
305        if ("pattern".equals(codeString))
306          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.PATTERN);
307        if ("type".equals(codeString))
308          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.TYPE);
309        if ("profile".equals(codeString))
310          return new Enumeration<DiscriminatorType>(this, DiscriminatorType.PROFILE);
311        throw new FHIRException("Unknown DiscriminatorType code '"+codeString+"'");
312        }
313    public String toCode(DiscriminatorType code) {
314      if (code == DiscriminatorType.VALUE)
315        return "value";
316      if (code == DiscriminatorType.EXISTS)
317        return "exists";
318      if (code == DiscriminatorType.PATTERN)
319        return "pattern";
320      if (code == DiscriminatorType.TYPE)
321        return "type";
322      if (code == DiscriminatorType.PROFILE)
323        return "profile";
324      return "?";
325      }
326    public String toSystem(DiscriminatorType code) {
327      return code.getSystem();
328      }
329    }
330
331    public enum SlicingRules {
332        /**
333         * No additional content is allowed other than that described by the slices in this profile.
334         */
335        CLOSED, 
336        /**
337         * Additional content is allowed anywhere in the list.
338         */
339        OPEN, 
340        /**
341         * 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.
342         */
343        OPENATEND, 
344        /**
345         * added to help the parsers with the generic types
346         */
347        NULL;
348        public static SlicingRules fromCode(String codeString) throws FHIRException {
349            if (codeString == null || "".equals(codeString))
350                return null;
351        if ("closed".equals(codeString))
352          return CLOSED;
353        if ("open".equals(codeString))
354          return OPEN;
355        if ("openAtEnd".equals(codeString))
356          return OPENATEND;
357        if (Configuration.isAcceptInvalidEnums())
358          return null;
359        else
360          throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
361        }
362        public String toCode() {
363          switch (this) {
364            case CLOSED: return "closed";
365            case OPEN: return "open";
366            case OPENATEND: return "openAtEnd";
367            default: return "?";
368          }
369        }
370        public String getSystem() {
371          switch (this) {
372            case CLOSED: return "http://hl7.org/fhir/resource-slicing-rules";
373            case OPEN: return "http://hl7.org/fhir/resource-slicing-rules";
374            case OPENATEND: return "http://hl7.org/fhir/resource-slicing-rules";
375            default: return "?";
376          }
377        }
378        public String getDefinition() {
379          switch (this) {
380            case CLOSED: return "No additional content is allowed other than that described by the slices in this profile.";
381            case OPEN: return "Additional content is allowed anywhere in the list.";
382            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.";
383            default: return "?";
384          }
385        }
386        public String getDisplay() {
387          switch (this) {
388            case CLOSED: return "Closed";
389            case OPEN: return "Open";
390            case OPENATEND: return "Open at End";
391            default: return "?";
392          }
393        }
394    }
395
396  public static class SlicingRulesEnumFactory implements EnumFactory<SlicingRules> {
397    public SlicingRules fromCode(String codeString) throws IllegalArgumentException {
398      if (codeString == null || "".equals(codeString))
399            if (codeString == null || "".equals(codeString))
400                return null;
401        if ("closed".equals(codeString))
402          return SlicingRules.CLOSED;
403        if ("open".equals(codeString))
404          return SlicingRules.OPEN;
405        if ("openAtEnd".equals(codeString))
406          return SlicingRules.OPENATEND;
407        throw new IllegalArgumentException("Unknown SlicingRules code '"+codeString+"'");
408        }
409        public Enumeration<SlicingRules> fromType(Base code) throws FHIRException {
410          if (code == null)
411            return null;
412          if (code.isEmpty())
413            return new Enumeration<SlicingRules>(this);
414          String codeString = ((PrimitiveType) code).asStringValue();
415          if (codeString == null || "".equals(codeString))
416            return null;
417        if ("closed".equals(codeString))
418          return new Enumeration<SlicingRules>(this, SlicingRules.CLOSED);
419        if ("open".equals(codeString))
420          return new Enumeration<SlicingRules>(this, SlicingRules.OPEN);
421        if ("openAtEnd".equals(codeString))
422          return new Enumeration<SlicingRules>(this, SlicingRules.OPENATEND);
423        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
424        }
425    public String toCode(SlicingRules code) {
426      if (code == SlicingRules.CLOSED)
427        return "closed";
428      if (code == SlicingRules.OPEN)
429        return "open";
430      if (code == SlicingRules.OPENATEND)
431        return "openAtEnd";
432      return "?";
433      }
434    public String toSystem(SlicingRules code) {
435      return code.getSystem();
436      }
437    }
438
439    public enum AggregationMode {
440        /**
441         * The reference is a local reference to a contained resource.
442         */
443        CONTAINED, 
444        /**
445         * The reference to a resource that has to be resolved externally to the resource that includes the reference.
446         */
447        REFERENCED, 
448        /**
449         * The resource the reference points to will be found in the same bundle as the resource that includes the reference.
450         */
451        BUNDLED, 
452        /**
453         * added to help the parsers with the generic types
454         */
455        NULL;
456        public static AggregationMode fromCode(String codeString) throws FHIRException {
457            if (codeString == null || "".equals(codeString))
458                return null;
459        if ("contained".equals(codeString))
460          return CONTAINED;
461        if ("referenced".equals(codeString))
462          return REFERENCED;
463        if ("bundled".equals(codeString))
464          return BUNDLED;
465        if (Configuration.isAcceptInvalidEnums())
466          return null;
467        else
468          throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
469        }
470        public String toCode() {
471          switch (this) {
472            case CONTAINED: return "contained";
473            case REFERENCED: return "referenced";
474            case BUNDLED: return "bundled";
475            default: return "?";
476          }
477        }
478        public String getSystem() {
479          switch (this) {
480            case CONTAINED: return "http://hl7.org/fhir/resource-aggregation-mode";
481            case REFERENCED: return "http://hl7.org/fhir/resource-aggregation-mode";
482            case BUNDLED: return "http://hl7.org/fhir/resource-aggregation-mode";
483            default: return "?";
484          }
485        }
486        public String getDefinition() {
487          switch (this) {
488            case CONTAINED: return "The reference is a local reference to a contained resource.";
489            case REFERENCED: return "The reference to a resource that has to be resolved externally to the resource that includes the reference.";
490            case BUNDLED: return "The resource the reference points to will be found in the same bundle as the resource that includes the reference.";
491            default: return "?";
492          }
493        }
494        public String getDisplay() {
495          switch (this) {
496            case CONTAINED: return "Contained";
497            case REFERENCED: return "Referenced";
498            case BUNDLED: return "Bundled";
499            default: return "?";
500          }
501        }
502    }
503
504  public static class AggregationModeEnumFactory implements EnumFactory<AggregationMode> {
505    public AggregationMode fromCode(String codeString) throws IllegalArgumentException {
506      if (codeString == null || "".equals(codeString))
507            if (codeString == null || "".equals(codeString))
508                return null;
509        if ("contained".equals(codeString))
510          return AggregationMode.CONTAINED;
511        if ("referenced".equals(codeString))
512          return AggregationMode.REFERENCED;
513        if ("bundled".equals(codeString))
514          return AggregationMode.BUNDLED;
515        throw new IllegalArgumentException("Unknown AggregationMode code '"+codeString+"'");
516        }
517        public Enumeration<AggregationMode> fromType(Base code) throws FHIRException {
518          if (code == null)
519            return null;
520          if (code.isEmpty())
521            return new Enumeration<AggregationMode>(this);
522          String codeString = ((PrimitiveType) code).asStringValue();
523          if (codeString == null || "".equals(codeString))
524            return null;
525        if ("contained".equals(codeString))
526          return new Enumeration<AggregationMode>(this, AggregationMode.CONTAINED);
527        if ("referenced".equals(codeString))
528          return new Enumeration<AggregationMode>(this, AggregationMode.REFERENCED);
529        if ("bundled".equals(codeString))
530          return new Enumeration<AggregationMode>(this, AggregationMode.BUNDLED);
531        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
532        }
533    public String toCode(AggregationMode code) {
534      if (code == AggregationMode.CONTAINED)
535        return "contained";
536      if (code == AggregationMode.REFERENCED)
537        return "referenced";
538      if (code == AggregationMode.BUNDLED)
539        return "bundled";
540      return "?";
541      }
542    public String toSystem(AggregationMode code) {
543      return code.getSystem();
544      }
545    }
546
547    public enum ReferenceVersionRules {
548        /**
549         * The reference may be either version independent or version specific
550         */
551        EITHER, 
552        /**
553         * The reference must be version independent
554         */
555        INDEPENDENT, 
556        /**
557         * The reference must be version specific
558         */
559        SPECIFIC, 
560        /**
561         * added to help the parsers with the generic types
562         */
563        NULL;
564        public static ReferenceVersionRules fromCode(String codeString) throws FHIRException {
565            if (codeString == null || "".equals(codeString))
566                return null;
567        if ("either".equals(codeString))
568          return EITHER;
569        if ("independent".equals(codeString))
570          return INDEPENDENT;
571        if ("specific".equals(codeString))
572          return SPECIFIC;
573        if (Configuration.isAcceptInvalidEnums())
574          return null;
575        else
576          throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
577        }
578        public String toCode() {
579          switch (this) {
580            case EITHER: return "either";
581            case INDEPENDENT: return "independent";
582            case SPECIFIC: return "specific";
583            default: return "?";
584          }
585        }
586        public String getSystem() {
587          switch (this) {
588            case EITHER: return "http://hl7.org/fhir/reference-version-rules";
589            case INDEPENDENT: return "http://hl7.org/fhir/reference-version-rules";
590            case SPECIFIC: return "http://hl7.org/fhir/reference-version-rules";
591            default: return "?";
592          }
593        }
594        public String getDefinition() {
595          switch (this) {
596            case EITHER: return "The reference may be either version independent or version specific";
597            case INDEPENDENT: return "The reference must be version independent";
598            case SPECIFIC: return "The reference must be version specific";
599            default: return "?";
600          }
601        }
602        public String getDisplay() {
603          switch (this) {
604            case EITHER: return "Either Specific or independent";
605            case INDEPENDENT: return "Version independent";
606            case SPECIFIC: return "Version Specific";
607            default: return "?";
608          }
609        }
610    }
611
612  public static class ReferenceVersionRulesEnumFactory implements EnumFactory<ReferenceVersionRules> {
613    public ReferenceVersionRules fromCode(String codeString) throws IllegalArgumentException {
614      if (codeString == null || "".equals(codeString))
615            if (codeString == null || "".equals(codeString))
616                return null;
617        if ("either".equals(codeString))
618          return ReferenceVersionRules.EITHER;
619        if ("independent".equals(codeString))
620          return ReferenceVersionRules.INDEPENDENT;
621        if ("specific".equals(codeString))
622          return ReferenceVersionRules.SPECIFIC;
623        throw new IllegalArgumentException("Unknown ReferenceVersionRules code '"+codeString+"'");
624        }
625        public Enumeration<ReferenceVersionRules> fromType(Base code) throws FHIRException {
626          if (code == null)
627            return null;
628          if (code.isEmpty())
629            return new Enumeration<ReferenceVersionRules>(this);
630          String codeString = ((PrimitiveType) code).asStringValue();
631          if (codeString == null || "".equals(codeString))
632            return null;
633        if ("either".equals(codeString))
634          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.EITHER);
635        if ("independent".equals(codeString))
636          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.INDEPENDENT);
637        if ("specific".equals(codeString))
638          return new Enumeration<ReferenceVersionRules>(this, ReferenceVersionRules.SPECIFIC);
639        throw new FHIRException("Unknown ReferenceVersionRules code '"+codeString+"'");
640        }
641    public String toCode(ReferenceVersionRules code) {
642      if (code == ReferenceVersionRules.EITHER)
643        return "either";
644      if (code == ReferenceVersionRules.INDEPENDENT)
645        return "independent";
646      if (code == ReferenceVersionRules.SPECIFIC)
647        return "specific";
648      return "?";
649      }
650    public String toSystem(ReferenceVersionRules code) {
651      return code.getSystem();
652      }
653    }
654
655    public enum ConstraintSeverity {
656        /**
657         * If the constraint is violated, the resource is not conformant.
658         */
659        ERROR, 
660        /**
661         * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.
662         */
663        WARNING, 
664        /**
665         * added to help the parsers with the generic types
666         */
667        NULL;
668        public static ConstraintSeverity fromCode(String codeString) throws FHIRException {
669            if (codeString == null || "".equals(codeString))
670                return null;
671        if ("error".equals(codeString))
672          return ERROR;
673        if ("warning".equals(codeString))
674          return WARNING;
675        if (Configuration.isAcceptInvalidEnums())
676          return null;
677        else
678          throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
679        }
680        public String toCode() {
681          switch (this) {
682            case ERROR: return "error";
683            case WARNING: return "warning";
684            default: return "?";
685          }
686        }
687        public String getSystem() {
688          switch (this) {
689            case ERROR: return "http://hl7.org/fhir/constraint-severity";
690            case WARNING: return "http://hl7.org/fhir/constraint-severity";
691            default: return "?";
692          }
693        }
694        public String getDefinition() {
695          switch (this) {
696            case ERROR: return "If the constraint is violated, the resource is not conformant.";
697            case WARNING: return "If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.";
698            default: return "?";
699          }
700        }
701        public String getDisplay() {
702          switch (this) {
703            case ERROR: return "Error";
704            case WARNING: return "Warning";
705            default: return "?";
706          }
707        }
708    }
709
710  public static class ConstraintSeverityEnumFactory implements EnumFactory<ConstraintSeverity> {
711    public ConstraintSeverity fromCode(String codeString) throws IllegalArgumentException {
712      if (codeString == null || "".equals(codeString))
713            if (codeString == null || "".equals(codeString))
714                return null;
715        if ("error".equals(codeString))
716          return ConstraintSeverity.ERROR;
717        if ("warning".equals(codeString))
718          return ConstraintSeverity.WARNING;
719        throw new IllegalArgumentException("Unknown ConstraintSeverity code '"+codeString+"'");
720        }
721        public Enumeration<ConstraintSeverity> fromType(Base code) throws FHIRException {
722          if (code == null)
723            return null;
724          if (code.isEmpty())
725            return new Enumeration<ConstraintSeverity>(this);
726          String codeString = ((PrimitiveType) code).asStringValue();
727          if (codeString == null || "".equals(codeString))
728            return null;
729        if ("error".equals(codeString))
730          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.ERROR);
731        if ("warning".equals(codeString))
732          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.WARNING);
733        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
734        }
735    public String toCode(ConstraintSeverity code) {
736      if (code == ConstraintSeverity.ERROR)
737        return "error";
738      if (code == ConstraintSeverity.WARNING)
739        return "warning";
740      return "?";
741      }
742    public String toSystem(ConstraintSeverity code) {
743      return code.getSystem();
744      }
745    }
746
747    @Block()
748    public static class ElementDefinitionSlicingComponent extends Element implements IBaseDatatypeElement {
749        /**
750         * 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.
751         */
752        @Child(name = "discriminator", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
753        @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." )
754        protected List<ElementDefinitionSlicingDiscriminatorComponent> discriminator;
755
756        /**
757         * 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.
758         */
759        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
760        @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." )
761        protected StringType description;
762
763        /**
764         * If the matching elements have to occur in the same order as defined in the profile.
765         */
766        @Child(name = "ordered", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
767        @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." )
768        protected BooleanType ordered;
769
770        /**
771         * 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.
772         */
773        @Child(name = "rules", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
774        @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." )
775        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-slicing-rules")
776        protected Enumeration<SlicingRules> rules;
777
778        private static final long serialVersionUID = -311635839L;
779
780    /**
781     * Constructor
782     */
783      public ElementDefinitionSlicingComponent() {
784        super();
785      }
786
787    /**
788     * Constructor
789     */
790      public ElementDefinitionSlicingComponent(Enumeration<SlicingRules> rules) {
791        super();
792        this.rules = rules;
793      }
794
795        /**
796         * @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.)
797         */
798        public List<ElementDefinitionSlicingDiscriminatorComponent> getDiscriminator() { 
799          if (this.discriminator == null)
800            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
801          return this.discriminator;
802        }
803
804        /**
805         * @return Returns a reference to <code>this</code> for easy method chaining
806         */
807        public ElementDefinitionSlicingComponent setDiscriminator(List<ElementDefinitionSlicingDiscriminatorComponent> theDiscriminator) { 
808          this.discriminator = theDiscriminator;
809          return this;
810        }
811
812        public boolean hasDiscriminator() { 
813          if (this.discriminator == null)
814            return false;
815          for (ElementDefinitionSlicingDiscriminatorComponent item : this.discriminator)
816            if (!item.isEmpty())
817              return true;
818          return false;
819        }
820
821        public ElementDefinitionSlicingDiscriminatorComponent addDiscriminator() { //3
822          ElementDefinitionSlicingDiscriminatorComponent t = new ElementDefinitionSlicingDiscriminatorComponent();
823          if (this.discriminator == null)
824            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
825          this.discriminator.add(t);
826          return t;
827        }
828
829        public ElementDefinitionSlicingComponent addDiscriminator(ElementDefinitionSlicingDiscriminatorComponent t) { //3
830          if (t == null)
831            return this;
832          if (this.discriminator == null)
833            this.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
834          this.discriminator.add(t);
835          return this;
836        }
837
838        /**
839         * @return The first repetition of repeating field {@link #discriminator}, creating it if it does not already exist
840         */
841        public ElementDefinitionSlicingDiscriminatorComponent getDiscriminatorFirstRep() { 
842          if (getDiscriminator().isEmpty()) {
843            addDiscriminator();
844          }
845          return getDiscriminator().get(0);
846        }
847
848        /**
849         * @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
850         */
851        public StringType getDescriptionElement() { 
852          if (this.description == null)
853            if (Configuration.errorOnAutoCreate())
854              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.description");
855            else if (Configuration.doAutoCreate())
856              this.description = new StringType(); // bb
857          return this.description;
858        }
859
860        public boolean hasDescriptionElement() { 
861          return this.description != null && !this.description.isEmpty();
862        }
863
864        public boolean hasDescription() { 
865          return this.description != null && !this.description.isEmpty();
866        }
867
868        /**
869         * @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
870         */
871        public ElementDefinitionSlicingComponent setDescriptionElement(StringType value) { 
872          this.description = value;
873          return this;
874        }
875
876        /**
877         * @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.
878         */
879        public String getDescription() { 
880          return this.description == null ? null : this.description.getValue();
881        }
882
883        /**
884         * @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.
885         */
886        public ElementDefinitionSlicingComponent setDescription(String value) { 
887          if (Utilities.noString(value))
888            this.description = null;
889          else {
890            if (this.description == null)
891              this.description = new StringType();
892            this.description.setValue(value);
893          }
894          return this;
895        }
896
897        /**
898         * @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
899         */
900        public BooleanType getOrderedElement() { 
901          if (this.ordered == null)
902            if (Configuration.errorOnAutoCreate())
903              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.ordered");
904            else if (Configuration.doAutoCreate())
905              this.ordered = new BooleanType(); // bb
906          return this.ordered;
907        }
908
909        public boolean hasOrderedElement() { 
910          return this.ordered != null && !this.ordered.isEmpty();
911        }
912
913        public boolean hasOrdered() { 
914          return this.ordered != null && !this.ordered.isEmpty();
915        }
916
917        /**
918         * @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
919         */
920        public ElementDefinitionSlicingComponent setOrderedElement(BooleanType value) { 
921          this.ordered = value;
922          return this;
923        }
924
925        /**
926         * @return If the matching elements have to occur in the same order as defined in the profile.
927         */
928        public boolean getOrdered() { 
929          return this.ordered == null || this.ordered.isEmpty() ? false : this.ordered.getValue();
930        }
931
932        /**
933         * @param value If the matching elements have to occur in the same order as defined in the profile.
934         */
935        public ElementDefinitionSlicingComponent setOrdered(boolean value) { 
936            if (this.ordered == null)
937              this.ordered = new BooleanType();
938            this.ordered.setValue(value);
939          return this;
940        }
941
942        /**
943         * @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
944         */
945        public Enumeration<SlicingRules> getRulesElement() { 
946          if (this.rules == null)
947            if (Configuration.errorOnAutoCreate())
948              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.rules");
949            else if (Configuration.doAutoCreate())
950              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory()); // bb
951          return this.rules;
952        }
953
954        public boolean hasRulesElement() { 
955          return this.rules != null && !this.rules.isEmpty();
956        }
957
958        public boolean hasRules() { 
959          return this.rules != null && !this.rules.isEmpty();
960        }
961
962        /**
963         * @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
964         */
965        public ElementDefinitionSlicingComponent setRulesElement(Enumeration<SlicingRules> value) { 
966          this.rules = value;
967          return this;
968        }
969
970        /**
971         * @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.
972         */
973        public SlicingRules getRules() { 
974          return this.rules == null ? null : this.rules.getValue();
975        }
976
977        /**
978         * @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.
979         */
980        public ElementDefinitionSlicingComponent setRules(SlicingRules value) { 
981            if (this.rules == null)
982              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory());
983            this.rules.setValue(value);
984          return this;
985        }
986
987        protected void listChildren(List<Property> childrenList) {
988          super.listChildren(childrenList);
989          childrenList.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));
990          childrenList.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, java.lang.Integer.MAX_VALUE, description));
991          childrenList.add(new Property("ordered", "boolean", "If the matching elements have to occur in the same order as defined in the profile.", 0, java.lang.Integer.MAX_VALUE, ordered));
992          childrenList.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, java.lang.Integer.MAX_VALUE, rules));
993        }
994
995      @Override
996      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
997        switch (hash) {
998        case -1888270692: /*discriminator*/ return this.discriminator == null ? new Base[0] : this.discriminator.toArray(new Base[this.discriminator.size()]); // ElementDefinitionSlicingDiscriminatorComponent
999        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1000        case -1207109523: /*ordered*/ return this.ordered == null ? new Base[0] : new Base[] {this.ordered}; // BooleanType
1001        case 108873975: /*rules*/ return this.rules == null ? new Base[0] : new Base[] {this.rules}; // Enumeration<SlicingRules>
1002        default: return super.getProperty(hash, name, checkValid);
1003        }
1004
1005      }
1006
1007      @Override
1008      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1009        switch (hash) {
1010        case -1888270692: // discriminator
1011          this.getDiscriminator().add((ElementDefinitionSlicingDiscriminatorComponent) value); // ElementDefinitionSlicingDiscriminatorComponent
1012          return value;
1013        case -1724546052: // description
1014          this.description = castToString(value); // StringType
1015          return value;
1016        case -1207109523: // ordered
1017          this.ordered = castToBoolean(value); // BooleanType
1018          return value;
1019        case 108873975: // rules
1020          value = new SlicingRulesEnumFactory().fromType(castToCode(value));
1021          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1022          return value;
1023        default: return super.setProperty(hash, name, value);
1024        }
1025
1026      }
1027
1028      @Override
1029      public Base setProperty(String name, Base value) throws FHIRException {
1030        if (name.equals("discriminator")) {
1031          this.getDiscriminator().add((ElementDefinitionSlicingDiscriminatorComponent) value);
1032        } else if (name.equals("description")) {
1033          this.description = castToString(value); // StringType
1034        } else if (name.equals("ordered")) {
1035          this.ordered = castToBoolean(value); // BooleanType
1036        } else if (name.equals("rules")) {
1037          value = new SlicingRulesEnumFactory().fromType(castToCode(value));
1038          this.rules = (Enumeration) value; // Enumeration<SlicingRules>
1039        } else
1040          return super.setProperty(name, value);
1041        return value;
1042      }
1043
1044      @Override
1045      public Base makeProperty(int hash, String name) throws FHIRException {
1046        switch (hash) {
1047        case -1888270692:  return addDiscriminator(); 
1048        case -1724546052:  return getDescriptionElement();
1049        case -1207109523:  return getOrderedElement();
1050        case 108873975:  return getRulesElement();
1051        default: return super.makeProperty(hash, name);
1052        }
1053
1054      }
1055
1056      @Override
1057      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1058        switch (hash) {
1059        case -1888270692: /*discriminator*/ return new String[] {};
1060        case -1724546052: /*description*/ return new String[] {"string"};
1061        case -1207109523: /*ordered*/ return new String[] {"boolean"};
1062        case 108873975: /*rules*/ return new String[] {"code"};
1063        default: return super.getTypesForProperty(hash, name);
1064        }
1065
1066      }
1067
1068      @Override
1069      public Base addChild(String name) throws FHIRException {
1070        if (name.equals("discriminator")) {
1071          return addDiscriminator();
1072        }
1073        else if (name.equals("description")) {
1074          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.description");
1075        }
1076        else if (name.equals("ordered")) {
1077          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.ordered");
1078        }
1079        else if (name.equals("rules")) {
1080          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.rules");
1081        }
1082        else
1083          return super.addChild(name);
1084      }
1085
1086      public ElementDefinitionSlicingComponent copy() {
1087        ElementDefinitionSlicingComponent dst = new ElementDefinitionSlicingComponent();
1088        copyValues(dst);
1089        if (discriminator != null) {
1090          dst.discriminator = new ArrayList<ElementDefinitionSlicingDiscriminatorComponent>();
1091          for (ElementDefinitionSlicingDiscriminatorComponent i : discriminator)
1092            dst.discriminator.add(i.copy());
1093        };
1094        dst.description = description == null ? null : description.copy();
1095        dst.ordered = ordered == null ? null : ordered.copy();
1096        dst.rules = rules == null ? null : rules.copy();
1097        return dst;
1098      }
1099
1100      @Override
1101      public boolean equalsDeep(Base other) {
1102        if (!super.equalsDeep(other))
1103          return false;
1104        if (!(other instanceof ElementDefinitionSlicingComponent))
1105          return false;
1106        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other;
1107        return compareDeep(discriminator, o.discriminator, true) && compareDeep(description, o.description, true)
1108           && compareDeep(ordered, o.ordered, true) && compareDeep(rules, o.rules, true);
1109      }
1110
1111      @Override
1112      public boolean equalsShallow(Base other) {
1113        if (!super.equalsShallow(other))
1114          return false;
1115        if (!(other instanceof ElementDefinitionSlicingComponent))
1116          return false;
1117        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other;
1118        return compareValues(description, o.description, true) && compareValues(ordered, o.ordered, true) && compareValues(rules, o.rules, true)
1119          ;
1120      }
1121
1122      public boolean isEmpty() {
1123        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(discriminator, description
1124          , ordered, rules);
1125      }
1126
1127  public String fhirType() {
1128    return "ElementDefinition.slicing";
1129
1130  }
1131
1132  }
1133
1134    @Block()
1135    public static class ElementDefinitionSlicingDiscriminatorComponent extends Element implements IBaseDatatypeElement {
1136        /**
1137         * How the element value is interpreted when discrimination is evaluated.
1138         */
1139        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1140        @Description(shortDefinition="value | exists | pattern | type | profile", formalDefinition="How the element value is interpreted when discrimination is evaluated." )
1141        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/discriminator-type")
1142        protected Enumeration<DiscriminatorType> type;
1143
1144        /**
1145         * A FHIRPath expression, using a restricted subset of FHIRPath, that is used to identify the element on which discrimination is based.
1146         */
1147        @Child(name = "path", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1148        @Description(shortDefinition="Path to element value", formalDefinition="A FHIRPath expression, using a restricted subset of FHIRPath, that is used to identify the element on which discrimination is based." )
1149        protected StringType path;
1150
1151        private static final long serialVersionUID = 1151159293L;
1152
1153    /**
1154     * Constructor
1155     */
1156      public ElementDefinitionSlicingDiscriminatorComponent() {
1157        super();
1158      }
1159
1160    /**
1161     * Constructor
1162     */
1163      public ElementDefinitionSlicingDiscriminatorComponent(Enumeration<DiscriminatorType> type, StringType path) {
1164        super();
1165        this.type = type;
1166        this.path = path;
1167      }
1168
1169        /**
1170         * @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
1171         */
1172        public Enumeration<DiscriminatorType> getTypeElement() { 
1173          if (this.type == null)
1174            if (Configuration.errorOnAutoCreate())
1175              throw new Error("Attempt to auto-create ElementDefinitionSlicingDiscriminatorComponent.type");
1176            else if (Configuration.doAutoCreate())
1177              this.type = new Enumeration<DiscriminatorType>(new DiscriminatorTypeEnumFactory()); // bb
1178          return this.type;
1179        }
1180
1181        public boolean hasTypeElement() { 
1182          return this.type != null && !this.type.isEmpty();
1183        }
1184
1185        public boolean hasType() { 
1186          return this.type != null && !this.type.isEmpty();
1187        }
1188
1189        /**
1190         * @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
1191         */
1192        public ElementDefinitionSlicingDiscriminatorComponent setTypeElement(Enumeration<DiscriminatorType> value) { 
1193          this.type = value;
1194          return this;
1195        }
1196
1197        /**
1198         * @return How the element value is interpreted when discrimination is evaluated.
1199         */
1200        public DiscriminatorType getType() { 
1201          return this.type == null ? null : this.type.getValue();
1202        }
1203
1204        /**
1205         * @param value How the element value is interpreted when discrimination is evaluated.
1206         */
1207        public ElementDefinitionSlicingDiscriminatorComponent setType(DiscriminatorType value) { 
1208            if (this.type == null)
1209              this.type = new Enumeration<DiscriminatorType>(new DiscriminatorTypeEnumFactory());
1210            this.type.setValue(value);
1211          return this;
1212        }
1213
1214        /**
1215         * @return {@link #path} (A FHIRPath expression, using a restricted subset of FHIRPath, 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
1216         */
1217        public StringType getPathElement() { 
1218          if (this.path == null)
1219            if (Configuration.errorOnAutoCreate())
1220              throw new Error("Attempt to auto-create ElementDefinitionSlicingDiscriminatorComponent.path");
1221            else if (Configuration.doAutoCreate())
1222              this.path = new StringType(); // bb
1223          return this.path;
1224        }
1225
1226        public boolean hasPathElement() { 
1227          return this.path != null && !this.path.isEmpty();
1228        }
1229
1230        public boolean hasPath() { 
1231          return this.path != null && !this.path.isEmpty();
1232        }
1233
1234        /**
1235         * @param value {@link #path} (A FHIRPath expression, using a restricted subset of FHIRPath, 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
1236         */
1237        public ElementDefinitionSlicingDiscriminatorComponent setPathElement(StringType value) { 
1238          this.path = value;
1239          return this;
1240        }
1241
1242        /**
1243         * @return A FHIRPath expression, using a restricted subset of FHIRPath, that is used to identify the element on which discrimination is based.
1244         */
1245        public String getPath() { 
1246          return this.path == null ? null : this.path.getValue();
1247        }
1248
1249        /**
1250         * @param value A FHIRPath expression, using a restricted subset of FHIRPath, that is used to identify the element on which discrimination is based.
1251         */
1252        public ElementDefinitionSlicingDiscriminatorComponent setPath(String value) { 
1253            if (this.path == null)
1254              this.path = new StringType();
1255            this.path.setValue(value);
1256          return this;
1257        }
1258
1259        protected void listChildren(List<Property> childrenList) {
1260          super.listChildren(childrenList);
1261          childrenList.add(new Property("type", "code", "How the element value is interpreted when discrimination is evaluated.", 0, java.lang.Integer.MAX_VALUE, type));
1262          childrenList.add(new Property("path", "string", "A FHIRPath expression, using a restricted subset of FHIRPath, that is used to identify the element on which discrimination is based.", 0, java.lang.Integer.MAX_VALUE, path));
1263        }
1264
1265      @Override
1266      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1267        switch (hash) {
1268        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DiscriminatorType>
1269        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1270        default: return super.getProperty(hash, name, checkValid);
1271        }
1272
1273      }
1274
1275      @Override
1276      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1277        switch (hash) {
1278        case 3575610: // type
1279          value = new DiscriminatorTypeEnumFactory().fromType(castToCode(value));
1280          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1281          return value;
1282        case 3433509: // path
1283          this.path = castToString(value); // StringType
1284          return value;
1285        default: return super.setProperty(hash, name, value);
1286        }
1287
1288      }
1289
1290      @Override
1291      public Base setProperty(String name, Base value) throws FHIRException {
1292        if (name.equals("type")) {
1293          value = new DiscriminatorTypeEnumFactory().fromType(castToCode(value));
1294          this.type = (Enumeration) value; // Enumeration<DiscriminatorType>
1295        } else if (name.equals("path")) {
1296          this.path = castToString(value); // StringType
1297        } else
1298          return super.setProperty(name, value);
1299        return value;
1300      }
1301
1302      @Override
1303      public Base makeProperty(int hash, String name) throws FHIRException {
1304        switch (hash) {
1305        case 3575610:  return getTypeElement();
1306        case 3433509:  return getPathElement();
1307        default: return super.makeProperty(hash, name);
1308        }
1309
1310      }
1311
1312      @Override
1313      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1314        switch (hash) {
1315        case 3575610: /*type*/ return new String[] {"code"};
1316        case 3433509: /*path*/ return new String[] {"string"};
1317        default: return super.getTypesForProperty(hash, name);
1318        }
1319
1320      }
1321
1322      @Override
1323      public Base addChild(String name) throws FHIRException {
1324        if (name.equals("type")) {
1325          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.type");
1326        }
1327        else if (name.equals("path")) {
1328          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
1329        }
1330        else
1331          return super.addChild(name);
1332      }
1333
1334      public ElementDefinitionSlicingDiscriminatorComponent copy() {
1335        ElementDefinitionSlicingDiscriminatorComponent dst = new ElementDefinitionSlicingDiscriminatorComponent();
1336        copyValues(dst);
1337        dst.type = type == null ? null : type.copy();
1338        dst.path = path == null ? null : path.copy();
1339        return dst;
1340      }
1341
1342      @Override
1343      public boolean equalsDeep(Base other) {
1344        if (!super.equalsDeep(other))
1345          return false;
1346        if (!(other instanceof ElementDefinitionSlicingDiscriminatorComponent))
1347          return false;
1348        ElementDefinitionSlicingDiscriminatorComponent o = (ElementDefinitionSlicingDiscriminatorComponent) other;
1349        return compareDeep(type, o.type, true) && compareDeep(path, o.path, true);
1350      }
1351
1352      @Override
1353      public boolean equalsShallow(Base other) {
1354        if (!super.equalsShallow(other))
1355          return false;
1356        if (!(other instanceof ElementDefinitionSlicingDiscriminatorComponent))
1357          return false;
1358        ElementDefinitionSlicingDiscriminatorComponent o = (ElementDefinitionSlicingDiscriminatorComponent) other;
1359        return compareValues(type, o.type, true) && compareValues(path, o.path, true);
1360      }
1361
1362      public boolean isEmpty() {
1363        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, path);
1364      }
1365
1366  public String fhirType() {
1367    return "ElementDefinition.slicing.discriminator";
1368
1369  }
1370
1371  }
1372
1373    @Block()
1374    public static class ElementDefinitionBaseComponent extends Element implements IBaseDatatypeElement {
1375        /**
1376         * 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]]] without a StructureDefinition.base.
1377         */
1378        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1379        @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]]] without a StructureDefinition.base." )
1380        protected StringType path;
1381
1382        /**
1383         * Minimum cardinality of the base element identified by the path.
1384         */
1385        @Child(name = "min", type = {UnsignedIntType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1386        @Description(shortDefinition="Min cardinality of the base element", formalDefinition="Minimum cardinality of the base element identified by the path." )
1387        protected UnsignedIntType min;
1388
1389        /**
1390         * Maximum cardinality of the base element identified by the path.
1391         */
1392        @Child(name = "max", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1393        @Description(shortDefinition="Max cardinality of the base element", formalDefinition="Maximum cardinality of the base element identified by the path." )
1394        protected StringType max;
1395
1396        private static final long serialVersionUID = -1412704221L;
1397
1398    /**
1399     * Constructor
1400     */
1401      public ElementDefinitionBaseComponent() {
1402        super();
1403      }
1404
1405    /**
1406     * Constructor
1407     */
1408      public ElementDefinitionBaseComponent(StringType path, UnsignedIntType min, StringType max) {
1409        super();
1410        this.path = path;
1411        this.min = min;
1412        this.max = max;
1413      }
1414
1415        /**
1416         * @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]]] without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1417         */
1418        public StringType getPathElement() { 
1419          if (this.path == null)
1420            if (Configuration.errorOnAutoCreate())
1421              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.path");
1422            else if (Configuration.doAutoCreate())
1423              this.path = new StringType(); // bb
1424          return this.path;
1425        }
1426
1427        public boolean hasPathElement() { 
1428          return this.path != null && !this.path.isEmpty();
1429        }
1430
1431        public boolean hasPath() { 
1432          return this.path != null && !this.path.isEmpty();
1433        }
1434
1435        /**
1436         * @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]]] without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1437         */
1438        public ElementDefinitionBaseComponent setPathElement(StringType value) { 
1439          this.path = value;
1440          return this;
1441        }
1442
1443        /**
1444         * @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]]] without a StructureDefinition.base.
1445         */
1446        public String getPath() { 
1447          return this.path == null ? null : this.path.getValue();
1448        }
1449
1450        /**
1451         * @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]]] without a StructureDefinition.base.
1452         */
1453        public ElementDefinitionBaseComponent setPath(String value) { 
1454            if (this.path == null)
1455              this.path = new StringType();
1456            this.path.setValue(value);
1457          return this;
1458        }
1459
1460        /**
1461         * @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
1462         */
1463        public UnsignedIntType getMinElement() { 
1464          if (this.min == null)
1465            if (Configuration.errorOnAutoCreate())
1466              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.min");
1467            else if (Configuration.doAutoCreate())
1468              this.min = new UnsignedIntType(); // bb
1469          return this.min;
1470        }
1471
1472        public boolean hasMinElement() { 
1473          return this.min != null && !this.min.isEmpty();
1474        }
1475
1476        public boolean hasMin() { 
1477          return this.min != null && !this.min.isEmpty();
1478        }
1479
1480        /**
1481         * @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
1482         */
1483        public ElementDefinitionBaseComponent setMinElement(UnsignedIntType value) { 
1484          this.min = value;
1485          return this;
1486        }
1487
1488        /**
1489         * @return Minimum cardinality of the base element identified by the path.
1490         */
1491        public int getMin() { 
1492          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
1493        }
1494
1495        /**
1496         * @param value Minimum cardinality of the base element identified by the path.
1497         */
1498        public ElementDefinitionBaseComponent setMin(int value) { 
1499            if (this.min == null)
1500              this.min = new UnsignedIntType();
1501            this.min.setValue(value);
1502          return this;
1503        }
1504
1505        /**
1506         * @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
1507         */
1508        public StringType getMaxElement() { 
1509          if (this.max == null)
1510            if (Configuration.errorOnAutoCreate())
1511              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.max");
1512            else if (Configuration.doAutoCreate())
1513              this.max = new StringType(); // bb
1514          return this.max;
1515        }
1516
1517        public boolean hasMaxElement() { 
1518          return this.max != null && !this.max.isEmpty();
1519        }
1520
1521        public boolean hasMax() { 
1522          return this.max != null && !this.max.isEmpty();
1523        }
1524
1525        /**
1526         * @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
1527         */
1528        public ElementDefinitionBaseComponent setMaxElement(StringType value) { 
1529          this.max = value;
1530          return this;
1531        }
1532
1533        /**
1534         * @return Maximum cardinality of the base element identified by the path.
1535         */
1536        public String getMax() { 
1537          return this.max == null ? null : this.max.getValue();
1538        }
1539
1540        /**
1541         * @param value Maximum cardinality of the base element identified by the path.
1542         */
1543        public ElementDefinitionBaseComponent setMax(String value) { 
1544            if (this.max == null)
1545              this.max = new StringType();
1546            this.max.setValue(value);
1547          return this;
1548        }
1549
1550        protected void listChildren(List<Property> childrenList) {
1551          super.listChildren(childrenList);
1552          childrenList.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]]] without a StructureDefinition.base.", 0, java.lang.Integer.MAX_VALUE, path));
1553          childrenList.add(new Property("min", "unsignedInt", "Minimum cardinality of the base element identified by the path.", 0, java.lang.Integer.MAX_VALUE, min));
1554          childrenList.add(new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, java.lang.Integer.MAX_VALUE, max));
1555        }
1556
1557      @Override
1558      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1559        switch (hash) {
1560        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1561        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // UnsignedIntType
1562        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
1563        default: return super.getProperty(hash, name, checkValid);
1564        }
1565
1566      }
1567
1568      @Override
1569      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1570        switch (hash) {
1571        case 3433509: // path
1572          this.path = castToString(value); // StringType
1573          return value;
1574        case 108114: // min
1575          this.min = castToUnsignedInt(value); // UnsignedIntType
1576          return value;
1577        case 107876: // max
1578          this.max = castToString(value); // StringType
1579          return value;
1580        default: return super.setProperty(hash, name, value);
1581        }
1582
1583      }
1584
1585      @Override
1586      public Base setProperty(String name, Base value) throws FHIRException {
1587        if (name.equals("path")) {
1588          this.path = castToString(value); // StringType
1589        } else if (name.equals("min")) {
1590          this.min = castToUnsignedInt(value); // UnsignedIntType
1591        } else if (name.equals("max")) {
1592          this.max = castToString(value); // StringType
1593        } else
1594          return super.setProperty(name, value);
1595        return value;
1596      }
1597
1598      @Override
1599      public Base makeProperty(int hash, String name) throws FHIRException {
1600        switch (hash) {
1601        case 3433509:  return getPathElement();
1602        case 108114:  return getMinElement();
1603        case 107876:  return getMaxElement();
1604        default: return super.makeProperty(hash, name);
1605        }
1606
1607      }
1608
1609      @Override
1610      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1611        switch (hash) {
1612        case 3433509: /*path*/ return new String[] {"string"};
1613        case 108114: /*min*/ return new String[] {"unsignedInt"};
1614        case 107876: /*max*/ return new String[] {"string"};
1615        default: return super.getTypesForProperty(hash, name);
1616        }
1617
1618      }
1619
1620      @Override
1621      public Base addChild(String name) throws FHIRException {
1622        if (name.equals("path")) {
1623          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
1624        }
1625        else if (name.equals("min")) {
1626          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.min");
1627        }
1628        else if (name.equals("max")) {
1629          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.max");
1630        }
1631        else
1632          return super.addChild(name);
1633      }
1634
1635      public ElementDefinitionBaseComponent copy() {
1636        ElementDefinitionBaseComponent dst = new ElementDefinitionBaseComponent();
1637        copyValues(dst);
1638        dst.path = path == null ? null : path.copy();
1639        dst.min = min == null ? null : min.copy();
1640        dst.max = max == null ? null : max.copy();
1641        return dst;
1642      }
1643
1644      @Override
1645      public boolean equalsDeep(Base other) {
1646        if (!super.equalsDeep(other))
1647          return false;
1648        if (!(other instanceof ElementDefinitionBaseComponent))
1649          return false;
1650        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other;
1651        return compareDeep(path, o.path, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
1652          ;
1653      }
1654
1655      @Override
1656      public boolean equalsShallow(Base other) {
1657        if (!super.equalsShallow(other))
1658          return false;
1659        if (!(other instanceof ElementDefinitionBaseComponent))
1660          return false;
1661        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other;
1662        return compareValues(path, o.path, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
1663          ;
1664      }
1665
1666      public boolean isEmpty() {
1667        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, min, max);
1668      }
1669
1670  public String fhirType() {
1671    return "ElementDefinition.base";
1672
1673  }
1674
1675  }
1676
1677    @Block()
1678    public static class TypeRefComponent extends Element implements IBaseDatatypeElement {
1679        /**
1680         * 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.
1681         */
1682        @Child(name = "code", type = {UriType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1683        @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." )
1684        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/defined-types")
1685        protected UriType code;
1686
1687        /**
1688         * Identifies a profile structure or implementation Guide that SHALL hold for the datatype this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.
1689         */
1690        @Child(name = "profile", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1691        @Description(shortDefinition="Profile (StructureDefinition) to apply (or IG)", formalDefinition="Identifies a profile structure or implementation Guide that SHALL hold for the datatype this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide." )
1692        protected UriType profile;
1693
1694        /**
1695         * Identifies a profile structure or implementation Guide that SHALL hold for the target of the reference this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.
1696         */
1697        @Child(name = "targetProfile", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1698        @Description(shortDefinition="Profile (StructureDefinition) to apply to reference target (or IG)", formalDefinition="Identifies a profile structure or implementation Guide that SHALL hold for the target of the reference this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide." )
1699        protected UriType targetProfile;
1700
1701        /**
1702         * 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.
1703         */
1704        @Child(name = "aggregation", type = {CodeType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1705        @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." )
1706        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-aggregation-mode")
1707        protected List<Enumeration<AggregationMode>> aggregation;
1708
1709        /**
1710         * Whether this reference needs to be version specific or version independent, or whether either can be used.
1711         */
1712        @Child(name = "versioning", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1713        @Description(shortDefinition="either | independent | specific", formalDefinition="Whether this reference needs to be version specific or version independent, or whether either can be used." )
1714        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/reference-version-rules")
1715        protected Enumeration<ReferenceVersionRules> versioning;
1716
1717        private static final long serialVersionUID = -560921355L;
1718
1719    /**
1720     * Constructor
1721     */
1722      public TypeRefComponent() {
1723        super();
1724      }
1725
1726    /**
1727     * Constructor
1728     */
1729      public TypeRefComponent(UriType code) {
1730        super();
1731        this.code = code;
1732      }
1733
1734        /**
1735         * @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
1736         */
1737        public UriType getCodeElement() { 
1738          if (this.code == null)
1739            if (Configuration.errorOnAutoCreate())
1740              throw new Error("Attempt to auto-create TypeRefComponent.code");
1741            else if (Configuration.doAutoCreate())
1742              this.code = new UriType(); // bb
1743          return this.code;
1744        }
1745
1746        public boolean hasCodeElement() { 
1747          return this.code != null && !this.code.isEmpty();
1748        }
1749
1750        public boolean hasCode() { 
1751          return this.code != null && !this.code.isEmpty();
1752        }
1753
1754        /**
1755         * @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
1756         */
1757        public TypeRefComponent setCodeElement(UriType value) { 
1758          this.code = value;
1759          return this;
1760        }
1761
1762        /**
1763         * @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.
1764         */
1765        public String getCode() { 
1766          return this.code == null ? null : this.code.getValue();
1767        }
1768
1769        /**
1770         * @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.
1771         */
1772        public TypeRefComponent setCode(String value) { 
1773            if (this.code == null)
1774              this.code = new UriType();
1775            this.code.setValue(value);
1776          return this;
1777        }
1778
1779        /**
1780         * @return {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for the datatype this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value
1781         */
1782        public UriType getProfileElement() { 
1783          if (this.profile == null)
1784            if (Configuration.errorOnAutoCreate())
1785              throw new Error("Attempt to auto-create TypeRefComponent.profile");
1786            else if (Configuration.doAutoCreate())
1787              this.profile = new UriType(); // bb
1788          return this.profile;
1789        }
1790
1791        public boolean hasProfileElement() { 
1792          return this.profile != null && !this.profile.isEmpty();
1793        }
1794
1795        public boolean hasProfile() { 
1796          return this.profile != null && !this.profile.isEmpty();
1797        }
1798
1799        /**
1800         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for the datatype this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value
1801         */
1802        public TypeRefComponent setProfileElement(UriType value) { 
1803          this.profile = value;
1804          return this;
1805        }
1806
1807        /**
1808         * @return Identifies a profile structure or implementation Guide that SHALL hold for the datatype this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.
1809         */
1810        public String getProfile() { 
1811          return this.profile == null ? null : this.profile.getValue();
1812        }
1813
1814        /**
1815         * @param value Identifies a profile structure or implementation Guide that SHALL hold for the datatype this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.
1816         */
1817        public TypeRefComponent setProfile(String value) { 
1818          if (Utilities.noString(value))
1819            this.profile = null;
1820          else {
1821            if (this.profile == null)
1822              this.profile = new UriType();
1823            this.profile.setValue(value);
1824          }
1825          return this;
1826        }
1827
1828        /**
1829         * @return {@link #targetProfile} (Identifies a profile structure or implementation Guide that SHALL hold for the target of the reference this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.). This is the underlying object with id, value and extensions. The accessor "getTargetProfile" gives direct access to the value
1830         */
1831        public UriType getTargetProfileElement() { 
1832          if (this.targetProfile == null)
1833            if (Configuration.errorOnAutoCreate())
1834              throw new Error("Attempt to auto-create TypeRefComponent.targetProfile");
1835            else if (Configuration.doAutoCreate())
1836              this.targetProfile = new UriType(); // bb
1837          return this.targetProfile;
1838        }
1839
1840        public boolean hasTargetProfileElement() { 
1841          return this.targetProfile != null && !this.targetProfile.isEmpty();
1842        }
1843
1844        public boolean hasTargetProfile() { 
1845          return this.targetProfile != null && !this.targetProfile.isEmpty();
1846        }
1847
1848        /**
1849         * @param value {@link #targetProfile} (Identifies a profile structure or implementation Guide that SHALL hold for the target of the reference this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.). This is the underlying object with id, value and extensions. The accessor "getTargetProfile" gives direct access to the value
1850         */
1851        public TypeRefComponent setTargetProfileElement(UriType value) { 
1852          this.targetProfile = value;
1853          return this;
1854        }
1855
1856        /**
1857         * @return Identifies a profile structure or implementation Guide that SHALL hold for the target of the reference this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.
1858         */
1859        public String getTargetProfile() { 
1860          return this.targetProfile == null ? null : this.targetProfile.getValue();
1861        }
1862
1863        /**
1864         * @param value Identifies a profile structure or implementation Guide that SHALL hold for the target of the reference this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.
1865         */
1866        public TypeRefComponent setTargetProfile(String value) { 
1867          if (Utilities.noString(value))
1868            this.targetProfile = null;
1869          else {
1870            if (this.targetProfile == null)
1871              this.targetProfile = new UriType();
1872            this.targetProfile.setValue(value);
1873          }
1874          return this;
1875        }
1876
1877        /**
1878         * @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.)
1879         */
1880        public List<Enumeration<AggregationMode>> getAggregation() { 
1881          if (this.aggregation == null)
1882            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1883          return this.aggregation;
1884        }
1885
1886        /**
1887         * @return Returns a reference to <code>this</code> for easy method chaining
1888         */
1889        public TypeRefComponent setAggregation(List<Enumeration<AggregationMode>> theAggregation) { 
1890          this.aggregation = theAggregation;
1891          return this;
1892        }
1893
1894        public boolean hasAggregation() { 
1895          if (this.aggregation == null)
1896            return false;
1897          for (Enumeration<AggregationMode> item : this.aggregation)
1898            if (!item.isEmpty())
1899              return true;
1900          return false;
1901        }
1902
1903        /**
1904         * @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.)
1905         */
1906        public Enumeration<AggregationMode> addAggregationElement() {//2 
1907          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
1908          if (this.aggregation == null)
1909            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1910          this.aggregation.add(t);
1911          return t;
1912        }
1913
1914        /**
1915         * @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.)
1916         */
1917        public TypeRefComponent addAggregation(AggregationMode value) { //1
1918          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
1919          t.setValue(value);
1920          if (this.aggregation == null)
1921            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1922          this.aggregation.add(t);
1923          return this;
1924        }
1925
1926        /**
1927         * @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.)
1928         */
1929        public boolean hasAggregation(AggregationMode value) { 
1930          if (this.aggregation == null)
1931            return false;
1932          for (Enumeration<AggregationMode> v : this.aggregation)
1933            if (v.getValue().equals(value)) // code
1934              return true;
1935          return false;
1936        }
1937
1938        /**
1939         * @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
1940         */
1941        public Enumeration<ReferenceVersionRules> getVersioningElement() { 
1942          if (this.versioning == null)
1943            if (Configuration.errorOnAutoCreate())
1944              throw new Error("Attempt to auto-create TypeRefComponent.versioning");
1945            else if (Configuration.doAutoCreate())
1946              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory()); // bb
1947          return this.versioning;
1948        }
1949
1950        public boolean hasVersioningElement() { 
1951          return this.versioning != null && !this.versioning.isEmpty();
1952        }
1953
1954        public boolean hasVersioning() { 
1955          return this.versioning != null && !this.versioning.isEmpty();
1956        }
1957
1958        /**
1959         * @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
1960         */
1961        public TypeRefComponent setVersioningElement(Enumeration<ReferenceVersionRules> value) { 
1962          this.versioning = value;
1963          return this;
1964        }
1965
1966        /**
1967         * @return Whether this reference needs to be version specific or version independent, or whether either can be used.
1968         */
1969        public ReferenceVersionRules getVersioning() { 
1970          return this.versioning == null ? null : this.versioning.getValue();
1971        }
1972
1973        /**
1974         * @param value Whether this reference needs to be version specific or version independent, or whether either can be used.
1975         */
1976        public TypeRefComponent setVersioning(ReferenceVersionRules value) { 
1977          if (value == null)
1978            this.versioning = null;
1979          else {
1980            if (this.versioning == null)
1981              this.versioning = new Enumeration<ReferenceVersionRules>(new ReferenceVersionRulesEnumFactory());
1982            this.versioning.setValue(value);
1983          }
1984          return this;
1985        }
1986
1987        protected void listChildren(List<Property> childrenList) {
1988          super.listChildren(childrenList);
1989          childrenList.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, java.lang.Integer.MAX_VALUE, code));
1990          childrenList.add(new Property("profile", "uri", "Identifies a profile structure or implementation Guide that SHALL hold for the datatype this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, profile));
1991          childrenList.add(new Property("targetProfile", "uri", "Identifies a profile structure or implementation Guide that SHALL hold for the target of the reference this element refers to. 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 resource SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, targetProfile));
1992          childrenList.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));
1993          childrenList.add(new Property("versioning", "code", "Whether this reference needs to be version specific or version independent, or whether either can be used.", 0, java.lang.Integer.MAX_VALUE, versioning));
1994        }
1995
1996      @Override
1997      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1998        switch (hash) {
1999        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // UriType
2000        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // UriType
2001        case 1994521304: /*targetProfile*/ return this.targetProfile == null ? new Base[0] : new Base[] {this.targetProfile}; // UriType
2002        case 841524962: /*aggregation*/ return this.aggregation == null ? new Base[0] : this.aggregation.toArray(new Base[this.aggregation.size()]); // Enumeration<AggregationMode>
2003        case -670487542: /*versioning*/ return this.versioning == null ? new Base[0] : new Base[] {this.versioning}; // Enumeration<ReferenceVersionRules>
2004        default: return super.getProperty(hash, name, checkValid);
2005        }
2006
2007      }
2008
2009      @Override
2010      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2011        switch (hash) {
2012        case 3059181: // code
2013          this.code = castToUri(value); // UriType
2014          return value;
2015        case -309425751: // profile
2016          this.profile = castToUri(value); // UriType
2017          return value;
2018        case 1994521304: // targetProfile
2019          this.targetProfile = castToUri(value); // UriType
2020          return value;
2021        case 841524962: // aggregation
2022          value = new AggregationModeEnumFactory().fromType(castToCode(value));
2023          this.getAggregation().add((Enumeration) value); // Enumeration<AggregationMode>
2024          return value;
2025        case -670487542: // versioning
2026          value = new ReferenceVersionRulesEnumFactory().fromType(castToCode(value));
2027          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2028          return value;
2029        default: return super.setProperty(hash, name, value);
2030        }
2031
2032      }
2033
2034      @Override
2035      public Base setProperty(String name, Base value) throws FHIRException {
2036        if (name.equals("code")) {
2037          this.code = castToUri(value); // UriType
2038        } else if (name.equals("profile")) {
2039          this.profile = castToUri(value); // UriType
2040        } else if (name.equals("targetProfile")) {
2041          this.targetProfile = castToUri(value); // UriType
2042        } else if (name.equals("aggregation")) {
2043          value = new AggregationModeEnumFactory().fromType(castToCode(value));
2044          this.getAggregation().add((Enumeration) value);
2045        } else if (name.equals("versioning")) {
2046          value = new ReferenceVersionRulesEnumFactory().fromType(castToCode(value));
2047          this.versioning = (Enumeration) value; // Enumeration<ReferenceVersionRules>
2048        } else
2049          return super.setProperty(name, value);
2050        return value;
2051      }
2052
2053      @Override
2054      public Base makeProperty(int hash, String name) throws FHIRException {
2055        switch (hash) {
2056        case 3059181:  return getCodeElement();
2057        case -309425751:  return getProfileElement();
2058        case 1994521304:  return getTargetProfileElement();
2059        case 841524962:  return addAggregationElement();
2060        case -670487542:  return getVersioningElement();
2061        default: return super.makeProperty(hash, name);
2062        }
2063
2064      }
2065
2066      @Override
2067      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2068        switch (hash) {
2069        case 3059181: /*code*/ return new String[] {"uri"};
2070        case -309425751: /*profile*/ return new String[] {"uri"};
2071        case 1994521304: /*targetProfile*/ return new String[] {"uri"};
2072        case 841524962: /*aggregation*/ return new String[] {"code"};
2073        case -670487542: /*versioning*/ return new String[] {"code"};
2074        default: return super.getTypesForProperty(hash, name);
2075        }
2076
2077      }
2078
2079      @Override
2080      public Base addChild(String name) throws FHIRException {
2081        if (name.equals("code")) {
2082          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.code");
2083        }
2084        else if (name.equals("profile")) {
2085          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.profile");
2086        }
2087        else if (name.equals("targetProfile")) {
2088          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.targetProfile");
2089        }
2090        else if (name.equals("aggregation")) {
2091          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.aggregation");
2092        }
2093        else if (name.equals("versioning")) {
2094          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.versioning");
2095        }
2096        else
2097          return super.addChild(name);
2098      }
2099
2100      public TypeRefComponent copy() {
2101        TypeRefComponent dst = new TypeRefComponent();
2102        copyValues(dst);
2103        dst.code = code == null ? null : code.copy();
2104        dst.profile = profile == null ? null : profile.copy();
2105        dst.targetProfile = targetProfile == null ? null : targetProfile.copy();
2106        if (aggregation != null) {
2107          dst.aggregation = new ArrayList<Enumeration<AggregationMode>>();
2108          for (Enumeration<AggregationMode> i : aggregation)
2109            dst.aggregation.add(i.copy());
2110        };
2111        dst.versioning = versioning == null ? null : versioning.copy();
2112        return dst;
2113      }
2114
2115      @Override
2116      public boolean equalsDeep(Base other) {
2117        if (!super.equalsDeep(other))
2118          return false;
2119        if (!(other instanceof TypeRefComponent))
2120          return false;
2121        TypeRefComponent o = (TypeRefComponent) other;
2122        return compareDeep(code, o.code, true) && compareDeep(profile, o.profile, true) && compareDeep(targetProfile, o.targetProfile, true)
2123           && compareDeep(aggregation, o.aggregation, true) && compareDeep(versioning, o.versioning, true)
2124          ;
2125      }
2126
2127      @Override
2128      public boolean equalsShallow(Base other) {
2129        if (!super.equalsShallow(other))
2130          return false;
2131        if (!(other instanceof TypeRefComponent))
2132          return false;
2133        TypeRefComponent o = (TypeRefComponent) other;
2134        return compareValues(code, o.code, true) && compareValues(profile, o.profile, true) && compareValues(targetProfile, o.targetProfile, true)
2135           && compareValues(aggregation, o.aggregation, true) && compareValues(versioning, o.versioning, true)
2136          ;
2137      }
2138
2139      public boolean isEmpty() {
2140        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, profile, targetProfile
2141          , aggregation, versioning);
2142      }
2143
2144  public String fhirType() {
2145    return "ElementDefinition.type";
2146
2147  }
2148
2149  }
2150
2151    @Block()
2152    public static class ElementDefinitionExampleComponent extends Element implements IBaseDatatypeElement {
2153        /**
2154         * Describes the purpose of this example amoung the set of examples.
2155         */
2156        @Child(name = "label", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2157        @Description(shortDefinition="Describes the purpose of this example", formalDefinition="Describes the purpose of this example amoung the set of examples." )
2158        protected StringType label;
2159
2160        /**
2161         * The actual value for the element, which must be one of the types allowed for this element.
2162         */
2163        @Child(name = "value", type = {}, order=2, min=1, max=1, modifier=false, summary=true)
2164        @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." )
2165        protected org.hl7.fhir.dstu3.model.Type value;
2166
2167        private static final long serialVersionUID = 1346348024L;
2168
2169    /**
2170     * Constructor
2171     */
2172      public ElementDefinitionExampleComponent() {
2173        super();
2174      }
2175
2176    /**
2177     * Constructor
2178     */
2179      public ElementDefinitionExampleComponent(StringType label, org.hl7.fhir.dstu3.model.Type value) {
2180        super();
2181        this.label = label;
2182        this.value = value;
2183      }
2184
2185        /**
2186         * @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
2187         */
2188        public StringType getLabelElement() { 
2189          if (this.label == null)
2190            if (Configuration.errorOnAutoCreate())
2191              throw new Error("Attempt to auto-create ElementDefinitionExampleComponent.label");
2192            else if (Configuration.doAutoCreate())
2193              this.label = new StringType(); // bb
2194          return this.label;
2195        }
2196
2197        public boolean hasLabelElement() { 
2198          return this.label != null && !this.label.isEmpty();
2199        }
2200
2201        public boolean hasLabel() { 
2202          return this.label != null && !this.label.isEmpty();
2203        }
2204
2205        /**
2206         * @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
2207         */
2208        public ElementDefinitionExampleComponent setLabelElement(StringType value) { 
2209          this.label = value;
2210          return this;
2211        }
2212
2213        /**
2214         * @return Describes the purpose of this example amoung the set of examples.
2215         */
2216        public String getLabel() { 
2217          return this.label == null ? null : this.label.getValue();
2218        }
2219
2220        /**
2221         * @param value Describes the purpose of this example amoung the set of examples.
2222         */
2223        public ElementDefinitionExampleComponent setLabel(String value) { 
2224            if (this.label == null)
2225              this.label = new StringType();
2226            this.label.setValue(value);
2227          return this;
2228        }
2229
2230        /**
2231         * @return {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2232         */
2233        public org.hl7.fhir.dstu3.model.Type getValue() { 
2234          return this.value;
2235        }
2236
2237        public boolean hasValue() { 
2238          return this.value != null && !this.value.isEmpty();
2239        }
2240
2241        /**
2242         * @param value {@link #value} (The actual value for the element, which must be one of the types allowed for this element.)
2243         */
2244        public ElementDefinitionExampleComponent setValue(org.hl7.fhir.dstu3.model.Type value) { 
2245          this.value = value;
2246          return this;
2247        }
2248
2249        protected void listChildren(List<Property> childrenList) {
2250          super.listChildren(childrenList);
2251          childrenList.add(new Property("label", "string", "Describes the purpose of this example amoung the set of examples.", 0, java.lang.Integer.MAX_VALUE, label));
2252          childrenList.add(new Property("value[x]", "*", "The actual value for the element, which must be one of the types allowed for this element.", 0, java.lang.Integer.MAX_VALUE, value));
2253        }
2254
2255      @Override
2256      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2257        switch (hash) {
2258        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
2259        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.dstu3.model.Type
2260        default: return super.getProperty(hash, name, checkValid);
2261        }
2262
2263      }
2264
2265      @Override
2266      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2267        switch (hash) {
2268        case 102727412: // label
2269          this.label = castToString(value); // StringType
2270          return value;
2271        case 111972721: // value
2272          this.value = castToType(value); // org.hl7.fhir.dstu3.model.Type
2273          return value;
2274        default: return super.setProperty(hash, name, value);
2275        }
2276
2277      }
2278
2279      @Override
2280      public Base setProperty(String name, Base value) throws FHIRException {
2281        if (name.equals("label")) {
2282          this.label = castToString(value); // StringType
2283        } else if (name.equals("value[x]")) {
2284          this.value = castToType(value); // org.hl7.fhir.dstu3.model.Type
2285        } else
2286          return super.setProperty(name, value);
2287        return value;
2288      }
2289
2290      @Override
2291      public Base makeProperty(int hash, String name) throws FHIRException {
2292        switch (hash) {
2293        case 102727412:  return getLabelElement();
2294        case -1410166417:  return getValue(); 
2295        case 111972721:  return getValue(); 
2296        default: return super.makeProperty(hash, name);
2297        }
2298
2299      }
2300
2301      @Override
2302      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2303        switch (hash) {
2304        case 102727412: /*label*/ return new String[] {"string"};
2305        case 111972721: /*value*/ return new String[] {"*"};
2306        default: return super.getTypesForProperty(hash, name);
2307        }
2308
2309      }
2310
2311      @Override
2312      public Base addChild(String name) throws FHIRException {
2313        if (name.equals("label")) {
2314          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.label");
2315        }
2316        else if (name.equals("valueBoolean")) {
2317          this.value = new BooleanType();
2318          return this.value;
2319        }
2320        else if (name.equals("valueInteger")) {
2321          this.value = new IntegerType();
2322          return this.value;
2323        }
2324        else if (name.equals("valueDecimal")) {
2325          this.value = new DecimalType();
2326          return this.value;
2327        }
2328        else if (name.equals("valueBase64Binary")) {
2329          this.value = new Base64BinaryType();
2330          return this.value;
2331        }
2332        else if (name.equals("valueInstant")) {
2333          this.value = new InstantType();
2334          return this.value;
2335        }
2336        else if (name.equals("valueString")) {
2337          this.value = new StringType();
2338          return this.value;
2339        }
2340        else if (name.equals("valueUri")) {
2341          this.value = new UriType();
2342          return this.value;
2343        }
2344        else if (name.equals("valueDate")) {
2345          this.value = new DateType();
2346          return this.value;
2347        }
2348        else if (name.equals("valueDateTime")) {
2349          this.value = new DateTimeType();
2350          return this.value;
2351        }
2352        else if (name.equals("valueTime")) {
2353          this.value = new TimeType();
2354          return this.value;
2355        }
2356        else if (name.equals("valueCode")) {
2357          this.value = new CodeType();
2358          return this.value;
2359        }
2360        else if (name.equals("valueOid")) {
2361          this.value = new OidType();
2362          return this.value;
2363        }
2364        else if (name.equals("valueId")) {
2365          this.value = new IdType();
2366          return this.value;
2367        }
2368        else if (name.equals("valueUnsignedInt")) {
2369          this.value = new UnsignedIntType();
2370          return this.value;
2371        }
2372        else if (name.equals("valuePositiveInt")) {
2373          this.value = new PositiveIntType();
2374          return this.value;
2375        }
2376        else if (name.equals("valueMarkdown")) {
2377          this.value = new MarkdownType();
2378          return this.value;
2379        }
2380        else if (name.equals("valueAnnotation")) {
2381          this.value = new Annotation();
2382          return this.value;
2383        }
2384        else if (name.equals("valueAttachment")) {
2385          this.value = new Attachment();
2386          return this.value;
2387        }
2388        else if (name.equals("valueIdentifier")) {
2389          this.value = new Identifier();
2390          return this.value;
2391        }
2392        else if (name.equals("valueCodeableConcept")) {
2393          this.value = new CodeableConcept();
2394          return this.value;
2395        }
2396        else if (name.equals("valueCoding")) {
2397          this.value = new Coding();
2398          return this.value;
2399        }
2400        else if (name.equals("valueQuantity")) {
2401          this.value = new Quantity();
2402          return this.value;
2403        }
2404        else if (name.equals("valueRange")) {
2405          this.value = new Range();
2406          return this.value;
2407        }
2408        else if (name.equals("valuePeriod")) {
2409          this.value = new Period();
2410          return this.value;
2411        }
2412        else if (name.equals("valueRatio")) {
2413          this.value = new Ratio();
2414          return this.value;
2415        }
2416        else if (name.equals("valueSampledData")) {
2417          this.value = new SampledData();
2418          return this.value;
2419        }
2420        else if (name.equals("valueSignature")) {
2421          this.value = new Signature();
2422          return this.value;
2423        }
2424        else if (name.equals("valueHumanName")) {
2425          this.value = new HumanName();
2426          return this.value;
2427        }
2428        else if (name.equals("valueAddress")) {
2429          this.value = new Address();
2430          return this.value;
2431        }
2432        else if (name.equals("valueContactPoint")) {
2433          this.value = new ContactPoint();
2434          return this.value;
2435        }
2436        else if (name.equals("valueTiming")) {
2437          this.value = new Timing();
2438          return this.value;
2439        }
2440        else if (name.equals("valueReference")) {
2441          this.value = new Reference();
2442          return this.value;
2443        }
2444        else if (name.equals("valueMeta")) {
2445          this.value = new Meta();
2446          return this.value;
2447        }
2448        else
2449          return super.addChild(name);
2450      }
2451
2452      public ElementDefinitionExampleComponent copy() {
2453        ElementDefinitionExampleComponent dst = new ElementDefinitionExampleComponent();
2454        copyValues(dst);
2455        dst.label = label == null ? null : label.copy();
2456        dst.value = value == null ? null : value.copy();
2457        return dst;
2458      }
2459
2460      @Override
2461      public boolean equalsDeep(Base other) {
2462        if (!super.equalsDeep(other))
2463          return false;
2464        if (!(other instanceof ElementDefinitionExampleComponent))
2465          return false;
2466        ElementDefinitionExampleComponent o = (ElementDefinitionExampleComponent) other;
2467        return compareDeep(label, o.label, true) && compareDeep(value, o.value, true);
2468      }
2469
2470      @Override
2471      public boolean equalsShallow(Base other) {
2472        if (!super.equalsShallow(other))
2473          return false;
2474        if (!(other instanceof ElementDefinitionExampleComponent))
2475          return false;
2476        ElementDefinitionExampleComponent o = (ElementDefinitionExampleComponent) other;
2477        return compareValues(label, o.label, true);
2478      }
2479
2480      public boolean isEmpty() {
2481        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(label, value);
2482      }
2483
2484  public String fhirType() {
2485    return "ElementDefinition.example";
2486
2487  }
2488
2489  }
2490
2491    @Block()
2492    public static class ElementDefinitionConstraintComponent extends Element implements IBaseDatatypeElement {
2493        /**
2494         * Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
2495         */
2496        @Child(name = "key", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2497        @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." )
2498        protected IdType key;
2499
2500        /**
2501         * Description of why this constraint is necessary or appropriate.
2502         */
2503        @Child(name = "requirements", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2504        @Description(shortDefinition="Why this constraint is necessary or appropriate", formalDefinition="Description of why this constraint is necessary or appropriate." )
2505        protected StringType requirements;
2506
2507        /**
2508         * Identifies the impact constraint violation has on the conformance of the instance.
2509         */
2510        @Child(name = "severity", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
2511        @Description(shortDefinition="error | warning", formalDefinition="Identifies the impact constraint violation has on the conformance of the instance." )
2512        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/constraint-severity")
2513        protected Enumeration<ConstraintSeverity> severity;
2514
2515        /**
2516         * Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
2517         */
2518        @Child(name = "human", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
2519        @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." )
2520        protected StringType human;
2521
2522        /**
2523         * A [FHIRPath](http://hl7.org/fluentpath) expression of constraint that can be executed to see if this constraint is met.
2524         */
2525        @Child(name = "expression", type = {StringType.class}, order=5, min=1, max=1, modifier=false, summary=true)
2526        @Description(shortDefinition="FHIRPath expression of constraint", formalDefinition="A [FHIRPath](http://hl7.org/fluentpath) expression of constraint that can be executed to see if this constraint is met." )
2527        protected StringType expression;
2528
2529        /**
2530         * An XPath expression of constraint that can be executed to see if this constraint is met.
2531         */
2532        @Child(name = "xpath", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
2533        @Description(shortDefinition="XPath expression of constraint", formalDefinition="An XPath expression of constraint that can be executed to see if this constraint is met." )
2534        protected StringType xpath;
2535
2536        /**
2537         * A reference to the original source of the constraint, for traceability purposes.
2538         */
2539        @Child(name = "source", type = {UriType.class}, order=7, min=0, max=1, modifier=false, summary=true)
2540        @Description(shortDefinition="Reference to original source of constraint", formalDefinition="A reference to the original source of the constraint, for traceability purposes." )
2541        protected UriType source;
2542
2543        private static final long serialVersionUID = 1860862205L;
2544
2545    /**
2546     * Constructor
2547     */
2548      public ElementDefinitionConstraintComponent() {
2549        super();
2550      }
2551
2552    /**
2553     * Constructor
2554     */
2555      public ElementDefinitionConstraintComponent(IdType key, Enumeration<ConstraintSeverity> severity, StringType human, StringType expression) {
2556        super();
2557        this.key = key;
2558        this.severity = severity;
2559        this.human = human;
2560        this.expression = expression;
2561      }
2562
2563        /**
2564         * @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
2565         */
2566        public IdType getKeyElement() { 
2567          if (this.key == null)
2568            if (Configuration.errorOnAutoCreate())
2569              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.key");
2570            else if (Configuration.doAutoCreate())
2571              this.key = new IdType(); // bb
2572          return this.key;
2573        }
2574
2575        public boolean hasKeyElement() { 
2576          return this.key != null && !this.key.isEmpty();
2577        }
2578
2579        public boolean hasKey() { 
2580          return this.key != null && !this.key.isEmpty();
2581        }
2582
2583        /**
2584         * @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
2585         */
2586        public ElementDefinitionConstraintComponent setKeyElement(IdType value) { 
2587          this.key = value;
2588          return this;
2589        }
2590
2591        /**
2592         * @return Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
2593         */
2594        public String getKey() { 
2595          return this.key == null ? null : this.key.getValue();
2596        }
2597
2598        /**
2599         * @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.
2600         */
2601        public ElementDefinitionConstraintComponent setKey(String value) { 
2602            if (this.key == null)
2603              this.key = new IdType();
2604            this.key.setValue(value);
2605          return this;
2606        }
2607
2608        /**
2609         * @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
2610         */
2611        public StringType getRequirementsElement() { 
2612          if (this.requirements == null)
2613            if (Configuration.errorOnAutoCreate())
2614              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.requirements");
2615            else if (Configuration.doAutoCreate())
2616              this.requirements = new StringType(); // bb
2617          return this.requirements;
2618        }
2619
2620        public boolean hasRequirementsElement() { 
2621          return this.requirements != null && !this.requirements.isEmpty();
2622        }
2623
2624        public boolean hasRequirements() { 
2625          return this.requirements != null && !this.requirements.isEmpty();
2626        }
2627
2628        /**
2629         * @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
2630         */
2631        public ElementDefinitionConstraintComponent setRequirementsElement(StringType value) { 
2632          this.requirements = value;
2633          return this;
2634        }
2635
2636        /**
2637         * @return Description of why this constraint is necessary or appropriate.
2638         */
2639        public String getRequirements() { 
2640          return this.requirements == null ? null : this.requirements.getValue();
2641        }
2642
2643        /**
2644         * @param value Description of why this constraint is necessary or appropriate.
2645         */
2646        public ElementDefinitionConstraintComponent setRequirements(String value) { 
2647          if (Utilities.noString(value))
2648            this.requirements = null;
2649          else {
2650            if (this.requirements == null)
2651              this.requirements = new StringType();
2652            this.requirements.setValue(value);
2653          }
2654          return this;
2655        }
2656
2657        /**
2658         * @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
2659         */
2660        public Enumeration<ConstraintSeverity> getSeverityElement() { 
2661          if (this.severity == null)
2662            if (Configuration.errorOnAutoCreate())
2663              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.severity");
2664            else if (Configuration.doAutoCreate())
2665              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory()); // bb
2666          return this.severity;
2667        }
2668
2669        public boolean hasSeverityElement() { 
2670          return this.severity != null && !this.severity.isEmpty();
2671        }
2672
2673        public boolean hasSeverity() { 
2674          return this.severity != null && !this.severity.isEmpty();
2675        }
2676
2677        /**
2678         * @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
2679         */
2680        public ElementDefinitionConstraintComponent setSeverityElement(Enumeration<ConstraintSeverity> value) { 
2681          this.severity = value;
2682          return this;
2683        }
2684
2685        /**
2686         * @return Identifies the impact constraint violation has on the conformance of the instance.
2687         */
2688        public ConstraintSeverity getSeverity() { 
2689          return this.severity == null ? null : this.severity.getValue();
2690        }
2691
2692        /**
2693         * @param value Identifies the impact constraint violation has on the conformance of the instance.
2694         */
2695        public ElementDefinitionConstraintComponent setSeverity(ConstraintSeverity value) { 
2696            if (this.severity == null)
2697              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory());
2698            this.severity.setValue(value);
2699          return this;
2700        }
2701
2702        /**
2703         * @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
2704         */
2705        public StringType getHumanElement() { 
2706          if (this.human == null)
2707            if (Configuration.errorOnAutoCreate())
2708              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.human");
2709            else if (Configuration.doAutoCreate())
2710              this.human = new StringType(); // bb
2711          return this.human;
2712        }
2713
2714        public boolean hasHumanElement() { 
2715          return this.human != null && !this.human.isEmpty();
2716        }
2717
2718        public boolean hasHuman() { 
2719          return this.human != null && !this.human.isEmpty();
2720        }
2721
2722        /**
2723         * @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
2724         */
2725        public ElementDefinitionConstraintComponent setHumanElement(StringType value) { 
2726          this.human = value;
2727          return this;
2728        }
2729
2730        /**
2731         * @return Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
2732         */
2733        public String getHuman() { 
2734          return this.human == null ? null : this.human.getValue();
2735        }
2736
2737        /**
2738         * @param value Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
2739         */
2740        public ElementDefinitionConstraintComponent setHuman(String value) { 
2741            if (this.human == null)
2742              this.human = new StringType();
2743            this.human.setValue(value);
2744          return this;
2745        }
2746
2747        /**
2748         * @return {@link #expression} (A [FHIRPath](http://hl7.org/fluentpath) 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
2749         */
2750        public StringType getExpressionElement() { 
2751          if (this.expression == null)
2752            if (Configuration.errorOnAutoCreate())
2753              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.expression");
2754            else if (Configuration.doAutoCreate())
2755              this.expression = new StringType(); // bb
2756          return this.expression;
2757        }
2758
2759        public boolean hasExpressionElement() { 
2760          return this.expression != null && !this.expression.isEmpty();
2761        }
2762
2763        public boolean hasExpression() { 
2764          return this.expression != null && !this.expression.isEmpty();
2765        }
2766
2767        /**
2768         * @param value {@link #expression} (A [FHIRPath](http://hl7.org/fluentpath) 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
2769         */
2770        public ElementDefinitionConstraintComponent setExpressionElement(StringType value) { 
2771          this.expression = value;
2772          return this;
2773        }
2774
2775        /**
2776         * @return A [FHIRPath](http://hl7.org/fluentpath) expression of constraint that can be executed to see if this constraint is met.
2777         */
2778        public String getExpression() { 
2779          return this.expression == null ? null : this.expression.getValue();
2780        }
2781
2782        /**
2783         * @param value A [FHIRPath](http://hl7.org/fluentpath) expression of constraint that can be executed to see if this constraint is met.
2784         */
2785        public ElementDefinitionConstraintComponent setExpression(String value) { 
2786            if (this.expression == null)
2787              this.expression = new StringType();
2788            this.expression.setValue(value);
2789          return this;
2790        }
2791
2792        /**
2793         * @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
2794         */
2795        public StringType getXpathElement() { 
2796          if (this.xpath == null)
2797            if (Configuration.errorOnAutoCreate())
2798              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.xpath");
2799            else if (Configuration.doAutoCreate())
2800              this.xpath = new StringType(); // bb
2801          return this.xpath;
2802        }
2803
2804        public boolean hasXpathElement() { 
2805          return this.xpath != null && !this.xpath.isEmpty();
2806        }
2807
2808        public boolean hasXpath() { 
2809          return this.xpath != null && !this.xpath.isEmpty();
2810        }
2811
2812        /**
2813         * @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
2814         */
2815        public ElementDefinitionConstraintComponent setXpathElement(StringType value) { 
2816          this.xpath = value;
2817          return this;
2818        }
2819
2820        /**
2821         * @return An XPath expression of constraint that can be executed to see if this constraint is met.
2822         */
2823        public String getXpath() { 
2824          return this.xpath == null ? null : this.xpath.getValue();
2825        }
2826
2827        /**
2828         * @param value An XPath expression of constraint that can be executed to see if this constraint is met.
2829         */
2830        public ElementDefinitionConstraintComponent setXpath(String value) { 
2831          if (Utilities.noString(value))
2832            this.xpath = null;
2833          else {
2834            if (this.xpath == null)
2835              this.xpath = new StringType();
2836            this.xpath.setValue(value);
2837          }
2838          return this;
2839        }
2840
2841        /**
2842         * @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
2843         */
2844        public UriType getSourceElement() { 
2845          if (this.source == null)
2846            if (Configuration.errorOnAutoCreate())
2847              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.source");
2848            else if (Configuration.doAutoCreate())
2849              this.source = new UriType(); // bb
2850          return this.source;
2851        }
2852
2853        public boolean hasSourceElement() { 
2854          return this.source != null && !this.source.isEmpty();
2855        }
2856
2857        public boolean hasSource() { 
2858          return this.source != null && !this.source.isEmpty();
2859        }
2860
2861        /**
2862         * @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
2863         */
2864        public ElementDefinitionConstraintComponent setSourceElement(UriType value) { 
2865          this.source = value;
2866          return this;
2867        }
2868
2869        /**
2870         * @return A reference to the original source of the constraint, for traceability purposes.
2871         */
2872        public String getSource() { 
2873          return this.source == null ? null : this.source.getValue();
2874        }
2875
2876        /**
2877         * @param value A reference to the original source of the constraint, for traceability purposes.
2878         */
2879        public ElementDefinitionConstraintComponent setSource(String value) { 
2880          if (Utilities.noString(value))
2881            this.source = null;
2882          else {
2883            if (this.source == null)
2884              this.source = new UriType();
2885            this.source.setValue(value);
2886          }
2887          return this;
2888        }
2889
2890        protected void listChildren(List<Property> childrenList) {
2891          super.listChildren(childrenList);
2892          childrenList.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, java.lang.Integer.MAX_VALUE, key));
2893          childrenList.add(new Property("requirements", "string", "Description of why this constraint is necessary or appropriate.", 0, java.lang.Integer.MAX_VALUE, requirements));
2894          childrenList.add(new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, java.lang.Integer.MAX_VALUE, severity));
2895          childrenList.add(new Property("human", "string", "Text that can be used to describe the constraint in messages identifying that the constraint has been violated.", 0, java.lang.Integer.MAX_VALUE, human));
2896          childrenList.add(new Property("expression", "string", "A [FHIRPath](http://hl7.org/fluentpath) expression of constraint that can be executed to see if this constraint is met.", 0, java.lang.Integer.MAX_VALUE, expression));
2897          childrenList.add(new Property("xpath", "string", "An XPath expression of constraint that can be executed to see if this constraint is met.", 0, java.lang.Integer.MAX_VALUE, xpath));
2898          childrenList.add(new Property("source", "uri", "A reference to the original source of the constraint, for traceability purposes.", 0, java.lang.Integer.MAX_VALUE, source));
2899        }
2900
2901      @Override
2902      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2903        switch (hash) {
2904        case 106079: /*key*/ return this.key == null ? new Base[0] : new Base[] {this.key}; // IdType
2905        case -1619874672: /*requirements*/ return this.requirements == null ? new Base[0] : new Base[] {this.requirements}; // StringType
2906        case 1478300413: /*severity*/ return this.severity == null ? new Base[0] : new Base[] {this.severity}; // Enumeration<ConstraintSeverity>
2907        case 99639597: /*human*/ return this.human == null ? new Base[0] : new Base[] {this.human}; // StringType
2908        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
2909        case 114256029: /*xpath*/ return this.xpath == null ? new Base[0] : new Base[] {this.xpath}; // StringType
2910        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // UriType
2911        default: return super.getProperty(hash, name, checkValid);
2912        }
2913
2914      }
2915
2916      @Override
2917      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2918        switch (hash) {
2919        case 106079: // key
2920          this.key = castToId(value); // IdType
2921          return value;
2922        case -1619874672: // requirements
2923          this.requirements = castToString(value); // StringType
2924          return value;
2925        case 1478300413: // severity
2926          value = new ConstraintSeverityEnumFactory().fromType(castToCode(value));
2927          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
2928          return value;
2929        case 99639597: // human
2930          this.human = castToString(value); // StringType
2931          return value;
2932        case -1795452264: // expression
2933          this.expression = castToString(value); // StringType
2934          return value;
2935        case 114256029: // xpath
2936          this.xpath = castToString(value); // StringType
2937          return value;
2938        case -896505829: // source
2939          this.source = castToUri(value); // UriType
2940          return value;
2941        default: return super.setProperty(hash, name, value);
2942        }
2943
2944      }
2945
2946      @Override
2947      public Base setProperty(String name, Base value) throws FHIRException {
2948        if (name.equals("key")) {
2949          this.key = castToId(value); // IdType
2950        } else if (name.equals("requirements")) {
2951          this.requirements = castToString(value); // StringType
2952        } else if (name.equals("severity")) {
2953          value = new ConstraintSeverityEnumFactory().fromType(castToCode(value));
2954          this.severity = (Enumeration) value; // Enumeration<ConstraintSeverity>
2955        } else if (name.equals("human")) {
2956          this.human = castToString(value); // StringType
2957        } else if (name.equals("expression")) {
2958          this.expression = castToString(value); // StringType
2959        } else if (name.equals("xpath")) {
2960          this.xpath = castToString(value); // StringType
2961        } else if (name.equals("source")) {
2962          this.source = castToUri(value); // UriType
2963        } else
2964          return super.setProperty(name, value);
2965        return value;
2966      }
2967
2968      @Override
2969      public Base makeProperty(int hash, String name) throws FHIRException {
2970        switch (hash) {
2971        case 106079:  return getKeyElement();
2972        case -1619874672:  return getRequirementsElement();
2973        case 1478300413:  return getSeverityElement();
2974        case 99639597:  return getHumanElement();
2975        case -1795452264:  return getExpressionElement();
2976        case 114256029:  return getXpathElement();
2977        case -896505829:  return getSourceElement();
2978        default: return super.makeProperty(hash, name);
2979        }
2980
2981      }
2982
2983      @Override
2984      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2985        switch (hash) {
2986        case 106079: /*key*/ return new String[] {"id"};
2987        case -1619874672: /*requirements*/ return new String[] {"string"};
2988        case 1478300413: /*severity*/ return new String[] {"code"};
2989        case 99639597: /*human*/ return new String[] {"string"};
2990        case -1795452264: /*expression*/ return new String[] {"string"};
2991        case 114256029: /*xpath*/ return new String[] {"string"};
2992        case -896505829: /*source*/ return new String[] {"uri"};
2993        default: return super.getTypesForProperty(hash, name);
2994        }
2995
2996      }
2997
2998      @Override
2999      public Base addChild(String name) throws FHIRException {
3000        if (name.equals("key")) {
3001          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.key");
3002        }
3003        else if (name.equals("requirements")) {
3004          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.requirements");
3005        }
3006        else if (name.equals("severity")) {
3007          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.severity");
3008        }
3009        else if (name.equals("human")) {
3010          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.human");
3011        }
3012        else if (name.equals("expression")) {
3013          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.expression");
3014        }
3015        else if (name.equals("xpath")) {
3016          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.xpath");
3017        }
3018        else if (name.equals("source")) {
3019          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.source");
3020        }
3021        else
3022          return super.addChild(name);
3023      }
3024
3025      public ElementDefinitionConstraintComponent copy() {
3026        ElementDefinitionConstraintComponent dst = new ElementDefinitionConstraintComponent();
3027        copyValues(dst);
3028        dst.key = key == null ? null : key.copy();
3029        dst.requirements = requirements == null ? null : requirements.copy();
3030        dst.severity = severity == null ? null : severity.copy();
3031        dst.human = human == null ? null : human.copy();
3032        dst.expression = expression == null ? null : expression.copy();
3033        dst.xpath = xpath == null ? null : xpath.copy();
3034        dst.source = source == null ? null : source.copy();
3035        return dst;
3036      }
3037
3038      @Override
3039      public boolean equalsDeep(Base other) {
3040        if (!super.equalsDeep(other))
3041          return false;
3042        if (!(other instanceof ElementDefinitionConstraintComponent))
3043          return false;
3044        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other;
3045        return compareDeep(key, o.key, true) && compareDeep(requirements, o.requirements, true) && compareDeep(severity, o.severity, true)
3046           && compareDeep(human, o.human, true) && compareDeep(expression, o.expression, true) && compareDeep(xpath, o.xpath, true)
3047           && compareDeep(source, o.source, true);
3048      }
3049
3050      @Override
3051      public boolean equalsShallow(Base other) {
3052        if (!super.equalsShallow(other))
3053          return false;
3054        if (!(other instanceof ElementDefinitionConstraintComponent))
3055          return false;
3056        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other;
3057        return compareValues(key, o.key, true) && compareValues(requirements, o.requirements, true) && compareValues(severity, o.severity, true)
3058           && compareValues(human, o.human, true) && compareValues(expression, o.expression, true) && compareValues(xpath, o.xpath, true)
3059           && compareValues(source, o.source, true);
3060      }
3061
3062      public boolean isEmpty() {
3063        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(key, requirements, severity
3064          , human, expression, xpath, source);
3065      }
3066
3067  public String fhirType() {
3068    return "ElementDefinition.constraint";
3069
3070  }
3071
3072  }
3073
3074    @Block()
3075    public static class ElementDefinitionBindingComponent extends Element implements IBaseDatatypeElement {
3076        /**
3077         * 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.
3078         */
3079        @Child(name = "strength", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
3080        @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." )
3081        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/binding-strength")
3082        protected Enumeration<BindingStrength> strength;
3083
3084        /**
3085         * Describes the intended use of this particular set of codes.
3086         */
3087        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
3088        @Description(shortDefinition="Human explanation of the value set", formalDefinition="Describes the intended use of this particular set of codes." )
3089        protected StringType description;
3090
3091        /**
3092         * Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used. If the binding refers to an explicit value set - the normal case - then use a Reference(ValueSet) preferably containing the canonical URL for the value set. If the reference is to an implicit value set - usually, an IETF RFC that defines a grammar, such as mime types - then use a uri.
3093         */
3094        @Child(name = "valueSet", type = {UriType.class, ValueSet.class}, order=3, min=0, max=1, modifier=false, summary=true)
3095        @Description(shortDefinition="Source of value set", formalDefinition="Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used. If the binding refers to an explicit value set - the normal case - then use a Reference(ValueSet) preferably containing the canonical URL for the value set. If the reference is to an implicit value set - usually, an IETF RFC that defines a grammar, such as mime types - then use a uri." )
3096        protected Type valueSet;
3097
3098        private static final long serialVersionUID = 1355538460L;
3099
3100    /**
3101     * Constructor
3102     */
3103      public ElementDefinitionBindingComponent() {
3104        super();
3105      }
3106
3107    /**
3108     * Constructor
3109     */
3110      public ElementDefinitionBindingComponent(Enumeration<BindingStrength> strength) {
3111        super();
3112        this.strength = strength;
3113      }
3114
3115        /**
3116         * @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
3117         */
3118        public Enumeration<BindingStrength> getStrengthElement() { 
3119          if (this.strength == null)
3120            if (Configuration.errorOnAutoCreate())
3121              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.strength");
3122            else if (Configuration.doAutoCreate())
3123              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory()); // bb
3124          return this.strength;
3125        }
3126
3127        public boolean hasStrengthElement() { 
3128          return this.strength != null && !this.strength.isEmpty();
3129        }
3130
3131        public boolean hasStrength() { 
3132          return this.strength != null && !this.strength.isEmpty();
3133        }
3134
3135        /**
3136         * @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
3137         */
3138        public ElementDefinitionBindingComponent setStrengthElement(Enumeration<BindingStrength> value) { 
3139          this.strength = value;
3140          return this;
3141        }
3142
3143        /**
3144         * @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.
3145         */
3146        public BindingStrength getStrength() { 
3147          return this.strength == null ? null : this.strength.getValue();
3148        }
3149
3150        /**
3151         * @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.
3152         */
3153        public ElementDefinitionBindingComponent setStrength(BindingStrength value) { 
3154            if (this.strength == null)
3155              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory());
3156            this.strength.setValue(value);
3157          return this;
3158        }
3159
3160        /**
3161         * @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
3162         */
3163        public StringType getDescriptionElement() { 
3164          if (this.description == null)
3165            if (Configuration.errorOnAutoCreate())
3166              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.description");
3167            else if (Configuration.doAutoCreate())
3168              this.description = new StringType(); // bb
3169          return this.description;
3170        }
3171
3172        public boolean hasDescriptionElement() { 
3173          return this.description != null && !this.description.isEmpty();
3174        }
3175
3176        public boolean hasDescription() { 
3177          return this.description != null && !this.description.isEmpty();
3178        }
3179
3180        /**
3181         * @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
3182         */
3183        public ElementDefinitionBindingComponent setDescriptionElement(StringType value) { 
3184          this.description = value;
3185          return this;
3186        }
3187
3188        /**
3189         * @return Describes the intended use of this particular set of codes.
3190         */
3191        public String getDescription() { 
3192          return this.description == null ? null : this.description.getValue();
3193        }
3194
3195        /**
3196         * @param value Describes the intended use of this particular set of codes.
3197         */
3198        public ElementDefinitionBindingComponent setDescription(String value) { 
3199          if (Utilities.noString(value))
3200            this.description = null;
3201          else {
3202            if (this.description == null)
3203              this.description = new StringType();
3204            this.description.setValue(value);
3205          }
3206          return this;
3207        }
3208
3209        /**
3210         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used. If the binding refers to an explicit value set - the normal case - then use a Reference(ValueSet) preferably containing the canonical URL for the value set. If the reference is to an implicit value set - usually, an IETF RFC that defines a grammar, such as mime types - then use a uri.)
3211         */
3212        public Type getValueSet() { 
3213          return this.valueSet;
3214        }
3215
3216        /**
3217         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used. If the binding refers to an explicit value set - the normal case - then use a Reference(ValueSet) preferably containing the canonical URL for the value set. If the reference is to an implicit value set - usually, an IETF RFC that defines a grammar, such as mime types - then use a uri.)
3218         */
3219        public UriType getValueSetUriType() throws FHIRException { 
3220          if (!(this.valueSet instanceof UriType))
3221            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.valueSet.getClass().getName()+" was encountered");
3222          return (UriType) this.valueSet;
3223        }
3224
3225        public boolean hasValueSetUriType() { 
3226          return this.valueSet instanceof UriType;
3227        }
3228
3229        /**
3230         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used. If the binding refers to an explicit value set - the normal case - then use a Reference(ValueSet) preferably containing the canonical URL for the value set. If the reference is to an implicit value set - usually, an IETF RFC that defines a grammar, such as mime types - then use a uri.)
3231         */
3232        public Reference getValueSetReference() throws FHIRException { 
3233          if (!(this.valueSet instanceof Reference))
3234            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.valueSet.getClass().getName()+" was encountered");
3235          return (Reference) this.valueSet;
3236        }
3237
3238        public boolean hasValueSetReference() { 
3239          return this.valueSet instanceof Reference;
3240        }
3241
3242        public boolean hasValueSet() { 
3243          return this.valueSet != null && !this.valueSet.isEmpty();
3244        }
3245
3246        /**
3247         * @param value {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used. If the binding refers to an explicit value set - the normal case - then use a Reference(ValueSet) preferably containing the canonical URL for the value set. If the reference is to an implicit value set - usually, an IETF RFC that defines a grammar, such as mime types - then use a uri.)
3248         */
3249        public ElementDefinitionBindingComponent setValueSet(Type value) { 
3250          this.valueSet = value;
3251          return this;
3252        }
3253
3254        protected void listChildren(List<Property> childrenList) {
3255          super.listChildren(childrenList);
3256          childrenList.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, java.lang.Integer.MAX_VALUE, strength));
3257          childrenList.add(new Property("description", "string", "Describes the intended use of this particular set of codes.", 0, java.lang.Integer.MAX_VALUE, description));
3258          childrenList.add(new Property("valueSet[x]", "uri|Reference(ValueSet)", "Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used. If the binding refers to an explicit value set - the normal case - then use a Reference(ValueSet) preferably containing the canonical URL for the value set. If the reference is to an implicit value set - usually, an IETF RFC that defines a grammar, such as mime types - then use a uri.", 0, java.lang.Integer.MAX_VALUE, valueSet));
3259        }
3260
3261      @Override
3262      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3263        switch (hash) {
3264        case 1791316033: /*strength*/ return this.strength == null ? new Base[0] : new Base[] {this.strength}; // Enumeration<BindingStrength>
3265        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
3266        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // Type
3267        default: return super.getProperty(hash, name, checkValid);
3268        }
3269
3270      }
3271
3272      @Override
3273      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3274        switch (hash) {
3275        case 1791316033: // strength
3276          value = new BindingStrengthEnumFactory().fromType(castToCode(value));
3277          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
3278          return value;
3279        case -1724546052: // description
3280          this.description = castToString(value); // StringType
3281          return value;
3282        case -1410174671: // valueSet
3283          this.valueSet = castToType(value); // Type
3284          return value;
3285        default: return super.setProperty(hash, name, value);
3286        }
3287
3288      }
3289
3290      @Override
3291      public Base setProperty(String name, Base value) throws FHIRException {
3292        if (name.equals("strength")) {
3293          value = new BindingStrengthEnumFactory().fromType(castToCode(value));
3294          this.strength = (Enumeration) value; // Enumeration<BindingStrength>
3295        } else if (name.equals("description")) {
3296          this.description = castToString(value); // StringType
3297        } else if (name.equals("valueSet[x]")) {
3298          this.valueSet = castToType(value); // Type
3299        } else
3300          return super.setProperty(name, value);
3301        return value;
3302      }
3303
3304      @Override
3305      public Base makeProperty(int hash, String name) throws FHIRException {
3306        switch (hash) {
3307        case 1791316033:  return getStrengthElement();
3308        case -1724546052:  return getDescriptionElement();
3309        case -1438410321:  return getValueSet(); 
3310        case -1410174671:  return getValueSet(); 
3311        default: return super.makeProperty(hash, name);
3312        }
3313
3314      }
3315
3316      @Override
3317      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3318        switch (hash) {
3319        case 1791316033: /*strength*/ return new String[] {"code"};
3320        case -1724546052: /*description*/ return new String[] {"string"};
3321        case -1410174671: /*valueSet*/ return new String[] {"uri", "Reference"};
3322        default: return super.getTypesForProperty(hash, name);
3323        }
3324
3325      }
3326
3327      @Override
3328      public Base addChild(String name) throws FHIRException {
3329        if (name.equals("strength")) {
3330          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.strength");
3331        }
3332        else if (name.equals("description")) {
3333          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.description");
3334        }
3335        else if (name.equals("valueSetUri")) {
3336          this.valueSet = new UriType();
3337          return this.valueSet;
3338        }
3339        else if (name.equals("valueSetReference")) {
3340          this.valueSet = new Reference();
3341          return this.valueSet;
3342        }
3343        else
3344          return super.addChild(name);
3345      }
3346
3347      public ElementDefinitionBindingComponent copy() {
3348        ElementDefinitionBindingComponent dst = new ElementDefinitionBindingComponent();
3349        copyValues(dst);
3350        dst.strength = strength == null ? null : strength.copy();
3351        dst.description = description == null ? null : description.copy();
3352        dst.valueSet = valueSet == null ? null : valueSet.copy();
3353        return dst;
3354      }
3355
3356      @Override
3357      public boolean equalsDeep(Base other) {
3358        if (!super.equalsDeep(other))
3359          return false;
3360        if (!(other instanceof ElementDefinitionBindingComponent))
3361          return false;
3362        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
3363        return compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
3364           && compareDeep(valueSet, o.valueSet, true);
3365      }
3366
3367      @Override
3368      public boolean equalsShallow(Base other) {
3369        if (!super.equalsShallow(other))
3370          return false;
3371        if (!(other instanceof ElementDefinitionBindingComponent))
3372          return false;
3373        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
3374        return compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
3375          ;
3376      }
3377
3378      public boolean isEmpty() {
3379        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(strength, description, valueSet
3380          );
3381      }
3382
3383  public String fhirType() {
3384    return "ElementDefinition.binding";
3385
3386  }
3387
3388  }
3389
3390    @Block()
3391    public static class ElementDefinitionMappingComponent extends Element implements IBaseDatatypeElement {
3392        /**
3393         * An internal reference to the definition of a mapping.
3394         */
3395        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
3396        @Description(shortDefinition="Reference to mapping declaration", formalDefinition="An internal reference to the definition of a mapping." )
3397        protected IdType identity;
3398
3399        /**
3400         * Identifies the computable language in which mapping.map is expressed.
3401         */
3402        @Child(name = "language", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
3403        @Description(shortDefinition="Computable language of mapping", formalDefinition="Identifies the computable language in which mapping.map is expressed." )
3404        protected CodeType language;
3405
3406        /**
3407         * Expresses what part of the target specification corresponds to this element.
3408         */
3409        @Child(name = "map", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
3410        @Description(shortDefinition="Details of the mapping", formalDefinition="Expresses what part of the target specification corresponds to this element." )
3411        protected StringType map;
3412
3413        /**
3414         * Comments that provide information about the mapping or its use.
3415         */
3416        @Child(name = "comment", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3417        @Description(shortDefinition="Comments about the mapping or its use", formalDefinition="Comments that provide information about the mapping or its use." )
3418        protected StringType comment;
3419
3420        private static final long serialVersionUID = 1386816887L;
3421
3422    /**
3423     * Constructor
3424     */
3425      public ElementDefinitionMappingComponent() {
3426        super();
3427      }
3428
3429    /**
3430     * Constructor
3431     */
3432      public ElementDefinitionMappingComponent(IdType identity, StringType map) {
3433        super();
3434        this.identity = identity;
3435        this.map = map;
3436      }
3437
3438        /**
3439         * @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
3440         */
3441        public IdType getIdentityElement() { 
3442          if (this.identity == null)
3443            if (Configuration.errorOnAutoCreate())
3444              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.identity");
3445            else if (Configuration.doAutoCreate())
3446              this.identity = new IdType(); // bb
3447          return this.identity;
3448        }
3449
3450        public boolean hasIdentityElement() { 
3451          return this.identity != null && !this.identity.isEmpty();
3452        }
3453
3454        public boolean hasIdentity() { 
3455          return this.identity != null && !this.identity.isEmpty();
3456        }
3457
3458        /**
3459         * @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
3460         */
3461        public ElementDefinitionMappingComponent setIdentityElement(IdType value) { 
3462          this.identity = value;
3463          return this;
3464        }
3465
3466        /**
3467         * @return An internal reference to the definition of a mapping.
3468         */
3469        public String getIdentity() { 
3470          return this.identity == null ? null : this.identity.getValue();
3471        }
3472
3473        /**
3474         * @param value An internal reference to the definition of a mapping.
3475         */
3476        public ElementDefinitionMappingComponent setIdentity(String value) { 
3477            if (this.identity == null)
3478              this.identity = new IdType();
3479            this.identity.setValue(value);
3480          return this;
3481        }
3482
3483        /**
3484         * @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
3485         */
3486        public CodeType getLanguageElement() { 
3487          if (this.language == null)
3488            if (Configuration.errorOnAutoCreate())
3489              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.language");
3490            else if (Configuration.doAutoCreate())
3491              this.language = new CodeType(); // bb
3492          return this.language;
3493        }
3494
3495        public boolean hasLanguageElement() { 
3496          return this.language != null && !this.language.isEmpty();
3497        }
3498
3499        public boolean hasLanguage() { 
3500          return this.language != null && !this.language.isEmpty();
3501        }
3502
3503        /**
3504         * @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
3505         */
3506        public ElementDefinitionMappingComponent setLanguageElement(CodeType value) { 
3507          this.language = value;
3508          return this;
3509        }
3510
3511        /**
3512         * @return Identifies the computable language in which mapping.map is expressed.
3513         */
3514        public String getLanguage() { 
3515          return this.language == null ? null : this.language.getValue();
3516        }
3517
3518        /**
3519         * @param value Identifies the computable language in which mapping.map is expressed.
3520         */
3521        public ElementDefinitionMappingComponent setLanguage(String value) { 
3522          if (Utilities.noString(value))
3523            this.language = null;
3524          else {
3525            if (this.language == null)
3526              this.language = new CodeType();
3527            this.language.setValue(value);
3528          }
3529          return this;
3530        }
3531
3532        /**
3533         * @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
3534         */
3535        public StringType getMapElement() { 
3536          if (this.map == null)
3537            if (Configuration.errorOnAutoCreate())
3538              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.map");
3539            else if (Configuration.doAutoCreate())
3540              this.map = new StringType(); // bb
3541          return this.map;
3542        }
3543
3544        public boolean hasMapElement() { 
3545          return this.map != null && !this.map.isEmpty();
3546        }
3547
3548        public boolean hasMap() { 
3549          return this.map != null && !this.map.isEmpty();
3550        }
3551
3552        /**
3553         * @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
3554         */
3555        public ElementDefinitionMappingComponent setMapElement(StringType value) { 
3556          this.map = value;
3557          return this;
3558        }
3559
3560        /**
3561         * @return Expresses what part of the target specification corresponds to this element.
3562         */
3563        public String getMap() { 
3564          return this.map == null ? null : this.map.getValue();
3565        }
3566
3567        /**
3568         * @param value Expresses what part of the target specification corresponds to this element.
3569         */
3570        public ElementDefinitionMappingComponent setMap(String value) { 
3571            if (this.map == null)
3572              this.map = new StringType();
3573            this.map.setValue(value);
3574          return this;
3575        }
3576
3577        /**
3578         * @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
3579         */
3580        public StringType getCommentElement() { 
3581          if (this.comment == null)
3582            if (Configuration.errorOnAutoCreate())
3583              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.comment");
3584            else if (Configuration.doAutoCreate())
3585              this.comment = new StringType(); // bb
3586          return this.comment;
3587        }
3588
3589        public boolean hasCommentElement() { 
3590          return this.comment != null && !this.comment.isEmpty();
3591        }
3592
3593        public boolean hasComment() { 
3594          return this.comment != null && !this.comment.isEmpty();
3595        }
3596
3597        /**
3598         * @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
3599         */
3600        public ElementDefinitionMappingComponent setCommentElement(StringType value) { 
3601          this.comment = value;
3602          return this;
3603        }
3604
3605        /**
3606         * @return Comments that provide information about the mapping or its use.
3607         */
3608        public String getComment() { 
3609          return this.comment == null ? null : this.comment.getValue();
3610        }
3611
3612        /**
3613         * @param value Comments that provide information about the mapping or its use.
3614         */
3615        public ElementDefinitionMappingComponent setComment(String value) { 
3616          if (Utilities.noString(value))
3617            this.comment = null;
3618          else {
3619            if (this.comment == null)
3620              this.comment = new StringType();
3621            this.comment.setValue(value);
3622          }
3623          return this;
3624        }
3625
3626        protected void listChildren(List<Property> childrenList) {
3627          super.listChildren(childrenList);
3628          childrenList.add(new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, java.lang.Integer.MAX_VALUE, identity));
3629          childrenList.add(new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, java.lang.Integer.MAX_VALUE, language));
3630          childrenList.add(new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, java.lang.Integer.MAX_VALUE, map));
3631          childrenList.add(new Property("comment", "string", "Comments that provide information about the mapping or its use.", 0, java.lang.Integer.MAX_VALUE, comment));
3632        }
3633
3634      @Override
3635      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3636        switch (hash) {
3637        case -135761730: /*identity*/ return this.identity == null ? new Base[0] : new Base[] {this.identity}; // IdType
3638        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType
3639        case 107868: /*map*/ return this.map == null ? new Base[0] : new Base[] {this.map}; // StringType
3640        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
3641        default: return super.getProperty(hash, name, checkValid);
3642        }
3643
3644      }
3645
3646      @Override
3647      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3648        switch (hash) {
3649        case -135761730: // identity
3650          this.identity = castToId(value); // IdType
3651          return value;
3652        case -1613589672: // language
3653          this.language = castToCode(value); // CodeType
3654          return value;
3655        case 107868: // map
3656          this.map = castToString(value); // StringType
3657          return value;
3658        case 950398559: // comment
3659          this.comment = castToString(value); // StringType
3660          return value;
3661        default: return super.setProperty(hash, name, value);
3662        }
3663
3664      }
3665
3666      @Override
3667      public Base setProperty(String name, Base value) throws FHIRException {
3668        if (name.equals("identity")) {
3669          this.identity = castToId(value); // IdType
3670        } else if (name.equals("language")) {
3671          this.language = castToCode(value); // CodeType
3672        } else if (name.equals("map")) {
3673          this.map = castToString(value); // StringType
3674        } else if (name.equals("comment")) {
3675          this.comment = castToString(value); // StringType
3676        } else
3677          return super.setProperty(name, value);
3678        return value;
3679      }
3680
3681      @Override
3682      public Base makeProperty(int hash, String name) throws FHIRException {
3683        switch (hash) {
3684        case -135761730:  return getIdentityElement();
3685        case -1613589672:  return getLanguageElement();
3686        case 107868:  return getMapElement();
3687        case 950398559:  return getCommentElement();
3688        default: return super.makeProperty(hash, name);
3689        }
3690
3691      }
3692
3693      @Override
3694      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3695        switch (hash) {
3696        case -135761730: /*identity*/ return new String[] {"id"};
3697        case -1613589672: /*language*/ return new String[] {"code"};
3698        case 107868: /*map*/ return new String[] {"string"};
3699        case 950398559: /*comment*/ return new String[] {"string"};
3700        default: return super.getTypesForProperty(hash, name);
3701        }
3702
3703      }
3704
3705      @Override
3706      public Base addChild(String name) throws FHIRException {
3707        if (name.equals("identity")) {
3708          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.identity");
3709        }
3710        else if (name.equals("language")) {
3711          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.language");
3712        }
3713        else if (name.equals("map")) {
3714          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.map");
3715        }
3716        else if (name.equals("comment")) {
3717          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.comment");
3718        }
3719        else
3720          return super.addChild(name);
3721      }
3722
3723      public ElementDefinitionMappingComponent copy() {
3724        ElementDefinitionMappingComponent dst = new ElementDefinitionMappingComponent();
3725        copyValues(dst);
3726        dst.identity = identity == null ? null : identity.copy();
3727        dst.language = language == null ? null : language.copy();
3728        dst.map = map == null ? null : map.copy();
3729        dst.comment = comment == null ? null : comment.copy();
3730        return dst;
3731      }
3732
3733      @Override
3734      public boolean equalsDeep(Base other) {
3735        if (!super.equalsDeep(other))
3736          return false;
3737        if (!(other instanceof ElementDefinitionMappingComponent))
3738          return false;
3739        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other;
3740        return compareDeep(identity, o.identity, true) && compareDeep(language, o.language, true) && compareDeep(map, o.map, true)
3741           && compareDeep(comment, o.comment, true);
3742      }
3743
3744      @Override
3745      public boolean equalsShallow(Base other) {
3746        if (!super.equalsShallow(other))
3747          return false;
3748        if (!(other instanceof ElementDefinitionMappingComponent))
3749          return false;
3750        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other;
3751        return compareValues(identity, o.identity, true) && compareValues(language, o.language, true) && compareValues(map, o.map, true)
3752           && compareValues(comment, o.comment, true);
3753      }
3754
3755      public boolean isEmpty() {
3756        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identity, language, map
3757          , comment);
3758      }
3759
3760  public String fhirType() {
3761    return "ElementDefinition.mapping";
3762
3763  }
3764
3765  }
3766
3767    /**
3768     * The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
3769     */
3770    @Child(name = "path", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=true)
3771    @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." )
3772    protected StringType path;
3773
3774    /**
3775     * Codes that define how this element is represented in instances, when the deviation varies from the normal case.
3776     */
3777    @Child(name = "representation", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3778    @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." )
3779    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/property-representation")
3780    protected List<Enumeration<PropertyRepresentation>> representation;
3781
3782    /**
3783     * 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.
3784     */
3785    @Child(name = "sliceName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
3786    @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." )
3787    protected StringType sliceName;
3788
3789    /**
3790     * 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.
3791     */
3792    @Child(name = "label", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
3793    @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." )
3794    protected StringType label;
3795
3796    /**
3797     * A code that has the same meaning as the element in a particular terminology.
3798     */
3799    @Child(name = "code", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3800    @Description(shortDefinition="Corresponding codes in terminologies", formalDefinition="A code that has the same meaning as the element in a particular terminology." )
3801    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
3802    protected List<Coding> code;
3803
3804    /**
3805     * 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).
3806     */
3807    @Child(name = "slicing", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
3808    @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)." )
3809    protected ElementDefinitionSlicingComponent slicing;
3810
3811    /**
3812     * A concise description of what this element means (e.g. for use in autogenerated summaries).
3813     */
3814    @Child(name = "short", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
3815    @Description(shortDefinition="Concise definition for space-constrained presentation", formalDefinition="A concise description of what this element means (e.g. for use in autogenerated summaries)." )
3816    protected StringType short_;
3817
3818    /**
3819     * 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.
3820     */
3821    @Child(name = "definition", type = {MarkdownType.class}, order=7, min=0, max=1, modifier=false, summary=true)
3822    @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." )
3823    protected MarkdownType definition;
3824
3825    /**
3826     * Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
3827     */
3828    @Child(name = "comment", type = {MarkdownType.class}, order=8, min=0, max=1, modifier=false, summary=true)
3829    @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." )
3830    protected MarkdownType comment;
3831
3832    /**
3833     * 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.
3834     */
3835    @Child(name = "requirements", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=true)
3836    @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." )
3837    protected MarkdownType requirements;
3838
3839    /**
3840     * Identifies additional names by which this element might also be known.
3841     */
3842    @Child(name = "alias", type = {StringType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3843    @Description(shortDefinition="Other names", formalDefinition="Identifies additional names by which this element might also be known." )
3844    protected List<StringType> alias;
3845
3846    /**
3847     * The minimum number of times this element SHALL appear in the instance.
3848     */
3849    @Child(name = "min", type = {UnsignedIntType.class}, order=11, min=0, max=1, modifier=false, summary=true)
3850    @Description(shortDefinition="Minimum Cardinality", formalDefinition="The minimum number of times this element SHALL appear in the instance." )
3851    protected UnsignedIntType min;
3852
3853    /**
3854     * The maximum number of times this element is permitted to appear in the instance.
3855     */
3856    @Child(name = "max", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
3857    @Description(shortDefinition="Maximum Cardinality (a number or *)", formalDefinition="The maximum number of times this element is permitted to appear in the instance." )
3858    protected StringType max;
3859
3860    /**
3861     * 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. This information is provided 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.
3862     */
3863    @Child(name = "base", type = {}, order=13, min=0, max=1, modifier=false, summary=true)
3864    @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. This information is provided 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." )
3865    protected ElementDefinitionBaseComponent base;
3866
3867    /**
3868     * Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.
3869     */
3870    @Child(name = "contentReference", type = {UriType.class}, order=14, min=0, max=1, modifier=false, summary=true)
3871    @Description(shortDefinition="Reference to definition of content for the element", formalDefinition="Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element." )
3872    protected UriType contentReference;
3873
3874    /**
3875     * The data type or resource that the value of this element is permitted to be.
3876     */
3877    @Child(name = "type", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3878    @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." )
3879    protected List<TypeRefComponent> type;
3880
3881    /**
3882     * 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').
3883     */
3884    @Child(name = "defaultValue", type = {}, order=16, min=0, max=1, modifier=false, summary=true)
3885    @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')." )
3886    protected org.hl7.fhir.dstu3.model.Type defaultValue;
3887
3888    /**
3889     * The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.
3890     */
3891    @Child(name = "meaningWhenMissing", type = {MarkdownType.class}, order=17, min=0, max=1, modifier=false, summary=true)
3892    @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'." )
3893    protected MarkdownType meaningWhenMissing;
3894
3895    /**
3896     * 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.
3897     */
3898    @Child(name = "orderMeaning", type = {StringType.class}, order=18, min=0, max=1, modifier=false, summary=true)
3899    @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." )
3900    protected StringType orderMeaning;
3901
3902    /**
3903     * 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.
3904     */
3905    @Child(name = "fixed", type = {}, order=19, min=0, max=1, modifier=false, summary=true)
3906    @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." )
3907    protected org.hl7.fhir.dstu3.model.Type fixed;
3908
3909    /**
3910     * 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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).
3911     */
3912    @Child(name = "pattern", type = {}, order=20, min=0, max=1, modifier=false, summary=true)
3913    @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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.)." )
3914    protected org.hl7.fhir.dstu3.model.Type pattern;
3915
3916    /**
3917     * A sample value for this element demonstrating the type of information that would typically be found in the element.
3918     */
3919    @Child(name = "example", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3920    @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." )
3921    protected List<ElementDefinitionExampleComponent> example;
3922
3923    /**
3924     * 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.
3925     */
3926    @Child(name = "minValue", type = {DateType.class, DateTimeType.class, InstantType.class, TimeType.class, DecimalType.class, IntegerType.class, PositiveIntType.class, UnsignedIntType.class, Quantity.class}, order=22, min=0, max=1, modifier=false, summary=true)
3927    @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." )
3928    protected Type minValue;
3929
3930    /**
3931     * 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.
3932     */
3933    @Child(name = "maxValue", type = {DateType.class, DateTimeType.class, InstantType.class, TimeType.class, DecimalType.class, IntegerType.class, PositiveIntType.class, UnsignedIntType.class, Quantity.class}, order=23, min=0, max=1, modifier=false, summary=true)
3934    @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." )
3935    protected Type maxValue;
3936
3937    /**
3938     * 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.
3939     */
3940    @Child(name = "maxLength", type = {IntegerType.class}, order=24, min=0, max=1, modifier=false, summary=true)
3941    @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." )
3942    protected IntegerType maxLength;
3943
3944    /**
3945     * A reference to an invariant that may make additional statements about the cardinality or value in the instance.
3946     */
3947    @Child(name = "condition", type = {IdType.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3948    @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." )
3949    protected List<IdType> condition;
3950
3951    /**
3952     * Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.
3953     */
3954    @Child(name = "constraint", type = {}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3955    @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." )
3956    protected List<ElementDefinitionConstraintComponent> constraint;
3957
3958    /**
3959     * 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.
3960     */
3961    @Child(name = "mustSupport", type = {BooleanType.class}, order=27, min=0, max=1, modifier=false, summary=true)
3962    @Description(shortDefinition="If the element must 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." )
3963    protected BooleanType mustSupport;
3964
3965    /**
3966     * 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.
3967     */
3968    @Child(name = "isModifier", type = {BooleanType.class}, order=28, min=0, max=1, modifier=false, summary=true)
3969    @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." )
3970    protected BooleanType isModifier;
3971
3972    /**
3973     * Whether the element should be included if a client requests a search with the parameter _summary=true.
3974     */
3975    @Child(name = "isSummary", type = {BooleanType.class}, order=29, min=0, max=1, modifier=false, summary=true)
3976    @Description(shortDefinition="Include when _summary = true?", formalDefinition="Whether the element should be included if a client requests a search with the parameter _summary=true." )
3977    protected BooleanType isSummary;
3978
3979    /**
3980     * Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri).
3981     */
3982    @Child(name = "binding", type = {}, order=30, min=0, max=1, modifier=false, summary=true)
3983    @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)." )
3984    protected ElementDefinitionBindingComponent binding;
3985
3986    /**
3987     * Identifies a concept from an external specification that roughly corresponds to this element.
3988     */
3989    @Child(name = "mapping", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3990    @Description(shortDefinition="Map element to another set of definitions", formalDefinition="Identifies a concept from an external specification that roughly corresponds to this element." )
3991    protected List<ElementDefinitionMappingComponent> mapping;
3992
3993    private static final long serialVersionUID = -278262340L;
3994
3995  /**
3996   * Constructor
3997   */
3998    public ElementDefinition() {
3999      super();
4000    }
4001
4002  /**
4003   * Constructor
4004   */
4005    public ElementDefinition(StringType path) {
4006      super();
4007      this.path = path;
4008    }
4009
4010    /**
4011     * @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
4012     */
4013    public StringType getPathElement() { 
4014      if (this.path == null)
4015        if (Configuration.errorOnAutoCreate())
4016          throw new Error("Attempt to auto-create ElementDefinition.path");
4017        else if (Configuration.doAutoCreate())
4018          this.path = new StringType(); // bb
4019      return this.path;
4020    }
4021
4022    public boolean hasPathElement() { 
4023      return this.path != null && !this.path.isEmpty();
4024    }
4025
4026    public boolean hasPath() { 
4027      return this.path != null && !this.path.isEmpty();
4028    }
4029
4030    /**
4031     * @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
4032     */
4033    public ElementDefinition setPathElement(StringType value) { 
4034      this.path = value;
4035      return this;
4036    }
4037
4038    /**
4039     * @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.
4040     */
4041    public String getPath() { 
4042      return this.path == null ? null : this.path.getValue();
4043    }
4044
4045    /**
4046     * @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.
4047     */
4048    public ElementDefinition setPath(String value) { 
4049        if (this.path == null)
4050          this.path = new StringType();
4051        this.path.setValue(value);
4052      return this;
4053    }
4054
4055    /**
4056     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
4057     */
4058    public List<Enumeration<PropertyRepresentation>> getRepresentation() { 
4059      if (this.representation == null)
4060        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
4061      return this.representation;
4062    }
4063
4064    /**
4065     * @return Returns a reference to <code>this</code> for easy method chaining
4066     */
4067    public ElementDefinition setRepresentation(List<Enumeration<PropertyRepresentation>> theRepresentation) { 
4068      this.representation = theRepresentation;
4069      return this;
4070    }
4071
4072    public boolean hasRepresentation() { 
4073      if (this.representation == null)
4074        return false;
4075      for (Enumeration<PropertyRepresentation> item : this.representation)
4076        if (!item.isEmpty())
4077          return true;
4078      return false;
4079    }
4080
4081    /**
4082     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
4083     */
4084    public Enumeration<PropertyRepresentation> addRepresentationElement() {//2 
4085      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
4086      if (this.representation == null)
4087        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
4088      this.representation.add(t);
4089      return t;
4090    }
4091
4092    /**
4093     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
4094     */
4095    public ElementDefinition addRepresentation(PropertyRepresentation value) { //1
4096      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
4097      t.setValue(value);
4098      if (this.representation == null)
4099        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
4100      this.representation.add(t);
4101      return this;
4102    }
4103
4104    /**
4105     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
4106     */
4107    public boolean hasRepresentation(PropertyRepresentation value) { 
4108      if (this.representation == null)
4109        return false;
4110      for (Enumeration<PropertyRepresentation> v : this.representation)
4111        if (v.getValue().equals(value)) // code
4112          return true;
4113      return false;
4114    }
4115
4116    /**
4117     * @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
4118     */
4119    public StringType getSliceNameElement() { 
4120      if (this.sliceName == null)
4121        if (Configuration.errorOnAutoCreate())
4122          throw new Error("Attempt to auto-create ElementDefinition.sliceName");
4123        else if (Configuration.doAutoCreate())
4124          this.sliceName = new StringType(); // bb
4125      return this.sliceName;
4126    }
4127
4128    public boolean hasSliceNameElement() { 
4129      return this.sliceName != null && !this.sliceName.isEmpty();
4130    }
4131
4132    public boolean hasSliceName() { 
4133      return this.sliceName != null && !this.sliceName.isEmpty();
4134    }
4135
4136    /**
4137     * @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
4138     */
4139    public ElementDefinition setSliceNameElement(StringType value) { 
4140      this.sliceName = value;
4141      return this;
4142    }
4143
4144    /**
4145     * @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.
4146     */
4147    public String getSliceName() { 
4148      return this.sliceName == null ? null : this.sliceName.getValue();
4149    }
4150
4151    /**
4152     * @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.
4153     */
4154    public ElementDefinition setSliceName(String value) { 
4155      if (Utilities.noString(value))
4156        this.sliceName = null;
4157      else {
4158        if (this.sliceName == null)
4159          this.sliceName = new StringType();
4160        this.sliceName.setValue(value);
4161      }
4162      return this;
4163    }
4164
4165    /**
4166     * @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
4167     */
4168    public StringType getLabelElement() { 
4169      if (this.label == null)
4170        if (Configuration.errorOnAutoCreate())
4171          throw new Error("Attempt to auto-create ElementDefinition.label");
4172        else if (Configuration.doAutoCreate())
4173          this.label = new StringType(); // bb
4174      return this.label;
4175    }
4176
4177    public boolean hasLabelElement() { 
4178      return this.label != null && !this.label.isEmpty();
4179    }
4180
4181    public boolean hasLabel() { 
4182      return this.label != null && !this.label.isEmpty();
4183    }
4184
4185    /**
4186     * @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
4187     */
4188    public ElementDefinition setLabelElement(StringType value) { 
4189      this.label = value;
4190      return this;
4191    }
4192
4193    /**
4194     * @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.
4195     */
4196    public String getLabel() { 
4197      return this.label == null ? null : this.label.getValue();
4198    }
4199
4200    /**
4201     * @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.
4202     */
4203    public ElementDefinition setLabel(String value) { 
4204      if (Utilities.noString(value))
4205        this.label = null;
4206      else {
4207        if (this.label == null)
4208          this.label = new StringType();
4209        this.label.setValue(value);
4210      }
4211      return this;
4212    }
4213
4214    /**
4215     * @return {@link #code} (A code that has the same meaning as the element in a particular terminology.)
4216     */
4217    public List<Coding> getCode() { 
4218      if (this.code == null)
4219        this.code = new ArrayList<Coding>();
4220      return this.code;
4221    }
4222
4223    /**
4224     * @return Returns a reference to <code>this</code> for easy method chaining
4225     */
4226    public ElementDefinition setCode(List<Coding> theCode) { 
4227      this.code = theCode;
4228      return this;
4229    }
4230
4231    public boolean hasCode() { 
4232      if (this.code == null)
4233        return false;
4234      for (Coding item : this.code)
4235        if (!item.isEmpty())
4236          return true;
4237      return false;
4238    }
4239
4240    public Coding addCode() { //3
4241      Coding t = new Coding();
4242      if (this.code == null)
4243        this.code = new ArrayList<Coding>();
4244      this.code.add(t);
4245      return t;
4246    }
4247
4248    public ElementDefinition addCode(Coding t) { //3
4249      if (t == null)
4250        return this;
4251      if (this.code == null)
4252        this.code = new ArrayList<Coding>();
4253      this.code.add(t);
4254      return this;
4255    }
4256
4257    /**
4258     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist
4259     */
4260    public Coding getCodeFirstRep() { 
4261      if (getCode().isEmpty()) {
4262        addCode();
4263      }
4264      return getCode().get(0);
4265    }
4266
4267    /**
4268     * @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).)
4269     */
4270    public ElementDefinitionSlicingComponent getSlicing() { 
4271      if (this.slicing == null)
4272        if (Configuration.errorOnAutoCreate())
4273          throw new Error("Attempt to auto-create ElementDefinition.slicing");
4274        else if (Configuration.doAutoCreate())
4275          this.slicing = new ElementDefinitionSlicingComponent(); // cc
4276      return this.slicing;
4277    }
4278
4279    public boolean hasSlicing() { 
4280      return this.slicing != null && !this.slicing.isEmpty();
4281    }
4282
4283    /**
4284     * @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).)
4285     */
4286    public ElementDefinition setSlicing(ElementDefinitionSlicingComponent value) { 
4287      this.slicing = value;
4288      return this;
4289    }
4290
4291    /**
4292     * @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
4293     */
4294    public StringType getShortElement() { 
4295      if (this.short_ == null)
4296        if (Configuration.errorOnAutoCreate())
4297          throw new Error("Attempt to auto-create ElementDefinition.short_");
4298        else if (Configuration.doAutoCreate())
4299          this.short_ = new StringType(); // bb
4300      return this.short_;
4301    }
4302
4303    public boolean hasShortElement() { 
4304      return this.short_ != null && !this.short_.isEmpty();
4305    }
4306
4307    public boolean hasShort() { 
4308      return this.short_ != null && !this.short_.isEmpty();
4309    }
4310
4311    /**
4312     * @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
4313     */
4314    public ElementDefinition setShortElement(StringType value) { 
4315      this.short_ = value;
4316      return this;
4317    }
4318
4319    /**
4320     * @return A concise description of what this element means (e.g. for use in autogenerated summaries).
4321     */
4322    public String getShort() { 
4323      return this.short_ == null ? null : this.short_.getValue();
4324    }
4325
4326    /**
4327     * @param value A concise description of what this element means (e.g. for use in autogenerated summaries).
4328     */
4329    public ElementDefinition setShort(String value) { 
4330      if (Utilities.noString(value))
4331        this.short_ = null;
4332      else {
4333        if (this.short_ == null)
4334          this.short_ = new StringType();
4335        this.short_.setValue(value);
4336      }
4337      return this;
4338    }
4339
4340    /**
4341     * @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.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
4342     */
4343    public MarkdownType getDefinitionElement() { 
4344      if (this.definition == null)
4345        if (Configuration.errorOnAutoCreate())
4346          throw new Error("Attempt to auto-create ElementDefinition.definition");
4347        else if (Configuration.doAutoCreate())
4348          this.definition = new MarkdownType(); // bb
4349      return this.definition;
4350    }
4351
4352    public boolean hasDefinitionElement() { 
4353      return this.definition != null && !this.definition.isEmpty();
4354    }
4355
4356    public boolean hasDefinition() { 
4357      return this.definition != null && !this.definition.isEmpty();
4358    }
4359
4360    /**
4361     * @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.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
4362     */
4363    public ElementDefinition setDefinitionElement(MarkdownType value) { 
4364      this.definition = value;
4365      return this;
4366    }
4367
4368    /**
4369     * @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.
4370     */
4371    public String getDefinition() { 
4372      return this.definition == null ? null : this.definition.getValue();
4373    }
4374
4375    /**
4376     * @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.
4377     */
4378    public ElementDefinition setDefinition(String value) { 
4379      if (value == null)
4380        this.definition = null;
4381      else {
4382        if (this.definition == null)
4383          this.definition = new MarkdownType();
4384        this.definition.setValue(value);
4385      }
4386      return this;
4387    }
4388
4389    /**
4390     * @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.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
4391     */
4392    public MarkdownType getCommentElement() { 
4393      if (this.comment == null)
4394        if (Configuration.errorOnAutoCreate())
4395          throw new Error("Attempt to auto-create ElementDefinition.comment");
4396        else if (Configuration.doAutoCreate())
4397          this.comment = new MarkdownType(); // bb
4398      return this.comment;
4399    }
4400
4401    public boolean hasCommentElement() { 
4402      return this.comment != null && !this.comment.isEmpty();
4403    }
4404
4405    public boolean hasComment() { 
4406      return this.comment != null && !this.comment.isEmpty();
4407    }
4408
4409    /**
4410     * @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.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
4411     */
4412    public ElementDefinition setCommentElement(MarkdownType value) { 
4413      this.comment = value;
4414      return this;
4415    }
4416
4417    /**
4418     * @return Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
4419     */
4420    public String getComment() { 
4421      return this.comment == null ? null : this.comment.getValue();
4422    }
4423
4424    /**
4425     * @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.
4426     */
4427    public ElementDefinition setComment(String value) { 
4428      if (value == null)
4429        this.comment = null;
4430      else {
4431        if (this.comment == null)
4432          this.comment = new MarkdownType();
4433        this.comment.setValue(value);
4434      }
4435      return this;
4436    }
4437
4438    /**
4439     * @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
4440     */
4441    public MarkdownType getRequirementsElement() { 
4442      if (this.requirements == null)
4443        if (Configuration.errorOnAutoCreate())
4444          throw new Error("Attempt to auto-create ElementDefinition.requirements");
4445        else if (Configuration.doAutoCreate())
4446          this.requirements = new MarkdownType(); // bb
4447      return this.requirements;
4448    }
4449
4450    public boolean hasRequirementsElement() { 
4451      return this.requirements != null && !this.requirements.isEmpty();
4452    }
4453
4454    public boolean hasRequirements() { 
4455      return this.requirements != null && !this.requirements.isEmpty();
4456    }
4457
4458    /**
4459     * @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
4460     */
4461    public ElementDefinition setRequirementsElement(MarkdownType value) { 
4462      this.requirements = value;
4463      return this;
4464    }
4465
4466    /**
4467     * @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.
4468     */
4469    public String getRequirements() { 
4470      return this.requirements == null ? null : this.requirements.getValue();
4471    }
4472
4473    /**
4474     * @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.
4475     */
4476    public ElementDefinition setRequirements(String value) { 
4477      if (value == null)
4478        this.requirements = null;
4479      else {
4480        if (this.requirements == null)
4481          this.requirements = new MarkdownType();
4482        this.requirements.setValue(value);
4483      }
4484      return this;
4485    }
4486
4487    /**
4488     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
4489     */
4490    public List<StringType> getAlias() { 
4491      if (this.alias == null)
4492        this.alias = new ArrayList<StringType>();
4493      return this.alias;
4494    }
4495
4496    /**
4497     * @return Returns a reference to <code>this</code> for easy method chaining
4498     */
4499    public ElementDefinition setAlias(List<StringType> theAlias) { 
4500      this.alias = theAlias;
4501      return this;
4502    }
4503
4504    public boolean hasAlias() { 
4505      if (this.alias == null)
4506        return false;
4507      for (StringType item : this.alias)
4508        if (!item.isEmpty())
4509          return true;
4510      return false;
4511    }
4512
4513    /**
4514     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
4515     */
4516    public StringType addAliasElement() {//2 
4517      StringType t = new StringType();
4518      if (this.alias == null)
4519        this.alias = new ArrayList<StringType>();
4520      this.alias.add(t);
4521      return t;
4522    }
4523
4524    /**
4525     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
4526     */
4527    public ElementDefinition addAlias(String value) { //1
4528      StringType t = new StringType();
4529      t.setValue(value);
4530      if (this.alias == null)
4531        this.alias = new ArrayList<StringType>();
4532      this.alias.add(t);
4533      return this;
4534    }
4535
4536    /**
4537     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
4538     */
4539    public boolean hasAlias(String value) { 
4540      if (this.alias == null)
4541        return false;
4542      for (StringType v : this.alias)
4543        if (v.equals(value)) // string
4544          return true;
4545      return false;
4546    }
4547
4548    /**
4549     * @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
4550     */
4551    public UnsignedIntType getMinElement() { 
4552      if (this.min == null)
4553        if (Configuration.errorOnAutoCreate())
4554          throw new Error("Attempt to auto-create ElementDefinition.min");
4555        else if (Configuration.doAutoCreate())
4556          this.min = new UnsignedIntType(); // bb
4557      return this.min;
4558    }
4559
4560    public boolean hasMinElement() { 
4561      return this.min != null && !this.min.isEmpty();
4562    }
4563
4564    public boolean hasMin() { 
4565      return this.min != null && !this.min.isEmpty();
4566    }
4567
4568    /**
4569     * @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
4570     */
4571    public ElementDefinition setMinElement(UnsignedIntType value) { 
4572      this.min = value;
4573      return this;
4574    }
4575
4576    /**
4577     * @return The minimum number of times this element SHALL appear in the instance.
4578     */
4579    public int getMin() { 
4580      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
4581    }
4582
4583    /**
4584     * @param value The minimum number of times this element SHALL appear in the instance.
4585     */
4586    public ElementDefinition setMin(int value) { 
4587        if (this.min == null)
4588          this.min = new UnsignedIntType();
4589        this.min.setValue(value);
4590      return this;
4591    }
4592
4593    /**
4594     * @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
4595     */
4596    public StringType getMaxElement() { 
4597      if (this.max == null)
4598        if (Configuration.errorOnAutoCreate())
4599          throw new Error("Attempt to auto-create ElementDefinition.max");
4600        else if (Configuration.doAutoCreate())
4601          this.max = new StringType(); // bb
4602      return this.max;
4603    }
4604
4605    public boolean hasMaxElement() { 
4606      return this.max != null && !this.max.isEmpty();
4607    }
4608
4609    public boolean hasMax() { 
4610      return this.max != null && !this.max.isEmpty();
4611    }
4612
4613    /**
4614     * @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
4615     */
4616    public ElementDefinition setMaxElement(StringType value) { 
4617      this.max = value;
4618      return this;
4619    }
4620
4621    /**
4622     * @return The maximum number of times this element is permitted to appear in the instance.
4623     */
4624    public String getMax() { 
4625      return this.max == null ? null : this.max.getValue();
4626    }
4627
4628    /**
4629     * @param value The maximum number of times this element is permitted to appear in the instance.
4630     */
4631    public ElementDefinition setMax(String value) { 
4632      if (Utilities.noString(value))
4633        this.max = null;
4634      else {
4635        if (this.max == null)
4636          this.max = new StringType();
4637        this.max.setValue(value);
4638      }
4639      return this;
4640    }
4641
4642    /**
4643     * @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. This information is provided 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.)
4644     */
4645    public ElementDefinitionBaseComponent getBase() { 
4646      if (this.base == null)
4647        if (Configuration.errorOnAutoCreate())
4648          throw new Error("Attempt to auto-create ElementDefinition.base");
4649        else if (Configuration.doAutoCreate())
4650          this.base = new ElementDefinitionBaseComponent(); // cc
4651      return this.base;
4652    }
4653
4654    public boolean hasBase() { 
4655      return this.base != null && !this.base.isEmpty();
4656    }
4657
4658    /**
4659     * @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. This information is provided 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.)
4660     */
4661    public ElementDefinition setBase(ElementDefinitionBaseComponent value) { 
4662      this.base = value;
4663      return this;
4664    }
4665
4666    /**
4667     * @return {@link #contentReference} (Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.). This is the underlying object with id, value and extensions. The accessor "getContentReference" gives direct access to the value
4668     */
4669    public UriType getContentReferenceElement() { 
4670      if (this.contentReference == null)
4671        if (Configuration.errorOnAutoCreate())
4672          throw new Error("Attempt to auto-create ElementDefinition.contentReference");
4673        else if (Configuration.doAutoCreate())
4674          this.contentReference = new UriType(); // bb
4675      return this.contentReference;
4676    }
4677
4678    public boolean hasContentReferenceElement() { 
4679      return this.contentReference != null && !this.contentReference.isEmpty();
4680    }
4681
4682    public boolean hasContentReference() { 
4683      return this.contentReference != null && !this.contentReference.isEmpty();
4684    }
4685
4686    /**
4687     * @param value {@link #contentReference} (Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.). This is the underlying object with id, value and extensions. The accessor "getContentReference" gives direct access to the value
4688     */
4689    public ElementDefinition setContentReferenceElement(UriType value) { 
4690      this.contentReference = value;
4691      return this;
4692    }
4693
4694    /**
4695     * @return Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.
4696     */
4697    public String getContentReference() { 
4698      return this.contentReference == null ? null : this.contentReference.getValue();
4699    }
4700
4701    /**
4702     * @param value Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.
4703     */
4704    public ElementDefinition setContentReference(String value) { 
4705      if (Utilities.noString(value))
4706        this.contentReference = null;
4707      else {
4708        if (this.contentReference == null)
4709          this.contentReference = new UriType();
4710        this.contentReference.setValue(value);
4711      }
4712      return this;
4713    }
4714
4715    /**
4716     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
4717     */
4718    public List<TypeRefComponent> getType() { 
4719      if (this.type == null)
4720        this.type = new ArrayList<TypeRefComponent>();
4721      return this.type;
4722    }
4723
4724    /**
4725     * @return Returns a reference to <code>this</code> for easy method chaining
4726     */
4727    public ElementDefinition setType(List<TypeRefComponent> theType) { 
4728      this.type = theType;
4729      return this;
4730    }
4731
4732    public boolean hasType() { 
4733      if (this.type == null)
4734        return false;
4735      for (TypeRefComponent item : this.type)
4736        if (!item.isEmpty())
4737          return true;
4738      return false;
4739    }
4740
4741    public TypeRefComponent addType() { //3
4742      TypeRefComponent t = new TypeRefComponent();
4743      if (this.type == null)
4744        this.type = new ArrayList<TypeRefComponent>();
4745      this.type.add(t);
4746      return t;
4747    }
4748
4749    public ElementDefinition addType(TypeRefComponent t) { //3
4750      if (t == null)
4751        return this;
4752      if (this.type == null)
4753        this.type = new ArrayList<TypeRefComponent>();
4754      this.type.add(t);
4755      return this;
4756    }
4757
4758    /**
4759     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
4760     */
4761    public TypeRefComponent getTypeFirstRep() { 
4762      if (getType().isEmpty()) {
4763        addType();
4764      }
4765      return getType().get(0);
4766    }
4767
4768    /**
4769     * @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').)
4770     */
4771    public org.hl7.fhir.dstu3.model.Type getDefaultValue() { 
4772      return this.defaultValue;
4773    }
4774
4775    public boolean hasDefaultValue() { 
4776      return this.defaultValue != null && !this.defaultValue.isEmpty();
4777    }
4778
4779    /**
4780     * @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').)
4781     */
4782    public ElementDefinition setDefaultValue(org.hl7.fhir.dstu3.model.Type value) { 
4783      this.defaultValue = value;
4784      return this;
4785    }
4786
4787    /**
4788     * @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
4789     */
4790    public MarkdownType getMeaningWhenMissingElement() { 
4791      if (this.meaningWhenMissing == null)
4792        if (Configuration.errorOnAutoCreate())
4793          throw new Error("Attempt to auto-create ElementDefinition.meaningWhenMissing");
4794        else if (Configuration.doAutoCreate())
4795          this.meaningWhenMissing = new MarkdownType(); // bb
4796      return this.meaningWhenMissing;
4797    }
4798
4799    public boolean hasMeaningWhenMissingElement() { 
4800      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
4801    }
4802
4803    public boolean hasMeaningWhenMissing() { 
4804      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
4805    }
4806
4807    /**
4808     * @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
4809     */
4810    public ElementDefinition setMeaningWhenMissingElement(MarkdownType value) { 
4811      this.meaningWhenMissing = value;
4812      return this;
4813    }
4814
4815    /**
4816     * @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'.
4817     */
4818    public String getMeaningWhenMissing() { 
4819      return this.meaningWhenMissing == null ? null : this.meaningWhenMissing.getValue();
4820    }
4821
4822    /**
4823     * @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'.
4824     */
4825    public ElementDefinition setMeaningWhenMissing(String value) { 
4826      if (value == null)
4827        this.meaningWhenMissing = null;
4828      else {
4829        if (this.meaningWhenMissing == null)
4830          this.meaningWhenMissing = new MarkdownType();
4831        this.meaningWhenMissing.setValue(value);
4832      }
4833      return this;
4834    }
4835
4836    /**
4837     * @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
4838     */
4839    public StringType getOrderMeaningElement() { 
4840      if (this.orderMeaning == null)
4841        if (Configuration.errorOnAutoCreate())
4842          throw new Error("Attempt to auto-create ElementDefinition.orderMeaning");
4843        else if (Configuration.doAutoCreate())
4844          this.orderMeaning = new StringType(); // bb
4845      return this.orderMeaning;
4846    }
4847
4848    public boolean hasOrderMeaningElement() { 
4849      return this.orderMeaning != null && !this.orderMeaning.isEmpty();
4850    }
4851
4852    public boolean hasOrderMeaning() { 
4853      return this.orderMeaning != null && !this.orderMeaning.isEmpty();
4854    }
4855
4856    /**
4857     * @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
4858     */
4859    public ElementDefinition setOrderMeaningElement(StringType value) { 
4860      this.orderMeaning = value;
4861      return this;
4862    }
4863
4864    /**
4865     * @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.
4866     */
4867    public String getOrderMeaning() { 
4868      return this.orderMeaning == null ? null : this.orderMeaning.getValue();
4869    }
4870
4871    /**
4872     * @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.
4873     */
4874    public ElementDefinition setOrderMeaning(String value) { 
4875      if (Utilities.noString(value))
4876        this.orderMeaning = null;
4877      else {
4878        if (this.orderMeaning == null)
4879          this.orderMeaning = new StringType();
4880        this.orderMeaning.setValue(value);
4881      }
4882      return this;
4883    }
4884
4885    /**
4886     * @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.)
4887     */
4888    public org.hl7.fhir.dstu3.model.Type getFixed() { 
4889      return this.fixed;
4890    }
4891
4892    public boolean hasFixed() { 
4893      return this.fixed != null && !this.fixed.isEmpty();
4894    }
4895
4896    /**
4897     * @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.)
4898     */
4899    public ElementDefinition setFixed(org.hl7.fhir.dstu3.model.Type value) { 
4900      this.fixed = value;
4901      return this;
4902    }
4903
4904    /**
4905     * @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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).)
4906     */
4907    public org.hl7.fhir.dstu3.model.Type getPattern() { 
4908      return this.pattern;
4909    }
4910
4911    public boolean hasPattern() { 
4912      return this.pattern != null && !this.pattern.isEmpty();
4913    }
4914
4915    /**
4916     * @param value {@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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).)
4917     */
4918    public ElementDefinition setPattern(org.hl7.fhir.dstu3.model.Type value) { 
4919      this.pattern = value;
4920      return this;
4921    }
4922
4923    /**
4924     * @return {@link #example} (A sample value for this element demonstrating the type of information that would typically be found in the element.)
4925     */
4926    public List<ElementDefinitionExampleComponent> getExample() { 
4927      if (this.example == null)
4928        this.example = new ArrayList<ElementDefinitionExampleComponent>();
4929      return this.example;
4930    }
4931
4932    /**
4933     * @return Returns a reference to <code>this</code> for easy method chaining
4934     */
4935    public ElementDefinition setExample(List<ElementDefinitionExampleComponent> theExample) { 
4936      this.example = theExample;
4937      return this;
4938    }
4939
4940    public boolean hasExample() { 
4941      if (this.example == null)
4942        return false;
4943      for (ElementDefinitionExampleComponent item : this.example)
4944        if (!item.isEmpty())
4945          return true;
4946      return false;
4947    }
4948
4949    public ElementDefinitionExampleComponent addExample() { //3
4950      ElementDefinitionExampleComponent t = new ElementDefinitionExampleComponent();
4951      if (this.example == null)
4952        this.example = new ArrayList<ElementDefinitionExampleComponent>();
4953      this.example.add(t);
4954      return t;
4955    }
4956
4957    public ElementDefinition addExample(ElementDefinitionExampleComponent t) { //3
4958      if (t == null)
4959        return this;
4960      if (this.example == null)
4961        this.example = new ArrayList<ElementDefinitionExampleComponent>();
4962      this.example.add(t);
4963      return this;
4964    }
4965
4966    /**
4967     * @return The first repetition of repeating field {@link #example}, creating it if it does not already exist
4968     */
4969    public ElementDefinitionExampleComponent getExampleFirstRep() { 
4970      if (getExample().isEmpty()) {
4971        addExample();
4972      }
4973      return getExample().get(0);
4974    }
4975
4976    /**
4977     * @return {@link #minValue} (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.)
4978     */
4979    public Type getMinValue() { 
4980      return this.minValue;
4981    }
4982
4983    /**
4984     * @return {@link #minValue} (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.)
4985     */
4986    public DateType getMinValueDateType() throws FHIRException { 
4987      if (!(this.minValue instanceof DateType))
4988        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.minValue.getClass().getName()+" was encountered");
4989      return (DateType) this.minValue;
4990    }
4991
4992    public boolean hasMinValueDateType() { 
4993      return this.minValue instanceof DateType;
4994    }
4995
4996    /**
4997     * @return {@link #minValue} (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.)
4998     */
4999    public DateTimeType getMinValueDateTimeType() throws FHIRException { 
5000      if (!(this.minValue instanceof DateTimeType))
5001        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.minValue.getClass().getName()+" was encountered");
5002      return (DateTimeType) this.minValue;
5003    }
5004
5005    public boolean hasMinValueDateTimeType() { 
5006      return this.minValue instanceof DateTimeType;
5007    }
5008
5009    /**
5010     * @return {@link #minValue} (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.)
5011     */
5012    public InstantType getMinValueInstantType() throws FHIRException { 
5013      if (!(this.minValue instanceof InstantType))
5014        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.minValue.getClass().getName()+" was encountered");
5015      return (InstantType) this.minValue;
5016    }
5017
5018    public boolean hasMinValueInstantType() { 
5019      return this.minValue instanceof InstantType;
5020    }
5021
5022    /**
5023     * @return {@link #minValue} (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.)
5024     */
5025    public TimeType getMinValueTimeType() throws FHIRException { 
5026      if (!(this.minValue instanceof TimeType))
5027        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.minValue.getClass().getName()+" was encountered");
5028      return (TimeType) this.minValue;
5029    }
5030
5031    public boolean hasMinValueTimeType() { 
5032      return this.minValue instanceof TimeType;
5033    }
5034
5035    /**
5036     * @return {@link #minValue} (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.)
5037     */
5038    public DecimalType getMinValueDecimalType() throws FHIRException { 
5039      if (!(this.minValue instanceof DecimalType))
5040        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.minValue.getClass().getName()+" was encountered");
5041      return (DecimalType) this.minValue;
5042    }
5043
5044    public boolean hasMinValueDecimalType() { 
5045      return this.minValue instanceof DecimalType;
5046    }
5047
5048    /**
5049     * @return {@link #minValue} (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.)
5050     */
5051    public IntegerType getMinValueIntegerType() throws FHIRException { 
5052      if (!(this.minValue instanceof IntegerType))
5053        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.minValue.getClass().getName()+" was encountered");
5054      return (IntegerType) this.minValue;
5055    }
5056
5057    public boolean hasMinValueIntegerType() { 
5058      return this.minValue instanceof IntegerType;
5059    }
5060
5061    /**
5062     * @return {@link #minValue} (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.)
5063     */
5064    public PositiveIntType getMinValuePositiveIntType() throws FHIRException { 
5065      if (!(this.minValue instanceof PositiveIntType))
5066        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.minValue.getClass().getName()+" was encountered");
5067      return (PositiveIntType) this.minValue;
5068    }
5069
5070    public boolean hasMinValuePositiveIntType() { 
5071      return this.minValue instanceof PositiveIntType;
5072    }
5073
5074    /**
5075     * @return {@link #minValue} (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.)
5076     */
5077    public UnsignedIntType getMinValueUnsignedIntType() throws FHIRException { 
5078      if (!(this.minValue instanceof UnsignedIntType))
5079        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.minValue.getClass().getName()+" was encountered");
5080      return (UnsignedIntType) this.minValue;
5081    }
5082
5083    public boolean hasMinValueUnsignedIntType() { 
5084      return this.minValue instanceof UnsignedIntType;
5085    }
5086
5087    /**
5088     * @return {@link #minValue} (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.)
5089     */
5090    public Quantity getMinValueQuantity() throws FHIRException { 
5091      if (!(this.minValue instanceof Quantity))
5092        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.minValue.getClass().getName()+" was encountered");
5093      return (Quantity) this.minValue;
5094    }
5095
5096    public boolean hasMinValueQuantity() { 
5097      return this.minValue instanceof Quantity;
5098    }
5099
5100    public boolean hasMinValue() { 
5101      return this.minValue != null && !this.minValue.isEmpty();
5102    }
5103
5104    /**
5105     * @param value {@link #minValue} (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.)
5106     */
5107    public ElementDefinition setMinValue(Type value) { 
5108      this.minValue = value;
5109      return this;
5110    }
5111
5112    /**
5113     * @return {@link #maxValue} (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.)
5114     */
5115    public Type getMaxValue() { 
5116      return this.maxValue;
5117    }
5118
5119    /**
5120     * @return {@link #maxValue} (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.)
5121     */
5122    public DateType getMaxValueDateType() throws FHIRException { 
5123      if (!(this.maxValue instanceof DateType))
5124        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5125      return (DateType) this.maxValue;
5126    }
5127
5128    public boolean hasMaxValueDateType() { 
5129      return this.maxValue instanceof DateType;
5130    }
5131
5132    /**
5133     * @return {@link #maxValue} (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.)
5134     */
5135    public DateTimeType getMaxValueDateTimeType() throws FHIRException { 
5136      if (!(this.maxValue instanceof DateTimeType))
5137        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5138      return (DateTimeType) this.maxValue;
5139    }
5140
5141    public boolean hasMaxValueDateTimeType() { 
5142      return this.maxValue instanceof DateTimeType;
5143    }
5144
5145    /**
5146     * @return {@link #maxValue} (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.)
5147     */
5148    public InstantType getMaxValueInstantType() throws FHIRException { 
5149      if (!(this.maxValue instanceof InstantType))
5150        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5151      return (InstantType) this.maxValue;
5152    }
5153
5154    public boolean hasMaxValueInstantType() { 
5155      return this.maxValue instanceof InstantType;
5156    }
5157
5158    /**
5159     * @return {@link #maxValue} (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.)
5160     */
5161    public TimeType getMaxValueTimeType() throws FHIRException { 
5162      if (!(this.maxValue instanceof TimeType))
5163        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5164      return (TimeType) this.maxValue;
5165    }
5166
5167    public boolean hasMaxValueTimeType() { 
5168      return this.maxValue instanceof TimeType;
5169    }
5170
5171    /**
5172     * @return {@link #maxValue} (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.)
5173     */
5174    public DecimalType getMaxValueDecimalType() throws FHIRException { 
5175      if (!(this.maxValue instanceof DecimalType))
5176        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5177      return (DecimalType) this.maxValue;
5178    }
5179
5180    public boolean hasMaxValueDecimalType() { 
5181      return this.maxValue instanceof DecimalType;
5182    }
5183
5184    /**
5185     * @return {@link #maxValue} (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.)
5186     */
5187    public IntegerType getMaxValueIntegerType() throws FHIRException { 
5188      if (!(this.maxValue instanceof IntegerType))
5189        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5190      return (IntegerType) this.maxValue;
5191    }
5192
5193    public boolean hasMaxValueIntegerType() { 
5194      return this.maxValue instanceof IntegerType;
5195    }
5196
5197    /**
5198     * @return {@link #maxValue} (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.)
5199     */
5200    public PositiveIntType getMaxValuePositiveIntType() throws FHIRException { 
5201      if (!(this.maxValue instanceof PositiveIntType))
5202        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5203      return (PositiveIntType) this.maxValue;
5204    }
5205
5206    public boolean hasMaxValuePositiveIntType() { 
5207      return this.maxValue instanceof PositiveIntType;
5208    }
5209
5210    /**
5211     * @return {@link #maxValue} (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.)
5212     */
5213    public UnsignedIntType getMaxValueUnsignedIntType() throws FHIRException { 
5214      if (!(this.maxValue instanceof UnsignedIntType))
5215        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5216      return (UnsignedIntType) this.maxValue;
5217    }
5218
5219    public boolean hasMaxValueUnsignedIntType() { 
5220      return this.maxValue instanceof UnsignedIntType;
5221    }
5222
5223    /**
5224     * @return {@link #maxValue} (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.)
5225     */
5226    public Quantity getMaxValueQuantity() throws FHIRException { 
5227      if (!(this.maxValue instanceof Quantity))
5228        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.maxValue.getClass().getName()+" was encountered");
5229      return (Quantity) this.maxValue;
5230    }
5231
5232    public boolean hasMaxValueQuantity() { 
5233      return this.maxValue instanceof Quantity;
5234    }
5235
5236    public boolean hasMaxValue() { 
5237      return this.maxValue != null && !this.maxValue.isEmpty();
5238    }
5239
5240    /**
5241     * @param value {@link #maxValue} (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.)
5242     */
5243    public ElementDefinition setMaxValue(Type value) { 
5244      this.maxValue = value;
5245      return this;
5246    }
5247
5248    /**
5249     * @return {@link #maxLength} (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.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
5250     */
5251    public IntegerType getMaxLengthElement() { 
5252      if (this.maxLength == null)
5253        if (Configuration.errorOnAutoCreate())
5254          throw new Error("Attempt to auto-create ElementDefinition.maxLength");
5255        else if (Configuration.doAutoCreate())
5256          this.maxLength = new IntegerType(); // bb
5257      return this.maxLength;
5258    }
5259
5260    public boolean hasMaxLengthElement() { 
5261      return this.maxLength != null && !this.maxLength.isEmpty();
5262    }
5263
5264    public boolean hasMaxLength() { 
5265      return this.maxLength != null && !this.maxLength.isEmpty();
5266    }
5267
5268    /**
5269     * @param value {@link #maxLength} (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.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
5270     */
5271    public ElementDefinition setMaxLengthElement(IntegerType value) { 
5272      this.maxLength = value;
5273      return this;
5274    }
5275
5276    /**
5277     * @return 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.
5278     */
5279    public int getMaxLength() { 
5280      return this.maxLength == null || this.maxLength.isEmpty() ? 0 : this.maxLength.getValue();
5281    }
5282
5283    /**
5284     * @param value 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.
5285     */
5286    public ElementDefinition setMaxLength(int value) { 
5287        if (this.maxLength == null)
5288          this.maxLength = new IntegerType();
5289        this.maxLength.setValue(value);
5290      return this;
5291    }
5292
5293    /**
5294     * @return {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
5295     */
5296    public List<IdType> getCondition() { 
5297      if (this.condition == null)
5298        this.condition = new ArrayList<IdType>();
5299      return this.condition;
5300    }
5301
5302    /**
5303     * @return Returns a reference to <code>this</code> for easy method chaining
5304     */
5305    public ElementDefinition setCondition(List<IdType> theCondition) { 
5306      this.condition = theCondition;
5307      return this;
5308    }
5309
5310    public boolean hasCondition() { 
5311      if (this.condition == null)
5312        return false;
5313      for (IdType item : this.condition)
5314        if (!item.isEmpty())
5315          return true;
5316      return false;
5317    }
5318
5319    /**
5320     * @return {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
5321     */
5322    public IdType addConditionElement() {//2 
5323      IdType t = new IdType();
5324      if (this.condition == null)
5325        this.condition = new ArrayList<IdType>();
5326      this.condition.add(t);
5327      return t;
5328    }
5329
5330    /**
5331     * @param value {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
5332     */
5333    public ElementDefinition addCondition(String value) { //1
5334      IdType t = new IdType();
5335      t.setValue(value);
5336      if (this.condition == null)
5337        this.condition = new ArrayList<IdType>();
5338      this.condition.add(t);
5339      return this;
5340    }
5341
5342    /**
5343     * @param value {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
5344     */
5345    public boolean hasCondition(String value) { 
5346      if (this.condition == null)
5347        return false;
5348      for (IdType v : this.condition)
5349        if (v.equals(value)) // id
5350          return true;
5351      return false;
5352    }
5353
5354    /**
5355     * @return {@link #constraint} (Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.)
5356     */
5357    public List<ElementDefinitionConstraintComponent> getConstraint() { 
5358      if (this.constraint == null)
5359        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
5360      return this.constraint;
5361    }
5362
5363    /**
5364     * @return Returns a reference to <code>this</code> for easy method chaining
5365     */
5366    public ElementDefinition setConstraint(List<ElementDefinitionConstraintComponent> theConstraint) { 
5367      this.constraint = theConstraint;
5368      return this;
5369    }
5370
5371    public boolean hasConstraint() { 
5372      if (this.constraint == null)
5373        return false;
5374      for (ElementDefinitionConstraintComponent item : this.constraint)
5375        if (!item.isEmpty())
5376          return true;
5377      return false;
5378    }
5379
5380    public ElementDefinitionConstraintComponent addConstraint() { //3
5381      ElementDefinitionConstraintComponent t = new ElementDefinitionConstraintComponent();
5382      if (this.constraint == null)
5383        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
5384      this.constraint.add(t);
5385      return t;
5386    }
5387
5388    public ElementDefinition addConstraint(ElementDefinitionConstraintComponent t) { //3
5389      if (t == null)
5390        return this;
5391      if (this.constraint == null)
5392        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
5393      this.constraint.add(t);
5394      return this;
5395    }
5396
5397    /**
5398     * @return The first repetition of repeating field {@link #constraint}, creating it if it does not already exist
5399     */
5400    public ElementDefinitionConstraintComponent getConstraintFirstRep() { 
5401      if (getConstraint().isEmpty()) {
5402        addConstraint();
5403      }
5404      return getConstraint().get(0);
5405    }
5406
5407    /**
5408     * @return {@link #mustSupport} (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.). This is the underlying object with id, value and extensions. The accessor "getMustSupport" gives direct access to the value
5409     */
5410    public BooleanType getMustSupportElement() { 
5411      if (this.mustSupport == null)
5412        if (Configuration.errorOnAutoCreate())
5413          throw new Error("Attempt to auto-create ElementDefinition.mustSupport");
5414        else if (Configuration.doAutoCreate())
5415          this.mustSupport = new BooleanType(); // bb
5416      return this.mustSupport;
5417    }
5418
5419    public boolean hasMustSupportElement() { 
5420      return this.mustSupport != null && !this.mustSupport.isEmpty();
5421    }
5422
5423    public boolean hasMustSupport() { 
5424      return this.mustSupport != null && !this.mustSupport.isEmpty();
5425    }
5426
5427    /**
5428     * @param value {@link #mustSupport} (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.). This is the underlying object with id, value and extensions. The accessor "getMustSupport" gives direct access to the value
5429     */
5430    public ElementDefinition setMustSupportElement(BooleanType value) { 
5431      this.mustSupport = value;
5432      return this;
5433    }
5434
5435    /**
5436     * @return 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.
5437     */
5438    public boolean getMustSupport() { 
5439      return this.mustSupport == null || this.mustSupport.isEmpty() ? false : this.mustSupport.getValue();
5440    }
5441
5442    /**
5443     * @param value 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.
5444     */
5445    public ElementDefinition setMustSupport(boolean value) { 
5446        if (this.mustSupport == null)
5447          this.mustSupport = new BooleanType();
5448        this.mustSupport.setValue(value);
5449      return this;
5450    }
5451
5452    /**
5453     * @return {@link #isModifier} (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.). This is the underlying object with id, value and extensions. The accessor "getIsModifier" gives direct access to the value
5454     */
5455    public BooleanType getIsModifierElement() { 
5456      if (this.isModifier == null)
5457        if (Configuration.errorOnAutoCreate())
5458          throw new Error("Attempt to auto-create ElementDefinition.isModifier");
5459        else if (Configuration.doAutoCreate())
5460          this.isModifier = new BooleanType(); // bb
5461      return this.isModifier;
5462    }
5463
5464    public boolean hasIsModifierElement() { 
5465      return this.isModifier != null && !this.isModifier.isEmpty();
5466    }
5467
5468    public boolean hasIsModifier() { 
5469      return this.isModifier != null && !this.isModifier.isEmpty();
5470    }
5471
5472    /**
5473     * @param value {@link #isModifier} (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.). This is the underlying object with id, value and extensions. The accessor "getIsModifier" gives direct access to the value
5474     */
5475    public ElementDefinition setIsModifierElement(BooleanType value) { 
5476      this.isModifier = value;
5477      return this;
5478    }
5479
5480    /**
5481     * @return 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.
5482     */
5483    public boolean getIsModifier() { 
5484      return this.isModifier == null || this.isModifier.isEmpty() ? false : this.isModifier.getValue();
5485    }
5486
5487    /**
5488     * @param value 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.
5489     */
5490    public ElementDefinition setIsModifier(boolean value) { 
5491        if (this.isModifier == null)
5492          this.isModifier = new BooleanType();
5493        this.isModifier.setValue(value);
5494      return this;
5495    }
5496
5497    /**
5498     * @return {@link #isSummary} (Whether the element should be included if a client requests a search with the parameter _summary=true.). This is the underlying object with id, value and extensions. The accessor "getIsSummary" gives direct access to the value
5499     */
5500    public BooleanType getIsSummaryElement() { 
5501      if (this.isSummary == null)
5502        if (Configuration.errorOnAutoCreate())
5503          throw new Error("Attempt to auto-create ElementDefinition.isSummary");
5504        else if (Configuration.doAutoCreate())
5505          this.isSummary = new BooleanType(); // bb
5506      return this.isSummary;
5507    }
5508
5509    public boolean hasIsSummaryElement() { 
5510      return this.isSummary != null && !this.isSummary.isEmpty();
5511    }
5512
5513    public boolean hasIsSummary() { 
5514      return this.isSummary != null && !this.isSummary.isEmpty();
5515    }
5516
5517    /**
5518     * @param value {@link #isSummary} (Whether the element should be included if a client requests a search with the parameter _summary=true.). This is the underlying object with id, value and extensions. The accessor "getIsSummary" gives direct access to the value
5519     */
5520    public ElementDefinition setIsSummaryElement(BooleanType value) { 
5521      this.isSummary = value;
5522      return this;
5523    }
5524
5525    /**
5526     * @return Whether the element should be included if a client requests a search with the parameter _summary=true.
5527     */
5528    public boolean getIsSummary() { 
5529      return this.isSummary == null || this.isSummary.isEmpty() ? false : this.isSummary.getValue();
5530    }
5531
5532    /**
5533     * @param value Whether the element should be included if a client requests a search with the parameter _summary=true.
5534     */
5535    public ElementDefinition setIsSummary(boolean value) { 
5536        if (this.isSummary == null)
5537          this.isSummary = new BooleanType();
5538        this.isSummary.setValue(value);
5539      return this;
5540    }
5541
5542    /**
5543     * @return {@link #binding} (Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri).)
5544     */
5545    public ElementDefinitionBindingComponent getBinding() { 
5546      if (this.binding == null)
5547        if (Configuration.errorOnAutoCreate())
5548          throw new Error("Attempt to auto-create ElementDefinition.binding");
5549        else if (Configuration.doAutoCreate())
5550          this.binding = new ElementDefinitionBindingComponent(); // cc
5551      return this.binding;
5552    }
5553
5554    public boolean hasBinding() { 
5555      return this.binding != null && !this.binding.isEmpty();
5556    }
5557
5558    /**
5559     * @param value {@link #binding} (Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri).)
5560     */
5561    public ElementDefinition setBinding(ElementDefinitionBindingComponent value) { 
5562      this.binding = value;
5563      return this;
5564    }
5565
5566    /**
5567     * @return {@link #mapping} (Identifies a concept from an external specification that roughly corresponds to this element.)
5568     */
5569    public List<ElementDefinitionMappingComponent> getMapping() { 
5570      if (this.mapping == null)
5571        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
5572      return this.mapping;
5573    }
5574
5575    /**
5576     * @return Returns a reference to <code>this</code> for easy method chaining
5577     */
5578    public ElementDefinition setMapping(List<ElementDefinitionMappingComponent> theMapping) { 
5579      this.mapping = theMapping;
5580      return this;
5581    }
5582
5583    public boolean hasMapping() { 
5584      if (this.mapping == null)
5585        return false;
5586      for (ElementDefinitionMappingComponent item : this.mapping)
5587        if (!item.isEmpty())
5588          return true;
5589      return false;
5590    }
5591
5592    public ElementDefinitionMappingComponent addMapping() { //3
5593      ElementDefinitionMappingComponent t = new ElementDefinitionMappingComponent();
5594      if (this.mapping == null)
5595        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
5596      this.mapping.add(t);
5597      return t;
5598    }
5599
5600    public ElementDefinition addMapping(ElementDefinitionMappingComponent t) { //3
5601      if (t == null)
5602        return this;
5603      if (this.mapping == null)
5604        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
5605      this.mapping.add(t);
5606      return this;
5607    }
5608
5609    /**
5610     * @return The first repetition of repeating field {@link #mapping}, creating it if it does not already exist
5611     */
5612    public ElementDefinitionMappingComponent getMappingFirstRep() { 
5613      if (getMapping().isEmpty()) {
5614        addMapping();
5615      }
5616      return getMapping().get(0);
5617    }
5618
5619      protected void listChildren(List<Property> childrenList) {
5620        super.listChildren(childrenList);
5621        childrenList.add(new Property("path", "string", "The path identifies the element and is expressed as a \".\"-separated list of ancestor elements, beginning with the name of the resource or extension.", 0, java.lang.Integer.MAX_VALUE, path));
5622        childrenList.add(new Property("representation", "code", "Codes that define how this element is represented in instances, when the deviation varies from the normal case.", 0, java.lang.Integer.MAX_VALUE, representation));
5623        childrenList.add(new Property("sliceName", "string", "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.", 0, java.lang.Integer.MAX_VALUE, sliceName));
5624        childrenList.add(new Property("label", "string", "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.", 0, java.lang.Integer.MAX_VALUE, label));
5625        childrenList.add(new Property("code", "Coding", "A code that has the same meaning as the element in a particular terminology.", 0, java.lang.Integer.MAX_VALUE, code));
5626        childrenList.add(new Property("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).", 0, java.lang.Integer.MAX_VALUE, slicing));
5627        childrenList.add(new Property("short", "string", "A concise description of what this element means (e.g. for use in autogenerated summaries).", 0, java.lang.Integer.MAX_VALUE, short_));
5628        childrenList.add(new Property("definition", "markdown", "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.", 0, java.lang.Integer.MAX_VALUE, definition));
5629        childrenList.add(new Property("comment", "markdown", "Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.", 0, java.lang.Integer.MAX_VALUE, comment));
5630        childrenList.add(new Property("requirements", "markdown", "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.", 0, java.lang.Integer.MAX_VALUE, requirements));
5631        childrenList.add(new Property("alias", "string", "Identifies additional names by which this element might also be known.", 0, java.lang.Integer.MAX_VALUE, alias));
5632        childrenList.add(new Property("min", "unsignedInt", "The minimum number of times this element SHALL appear in the instance.", 0, java.lang.Integer.MAX_VALUE, min));
5633        childrenList.add(new Property("max", "string", "The maximum number of times this element is permitted to appear in the instance.", 0, java.lang.Integer.MAX_VALUE, max));
5634        childrenList.add(new Property("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. This information is provided 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.", 0, java.lang.Integer.MAX_VALUE, base));
5635        childrenList.add(new Property("contentReference", "uri", "Identifies the identity of an element defined elsewhere in the profile whose content rules should be applied to the current element.", 0, java.lang.Integer.MAX_VALUE, contentReference));
5636        childrenList.add(new Property("type", "", "The data type or resource that the value of this element is permitted to be.", 0, java.lang.Integer.MAX_VALUE, type));
5637        childrenList.add(new Property("defaultValue[x]", "*", "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').", 0, java.lang.Integer.MAX_VALUE, defaultValue));
5638        childrenList.add(new Property("meaningWhenMissing", "markdown", "The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.", 0, java.lang.Integer.MAX_VALUE, meaningWhenMissing));
5639        childrenList.add(new Property("orderMeaning", "string", "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.", 0, java.lang.Integer.MAX_VALUE, orderMeaning));
5640        childrenList.add(new Property("fixed[x]", "*", "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.", 0, java.lang.Integer.MAX_VALUE, fixed));
5641        childrenList.add(new Property("pattern[x]", "*", "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.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).", 0, java.lang.Integer.MAX_VALUE, pattern));
5642        childrenList.add(new Property("example", "", "A sample value for this element demonstrating the type of information that would typically be found in the element.", 0, java.lang.Integer.MAX_VALUE, example));
5643        childrenList.add(new Property("minValue[x]", "date|dateTime|instant|time|decimal|integer|positiveInt|unsignedInt|Quantity", "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.", 0, java.lang.Integer.MAX_VALUE, minValue));
5644        childrenList.add(new Property("maxValue[x]", "date|dateTime|instant|time|decimal|integer|positiveInt|unsignedInt|Quantity", "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.", 0, java.lang.Integer.MAX_VALUE, maxValue));
5645        childrenList.add(new Property("maxLength", "integer", "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.", 0, java.lang.Integer.MAX_VALUE, maxLength));
5646        childrenList.add(new Property("condition", "id", "A reference to an invariant that may make additional statements about the cardinality or value in the instance.", 0, java.lang.Integer.MAX_VALUE, condition));
5647        childrenList.add(new Property("constraint", "", "Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.", 0, java.lang.Integer.MAX_VALUE, constraint));
5648        childrenList.add(new Property("mustSupport", "boolean", "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.", 0, java.lang.Integer.MAX_VALUE, mustSupport));
5649        childrenList.add(new Property("isModifier", "boolean", "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.", 0, java.lang.Integer.MAX_VALUE, isModifier));
5650        childrenList.add(new Property("isSummary", "boolean", "Whether the element should be included if a client requests a search with the parameter _summary=true.", 0, java.lang.Integer.MAX_VALUE, isSummary));
5651        childrenList.add(new Property("binding", "", "Binds to a value set if this element is coded (code, Coding, CodeableConcept, Quantity), or the data types (string, uri).", 0, java.lang.Integer.MAX_VALUE, binding));
5652        childrenList.add(new Property("mapping", "", "Identifies a concept from an external specification that roughly corresponds to this element.", 0, java.lang.Integer.MAX_VALUE, mapping));
5653      }
5654
5655      @Override
5656      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5657        switch (hash) {
5658        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
5659        case -671065907: /*representation*/ return this.representation == null ? new Base[0] : this.representation.toArray(new Base[this.representation.size()]); // Enumeration<PropertyRepresentation>
5660        case -825289923: /*sliceName*/ return this.sliceName == null ? new Base[0] : new Base[] {this.sliceName}; // StringType
5661        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
5662        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
5663        case -2119287345: /*slicing*/ return this.slicing == null ? new Base[0] : new Base[] {this.slicing}; // ElementDefinitionSlicingComponent
5664        case 109413500: /*short*/ return this.short_ == null ? new Base[0] : new Base[] {this.short_}; // StringType
5665        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // MarkdownType
5666        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // MarkdownType
5667        case -1619874672: /*requirements*/ return this.requirements == null ? new Base[0] : new Base[] {this.requirements}; // MarkdownType
5668        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
5669        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // UnsignedIntType
5670        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
5671        case 3016401: /*base*/ return this.base == null ? new Base[0] : new Base[] {this.base}; // ElementDefinitionBaseComponent
5672        case 1193747154: /*contentReference*/ return this.contentReference == null ? new Base[0] : new Base[] {this.contentReference}; // UriType
5673        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // TypeRefComponent
5674        case -659125328: /*defaultValue*/ return this.defaultValue == null ? new Base[0] : new Base[] {this.defaultValue}; // org.hl7.fhir.dstu3.model.Type
5675        case 1857257103: /*meaningWhenMissing*/ return this.meaningWhenMissing == null ? new Base[0] : new Base[] {this.meaningWhenMissing}; // MarkdownType
5676        case 1828196047: /*orderMeaning*/ return this.orderMeaning == null ? new Base[0] : new Base[] {this.orderMeaning}; // StringType
5677        case 97445748: /*fixed*/ return this.fixed == null ? new Base[0] : new Base[] {this.fixed}; // org.hl7.fhir.dstu3.model.Type
5678        case -791090288: /*pattern*/ return this.pattern == null ? new Base[0] : new Base[] {this.pattern}; // org.hl7.fhir.dstu3.model.Type
5679        case -1322970774: /*example*/ return this.example == null ? new Base[0] : this.example.toArray(new Base[this.example.size()]); // ElementDefinitionExampleComponent
5680        case -1376969153: /*minValue*/ return this.minValue == null ? new Base[0] : new Base[] {this.minValue}; // Type
5681        case 399227501: /*maxValue*/ return this.maxValue == null ? new Base[0] : new Base[] {this.maxValue}; // Type
5682        case -791400086: /*maxLength*/ return this.maxLength == null ? new Base[0] : new Base[] {this.maxLength}; // IntegerType
5683        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : this.condition.toArray(new Base[this.condition.size()]); // IdType
5684        case -190376483: /*constraint*/ return this.constraint == null ? new Base[0] : this.constraint.toArray(new Base[this.constraint.size()]); // ElementDefinitionConstraintComponent
5685        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : new Base[] {this.mustSupport}; // BooleanType
5686        case -1408783839: /*isModifier*/ return this.isModifier == null ? new Base[0] : new Base[] {this.isModifier}; // BooleanType
5687        case 1857548060: /*isSummary*/ return this.isSummary == null ? new Base[0] : new Base[] {this.isSummary}; // BooleanType
5688        case -108220795: /*binding*/ return this.binding == null ? new Base[0] : new Base[] {this.binding}; // ElementDefinitionBindingComponent
5689        case 837556430: /*mapping*/ return this.mapping == null ? new Base[0] : this.mapping.toArray(new Base[this.mapping.size()]); // ElementDefinitionMappingComponent
5690        default: return super.getProperty(hash, name, checkValid);
5691        }
5692
5693      }
5694
5695      @Override
5696      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5697        switch (hash) {
5698        case 3433509: // path
5699          this.path = castToString(value); // StringType
5700          return value;
5701        case -671065907: // representation
5702          value = new PropertyRepresentationEnumFactory().fromType(castToCode(value));
5703          this.getRepresentation().add((Enumeration) value); // Enumeration<PropertyRepresentation>
5704          return value;
5705        case -825289923: // sliceName
5706          this.sliceName = castToString(value); // StringType
5707          return value;
5708        case 102727412: // label
5709          this.label = castToString(value); // StringType
5710          return value;
5711        case 3059181: // code
5712          this.getCode().add(castToCoding(value)); // Coding
5713          return value;
5714        case -2119287345: // slicing
5715          this.slicing = (ElementDefinitionSlicingComponent) value; // ElementDefinitionSlicingComponent
5716          return value;
5717        case 109413500: // short
5718          this.short_ = castToString(value); // StringType
5719          return value;
5720        case -1014418093: // definition
5721          this.definition = castToMarkdown(value); // MarkdownType
5722          return value;
5723        case 950398559: // comment
5724          this.comment = castToMarkdown(value); // MarkdownType
5725          return value;
5726        case -1619874672: // requirements
5727          this.requirements = castToMarkdown(value); // MarkdownType
5728          return value;
5729        case 92902992: // alias
5730          this.getAlias().add(castToString(value)); // StringType
5731          return value;
5732        case 108114: // min
5733          this.min = castToUnsignedInt(value); // UnsignedIntType
5734          return value;
5735        case 107876: // max
5736          this.max = castToString(value); // StringType
5737          return value;
5738        case 3016401: // base
5739          this.base = (ElementDefinitionBaseComponent) value; // ElementDefinitionBaseComponent
5740          return value;
5741        case 1193747154: // contentReference
5742          this.contentReference = castToUri(value); // UriType
5743          return value;
5744        case 3575610: // type
5745          this.getType().add((TypeRefComponent) value); // TypeRefComponent
5746          return value;
5747        case -659125328: // defaultValue
5748          this.defaultValue = castToType(value); // org.hl7.fhir.dstu3.model.Type
5749          return value;
5750        case 1857257103: // meaningWhenMissing
5751          this.meaningWhenMissing = castToMarkdown(value); // MarkdownType
5752          return value;
5753        case 1828196047: // orderMeaning
5754          this.orderMeaning = castToString(value); // StringType
5755          return value;
5756        case 97445748: // fixed
5757          this.fixed = castToType(value); // org.hl7.fhir.dstu3.model.Type
5758          return value;
5759        case -791090288: // pattern
5760          this.pattern = castToType(value); // org.hl7.fhir.dstu3.model.Type
5761          return value;
5762        case -1322970774: // example
5763          this.getExample().add((ElementDefinitionExampleComponent) value); // ElementDefinitionExampleComponent
5764          return value;
5765        case -1376969153: // minValue
5766          this.minValue = castToType(value); // Type
5767          return value;
5768        case 399227501: // maxValue
5769          this.maxValue = castToType(value); // Type
5770          return value;
5771        case -791400086: // maxLength
5772          this.maxLength = castToInteger(value); // IntegerType
5773          return value;
5774        case -861311717: // condition
5775          this.getCondition().add(castToId(value)); // IdType
5776          return value;
5777        case -190376483: // constraint
5778          this.getConstraint().add((ElementDefinitionConstraintComponent) value); // ElementDefinitionConstraintComponent
5779          return value;
5780        case -1402857082: // mustSupport
5781          this.mustSupport = castToBoolean(value); // BooleanType
5782          return value;
5783        case -1408783839: // isModifier
5784          this.isModifier = castToBoolean(value); // BooleanType
5785          return value;
5786        case 1857548060: // isSummary
5787          this.isSummary = castToBoolean(value); // BooleanType
5788          return value;
5789        case -108220795: // binding
5790          this.binding = (ElementDefinitionBindingComponent) value; // ElementDefinitionBindingComponent
5791          return value;
5792        case 837556430: // mapping
5793          this.getMapping().add((ElementDefinitionMappingComponent) value); // ElementDefinitionMappingComponent
5794          return value;
5795        default: return super.setProperty(hash, name, value);
5796        }
5797
5798      }
5799
5800      @Override
5801      public Base setProperty(String name, Base value) throws FHIRException {
5802        if (name.equals("path")) {
5803          this.path = castToString(value); // StringType
5804        } else if (name.equals("representation")) {
5805          value = new PropertyRepresentationEnumFactory().fromType(castToCode(value));
5806          this.getRepresentation().add((Enumeration) value);
5807        } else if (name.equals("sliceName")) {
5808          this.sliceName = castToString(value); // StringType
5809        } else if (name.equals("label")) {
5810          this.label = castToString(value); // StringType
5811        } else if (name.equals("code")) {
5812          this.getCode().add(castToCoding(value));
5813        } else if (name.equals("slicing")) {
5814          this.slicing = (ElementDefinitionSlicingComponent) value; // ElementDefinitionSlicingComponent
5815        } else if (name.equals("short")) {
5816          this.short_ = castToString(value); // StringType
5817        } else if (name.equals("definition")) {
5818          this.definition = castToMarkdown(value); // MarkdownType
5819        } else if (name.equals("comment")) {
5820          this.comment = castToMarkdown(value); // MarkdownType
5821        } else if (name.equals("requirements")) {
5822          this.requirements = castToMarkdown(value); // MarkdownType
5823        } else if (name.equals("alias")) {
5824          this.getAlias().add(castToString(value));
5825        } else if (name.equals("min")) {
5826          this.min = castToUnsignedInt(value); // UnsignedIntType
5827        } else if (name.equals("max")) {
5828          this.max = castToString(value); // StringType
5829        } else if (name.equals("base")) {
5830          this.base = (ElementDefinitionBaseComponent) value; // ElementDefinitionBaseComponent
5831        } else if (name.equals("contentReference")) {
5832          this.contentReference = castToUri(value); // UriType
5833        } else if (name.equals("type")) {
5834          this.getType().add((TypeRefComponent) value);
5835        } else if (name.equals("defaultValue[x]")) {
5836          this.defaultValue = castToType(value); // org.hl7.fhir.dstu3.model.Type
5837        } else if (name.equals("meaningWhenMissing")) {
5838          this.meaningWhenMissing = castToMarkdown(value); // MarkdownType
5839        } else if (name.equals("orderMeaning")) {
5840          this.orderMeaning = castToString(value); // StringType
5841        } else if (name.equals("fixed[x]")) {
5842          this.fixed = castToType(value); // org.hl7.fhir.dstu3.model.Type
5843        } else if (name.equals("pattern[x]")) {
5844          this.pattern = castToType(value); // org.hl7.fhir.dstu3.model.Type
5845        } else if (name.equals("example")) {
5846          this.getExample().add((ElementDefinitionExampleComponent) value);
5847        } else if (name.equals("minValue[x]")) {
5848          this.minValue = castToType(value); // Type
5849        } else if (name.equals("maxValue[x]")) {
5850          this.maxValue = castToType(value); // Type
5851        } else if (name.equals("maxLength")) {
5852          this.maxLength = castToInteger(value); // IntegerType
5853        } else if (name.equals("condition")) {
5854          this.getCondition().add(castToId(value));
5855        } else if (name.equals("constraint")) {
5856          this.getConstraint().add((ElementDefinitionConstraintComponent) value);
5857        } else if (name.equals("mustSupport")) {
5858          this.mustSupport = castToBoolean(value); // BooleanType
5859        } else if (name.equals("isModifier")) {
5860          this.isModifier = castToBoolean(value); // BooleanType
5861        } else if (name.equals("isSummary")) {
5862          this.isSummary = castToBoolean(value); // BooleanType
5863        } else if (name.equals("binding")) {
5864          this.binding = (ElementDefinitionBindingComponent) value; // ElementDefinitionBindingComponent
5865        } else if (name.equals("mapping")) {
5866          this.getMapping().add((ElementDefinitionMappingComponent) value);
5867        } else
5868          return super.setProperty(name, value);
5869        return value;
5870      }
5871
5872      @Override
5873      public Base makeProperty(int hash, String name) throws FHIRException {
5874        switch (hash) {
5875        case 3433509:  return getPathElement();
5876        case -671065907:  return addRepresentationElement();
5877        case -825289923:  return getSliceNameElement();
5878        case 102727412:  return getLabelElement();
5879        case 3059181:  return addCode(); 
5880        case -2119287345:  return getSlicing(); 
5881        case 109413500:  return getShortElement();
5882        case -1014418093:  return getDefinitionElement();
5883        case 950398559:  return getCommentElement();
5884        case -1619874672:  return getRequirementsElement();
5885        case 92902992:  return addAliasElement();
5886        case 108114:  return getMinElement();
5887        case 107876:  return getMaxElement();
5888        case 3016401:  return getBase(); 
5889        case 1193747154:  return getContentReferenceElement();
5890        case 3575610:  return addType(); 
5891        case 587922128:  return getDefaultValue(); 
5892        case -659125328:  return getDefaultValue(); 
5893        case 1857257103:  return getMeaningWhenMissingElement();
5894        case 1828196047:  return getOrderMeaningElement();
5895        case -391522164:  return getFixed(); 
5896        case 97445748:  return getFixed(); 
5897        case -885125392:  return getPattern(); 
5898        case -791090288:  return getPattern(); 
5899        case -1322970774:  return addExample(); 
5900        case -55301663:  return getMinValue(); 
5901        case -1376969153:  return getMinValue(); 
5902        case 622130931:  return getMaxValue(); 
5903        case 399227501:  return getMaxValue(); 
5904        case -791400086:  return getMaxLengthElement();
5905        case -861311717:  return addConditionElement();
5906        case -190376483:  return addConstraint(); 
5907        case -1402857082:  return getMustSupportElement();
5908        case -1408783839:  return getIsModifierElement();
5909        case 1857548060:  return getIsSummaryElement();
5910        case -108220795:  return getBinding(); 
5911        case 837556430:  return addMapping(); 
5912        default: return super.makeProperty(hash, name);
5913        }
5914
5915      }
5916
5917      @Override
5918      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5919        switch (hash) {
5920        case 3433509: /*path*/ return new String[] {"string"};
5921        case -671065907: /*representation*/ return new String[] {"code"};
5922        case -825289923: /*sliceName*/ return new String[] {"string"};
5923        case 102727412: /*label*/ return new String[] {"string"};
5924        case 3059181: /*code*/ return new String[] {"Coding"};
5925        case -2119287345: /*slicing*/ return new String[] {};
5926        case 109413500: /*short*/ return new String[] {"string"};
5927        case -1014418093: /*definition*/ return new String[] {"markdown"};
5928        case 950398559: /*comment*/ return new String[] {"markdown"};
5929        case -1619874672: /*requirements*/ return new String[] {"markdown"};
5930        case 92902992: /*alias*/ return new String[] {"string"};
5931        case 108114: /*min*/ return new String[] {"unsignedInt"};
5932        case 107876: /*max*/ return new String[] {"string"};
5933        case 3016401: /*base*/ return new String[] {};
5934        case 1193747154: /*contentReference*/ return new String[] {"uri"};
5935        case 3575610: /*type*/ return new String[] {};
5936        case -659125328: /*defaultValue*/ return new String[] {"*"};
5937        case 1857257103: /*meaningWhenMissing*/ return new String[] {"markdown"};
5938        case 1828196047: /*orderMeaning*/ return new String[] {"string"};
5939        case 97445748: /*fixed*/ return new String[] {"*"};
5940        case -791090288: /*pattern*/ return new String[] {"*"};
5941        case -1322970774: /*example*/ return new String[] {};
5942        case -1376969153: /*minValue*/ return new String[] {"date", "dateTime", "instant", "time", "decimal", "integer", "positiveInt", "unsignedInt", "Quantity"};
5943        case 399227501: /*maxValue*/ return new String[] {"date", "dateTime", "instant", "time", "decimal", "integer", "positiveInt", "unsignedInt", "Quantity"};
5944        case -791400086: /*maxLength*/ return new String[] {"integer"};
5945        case -861311717: /*condition*/ return new String[] {"id"};
5946        case -190376483: /*constraint*/ return new String[] {};
5947        case -1402857082: /*mustSupport*/ return new String[] {"boolean"};
5948        case -1408783839: /*isModifier*/ return new String[] {"boolean"};
5949        case 1857548060: /*isSummary*/ return new String[] {"boolean"};
5950        case -108220795: /*binding*/ return new String[] {};
5951        case 837556430: /*mapping*/ return new String[] {};
5952        default: return super.getTypesForProperty(hash, name);
5953        }
5954
5955      }
5956
5957      @Override
5958      public Base addChild(String name) throws FHIRException {
5959        if (name.equals("path")) {
5960          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
5961        }
5962        else if (name.equals("representation")) {
5963          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.representation");
5964        }
5965        else if (name.equals("sliceName")) {
5966          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.sliceName");
5967        }
5968        else if (name.equals("label")) {
5969          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.label");
5970        }
5971        else if (name.equals("code")) {
5972          return addCode();
5973        }
5974        else if (name.equals("slicing")) {
5975          this.slicing = new ElementDefinitionSlicingComponent();
5976          return this.slicing;
5977        }
5978        else if (name.equals("short")) {
5979          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.short");
5980        }
5981        else if (name.equals("definition")) {
5982          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.definition");
5983        }
5984        else if (name.equals("comment")) {
5985          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.comment");
5986        }
5987        else if (name.equals("requirements")) {
5988          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.requirements");
5989        }
5990        else if (name.equals("alias")) {
5991          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.alias");
5992        }
5993        else if (name.equals("min")) {
5994          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.min");
5995        }
5996        else if (name.equals("max")) {
5997          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.max");
5998        }
5999        else if (name.equals("base")) {
6000          this.base = new ElementDefinitionBaseComponent();
6001          return this.base;
6002        }
6003        else if (name.equals("contentReference")) {
6004          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.contentReference");
6005        }
6006        else if (name.equals("type")) {
6007          return addType();
6008        }
6009        else if (name.equals("defaultValueBoolean")) {
6010          this.defaultValue = new BooleanType();
6011          return this.defaultValue;
6012        }
6013        else if (name.equals("defaultValueInteger")) {
6014          this.defaultValue = new IntegerType();
6015          return this.defaultValue;
6016        }
6017        else if (name.equals("defaultValueDecimal")) {
6018          this.defaultValue = new DecimalType();
6019          return this.defaultValue;
6020        }
6021        else if (name.equals("defaultValueBase64Binary")) {
6022          this.defaultValue = new Base64BinaryType();
6023          return this.defaultValue;
6024        }
6025        else if (name.equals("defaultValueInstant")) {
6026          this.defaultValue = new InstantType();
6027          return this.defaultValue;
6028        }
6029        else if (name.equals("defaultValueString")) {
6030          this.defaultValue = new StringType();
6031          return this.defaultValue;
6032        }
6033        else if (name.equals("defaultValueUri")) {
6034          this.defaultValue = new UriType();
6035          return this.defaultValue;
6036        }
6037        else if (name.equals("defaultValueDate")) {
6038          this.defaultValue = new DateType();
6039          return this.defaultValue;
6040        }
6041        else if (name.equals("defaultValueDateTime")) {
6042          this.defaultValue = new DateTimeType();
6043          return this.defaultValue;
6044        }
6045        else if (name.equals("defaultValueTime")) {
6046          this.defaultValue = new TimeType();
6047          return this.defaultValue;
6048        }
6049        else if (name.equals("defaultValueCode")) {
6050          this.defaultValue = new CodeType();
6051          return this.defaultValue;
6052        }
6053        else if (name.equals("defaultValueOid")) {
6054          this.defaultValue = new OidType();
6055          return this.defaultValue;
6056        }
6057        else if (name.equals("defaultValueId")) {
6058          this.defaultValue = new IdType();
6059          return this.defaultValue;
6060        }
6061        else if (name.equals("defaultValueUnsignedInt")) {
6062          this.defaultValue = new UnsignedIntType();
6063          return this.defaultValue;
6064        }
6065        else if (name.equals("defaultValuePositiveInt")) {
6066          this.defaultValue = new PositiveIntType();
6067          return this.defaultValue;
6068        }
6069        else if (name.equals("defaultValueMarkdown")) {
6070          this.defaultValue = new MarkdownType();
6071          return this.defaultValue;
6072        }
6073        else if (name.equals("defaultValueAnnotation")) {
6074          this.defaultValue = new Annotation();
6075          return this.defaultValue;
6076        }
6077        else if (name.equals("defaultValueAttachment")) {
6078          this.defaultValue = new Attachment();
6079          return this.defaultValue;
6080        }
6081        else if (name.equals("defaultValueIdentifier")) {
6082          this.defaultValue = new Identifier();
6083          return this.defaultValue;
6084        }
6085        else if (name.equals("defaultValueCodeableConcept")) {
6086          this.defaultValue = new CodeableConcept();
6087          return this.defaultValue;
6088        }
6089        else if (name.equals("defaultValueCoding")) {
6090          this.defaultValue = new Coding();
6091          return this.defaultValue;
6092        }
6093        else if (name.equals("defaultValueQuantity")) {
6094          this.defaultValue = new Quantity();
6095          return this.defaultValue;
6096        }
6097        else if (name.equals("defaultValueRange")) {
6098          this.defaultValue = new Range();
6099          return this.defaultValue;
6100        }
6101        else if (name.equals("defaultValuePeriod")) {
6102          this.defaultValue = new Period();
6103          return this.defaultValue;
6104        }
6105        else if (name.equals("defaultValueRatio")) {
6106          this.defaultValue = new Ratio();
6107          return this.defaultValue;
6108        }
6109        else if (name.equals("defaultValueSampledData")) {
6110          this.defaultValue = new SampledData();
6111          return this.defaultValue;
6112        }
6113        else if (name.equals("defaultValueSignature")) {
6114          this.defaultValue = new Signature();
6115          return this.defaultValue;
6116        }
6117        else if (name.equals("defaultValueHumanName")) {
6118          this.defaultValue = new HumanName();
6119          return this.defaultValue;
6120        }
6121        else if (name.equals("defaultValueAddress")) {
6122          this.defaultValue = new Address();
6123          return this.defaultValue;
6124        }
6125        else if (name.equals("defaultValueContactPoint")) {
6126          this.defaultValue = new ContactPoint();
6127          return this.defaultValue;
6128        }
6129        else if (name.equals("defaultValueTiming")) {
6130          this.defaultValue = new Timing();
6131          return this.defaultValue;
6132        }
6133        else if (name.equals("defaultValueReference")) {
6134          this.defaultValue = new Reference();
6135          return this.defaultValue;
6136        }
6137        else if (name.equals("defaultValueMeta")) {
6138          this.defaultValue = new Meta();
6139          return this.defaultValue;
6140        }
6141        else if (name.equals("meaningWhenMissing")) {
6142          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.meaningWhenMissing");
6143        }
6144        else if (name.equals("orderMeaning")) {
6145          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.orderMeaning");
6146        }
6147        else if (name.equals("fixedBoolean")) {
6148          this.fixed = new BooleanType();
6149          return this.fixed;
6150        }
6151        else if (name.equals("fixedInteger")) {
6152          this.fixed = new IntegerType();
6153          return this.fixed;
6154        }
6155        else if (name.equals("fixedDecimal")) {
6156          this.fixed = new DecimalType();
6157          return this.fixed;
6158        }
6159        else if (name.equals("fixedBase64Binary")) {
6160          this.fixed = new Base64BinaryType();
6161          return this.fixed;
6162        }
6163        else if (name.equals("fixedInstant")) {
6164          this.fixed = new InstantType();
6165          return this.fixed;
6166        }
6167        else if (name.equals("fixedString")) {
6168          this.fixed = new StringType();
6169          return this.fixed;
6170        }
6171        else if (name.equals("fixedUri")) {
6172          this.fixed = new UriType();
6173          return this.fixed;
6174        }
6175        else if (name.equals("fixedDate")) {
6176          this.fixed = new DateType();
6177          return this.fixed;
6178        }
6179        else if (name.equals("fixedDateTime")) {
6180          this.fixed = new DateTimeType();
6181          return this.fixed;
6182        }
6183        else if (name.equals("fixedTime")) {
6184          this.fixed = new TimeType();
6185          return this.fixed;
6186        }
6187        else if (name.equals("fixedCode")) {
6188          this.fixed = new CodeType();
6189          return this.fixed;
6190        }
6191        else if (name.equals("fixedOid")) {
6192          this.fixed = new OidType();
6193          return this.fixed;
6194        }
6195        else if (name.equals("fixedId")) {
6196          this.fixed = new IdType();
6197          return this.fixed;
6198        }
6199        else if (name.equals("fixedUnsignedInt")) {
6200          this.fixed = new UnsignedIntType();
6201          return this.fixed;
6202        }
6203        else if (name.equals("fixedPositiveInt")) {
6204          this.fixed = new PositiveIntType();
6205          return this.fixed;
6206        }
6207        else if (name.equals("fixedMarkdown")) {
6208          this.fixed = new MarkdownType();
6209          return this.fixed;
6210        }
6211        else if (name.equals("fixedAnnotation")) {
6212          this.fixed = new Annotation();
6213          return this.fixed;
6214        }
6215        else if (name.equals("fixedAttachment")) {
6216          this.fixed = new Attachment();
6217          return this.fixed;
6218        }
6219        else if (name.equals("fixedIdentifier")) {
6220          this.fixed = new Identifier();
6221          return this.fixed;
6222        }
6223        else if (name.equals("fixedCodeableConcept")) {
6224          this.fixed = new CodeableConcept();
6225          return this.fixed;
6226        }
6227        else if (name.equals("fixedCoding")) {
6228          this.fixed = new Coding();
6229          return this.fixed;
6230        }
6231        else if (name.equals("fixedQuantity")) {
6232          this.fixed = new Quantity();
6233          return this.fixed;
6234        }
6235        else if (name.equals("fixedRange")) {
6236          this.fixed = new Range();
6237          return this.fixed;
6238        }
6239        else if (name.equals("fixedPeriod")) {
6240          this.fixed = new Period();
6241          return this.fixed;
6242        }
6243        else if (name.equals("fixedRatio")) {
6244          this.fixed = new Ratio();
6245          return this.fixed;
6246        }
6247        else if (name.equals("fixedSampledData")) {
6248          this.fixed = new SampledData();
6249          return this.fixed;
6250        }
6251        else if (name.equals("fixedSignature")) {
6252          this.fixed = new Signature();
6253          return this.fixed;
6254        }
6255        else if (name.equals("fixedHumanName")) {
6256          this.fixed = new HumanName();
6257          return this.fixed;
6258        }
6259        else if (name.equals("fixedAddress")) {
6260          this.fixed = new Address();
6261          return this.fixed;
6262        }
6263        else if (name.equals("fixedContactPoint")) {
6264          this.fixed = new ContactPoint();
6265          return this.fixed;
6266        }
6267        else if (name.equals("fixedTiming")) {
6268          this.fixed = new Timing();
6269          return this.fixed;
6270        }
6271        else if (name.equals("fixedReference")) {
6272          this.fixed = new Reference();
6273          return this.fixed;
6274        }
6275        else if (name.equals("fixedMeta")) {
6276          this.fixed = new Meta();
6277          return this.fixed;
6278        }
6279        else if (name.equals("patternBoolean")) {
6280          this.pattern = new BooleanType();
6281          return this.pattern;
6282        }
6283        else if (name.equals("patternInteger")) {
6284          this.pattern = new IntegerType();
6285          return this.pattern;
6286        }
6287        else if (name.equals("patternDecimal")) {
6288          this.pattern = new DecimalType();
6289          return this.pattern;
6290        }
6291        else if (name.equals("patternBase64Binary")) {
6292          this.pattern = new Base64BinaryType();
6293          return this.pattern;
6294        }
6295        else if (name.equals("patternInstant")) {
6296          this.pattern = new InstantType();
6297          return this.pattern;
6298        }
6299        else if (name.equals("patternString")) {
6300          this.pattern = new StringType();
6301          return this.pattern;
6302        }
6303        else if (name.equals("patternUri")) {
6304          this.pattern = new UriType();
6305          return this.pattern;
6306        }
6307        else if (name.equals("patternDate")) {
6308          this.pattern = new DateType();
6309          return this.pattern;
6310        }
6311        else if (name.equals("patternDateTime")) {
6312          this.pattern = new DateTimeType();
6313          return this.pattern;
6314        }
6315        else if (name.equals("patternTime")) {
6316          this.pattern = new TimeType();
6317          return this.pattern;
6318        }
6319        else if (name.equals("patternCode")) {
6320          this.pattern = new CodeType();
6321          return this.pattern;
6322        }
6323        else if (name.equals("patternOid")) {
6324          this.pattern = new OidType();
6325          return this.pattern;
6326        }
6327        else if (name.equals("patternId")) {
6328          this.pattern = new IdType();
6329          return this.pattern;
6330        }
6331        else if (name.equals("patternUnsignedInt")) {
6332          this.pattern = new UnsignedIntType();
6333          return this.pattern;
6334        }
6335        else if (name.equals("patternPositiveInt")) {
6336          this.pattern = new PositiveIntType();
6337          return this.pattern;
6338        }
6339        else if (name.equals("patternMarkdown")) {
6340          this.pattern = new MarkdownType();
6341          return this.pattern;
6342        }
6343        else if (name.equals("patternAnnotation")) {
6344          this.pattern = new Annotation();
6345          return this.pattern;
6346        }
6347        else if (name.equals("patternAttachment")) {
6348          this.pattern = new Attachment();
6349          return this.pattern;
6350        }
6351        else if (name.equals("patternIdentifier")) {
6352          this.pattern = new Identifier();
6353          return this.pattern;
6354        }
6355        else if (name.equals("patternCodeableConcept")) {
6356          this.pattern = new CodeableConcept();
6357          return this.pattern;
6358        }
6359        else if (name.equals("patternCoding")) {
6360          this.pattern = new Coding();
6361          return this.pattern;
6362        }
6363        else if (name.equals("patternQuantity")) {
6364          this.pattern = new Quantity();
6365          return this.pattern;
6366        }
6367        else if (name.equals("patternRange")) {
6368          this.pattern = new Range();
6369          return this.pattern;
6370        }
6371        else if (name.equals("patternPeriod")) {
6372          this.pattern = new Period();
6373          return this.pattern;
6374        }
6375        else if (name.equals("patternRatio")) {
6376          this.pattern = new Ratio();
6377          return this.pattern;
6378        }
6379        else if (name.equals("patternSampledData")) {
6380          this.pattern = new SampledData();
6381          return this.pattern;
6382        }
6383        else if (name.equals("patternSignature")) {
6384          this.pattern = new Signature();
6385          return this.pattern;
6386        }
6387        else if (name.equals("patternHumanName")) {
6388          this.pattern = new HumanName();
6389          return this.pattern;
6390        }
6391        else if (name.equals("patternAddress")) {
6392          this.pattern = new Address();
6393          return this.pattern;
6394        }
6395        else if (name.equals("patternContactPoint")) {
6396          this.pattern = new ContactPoint();
6397          return this.pattern;
6398        }
6399        else if (name.equals("patternTiming")) {
6400          this.pattern = new Timing();
6401          return this.pattern;
6402        }
6403        else if (name.equals("patternReference")) {
6404          this.pattern = new Reference();
6405          return this.pattern;
6406        }
6407        else if (name.equals("patternMeta")) {
6408          this.pattern = new Meta();
6409          return this.pattern;
6410        }
6411        else if (name.equals("example")) {
6412          return addExample();
6413        }
6414        else if (name.equals("minValueDate")) {
6415          this.minValue = new DateType();
6416          return this.minValue;
6417        }
6418        else if (name.equals("minValueDateTime")) {
6419          this.minValue = new DateTimeType();
6420          return this.minValue;
6421        }
6422        else if (name.equals("minValueInstant")) {
6423          this.minValue = new InstantType();
6424          return this.minValue;
6425        }
6426        else if (name.equals("minValueTime")) {
6427          this.minValue = new TimeType();
6428          return this.minValue;
6429        }
6430        else if (name.equals("minValueDecimal")) {
6431          this.minValue = new DecimalType();
6432          return this.minValue;
6433        }
6434        else if (name.equals("minValueInteger")) {
6435          this.minValue = new IntegerType();
6436          return this.minValue;
6437        }
6438        else if (name.equals("minValuePositiveInt")) {
6439          this.minValue = new PositiveIntType();
6440          return this.minValue;
6441        }
6442        else if (name.equals("minValueUnsignedInt")) {
6443          this.minValue = new UnsignedIntType();
6444          return this.minValue;
6445        }
6446        else if (name.equals("minValueQuantity")) {
6447          this.minValue = new Quantity();
6448          return this.minValue;
6449        }
6450        else if (name.equals("maxValueDate")) {
6451          this.maxValue = new DateType();
6452          return this.maxValue;
6453        }
6454        else if (name.equals("maxValueDateTime")) {
6455          this.maxValue = new DateTimeType();
6456          return this.maxValue;
6457        }
6458        else if (name.equals("maxValueInstant")) {
6459          this.maxValue = new InstantType();
6460          return this.maxValue;
6461        }
6462        else if (name.equals("maxValueTime")) {
6463          this.maxValue = new TimeType();
6464          return this.maxValue;
6465        }
6466        else if (name.equals("maxValueDecimal")) {
6467          this.maxValue = new DecimalType();
6468          return this.maxValue;
6469        }
6470        else if (name.equals("maxValueInteger")) {
6471          this.maxValue = new IntegerType();
6472          return this.maxValue;
6473        }
6474        else if (name.equals("maxValuePositiveInt")) {
6475          this.maxValue = new PositiveIntType();
6476          return this.maxValue;
6477        }
6478        else if (name.equals("maxValueUnsignedInt")) {
6479          this.maxValue = new UnsignedIntType();
6480          return this.maxValue;
6481        }
6482        else if (name.equals("maxValueQuantity")) {
6483          this.maxValue = new Quantity();
6484          return this.maxValue;
6485        }
6486        else if (name.equals("maxLength")) {
6487          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.maxLength");
6488        }
6489        else if (name.equals("condition")) {
6490          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.condition");
6491        }
6492        else if (name.equals("constraint")) {
6493          return addConstraint();
6494        }
6495        else if (name.equals("mustSupport")) {
6496          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.mustSupport");
6497        }
6498        else if (name.equals("isModifier")) {
6499          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.isModifier");
6500        }
6501        else if (name.equals("isSummary")) {
6502          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.isSummary");
6503        }
6504        else if (name.equals("binding")) {
6505          this.binding = new ElementDefinitionBindingComponent();
6506          return this.binding;
6507        }
6508        else if (name.equals("mapping")) {
6509          return addMapping();
6510        }
6511        else
6512          return super.addChild(name);
6513      }
6514
6515  public String fhirType() {
6516    return "ElementDefinition";
6517
6518  }
6519
6520      public ElementDefinition copy() {
6521        ElementDefinition dst = new ElementDefinition();
6522        copyValues(dst);
6523        dst.path = path == null ? null : path.copy();
6524        if (representation != null) {
6525          dst.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
6526          for (Enumeration<PropertyRepresentation> i : representation)
6527            dst.representation.add(i.copy());
6528        };
6529        dst.sliceName = sliceName == null ? null : sliceName.copy();
6530        dst.label = label == null ? null : label.copy();
6531        if (code != null) {
6532          dst.code = new ArrayList<Coding>();
6533          for (Coding i : code)
6534            dst.code.add(i.copy());
6535        };
6536        dst.slicing = slicing == null ? null : slicing.copy();
6537        dst.short_ = short_ == null ? null : short_.copy();
6538        dst.definition = definition == null ? null : definition.copy();
6539        dst.comment = comment == null ? null : comment.copy();
6540        dst.requirements = requirements == null ? null : requirements.copy();
6541        if (alias != null) {
6542          dst.alias = new ArrayList<StringType>();
6543          for (StringType i : alias)
6544            dst.alias.add(i.copy());
6545        };
6546        dst.min = min == null ? null : min.copy();
6547        dst.max = max == null ? null : max.copy();
6548        dst.base = base == null ? null : base.copy();
6549        dst.contentReference = contentReference == null ? null : contentReference.copy();
6550        if (type != null) {
6551          dst.type = new ArrayList<TypeRefComponent>();
6552          for (TypeRefComponent i : type)
6553            dst.type.add(i.copy());
6554        };
6555        dst.defaultValue = defaultValue == null ? null : defaultValue.copy();
6556        dst.meaningWhenMissing = meaningWhenMissing == null ? null : meaningWhenMissing.copy();
6557        dst.orderMeaning = orderMeaning == null ? null : orderMeaning.copy();
6558        dst.fixed = fixed == null ? null : fixed.copy();
6559        dst.pattern = pattern == null ? null : pattern.copy();
6560        if (example != null) {
6561          dst.example = new ArrayList<ElementDefinitionExampleComponent>();
6562          for (ElementDefinitionExampleComponent i : example)
6563            dst.example.add(i.copy());
6564        };
6565        dst.minValue = minValue == null ? null : minValue.copy();
6566        dst.maxValue = maxValue == null ? null : maxValue.copy();
6567        dst.maxLength = maxLength == null ? null : maxLength.copy();
6568        if (condition != null) {
6569          dst.condition = new ArrayList<IdType>();
6570          for (IdType i : condition)
6571            dst.condition.add(i.copy());
6572        };
6573        if (constraint != null) {
6574          dst.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
6575          for (ElementDefinitionConstraintComponent i : constraint)
6576            dst.constraint.add(i.copy());
6577        };
6578        dst.mustSupport = mustSupport == null ? null : mustSupport.copy();
6579        dst.isModifier = isModifier == null ? null : isModifier.copy();
6580        dst.isSummary = isSummary == null ? null : isSummary.copy();
6581        dst.binding = binding == null ? null : binding.copy();
6582        if (mapping != null) {
6583          dst.mapping = new ArrayList<ElementDefinitionMappingComponent>();
6584          for (ElementDefinitionMappingComponent i : mapping)
6585            dst.mapping.add(i.copy());
6586        };
6587        return dst;
6588      }
6589
6590      protected ElementDefinition typedCopy() {
6591        return copy();
6592      }
6593
6594      @Override
6595      public boolean equalsDeep(Base other) {
6596        if (!super.equalsDeep(other))
6597          return false;
6598        if (!(other instanceof ElementDefinition))
6599          return false;
6600        ElementDefinition o = (ElementDefinition) other;
6601        return compareDeep(path, o.path, true) && compareDeep(representation, o.representation, true) && compareDeep(sliceName, o.sliceName, true)
6602           && compareDeep(label, o.label, true) && compareDeep(code, o.code, true) && compareDeep(slicing, o.slicing, true)
6603           && compareDeep(short_, o.short_, true) && compareDeep(definition, o.definition, true) && compareDeep(comment, o.comment, true)
6604           && compareDeep(requirements, o.requirements, true) && compareDeep(alias, o.alias, true) && compareDeep(min, o.min, true)
6605           && compareDeep(max, o.max, true) && compareDeep(base, o.base, true) && compareDeep(contentReference, o.contentReference, true)
6606           && compareDeep(type, o.type, true) && compareDeep(defaultValue, o.defaultValue, true) && compareDeep(meaningWhenMissing, o.meaningWhenMissing, true)
6607           && compareDeep(orderMeaning, o.orderMeaning, true) && compareDeep(fixed, o.fixed, true) && compareDeep(pattern, o.pattern, true)
6608           && compareDeep(example, o.example, true) && compareDeep(minValue, o.minValue, true) && compareDeep(maxValue, o.maxValue, true)
6609           && compareDeep(maxLength, o.maxLength, true) && compareDeep(condition, o.condition, true) && compareDeep(constraint, o.constraint, true)
6610           && compareDeep(mustSupport, o.mustSupport, true) && compareDeep(isModifier, o.isModifier, true)
6611           && compareDeep(isSummary, o.isSummary, true) && compareDeep(binding, o.binding, true) && compareDeep(mapping, o.mapping, true)
6612          ;
6613      }
6614
6615      @Override
6616      public boolean equalsShallow(Base other) {
6617        if (!super.equalsShallow(other))
6618          return false;
6619        if (!(other instanceof ElementDefinition))
6620          return false;
6621        ElementDefinition o = (ElementDefinition) other;
6622        return compareValues(path, o.path, true) && compareValues(representation, o.representation, true) && compareValues(sliceName, o.sliceName, true)
6623           && compareValues(label, o.label, true) && compareValues(short_, o.short_, true) && compareValues(definition, o.definition, true)
6624           && compareValues(comment, o.comment, true) && compareValues(requirements, o.requirements, true) && compareValues(alias, o.alias, true)
6625           && compareValues(min, o.min, true) && compareValues(max, o.max, true) && compareValues(contentReference, o.contentReference, true)
6626           && compareValues(meaningWhenMissing, o.meaningWhenMissing, true) && compareValues(orderMeaning, o.orderMeaning, true)
6627           && compareValues(maxLength, o.maxLength, true) && compareValues(condition, o.condition, true) && compareValues(mustSupport, o.mustSupport, true)
6628           && compareValues(isModifier, o.isModifier, true) && compareValues(isSummary, o.isSummary, true);
6629      }
6630
6631      public boolean isEmpty() {
6632        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, representation, sliceName
6633          , label, code, slicing, short_, definition, comment, requirements, alias, min
6634          , max, base, contentReference, type, defaultValue, meaningWhenMissing, orderMeaning
6635          , fixed, pattern, example, minValue, maxValue, maxLength, condition, constraint
6636          , mustSupport, isModifier, isSummary, binding, mapping);
6637      }
6638
6639// added from java-adornments.txt:
6640  
6641  public String toString() {
6642    if (hasId())
6643      return getId();
6644    if (hasSliceName())
6645      return getPath()+":"+getSliceName();
6646    else
6647      return getPath();
6648  }
6649    
6650  public void makeBase(String path, int min, String max) {
6651    ElementDefinitionBaseComponent self = getBase();
6652    self.setPath(path);
6653    self.setMin(min);
6654    self.setMax(max);
6655  }
6656  
6657
6658// end addition
6659
6660}
6661