001package org.hl7.fhir.dstu2.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.List;
038
039import org.hl7.fhir.dstu2.model.Enumerations.BindingStrength;
040import org.hl7.fhir.dstu2.model.Enumerations.BindingStrengthEnumFactory;
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.DatatypeDef;
044import ca.uhn.fhir.model.api.annotation.Description;
045import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
046import org.hl7.fhir.instance.model.api.ICompositeType;
047import org.hl7.fhir.exceptions.FHIRException;
048import org.hl7.fhir.utilities.Utilities;
049/**
050 * Captures constraints on each element within the resource, profile, or extension.
051 */
052@DatatypeDef(name="ElementDefinition")
053public class ElementDefinition extends Type implements ICompositeType {
054
055    public enum PropertyRepresentation {
056        /**
057         * In XML, this property is represented as an attribute not an element.
058         */
059        XMLATTR, 
060        /**
061         * added to help the parsers
062         */
063        NULL;
064        public static PropertyRepresentation fromCode(String codeString) throws FHIRException {
065            if (codeString == null || "".equals(codeString))
066                return null;
067        if ("xmlAttr".equals(codeString))
068          return XMLATTR;
069        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
070        }
071        public String toCode() {
072          switch (this) {
073            case XMLATTR: return "xmlAttr";
074            case NULL: return null;
075            default: return "?";
076          }
077        }
078        public String getSystem() {
079          switch (this) {
080            case XMLATTR: return "http://hl7.org/fhir/property-representation";
081            case NULL: return null;
082            default: return "?";
083          }
084        }
085        public String getDefinition() {
086          switch (this) {
087            case XMLATTR: return "In XML, this property is represented as an attribute not an element.";
088            case NULL: return null;
089            default: return "?";
090          }
091        }
092        public String getDisplay() {
093          switch (this) {
094            case XMLATTR: return "XML Attribute";
095            case NULL: return null;
096            default: return "?";
097          }
098        }
099    }
100
101  public static class PropertyRepresentationEnumFactory implements EnumFactory<PropertyRepresentation> {
102    public PropertyRepresentation fromCode(String codeString) throws IllegalArgumentException {
103      if (codeString == null || "".equals(codeString))
104            if (codeString == null || "".equals(codeString))
105                return null;
106        if ("xmlAttr".equals(codeString))
107          return PropertyRepresentation.XMLATTR;
108        throw new IllegalArgumentException("Unknown PropertyRepresentation code '"+codeString+"'");
109        }
110        public Enumeration<PropertyRepresentation> fromType(Base code) throws FHIRException {
111          if (code == null || code.isEmpty())
112            return null;
113          String codeString = ((PrimitiveType) code).asStringValue();
114          if (codeString == null || "".equals(codeString))
115            return null;
116        if ("xmlAttr".equals(codeString))
117          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLATTR);
118        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
119        }
120    public String toCode(PropertyRepresentation code) {
121      if (code == PropertyRepresentation.XMLATTR)
122        return "xmlAttr";
123      return "?";
124      }
125    }
126
127    public enum SlicingRules {
128        /**
129         * No additional content is allowed other than that described by the slices in this profile.
130         */
131        CLOSED, 
132        /**
133         * Additional content is allowed anywhere in the list.
134         */
135        OPEN, 
136        /**
137         * 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.
138         */
139        OPENATEND, 
140        /**
141         * added to help the parsers
142         */
143        NULL;
144        public static SlicingRules fromCode(String codeString) throws FHIRException {
145            if (codeString == null || "".equals(codeString))
146                return null;
147        if ("closed".equals(codeString))
148          return CLOSED;
149        if ("open".equals(codeString))
150          return OPEN;
151        if ("openAtEnd".equals(codeString))
152          return OPENATEND;
153        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
154        }
155        public String toCode() {
156          switch (this) {
157            case CLOSED: return "closed";
158            case OPEN: return "open";
159            case OPENATEND: return "openAtEnd";
160            case NULL: return null;
161            default: return "?";
162          }
163        }
164        public String getSystem() {
165          switch (this) {
166            case CLOSED: return "http://hl7.org/fhir/resource-slicing-rules";
167            case OPEN: return "http://hl7.org/fhir/resource-slicing-rules";
168            case OPENATEND: return "http://hl7.org/fhir/resource-slicing-rules";
169            case NULL: return null;
170            default: return "?";
171          }
172        }
173        public String getDefinition() {
174          switch (this) {
175            case CLOSED: return "No additional content is allowed other than that described by the slices in this profile.";
176            case OPEN: return "Additional content is allowed anywhere in the list.";
177            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.";
178            case NULL: return null;
179            default: return "?";
180          }
181        }
182        public String getDisplay() {
183          switch (this) {
184            case CLOSED: return "Closed";
185            case OPEN: return "Open";
186            case OPENATEND: return "Open at End";
187            case NULL: return null;
188            default: return "?";
189          }
190        }
191    }
192
193  public static class SlicingRulesEnumFactory implements EnumFactory<SlicingRules> {
194    public SlicingRules fromCode(String codeString) throws IllegalArgumentException {
195      if (codeString == null || "".equals(codeString))
196            if (codeString == null || "".equals(codeString))
197                return null;
198        if ("closed".equals(codeString))
199          return SlicingRules.CLOSED;
200        if ("open".equals(codeString))
201          return SlicingRules.OPEN;
202        if ("openAtEnd".equals(codeString))
203          return SlicingRules.OPENATEND;
204        throw new IllegalArgumentException("Unknown SlicingRules code '"+codeString+"'");
205        }
206        public Enumeration<SlicingRules> fromType(Base code) throws FHIRException {
207          if (code == null || code.isEmpty())
208            return null;
209          String codeString = ((PrimitiveType) code).asStringValue();
210          if (codeString == null || "".equals(codeString))
211            return null;
212        if ("closed".equals(codeString))
213          return new Enumeration<SlicingRules>(this, SlicingRules.CLOSED);
214        if ("open".equals(codeString))
215          return new Enumeration<SlicingRules>(this, SlicingRules.OPEN);
216        if ("openAtEnd".equals(codeString))
217          return new Enumeration<SlicingRules>(this, SlicingRules.OPENATEND);
218        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
219        }
220    public String toCode(SlicingRules code) {
221      if (code == SlicingRules.CLOSED)
222        return "closed";
223      if (code == SlicingRules.OPEN)
224        return "open";
225      if (code == SlicingRules.OPENATEND)
226        return "openAtEnd";
227      return "?";
228      }
229    }
230
231    public enum AggregationMode {
232        /**
233         * The reference is a local reference to a contained resource.
234         */
235        CONTAINED, 
236        /**
237         * The reference to a resource that has to be resolved externally to the resource that includes the reference.
238         */
239        REFERENCED, 
240        /**
241         * The resource the reference points to will be found in the same bundle as the resource that includes the reference.
242         */
243        BUNDLED, 
244        /**
245         * added to help the parsers
246         */
247        NULL;
248        public static AggregationMode fromCode(String codeString) throws FHIRException {
249            if (codeString == null || "".equals(codeString))
250                return null;
251        if ("contained".equals(codeString))
252          return CONTAINED;
253        if ("referenced".equals(codeString))
254          return REFERENCED;
255        if ("bundled".equals(codeString))
256          return BUNDLED;
257        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
258        }
259        public String toCode() {
260          switch (this) {
261            case CONTAINED: return "contained";
262            case REFERENCED: return "referenced";
263            case BUNDLED: return "bundled";
264            case NULL: return null;
265            default: return "?";
266          }
267        }
268        public String getSystem() {
269          switch (this) {
270            case CONTAINED: return "http://hl7.org/fhir/resource-aggregation-mode";
271            case REFERENCED: return "http://hl7.org/fhir/resource-aggregation-mode";
272            case BUNDLED: return "http://hl7.org/fhir/resource-aggregation-mode";
273            case NULL: return null;
274            default: return "?";
275          }
276        }
277        public String getDefinition() {
278          switch (this) {
279            case CONTAINED: return "The reference is a local reference to a contained resource.";
280            case REFERENCED: return "The reference to a resource that has to be resolved externally to the resource that includes the reference.";
281            case BUNDLED: return "The resource the reference points to will be found in the same bundle as the resource that includes the reference.";
282            case NULL: return null;
283            default: return "?";
284          }
285        }
286        public String getDisplay() {
287          switch (this) {
288            case CONTAINED: return "Contained";
289            case REFERENCED: return "Referenced";
290            case BUNDLED: return "Bundled";
291            case NULL: return null;
292            default: return "?";
293          }
294        }
295    }
296
297  public static class AggregationModeEnumFactory implements EnumFactory<AggregationMode> {
298    public AggregationMode fromCode(String codeString) throws IllegalArgumentException {
299      if (codeString == null || "".equals(codeString))
300            if (codeString == null || "".equals(codeString))
301                return null;
302        if ("contained".equals(codeString))
303          return AggregationMode.CONTAINED;
304        if ("referenced".equals(codeString))
305          return AggregationMode.REFERENCED;
306        if ("bundled".equals(codeString))
307          return AggregationMode.BUNDLED;
308        throw new IllegalArgumentException("Unknown AggregationMode code '"+codeString+"'");
309        }
310        public Enumeration<AggregationMode> fromType(Base code) throws FHIRException {
311          if (code == null || code.isEmpty())
312            return null;
313          String codeString = ((PrimitiveType) code).asStringValue();
314          if (codeString == null || "".equals(codeString))
315            return null;
316        if ("contained".equals(codeString))
317          return new Enumeration<AggregationMode>(this, AggregationMode.CONTAINED);
318        if ("referenced".equals(codeString))
319          return new Enumeration<AggregationMode>(this, AggregationMode.REFERENCED);
320        if ("bundled".equals(codeString))
321          return new Enumeration<AggregationMode>(this, AggregationMode.BUNDLED);
322        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
323        }
324    public String toCode(AggregationMode code) {
325      if (code == AggregationMode.CONTAINED)
326        return "contained";
327      if (code == AggregationMode.REFERENCED)
328        return "referenced";
329      if (code == AggregationMode.BUNDLED)
330        return "bundled";
331      return "?";
332      }
333    }
334
335    public enum ConstraintSeverity {
336        /**
337         * If the constraint is violated, the resource is not conformant.
338         */
339        ERROR, 
340        /**
341         * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.
342         */
343        WARNING, 
344        /**
345         * added to help the parsers
346         */
347        NULL;
348        public static ConstraintSeverity fromCode(String codeString) throws FHIRException {
349            if (codeString == null || "".equals(codeString))
350                return null;
351        if ("error".equals(codeString))
352          return ERROR;
353        if ("warning".equals(codeString))
354          return WARNING;
355        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
356        }
357        public String toCode() {
358          switch (this) {
359            case ERROR: return "error";
360            case WARNING: return "warning";
361            case NULL: return null;
362            default: return "?";
363          }
364        }
365        public String getSystem() {
366          switch (this) {
367            case ERROR: return "http://hl7.org/fhir/constraint-severity";
368            case WARNING: return "http://hl7.org/fhir/constraint-severity";
369            case NULL: return null;
370            default: return "?";
371          }
372        }
373        public String getDefinition() {
374          switch (this) {
375            case ERROR: return "If the constraint is violated, the resource is not conformant.";
376            case WARNING: return "If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.";
377            case NULL: return null;
378            default: return "?";
379          }
380        }
381        public String getDisplay() {
382          switch (this) {
383            case ERROR: return "Error";
384            case WARNING: return "Warning";
385            case NULL: return null;
386            default: return "?";
387          }
388        }
389    }
390
391  public static class ConstraintSeverityEnumFactory implements EnumFactory<ConstraintSeverity> {
392    public ConstraintSeverity fromCode(String codeString) throws IllegalArgumentException {
393      if (codeString == null || "".equals(codeString))
394            if (codeString == null || "".equals(codeString))
395                return null;
396        if ("error".equals(codeString))
397          return ConstraintSeverity.ERROR;
398        if ("warning".equals(codeString))
399          return ConstraintSeverity.WARNING;
400        throw new IllegalArgumentException("Unknown ConstraintSeverity code '"+codeString+"'");
401        }
402        public Enumeration<ConstraintSeverity> fromType(Base code) throws FHIRException {
403          if (code == null || code.isEmpty())
404            return null;
405          String codeString = ((PrimitiveType) code).asStringValue();
406          if (codeString == null || "".equals(codeString))
407            return null;
408        if ("error".equals(codeString))
409          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.ERROR);
410        if ("warning".equals(codeString))
411          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.WARNING);
412        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
413        }
414    public String toCode(ConstraintSeverity code) {
415      if (code == ConstraintSeverity.ERROR)
416        return "error";
417      if (code == ConstraintSeverity.WARNING)
418        return "warning";
419      return "?";
420      }
421    }
422
423    @Block()
424    public static class ElementDefinitionSlicingComponent extends Element implements IBaseDatatypeElement {
425        /**
426         * 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.
427         */
428        @Child(name = "discriminator", type = {StringType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
429        @Description(shortDefinition="Element values that 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." )
430        protected List<StringType> discriminator;
431
432        /**
433         * 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.
434         */
435        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
436        @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." )
437        protected StringType description;
438
439        /**
440         * If the matching elements have to occur in the same order as defined in the profile.
441         */
442        @Child(name = "ordered", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
443        @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." )
444        protected BooleanType ordered;
445
446        /**
447         * 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.
448         */
449        @Child(name = "rules", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
450        @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." )
451        protected Enumeration<SlicingRules> rules;
452
453        private static final long serialVersionUID = 233544215L;
454
455    /*
456     * Constructor
457     */
458      public ElementDefinitionSlicingComponent() {
459        super();
460      }
461
462    /*
463     * Constructor
464     */
465      public ElementDefinitionSlicingComponent(Enumeration<SlicingRules> rules) {
466        super();
467        this.rules = rules;
468      }
469
470        /**
471         * @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.)
472         */
473        public List<StringType> getDiscriminator() { 
474          if (this.discriminator == null)
475            this.discriminator = new ArrayList<StringType>();
476          return this.discriminator;
477        }
478
479        public boolean hasDiscriminator() { 
480          if (this.discriminator == null)
481            return false;
482          for (StringType item : this.discriminator)
483            if (!item.isEmpty())
484              return true;
485          return false;
486        }
487
488        /**
489         * @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.)
490         */
491    // syntactic sugar
492        public StringType addDiscriminatorElement() {//2 
493          StringType t = new StringType();
494          if (this.discriminator == null)
495            this.discriminator = new ArrayList<StringType>();
496          this.discriminator.add(t);
497          return t;
498        }
499
500        /**
501         * @param value {@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.)
502         */
503        public ElementDefinitionSlicingComponent addDiscriminator(String value) { //1
504          StringType t = new StringType();
505          t.setValue(value);
506          if (this.discriminator == null)
507            this.discriminator = new ArrayList<StringType>();
508          this.discriminator.add(t);
509          return this;
510        }
511
512        /**
513         * @param value {@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.)
514         */
515        public boolean hasDiscriminator(String value) { 
516          if (this.discriminator == null)
517            return false;
518          for (StringType v : this.discriminator)
519            if (v.equals(value)) // string
520              return true;
521          return false;
522        }
523
524        /**
525         * @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
526         */
527        public StringType getDescriptionElement() { 
528          if (this.description == null)
529            if (Configuration.errorOnAutoCreate())
530              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.description");
531            else if (Configuration.doAutoCreate())
532              this.description = new StringType(); // bb
533          return this.description;
534        }
535
536        public boolean hasDescriptionElement() { 
537          return this.description != null && !this.description.isEmpty();
538        }
539
540        public boolean hasDescription() { 
541          return this.description != null && !this.description.isEmpty();
542        }
543
544        /**
545         * @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
546         */
547        public ElementDefinitionSlicingComponent setDescriptionElement(StringType value) { 
548          this.description = value;
549          return this;
550        }
551
552        /**
553         * @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.
554         */
555        public String getDescription() { 
556          return this.description == null ? null : this.description.getValue();
557        }
558
559        /**
560         * @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.
561         */
562        public ElementDefinitionSlicingComponent setDescription(String value) { 
563          if (Utilities.noString(value))
564            this.description = null;
565          else {
566            if (this.description == null)
567              this.description = new StringType();
568            this.description.setValue(value);
569          }
570          return this;
571        }
572
573        /**
574         * @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
575         */
576        public BooleanType getOrderedElement() { 
577          if (this.ordered == null)
578            if (Configuration.errorOnAutoCreate())
579              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.ordered");
580            else if (Configuration.doAutoCreate())
581              this.ordered = new BooleanType(); // bb
582          return this.ordered;
583        }
584
585        public boolean hasOrderedElement() { 
586          return this.ordered != null && !this.ordered.isEmpty();
587        }
588
589        public boolean hasOrdered() { 
590          return this.ordered != null && !this.ordered.isEmpty();
591        }
592
593        /**
594         * @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
595         */
596        public ElementDefinitionSlicingComponent setOrderedElement(BooleanType value) { 
597          this.ordered = value;
598          return this;
599        }
600
601        /**
602         * @return If the matching elements have to occur in the same order as defined in the profile.
603         */
604        public boolean getOrdered() { 
605          return this.ordered == null || this.ordered.isEmpty() ? false : this.ordered.getValue();
606        }
607
608        /**
609         * @param value If the matching elements have to occur in the same order as defined in the profile.
610         */
611        public ElementDefinitionSlicingComponent setOrdered(boolean value) { 
612            if (this.ordered == null)
613              this.ordered = new BooleanType();
614            this.ordered.setValue(value);
615          return this;
616        }
617
618        /**
619         * @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
620         */
621        public Enumeration<SlicingRules> getRulesElement() { 
622          if (this.rules == null)
623            if (Configuration.errorOnAutoCreate())
624              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.rules");
625            else if (Configuration.doAutoCreate())
626              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory()); // bb
627          return this.rules;
628        }
629
630        public boolean hasRulesElement() { 
631          return this.rules != null && !this.rules.isEmpty();
632        }
633
634        public boolean hasRules() { 
635          return this.rules != null && !this.rules.isEmpty();
636        }
637
638        /**
639         * @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
640         */
641        public ElementDefinitionSlicingComponent setRulesElement(Enumeration<SlicingRules> value) { 
642          this.rules = value;
643          return this;
644        }
645
646        /**
647         * @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.
648         */
649        public SlicingRules getRules() { 
650          return this.rules == null ? null : this.rules.getValue();
651        }
652
653        /**
654         * @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.
655         */
656        public ElementDefinitionSlicingComponent setRules(SlicingRules value) { 
657            if (this.rules == null)
658              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory());
659            this.rules.setValue(value);
660          return this;
661        }
662
663        protected void listChildren(List<Property> childrenList) {
664          super.listChildren(childrenList);
665          childrenList.add(new Property("discriminator", "string", "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));
666          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));
667          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));
668          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));
669        }
670
671      @Override
672      public void setProperty(String name, Base value) throws FHIRException {
673        if (name.equals("discriminator"))
674          this.getDiscriminator().add(castToString(value));
675        else if (name.equals("description"))
676          this.description = castToString(value); // StringType
677        else if (name.equals("ordered"))
678          this.ordered = castToBoolean(value); // BooleanType
679        else if (name.equals("rules"))
680          this.rules = new SlicingRulesEnumFactory().fromType(value); // Enumeration<SlicingRules>
681        else
682          super.setProperty(name, value);
683      }
684
685      @Override
686      public Base addChild(String name) throws FHIRException {
687        if (name.equals("discriminator")) {
688          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.discriminator");
689        }
690        else if (name.equals("description")) {
691          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.description");
692        }
693        else if (name.equals("ordered")) {
694          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.ordered");
695        }
696        else if (name.equals("rules")) {
697          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.rules");
698        }
699        else
700          return super.addChild(name);
701      }
702
703      public ElementDefinitionSlicingComponent copy() {
704        ElementDefinitionSlicingComponent dst = new ElementDefinitionSlicingComponent();
705        copyValues(dst);
706        if (discriminator != null) {
707          dst.discriminator = new ArrayList<StringType>();
708          for (StringType i : discriminator)
709            dst.discriminator.add(i.copy());
710        };
711        dst.description = description == null ? null : description.copy();
712        dst.ordered = ordered == null ? null : ordered.copy();
713        dst.rules = rules == null ? null : rules.copy();
714        return dst;
715      }
716
717      @Override
718      public boolean equalsDeep(Base other) {
719        if (!super.equalsDeep(other))
720          return false;
721        if (!(other instanceof ElementDefinitionSlicingComponent))
722          return false;
723        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other;
724        return compareDeep(discriminator, o.discriminator, true) && compareDeep(description, o.description, true)
725           && compareDeep(ordered, o.ordered, true) && compareDeep(rules, o.rules, true);
726      }
727
728      @Override
729      public boolean equalsShallow(Base other) {
730        if (!super.equalsShallow(other))
731          return false;
732        if (!(other instanceof ElementDefinitionSlicingComponent))
733          return false;
734        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other;
735        return compareValues(discriminator, o.discriminator, true) && compareValues(description, o.description, true)
736           && compareValues(ordered, o.ordered, true) && compareValues(rules, o.rules, true);
737      }
738
739      public boolean isEmpty() {
740        return super.isEmpty() && (discriminator == null || discriminator.isEmpty()) && (description == null || description.isEmpty())
741           && (ordered == null || ordered.isEmpty()) && (rules == null || rules.isEmpty());
742      }
743
744  public String fhirType() {
745    return "ElementDefinition.slicing";
746
747  }
748
749  }
750
751    @Block()
752    public static class ElementDefinitionBaseComponent extends Element implements IBaseDatatypeElement {
753        /**
754         * 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.
755         */
756        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
757        @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." )
758        protected StringType path;
759
760        /**
761         * Minimum cardinality of the base element identified by the path.
762         */
763        @Child(name = "min", type = {IntegerType.class}, order=2, min=1, max=1, modifier=false, summary=true)
764        @Description(shortDefinition="Min cardinality of the base element", formalDefinition="Minimum cardinality of the base element identified by the path." )
765        protected IntegerType min;
766
767        /**
768         * Maximum cardinality of the base element identified by the path.
769         */
770        @Child(name = "max", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
771        @Description(shortDefinition="Max cardinality of the base element", formalDefinition="Maximum cardinality of the base element identified by the path." )
772        protected StringType max;
773
774        private static final long serialVersionUID = 232204455L;
775
776    /*
777     * Constructor
778     */
779      public ElementDefinitionBaseComponent() {
780        super();
781      }
782
783    /*
784     * Constructor
785     */
786      public ElementDefinitionBaseComponent(StringType path, IntegerType min, StringType max) {
787        super();
788        this.path = path;
789        this.min = min;
790        this.max = max;
791      }
792
793        /**
794         * @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
795         */
796        public StringType getPathElement() { 
797          if (this.path == null)
798            if (Configuration.errorOnAutoCreate())
799              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.path");
800            else if (Configuration.doAutoCreate())
801              this.path = new StringType(); // bb
802          return this.path;
803        }
804
805        public boolean hasPathElement() { 
806          return this.path != null && !this.path.isEmpty();
807        }
808
809        public boolean hasPath() { 
810          return this.path != null && !this.path.isEmpty();
811        }
812
813        /**
814         * @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
815         */
816        public ElementDefinitionBaseComponent setPathElement(StringType value) { 
817          this.path = value;
818          return this;
819        }
820
821        /**
822         * @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.
823         */
824        public String getPath() { 
825          return this.path == null ? null : this.path.getValue();
826        }
827
828        /**
829         * @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.
830         */
831        public ElementDefinitionBaseComponent setPath(String value) { 
832            if (this.path == null)
833              this.path = new StringType();
834            this.path.setValue(value);
835          return this;
836        }
837
838        /**
839         * @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
840         */
841        public IntegerType getMinElement() { 
842          if (this.min == null)
843            if (Configuration.errorOnAutoCreate())
844              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.min");
845            else if (Configuration.doAutoCreate())
846              this.min = new IntegerType(); // bb
847          return this.min;
848        }
849
850        public boolean hasMinElement() { 
851          return this.min != null && !this.min.isEmpty();
852        }
853
854        public boolean hasMin() { 
855          return this.min != null && !this.min.isEmpty();
856        }
857
858        /**
859         * @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
860         */
861        public ElementDefinitionBaseComponent setMinElement(IntegerType value) { 
862          this.min = value;
863          return this;
864        }
865
866        /**
867         * @return Minimum cardinality of the base element identified by the path.
868         */
869        public int getMin() { 
870          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
871        }
872
873        /**
874         * @param value Minimum cardinality of the base element identified by the path.
875         */
876        public ElementDefinitionBaseComponent setMin(int value) { 
877            if (this.min == null)
878              this.min = new IntegerType();
879            this.min.setValue(value);
880          return this;
881        }
882
883        /**
884         * @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
885         */
886        public StringType getMaxElement() { 
887          if (this.max == null)
888            if (Configuration.errorOnAutoCreate())
889              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.max");
890            else if (Configuration.doAutoCreate())
891              this.max = new StringType(); // bb
892          return this.max;
893        }
894
895        public boolean hasMaxElement() { 
896          return this.max != null && !this.max.isEmpty();
897        }
898
899        public boolean hasMax() { 
900          return this.max != null && !this.max.isEmpty();
901        }
902
903        /**
904         * @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
905         */
906        public ElementDefinitionBaseComponent setMaxElement(StringType value) { 
907          this.max = value;
908          return this;
909        }
910
911        /**
912         * @return Maximum cardinality of the base element identified by the path.
913         */
914        public String getMax() { 
915          return this.max == null ? null : this.max.getValue();
916        }
917
918        /**
919         * @param value Maximum cardinality of the base element identified by the path.
920         */
921        public ElementDefinitionBaseComponent setMax(String value) { 
922            if (this.max == null)
923              this.max = new StringType();
924            this.max.setValue(value);
925          return this;
926        }
927
928        protected void listChildren(List<Property> childrenList) {
929          super.listChildren(childrenList);
930          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));
931          childrenList.add(new Property("min", "integer", "Minimum cardinality of the base element identified by the path.", 0, java.lang.Integer.MAX_VALUE, min));
932          childrenList.add(new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, java.lang.Integer.MAX_VALUE, max));
933        }
934
935      @Override
936      public void setProperty(String name, Base value) throws FHIRException {
937        if (name.equals("path"))
938          this.path = castToString(value); // StringType
939        else if (name.equals("min"))
940          this.min = castToInteger(value); // IntegerType
941        else if (name.equals("max"))
942          this.max = castToString(value); // StringType
943        else
944          super.setProperty(name, value);
945      }
946
947      @Override
948      public Base addChild(String name) throws FHIRException {
949        if (name.equals("path")) {
950          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
951        }
952        else if (name.equals("min")) {
953          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.min");
954        }
955        else if (name.equals("max")) {
956          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.max");
957        }
958        else
959          return super.addChild(name);
960      }
961
962      public ElementDefinitionBaseComponent copy() {
963        ElementDefinitionBaseComponent dst = new ElementDefinitionBaseComponent();
964        copyValues(dst);
965        dst.path = path == null ? null : path.copy();
966        dst.min = min == null ? null : min.copy();
967        dst.max = max == null ? null : max.copy();
968        return dst;
969      }
970
971      @Override
972      public boolean equalsDeep(Base other) {
973        if (!super.equalsDeep(other))
974          return false;
975        if (!(other instanceof ElementDefinitionBaseComponent))
976          return false;
977        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other;
978        return compareDeep(path, o.path, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
979          ;
980      }
981
982      @Override
983      public boolean equalsShallow(Base other) {
984        if (!super.equalsShallow(other))
985          return false;
986        if (!(other instanceof ElementDefinitionBaseComponent))
987          return false;
988        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other;
989        return compareValues(path, o.path, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
990          ;
991      }
992
993      public boolean isEmpty() {
994        return super.isEmpty() && (path == null || path.isEmpty()) && (min == null || min.isEmpty())
995           && (max == null || max.isEmpty());
996      }
997
998  public String fhirType() {
999    return "ElementDefinition.base";
1000
1001  }
1002
1003  }
1004
1005    @Block()
1006    public static class TypeRefComponent extends Element implements IBaseDatatypeElement {
1007        /**
1008         * Name of Data type or Resource that is a(or the) type used for this element.
1009         */
1010        @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1011        @Description(shortDefinition="Name of Data type or Resource", formalDefinition="Name of Data type or Resource that is a(or the) type used for this element." )
1012        protected CodeType code;
1013
1014        /**
1015         * Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.
1016         */
1017        @Child(name = "profile", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1018        @Description(shortDefinition="Profile (StructureDefinition) to apply (or IG)", formalDefinition="Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide." )
1019        protected List<UriType> profile;
1020
1021        /**
1022         * 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.
1023         */
1024        @Child(name = "aggregation", type = {CodeType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1025        @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." )
1026        protected List<Enumeration<AggregationMode>> aggregation;
1027
1028        private static final long serialVersionUID = -988693373L;
1029
1030    /*
1031     * Constructor
1032     */
1033      public TypeRefComponent() {
1034        super();
1035      }
1036
1037    /*
1038     * Constructor
1039     */
1040      public TypeRefComponent(CodeType code) {
1041        super();
1042        this.code = code;
1043      }
1044
1045        /**
1046         * @return {@link #code} (Name of Data type or Resource that is a(or the) type used for this element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1047         */
1048        public CodeType getCodeElement() { 
1049          if (this.code == null)
1050            if (Configuration.errorOnAutoCreate())
1051              throw new Error("Attempt to auto-create TypeRefComponent.code");
1052            else if (Configuration.doAutoCreate())
1053              this.code = new CodeType(); // bb
1054          return this.code;
1055        }
1056
1057        public boolean hasCodeElement() { 
1058          return this.code != null && !this.code.isEmpty();
1059        }
1060
1061        public boolean hasCode() { 
1062          return this.code != null && !this.code.isEmpty();
1063        }
1064
1065        /**
1066         * @param value {@link #code} (Name of Data type or Resource that is a(or the) type used for this element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1067         */
1068        public TypeRefComponent setCodeElement(CodeType value) { 
1069          this.code = value;
1070          return this;
1071        }
1072
1073        /**
1074         * @return Name of Data type or Resource that is a(or the) type used for this element.
1075         */
1076        public String getCode() { 
1077          return this.code == null ? null : this.code.getValue();
1078        }
1079
1080        /**
1081         * @param value Name of Data type or Resource that is a(or the) type used for this element.
1082         */
1083        public TypeRefComponent setCode(String value) { 
1084            if (this.code == null)
1085              this.code = new CodeType();
1086            this.code.setValue(value);
1087          return this;
1088        }
1089
1090        /**
1091         * @return {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1092         */
1093        public List<UriType> getProfile() { 
1094          if (this.profile == null)
1095            this.profile = new ArrayList<UriType>();
1096          return this.profile;
1097        }
1098
1099        public boolean hasProfile() { 
1100          if (this.profile == null)
1101            return false;
1102          for (UriType item : this.profile)
1103            if (!item.isEmpty())
1104              return true;
1105          return false;
1106        }
1107
1108        /**
1109         * @return {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1110         */
1111    // syntactic sugar
1112        public UriType addProfileElement() {//2 
1113          UriType t = new UriType();
1114          if (this.profile == null)
1115            this.profile = new ArrayList<UriType>();
1116          this.profile.add(t);
1117          return t;
1118        }
1119
1120        /**
1121         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1122         */
1123        public TypeRefComponent addProfile(String value) { //1
1124          UriType t = new UriType();
1125          t.setValue(value);
1126          if (this.profile == null)
1127            this.profile = new ArrayList<UriType>();
1128          this.profile.add(t);
1129          return this;
1130        }
1131
1132        /**
1133         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1134         */
1135        public boolean hasProfile(String value) { 
1136          if (this.profile == null)
1137            return false;
1138          for (UriType v : this.profile)
1139            if (v.equals(value)) // uri
1140              return true;
1141          return false;
1142        }
1143
1144        /**
1145         * @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.)
1146         */
1147        public List<Enumeration<AggregationMode>> getAggregation() { 
1148          if (this.aggregation == null)
1149            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1150          return this.aggregation;
1151        }
1152
1153        public TypeRefComponent setAggregation(List<Enumeration<AggregationMode>> aggregation) {
1154            this.aggregation = aggregation;
1155            return this;
1156        }
1157
1158        public boolean hasAggregation() {
1159          if (this.aggregation == null)
1160            return false;
1161          for (Enumeration<AggregationMode> item : this.aggregation)
1162            if (!item.isEmpty())
1163              return true;
1164          return false;
1165        }
1166
1167        /**
1168         * @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.)
1169         */
1170    // syntactic sugar
1171        public Enumeration<AggregationMode> addAggregationElement() {//2 
1172          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
1173          if (this.aggregation == null)
1174            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1175          this.aggregation.add(t);
1176          return t;
1177        }
1178
1179        /**
1180         * @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.)
1181         */
1182        public TypeRefComponent addAggregation(AggregationMode value) { //1
1183          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
1184          t.setValue(value);
1185          if (this.aggregation == null)
1186            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1187          this.aggregation.add(t);
1188          return this;
1189        }
1190
1191        /**
1192         * @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.)
1193         */
1194        public boolean hasAggregation(AggregationMode value) { 
1195          if (this.aggregation == null)
1196            return false;
1197          for (Enumeration<AggregationMode> v : this.aggregation)
1198            if (v.equals(value)) // code
1199              return true;
1200          return false;
1201        }
1202
1203        protected void listChildren(List<Property> childrenList) {
1204          super.listChildren(childrenList);
1205          childrenList.add(new Property("code", "code", "Name of Data type or Resource that is a(or the) type used for this element.", 0, java.lang.Integer.MAX_VALUE, code));
1206          childrenList.add(new Property("profile", "uri", "Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. 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));
1207          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));
1208        }
1209
1210      @Override
1211      public void setProperty(String name, Base value) throws FHIRException {
1212        if (name.equals("code"))
1213          this.code = castToCode(value); // CodeType
1214        else if (name.equals("profile"))
1215          this.getProfile().add(castToUri(value));
1216        else if (name.equals("aggregation"))
1217          this.getAggregation().add(new AggregationModeEnumFactory().fromType(value));
1218        else
1219          super.setProperty(name, value);
1220      }
1221
1222      @Override
1223      public Base addChild(String name) throws FHIRException {
1224        if (name.equals("code")) {
1225          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.code");
1226        }
1227        else if (name.equals("profile")) {
1228          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.profile");
1229        }
1230        else if (name.equals("aggregation")) {
1231          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.aggregation");
1232        }
1233        else
1234          return super.addChild(name);
1235      }
1236
1237      public TypeRefComponent copy() {
1238        TypeRefComponent dst = new TypeRefComponent();
1239        copyValues(dst);
1240        dst.code = code == null ? null : code.copy();
1241        if (profile != null) {
1242          dst.profile = new ArrayList<UriType>();
1243          for (UriType i : profile)
1244            dst.profile.add(i.copy());
1245        };
1246        if (aggregation != null) {
1247          dst.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1248          for (Enumeration<AggregationMode> i : aggregation)
1249            dst.aggregation.add(i.copy());
1250        };
1251        return dst;
1252      }
1253
1254      @Override
1255      public boolean equalsDeep(Base other) {
1256        if (!super.equalsDeep(other))
1257          return false;
1258        if (!(other instanceof TypeRefComponent))
1259          return false;
1260        TypeRefComponent o = (TypeRefComponent) other;
1261        return compareDeep(code, o.code, true) && compareDeep(profile, o.profile, true) && compareDeep(aggregation, o.aggregation, true)
1262          ;
1263      }
1264
1265      @Override
1266      public boolean equalsShallow(Base other) {
1267        if (!super.equalsShallow(other))
1268          return false;
1269        if (!(other instanceof TypeRefComponent))
1270          return false;
1271        TypeRefComponent o = (TypeRefComponent) other;
1272        return compareValues(code, o.code, true) && compareValues(profile, o.profile, true) && compareValues(aggregation, o.aggregation, true)
1273          ;
1274      }
1275
1276      public boolean isEmpty() {
1277        return super.isEmpty() && (code == null || code.isEmpty()) && (profile == null || profile.isEmpty())
1278           && (aggregation == null || aggregation.isEmpty());
1279      }
1280
1281  public String fhirType() {
1282    return "ElementDefinition.type";
1283
1284  }
1285
1286  public boolean hasTarget() {
1287    return Utilities.existsInList(getCode(), "Reference");
1288
1289  }
1290
1291  }
1292
1293    @Block()
1294    public static class ElementDefinitionConstraintComponent extends Element implements IBaseDatatypeElement {
1295        /**
1296         * Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
1297         */
1298        @Child(name = "key", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1299        @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." )
1300        protected IdType key;
1301
1302        /**
1303         * Description of why this constraint is necessary or appropriate.
1304         */
1305        @Child(name = "requirements", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1306        @Description(shortDefinition="Why this constraint necessary or appropriate", formalDefinition="Description of why this constraint is necessary or appropriate." )
1307        protected StringType requirements;
1308
1309        /**
1310         * Identifies the impact constraint violation has on the conformance of the instance.
1311         */
1312        @Child(name = "severity", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1313        @Description(shortDefinition="error | warning", formalDefinition="Identifies the impact constraint violation has on the conformance of the instance." )
1314        protected Enumeration<ConstraintSeverity> severity;
1315
1316        /**
1317         * Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1318         */
1319        @Child(name = "human", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
1320        @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." )
1321        protected StringType human;
1322
1323        /**
1324         * An XPath expression of constraint that can be executed to see if this constraint is met.
1325         */
1326        @Child(name = "xpath", type = {StringType.class}, order=5, min=1, max=1, modifier=false, summary=true)
1327        @Description(shortDefinition="XPath expression of constraint", formalDefinition="An XPath expression of constraint that can be executed to see if this constraint is met." )
1328        protected StringType xpath;
1329
1330        private static final long serialVersionUID = 854521265L;
1331
1332    /*
1333     * Constructor
1334     */
1335      public ElementDefinitionConstraintComponent() {
1336        super();
1337      }
1338
1339    /*
1340     * Constructor
1341     */
1342      public ElementDefinitionConstraintComponent(IdType key, Enumeration<ConstraintSeverity> severity, StringType human, StringType xpath) {
1343        super();
1344        this.key = key;
1345        this.severity = severity;
1346        this.human = human;
1347        this.xpath = xpath;
1348      }
1349
1350        /**
1351         * @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
1352         */
1353        public IdType getKeyElement() { 
1354          if (this.key == null)
1355            if (Configuration.errorOnAutoCreate())
1356              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.key");
1357            else if (Configuration.doAutoCreate())
1358              this.key = new IdType(); // bb
1359          return this.key;
1360        }
1361
1362        public boolean hasKeyElement() { 
1363          return this.key != null && !this.key.isEmpty();
1364        }
1365
1366        public boolean hasKey() { 
1367          return this.key != null && !this.key.isEmpty();
1368        }
1369
1370        /**
1371         * @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
1372         */
1373        public ElementDefinitionConstraintComponent setKeyElement(IdType value) { 
1374          this.key = value;
1375          return this;
1376        }
1377
1378        /**
1379         * @return Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
1380         */
1381        public String getKey() { 
1382          return this.key == null ? null : this.key.getValue();
1383        }
1384
1385        /**
1386         * @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.
1387         */
1388        public ElementDefinitionConstraintComponent setKey(String value) { 
1389            if (this.key == null)
1390              this.key = new IdType();
1391            this.key.setValue(value);
1392          return this;
1393        }
1394
1395        /**
1396         * @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
1397         */
1398        public StringType getRequirementsElement() { 
1399          if (this.requirements == null)
1400            if (Configuration.errorOnAutoCreate())
1401              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.requirements");
1402            else if (Configuration.doAutoCreate())
1403              this.requirements = new StringType(); // bb
1404          return this.requirements;
1405        }
1406
1407        public boolean hasRequirementsElement() { 
1408          return this.requirements != null && !this.requirements.isEmpty();
1409        }
1410
1411        public boolean hasRequirements() { 
1412          return this.requirements != null && !this.requirements.isEmpty();
1413        }
1414
1415        /**
1416         * @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
1417         */
1418        public ElementDefinitionConstraintComponent setRequirementsElement(StringType value) { 
1419          this.requirements = value;
1420          return this;
1421        }
1422
1423        /**
1424         * @return Description of why this constraint is necessary or appropriate.
1425         */
1426        public String getRequirements() { 
1427          return this.requirements == null ? null : this.requirements.getValue();
1428        }
1429
1430        /**
1431         * @param value Description of why this constraint is necessary or appropriate.
1432         */
1433        public ElementDefinitionConstraintComponent setRequirements(String value) { 
1434          if (Utilities.noString(value))
1435            this.requirements = null;
1436          else {
1437            if (this.requirements == null)
1438              this.requirements = new StringType();
1439            this.requirements.setValue(value);
1440          }
1441          return this;
1442        }
1443
1444        /**
1445         * @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
1446         */
1447        public Enumeration<ConstraintSeverity> getSeverityElement() { 
1448          if (this.severity == null)
1449            if (Configuration.errorOnAutoCreate())
1450              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.severity");
1451            else if (Configuration.doAutoCreate())
1452              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory()); // bb
1453          return this.severity;
1454        }
1455
1456        public boolean hasSeverityElement() { 
1457          return this.severity != null && !this.severity.isEmpty();
1458        }
1459
1460        public boolean hasSeverity() { 
1461          return this.severity != null && !this.severity.isEmpty();
1462        }
1463
1464        /**
1465         * @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
1466         */
1467        public ElementDefinitionConstraintComponent setSeverityElement(Enumeration<ConstraintSeverity> value) { 
1468          this.severity = value;
1469          return this;
1470        }
1471
1472        /**
1473         * @return Identifies the impact constraint violation has on the conformance of the instance.
1474         */
1475        public ConstraintSeverity getSeverity() { 
1476          return this.severity == null ? null : this.severity.getValue();
1477        }
1478
1479        /**
1480         * @param value Identifies the impact constraint violation has on the conformance of the instance.
1481         */
1482        public ElementDefinitionConstraintComponent setSeverity(ConstraintSeverity value) { 
1483            if (this.severity == null)
1484              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory());
1485            this.severity.setValue(value);
1486          return this;
1487        }
1488
1489        /**
1490         * @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
1491         */
1492        public StringType getHumanElement() { 
1493          if (this.human == null)
1494            if (Configuration.errorOnAutoCreate())
1495              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.human");
1496            else if (Configuration.doAutoCreate())
1497              this.human = new StringType(); // bb
1498          return this.human;
1499        }
1500
1501        public boolean hasHumanElement() { 
1502          return this.human != null && !this.human.isEmpty();
1503        }
1504
1505        public boolean hasHuman() { 
1506          return this.human != null && !this.human.isEmpty();
1507        }
1508
1509        /**
1510         * @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
1511         */
1512        public ElementDefinitionConstraintComponent setHumanElement(StringType value) { 
1513          this.human = value;
1514          return this;
1515        }
1516
1517        /**
1518         * @return Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1519         */
1520        public String getHuman() { 
1521          return this.human == null ? null : this.human.getValue();
1522        }
1523
1524        /**
1525         * @param value Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1526         */
1527        public ElementDefinitionConstraintComponent setHuman(String value) { 
1528            if (this.human == null)
1529              this.human = new StringType();
1530            this.human.setValue(value);
1531          return this;
1532        }
1533
1534        /**
1535         * @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
1536         */
1537        public StringType getXpathElement() { 
1538          if (this.xpath == null)
1539            if (Configuration.errorOnAutoCreate())
1540              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.xpath");
1541            else if (Configuration.doAutoCreate())
1542              this.xpath = new StringType(); // bb
1543          return this.xpath;
1544        }
1545
1546        public boolean hasXpathElement() { 
1547          return this.xpath != null && !this.xpath.isEmpty();
1548        }
1549
1550        public boolean hasXpath() { 
1551          return this.xpath != null && !this.xpath.isEmpty();
1552        }
1553
1554        /**
1555         * @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
1556         */
1557        public ElementDefinitionConstraintComponent setXpathElement(StringType value) { 
1558          this.xpath = value;
1559          return this;
1560        }
1561
1562        /**
1563         * @return An XPath expression of constraint that can be executed to see if this constraint is met.
1564         */
1565        public String getXpath() { 
1566          return this.xpath == null ? null : this.xpath.getValue();
1567        }
1568
1569        /**
1570         * @param value An XPath expression of constraint that can be executed to see if this constraint is met.
1571         */
1572        public ElementDefinitionConstraintComponent setXpath(String value) { 
1573            if (this.xpath == null)
1574              this.xpath = new StringType();
1575            this.xpath.setValue(value);
1576          return this;
1577        }
1578
1579        protected void listChildren(List<Property> childrenList) {
1580          super.listChildren(childrenList);
1581          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));
1582          childrenList.add(new Property("requirements", "string", "Description of why this constraint is necessary or appropriate.", 0, java.lang.Integer.MAX_VALUE, requirements));
1583          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));
1584          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));
1585          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));
1586        }
1587
1588      @Override
1589      public void setProperty(String name, Base value) throws FHIRException {
1590        if (name.equals("key"))
1591          this.key = castToId(value); // IdType
1592        else if (name.equals("requirements"))
1593          this.requirements = castToString(value); // StringType
1594        else if (name.equals("severity"))
1595          this.severity = new ConstraintSeverityEnumFactory().fromType(value); // Enumeration<ConstraintSeverity>
1596        else if (name.equals("human"))
1597          this.human = castToString(value); // StringType
1598        else if (name.equals("xpath"))
1599          this.xpath = castToString(value); // StringType
1600        else
1601          super.setProperty(name, value);
1602      }
1603
1604      @Override
1605      public Base addChild(String name) throws FHIRException {
1606        if (name.equals("key")) {
1607          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.key");
1608        }
1609        else if (name.equals("requirements")) {
1610          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.requirements");
1611        }
1612        else if (name.equals("severity")) {
1613          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.severity");
1614        }
1615        else if (name.equals("human")) {
1616          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.human");
1617        }
1618        else if (name.equals("xpath")) {
1619          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.xpath");
1620        }
1621        else
1622          return super.addChild(name);
1623      }
1624
1625      public ElementDefinitionConstraintComponent copy() {
1626        ElementDefinitionConstraintComponent dst = new ElementDefinitionConstraintComponent();
1627        copyValues(dst);
1628        dst.key = key == null ? null : key.copy();
1629        dst.requirements = requirements == null ? null : requirements.copy();
1630        dst.severity = severity == null ? null : severity.copy();
1631        dst.human = human == null ? null : human.copy();
1632        dst.xpath = xpath == null ? null : xpath.copy();
1633        return dst;
1634      }
1635
1636      @Override
1637      public boolean equalsDeep(Base other) {
1638        if (!super.equalsDeep(other))
1639          return false;
1640        if (!(other instanceof ElementDefinitionConstraintComponent))
1641          return false;
1642        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other;
1643        return compareDeep(key, o.key, true) && compareDeep(requirements, o.requirements, true) && compareDeep(severity, o.severity, true)
1644           && compareDeep(human, o.human, true) && compareDeep(xpath, o.xpath, true);
1645      }
1646
1647      @Override
1648      public boolean equalsShallow(Base other) {
1649        if (!super.equalsShallow(other))
1650          return false;
1651        if (!(other instanceof ElementDefinitionConstraintComponent))
1652          return false;
1653        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other;
1654        return compareValues(key, o.key, true) && compareValues(requirements, o.requirements, true) && compareValues(severity, o.severity, true)
1655           && compareValues(human, o.human, true) && compareValues(xpath, o.xpath, true);
1656      }
1657
1658      public boolean isEmpty() {
1659        return super.isEmpty() && (key == null || key.isEmpty()) && (requirements == null || requirements.isEmpty())
1660           && (severity == null || severity.isEmpty()) && (human == null || human.isEmpty()) && (xpath == null || xpath.isEmpty())
1661          ;
1662      }
1663
1664  public String fhirType() {
1665    return "ElementDefinition.constraint";
1666
1667  }
1668
1669  }
1670
1671    @Block()
1672    public static class ElementDefinitionBindingComponent extends Element implements IBaseDatatypeElement {
1673        /**
1674         * 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.
1675         */
1676        @Child(name = "strength", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1677        @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." )
1678        protected Enumeration<BindingStrength> strength;
1679
1680        /**
1681         * Describes the intended use of this particular set of codes.
1682         */
1683        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1684        @Description(shortDefinition="Human explanation of the value set", formalDefinition="Describes the intended use of this particular set of codes." )
1685        protected StringType description;
1686
1687        /**
1688         * Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.
1689         */
1690        @Child(name = "valueSet", type = {UriType.class, ValueSet.class}, order=3, min=0, max=1, modifier=false, summary=true)
1691        @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." )
1692        protected Type valueSet;
1693
1694        private static final long serialVersionUID = 1355538460L;
1695
1696    /*
1697     * Constructor
1698     */
1699      public ElementDefinitionBindingComponent() {
1700        super();
1701      }
1702
1703    /*
1704     * Constructor
1705     */
1706      public ElementDefinitionBindingComponent(Enumeration<BindingStrength> strength) {
1707        super();
1708        this.strength = strength;
1709      }
1710
1711        /**
1712         * @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
1713         */
1714        public Enumeration<BindingStrength> getStrengthElement() { 
1715          if (this.strength == null)
1716            if (Configuration.errorOnAutoCreate())
1717              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.strength");
1718            else if (Configuration.doAutoCreate())
1719              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory()); // bb
1720          return this.strength;
1721        }
1722
1723        public boolean hasStrengthElement() { 
1724          return this.strength != null && !this.strength.isEmpty();
1725        }
1726
1727        public boolean hasStrength() { 
1728          return this.strength != null && !this.strength.isEmpty();
1729        }
1730
1731        /**
1732         * @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
1733         */
1734        public ElementDefinitionBindingComponent setStrengthElement(Enumeration<BindingStrength> value) { 
1735          this.strength = value;
1736          return this;
1737        }
1738
1739        /**
1740         * @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.
1741         */
1742        public BindingStrength getStrength() { 
1743          return this.strength == null ? null : this.strength.getValue();
1744        }
1745
1746        /**
1747         * @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.
1748         */
1749        public ElementDefinitionBindingComponent setStrength(BindingStrength value) { 
1750            if (this.strength == null)
1751              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory());
1752            this.strength.setValue(value);
1753          return this;
1754        }
1755
1756        /**
1757         * @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
1758         */
1759        public StringType getDescriptionElement() { 
1760          if (this.description == null)
1761            if (Configuration.errorOnAutoCreate())
1762              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.description");
1763            else if (Configuration.doAutoCreate())
1764              this.description = new StringType(); // bb
1765          return this.description;
1766        }
1767
1768        public boolean hasDescriptionElement() { 
1769          return this.description != null && !this.description.isEmpty();
1770        }
1771
1772        public boolean hasDescription() { 
1773          return this.description != null && !this.description.isEmpty();
1774        }
1775
1776        /**
1777         * @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
1778         */
1779        public ElementDefinitionBindingComponent setDescriptionElement(StringType value) { 
1780          this.description = value;
1781          return this;
1782        }
1783
1784        /**
1785         * @return Describes the intended use of this particular set of codes.
1786         */
1787        public String getDescription() { 
1788          return this.description == null ? null : this.description.getValue();
1789        }
1790
1791        /**
1792         * @param value Describes the intended use of this particular set of codes.
1793         */
1794        public ElementDefinitionBindingComponent setDescription(String value) { 
1795          if (Utilities.noString(value))
1796            this.description = null;
1797          else {
1798            if (this.description == null)
1799              this.description = new StringType();
1800            this.description.setValue(value);
1801          }
1802          return this;
1803        }
1804
1805        /**
1806         * @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.)
1807         */
1808        public Type getValueSet() { 
1809          return this.valueSet;
1810        }
1811
1812        /**
1813         * @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.)
1814         */
1815        public UriType getValueSetUriType() throws FHIRException { 
1816          if (!(this.valueSet instanceof UriType))
1817            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.valueSet.getClass().getName()+" was encountered");
1818          return (UriType) this.valueSet;
1819        }
1820
1821        public boolean hasValueSetUriType() { 
1822          return this.valueSet instanceof UriType;
1823        }
1824
1825        /**
1826         * @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.)
1827         */
1828        public Reference getValueSetReference() throws FHIRException { 
1829          if (!(this.valueSet instanceof Reference))
1830            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.valueSet.getClass().getName()+" was encountered");
1831          return (Reference) this.valueSet;
1832        }
1833
1834        public boolean hasValueSetReference() { 
1835          return this.valueSet instanceof Reference;
1836        }
1837
1838        public boolean hasValueSet() { 
1839          return this.valueSet != null && !this.valueSet.isEmpty();
1840        }
1841
1842        /**
1843         * @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.)
1844         */
1845        public ElementDefinitionBindingComponent setValueSet(Type value) { 
1846          this.valueSet = value;
1847          return this;
1848        }
1849
1850        protected void listChildren(List<Property> childrenList) {
1851          super.listChildren(childrenList);
1852          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));
1853          childrenList.add(new Property("description", "string", "Describes the intended use of this particular set of codes.", 0, java.lang.Integer.MAX_VALUE, description));
1854          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.", 0, java.lang.Integer.MAX_VALUE, valueSet));
1855        }
1856
1857      @Override
1858      public void setProperty(String name, Base value) throws FHIRException {
1859        if (name.equals("strength"))
1860          this.strength = new BindingStrengthEnumFactory().fromType(value); // Enumeration<BindingStrength>
1861        else if (name.equals("description"))
1862          this.description = castToString(value); // StringType
1863        else if (name.equals("valueSet[x]"))
1864          this.valueSet = (Type) value; // Type
1865        else
1866          super.setProperty(name, value);
1867      }
1868
1869      @Override
1870      public Base addChild(String name) throws FHIRException {
1871        if (name.equals("strength")) {
1872          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.strength");
1873        }
1874        else if (name.equals("description")) {
1875          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.description");
1876        }
1877        else if (name.equals("valueSetUri")) {
1878          this.valueSet = new UriType();
1879          return this.valueSet;
1880        }
1881        else if (name.equals("valueSetReference")) {
1882          this.valueSet = new Reference();
1883          return this.valueSet;
1884        }
1885        else
1886          return super.addChild(name);
1887      }
1888
1889      public ElementDefinitionBindingComponent copy() {
1890        ElementDefinitionBindingComponent dst = new ElementDefinitionBindingComponent();
1891        copyValues(dst);
1892        dst.strength = strength == null ? null : strength.copy();
1893        dst.description = description == null ? null : description.copy();
1894        dst.valueSet = valueSet == null ? null : valueSet.copy();
1895        return dst;
1896      }
1897
1898      @Override
1899      public boolean equalsDeep(Base other) {
1900        if (!super.equalsDeep(other))
1901          return false;
1902        if (!(other instanceof ElementDefinitionBindingComponent))
1903          return false;
1904        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
1905        return compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
1906           && compareDeep(valueSet, o.valueSet, true);
1907      }
1908
1909      @Override
1910      public boolean equalsShallow(Base other) {
1911        if (!super.equalsShallow(other))
1912          return false;
1913        if (!(other instanceof ElementDefinitionBindingComponent))
1914          return false;
1915        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
1916        return compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
1917          ;
1918      }
1919
1920      public boolean isEmpty() {
1921        return super.isEmpty() && (strength == null || strength.isEmpty()) && (description == null || description.isEmpty())
1922           && (valueSet == null || valueSet.isEmpty());
1923      }
1924
1925  public String fhirType() {
1926    return "ElementDefinition.binding";
1927
1928  }
1929
1930  }
1931
1932    @Block()
1933    public static class ElementDefinitionMappingComponent extends Element implements IBaseDatatypeElement {
1934        /**
1935         * An internal reference to the definition of a mapping.
1936         */
1937        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1938        @Description(shortDefinition="Reference to mapping declaration", formalDefinition="An internal reference to the definition of a mapping." )
1939        protected IdType identity;
1940
1941        /**
1942         * Identifies the computable language in which mapping.map is expressed.
1943         */
1944        @Child(name = "language", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1945        @Description(shortDefinition="Computable language of mapping", formalDefinition="Identifies the computable language in which mapping.map is expressed." )
1946        protected CodeType language;
1947
1948        /**
1949         * Expresses what part of the target specification corresponds to this element.
1950         */
1951        @Child(name = "map", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1952        @Description(shortDefinition="Details of the mapping", formalDefinition="Expresses what part of the target specification corresponds to this element." )
1953        protected StringType map;
1954
1955        private static final long serialVersionUID = -669205371L;
1956
1957    /*
1958     * Constructor
1959     */
1960      public ElementDefinitionMappingComponent() {
1961        super();
1962      }
1963
1964    /*
1965     * Constructor
1966     */
1967      public ElementDefinitionMappingComponent(IdType identity, StringType map) {
1968        super();
1969        this.identity = identity;
1970        this.map = map;
1971      }
1972
1973        /**
1974         * @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
1975         */
1976        public IdType getIdentityElement() { 
1977          if (this.identity == null)
1978            if (Configuration.errorOnAutoCreate())
1979              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.identity");
1980            else if (Configuration.doAutoCreate())
1981              this.identity = new IdType(); // bb
1982          return this.identity;
1983        }
1984
1985        public boolean hasIdentityElement() { 
1986          return this.identity != null && !this.identity.isEmpty();
1987        }
1988
1989        public boolean hasIdentity() { 
1990          return this.identity != null && !this.identity.isEmpty();
1991        }
1992
1993        /**
1994         * @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
1995         */
1996        public ElementDefinitionMappingComponent setIdentityElement(IdType value) { 
1997          this.identity = value;
1998          return this;
1999        }
2000
2001        /**
2002         * @return An internal reference to the definition of a mapping.
2003         */
2004        public String getIdentity() { 
2005          return this.identity == null ? null : this.identity.getValue();
2006        }
2007
2008        /**
2009         * @param value An internal reference to the definition of a mapping.
2010         */
2011        public ElementDefinitionMappingComponent setIdentity(String value) { 
2012            if (this.identity == null)
2013              this.identity = new IdType();
2014            this.identity.setValue(value);
2015          return this;
2016        }
2017
2018        /**
2019         * @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
2020         */
2021        public CodeType getLanguageElement() { 
2022          if (this.language == null)
2023            if (Configuration.errorOnAutoCreate())
2024              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.language");
2025            else if (Configuration.doAutoCreate())
2026              this.language = new CodeType(); // bb
2027          return this.language;
2028        }
2029
2030        public boolean hasLanguageElement() { 
2031          return this.language != null && !this.language.isEmpty();
2032        }
2033
2034        public boolean hasLanguage() { 
2035          return this.language != null && !this.language.isEmpty();
2036        }
2037
2038        /**
2039         * @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
2040         */
2041        public ElementDefinitionMappingComponent setLanguageElement(CodeType value) { 
2042          this.language = value;
2043          return this;
2044        }
2045
2046        /**
2047         * @return Identifies the computable language in which mapping.map is expressed.
2048         */
2049        public String getLanguage() { 
2050          return this.language == null ? null : this.language.getValue();
2051        }
2052
2053        /**
2054         * @param value Identifies the computable language in which mapping.map is expressed.
2055         */
2056        public ElementDefinitionMappingComponent setLanguage(String value) { 
2057          if (Utilities.noString(value))
2058            this.language = null;
2059          else {
2060            if (this.language == null)
2061              this.language = new CodeType();
2062            this.language.setValue(value);
2063          }
2064          return this;
2065        }
2066
2067        /**
2068         * @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
2069         */
2070        public StringType getMapElement() { 
2071          if (this.map == null)
2072            if (Configuration.errorOnAutoCreate())
2073              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.map");
2074            else if (Configuration.doAutoCreate())
2075              this.map = new StringType(); // bb
2076          return this.map;
2077        }
2078
2079        public boolean hasMapElement() { 
2080          return this.map != null && !this.map.isEmpty();
2081        }
2082
2083        public boolean hasMap() { 
2084          return this.map != null && !this.map.isEmpty();
2085        }
2086
2087        /**
2088         * @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
2089         */
2090        public ElementDefinitionMappingComponent setMapElement(StringType value) { 
2091          this.map = value;
2092          return this;
2093        }
2094
2095        /**
2096         * @return Expresses what part of the target specification corresponds to this element.
2097         */
2098        public String getMap() { 
2099          return this.map == null ? null : this.map.getValue();
2100        }
2101
2102        /**
2103         * @param value Expresses what part of the target specification corresponds to this element.
2104         */
2105        public ElementDefinitionMappingComponent setMap(String value) { 
2106            if (this.map == null)
2107              this.map = new StringType();
2108            this.map.setValue(value);
2109          return this;
2110        }
2111
2112        protected void listChildren(List<Property> childrenList) {
2113          super.listChildren(childrenList);
2114          childrenList.add(new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, java.lang.Integer.MAX_VALUE, identity));
2115          childrenList.add(new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, java.lang.Integer.MAX_VALUE, language));
2116          childrenList.add(new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, java.lang.Integer.MAX_VALUE, map));
2117        }
2118
2119      @Override
2120      public void setProperty(String name, Base value) throws FHIRException {
2121        if (name.equals("identity"))
2122          this.identity = castToId(value); // IdType
2123        else if (name.equals("language"))
2124          this.language = castToCode(value); // CodeType
2125        else if (name.equals("map"))
2126          this.map = castToString(value); // StringType
2127        else
2128          super.setProperty(name, value);
2129      }
2130
2131      @Override
2132      public Base addChild(String name) throws FHIRException {
2133        if (name.equals("identity")) {
2134          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.identity");
2135        }
2136        else if (name.equals("language")) {
2137          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.language");
2138        }
2139        else if (name.equals("map")) {
2140          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.map");
2141        }
2142        else
2143          return super.addChild(name);
2144      }
2145
2146      public ElementDefinitionMappingComponent copy() {
2147        ElementDefinitionMappingComponent dst = new ElementDefinitionMappingComponent();
2148        copyValues(dst);
2149        dst.identity = identity == null ? null : identity.copy();
2150        dst.language = language == null ? null : language.copy();
2151        dst.map = map == null ? null : map.copy();
2152        return dst;
2153      }
2154
2155      @Override
2156      public boolean equalsDeep(Base other) {
2157        if (!super.equalsDeep(other))
2158          return false;
2159        if (!(other instanceof ElementDefinitionMappingComponent))
2160          return false;
2161        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other;
2162        return compareDeep(identity, o.identity, true) && compareDeep(language, o.language, true) && compareDeep(map, o.map, true)
2163          ;
2164      }
2165
2166      @Override
2167      public boolean equalsShallow(Base other) {
2168        if (!super.equalsShallow(other))
2169          return false;
2170        if (!(other instanceof ElementDefinitionMappingComponent))
2171          return false;
2172        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other;
2173        return compareValues(identity, o.identity, true) && compareValues(language, o.language, true) && compareValues(map, o.map, true)
2174          ;
2175      }
2176
2177      public boolean isEmpty() {
2178        return super.isEmpty() && (identity == null || identity.isEmpty()) && (language == null || language.isEmpty())
2179           && (map == null || map.isEmpty());
2180      }
2181
2182  public String fhirType() {
2183    return "ElementDefinition.mapping";
2184
2185  }
2186
2187  }
2188
2189    /**
2190     * The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
2191     */
2192    @Child(name = "path", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=true)
2193    @Description(shortDefinition="The path of the element (see the Detailed Descriptions)", 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." )
2194    protected StringType path;
2195
2196    /**
2197     * Codes that define how this element is represented in instances, when the deviation varies from the normal case.
2198     */
2199    @Child(name = "representation", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2200    @Description(shortDefinition="How this element is represented in instances", formalDefinition="Codes that define how this element is represented in instances, when the deviation varies from the normal case." )
2201    protected List<Enumeration<PropertyRepresentation>> representation;
2202
2203    /**
2204     * The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.
2205     */
2206    @Child(name = "name", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2207    @Description(shortDefinition="Name for this particular element definition (reference target)", formalDefinition="The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element." )
2208    protected StringType name;
2209
2210    /**
2211     * The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
2212     */
2213    @Child(name = "label", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2214    @Description(shortDefinition="Name for element to display with or prompt for element", formalDefinition="The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form." )
2215    protected StringType label;
2216
2217    /**
2218     * A code that provides the meaning for the element according to a particular terminology.
2219     */
2220    @Child(name = "code", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2221    @Description(shortDefinition="Defining code", formalDefinition="A code that provides the meaning for the element according to a particular terminology." )
2222    protected List<Coding> code;
2223
2224    /**
2225     * 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).
2226     */
2227    @Child(name = "slicing", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
2228    @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)." )
2229    protected ElementDefinitionSlicingComponent slicing;
2230
2231    /**
2232     * A concise description of what this element means (e.g. for use in autogenerated summaries).
2233     */
2234    @Child(name = "short", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
2235    @Description(shortDefinition="Concise definition for xml presentation", formalDefinition="A concise description of what this element means (e.g. for use in autogenerated summaries)." )
2236    protected StringType short_;
2237
2238    /**
2239     * 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.
2240     */
2241    @Child(name = "definition", type = {MarkdownType.class}, order=7, min=0, max=1, modifier=false, summary=true)
2242    @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." )
2243    protected MarkdownType definition;
2244
2245    /**
2246     * Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
2247     */
2248    @Child(name = "comments", type = {MarkdownType.class}, order=8, min=0, max=1, modifier=false, summary=true)
2249    @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." )
2250    protected MarkdownType comments;
2251
2252    /**
2253     * 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.
2254     */
2255    @Child(name = "requirements", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=true)
2256    @Description(shortDefinition="Why is this needed?", 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." )
2257    protected MarkdownType requirements;
2258
2259    /**
2260     * Identifies additional names by which this element might also be known.
2261     */
2262    @Child(name = "alias", type = {StringType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2263    @Description(shortDefinition="Other names", formalDefinition="Identifies additional names by which this element might also be known." )
2264    protected List<StringType> alias;
2265
2266    /**
2267     * The minimum number of times this element SHALL appear in the instance.
2268     */
2269    @Child(name = "min", type = {IntegerType.class}, order=11, min=0, max=1, modifier=false, summary=true)
2270    @Description(shortDefinition="Minimum Cardinality", formalDefinition="The minimum number of times this element SHALL appear in the instance." )
2271    protected IntegerType min;
2272
2273    /**
2274     * The maximum number of times this element is permitted to appear in the instance.
2275     */
2276    @Child(name = "max", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
2277    @Description(shortDefinition="Maximum Cardinality (a number or *)", formalDefinition="The maximum number of times this element is permitted to appear in the instance." )
2278    protected StringType max;
2279
2280    /**
2281     * Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.
2282     */
2283    @Child(name = "base", type = {}, order=13, min=0, max=1, modifier=false, summary=true)
2284    @Description(shortDefinition="Base definition information for tools", formalDefinition="Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition." )
2285    protected ElementDefinitionBaseComponent base;
2286
2287    /**
2288     * The data type or resource that the value of this element is permitted to be.
2289     */
2290    @Child(name = "type", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2291    @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." )
2292    protected List<TypeRefComponent> type;
2293
2294    /**
2295     * Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.
2296     */
2297    @Child(name = "nameReference", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=true)
2298    @Description(shortDefinition="To another element constraint (by element.name)", formalDefinition="Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element." )
2299    protected StringType nameReference;
2300
2301    /**
2302     * 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').
2303     */
2304    @Child(name = "defaultValue", type = {}, order=16, min=0, max=1, modifier=false, summary=true)
2305    @Description(shortDefinition="Specified value it 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')." )
2306    protected org.hl7.fhir.dstu2.model.Type defaultValue;
2307
2308    /**
2309     * The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.
2310     */
2311    @Child(name = "meaningWhenMissing", type = {MarkdownType.class}, order=17, min=0, max=1, modifier=false, summary=true)
2312    @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'." )
2313    protected MarkdownType meaningWhenMissing;
2314
2315    /**
2316     * 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.
2317     */
2318    @Child(name = "fixed", type = {}, order=18, min=0, max=1, modifier=false, summary=true)
2319    @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." )
2320    protected org.hl7.fhir.dstu2.model.Type fixed;
2321
2322    /**
2323     * 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.).
2324     */
2325    @Child(name = "pattern", type = {}, order=19, min=0, max=1, modifier=false, summary=true)
2326    @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.)." )
2327    protected org.hl7.fhir.dstu2.model.Type pattern;
2328
2329    /**
2330     * A sample value for this element demonstrating the type of information that would typically be captured.
2331     */
2332    @Child(name = "example", type = {}, order=20, min=0, max=1, modifier=false, summary=true)
2333    @Description(shortDefinition="Example value: [as defined for type]", formalDefinition="A sample value for this element demonstrating the type of information that would typically be captured." )
2334    protected org.hl7.fhir.dstu2.model.Type example;
2335
2336    /**
2337     * 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.
2338     */
2339    @Child(name = "minValue", type = {}, order=21, min=0, max=1, modifier=false, summary=true)
2340    @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." )
2341    protected org.hl7.fhir.dstu2.model.Type minValue;
2342
2343    /**
2344     * 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.
2345     */
2346    @Child(name = "maxValue", type = {}, order=22, min=0, max=1, modifier=false, summary=true)
2347    @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." )
2348    protected org.hl7.fhir.dstu2.model.Type maxValue;
2349
2350    /**
2351     * 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.
2352     */
2353    @Child(name = "maxLength", type = {IntegerType.class}, order=23, min=0, max=1, modifier=false, summary=true)
2354    @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." )
2355    protected IntegerType maxLength;
2356
2357    /**
2358     * A reference to an invariant that may make additional statements about the cardinality or value in the instance.
2359     */
2360    @Child(name = "condition", type = {IdType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2361    @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." )
2362    protected List<IdType> condition;
2363
2364    /**
2365     * Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.
2366     */
2367    @Child(name = "constraint", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2368    @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." )
2369    protected List<ElementDefinitionConstraintComponent> constraint;
2370
2371    /**
2372     * 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.
2373     */
2374    @Child(name = "mustSupport", type = {BooleanType.class}, order=26, min=0, max=1, modifier=false, summary=true)
2375    @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." )
2376    protected BooleanType mustSupport;
2377
2378    /**
2379     * 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.
2380     */
2381    @Child(name = "isModifier", type = {BooleanType.class}, order=27, min=0, max=1, modifier=false, summary=true)
2382    @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." )
2383    protected BooleanType isModifier;
2384
2385    /**
2386     * Whether the element should be included if a client requests a search with the parameter _summary=true.
2387     */
2388    @Child(name = "isSummary", type = {BooleanType.class}, order=28, min=0, max=1, modifier=false, summary=true)
2389    @Description(shortDefinition="Include when _summary = true?", formalDefinition="Whether the element should be included if a client requests a search with the parameter _summary=true." )
2390    protected BooleanType isSummary;
2391
2392    /**
2393     * Binds to a value set if this element is coded (code, Coding, CodeableConcept).
2394     */
2395    @Child(name = "binding", type = {}, order=29, min=0, max=1, modifier=false, summary=true)
2396    @Description(shortDefinition="ValueSet details if this is coded", formalDefinition="Binds to a value set if this element is coded (code, Coding, CodeableConcept)." )
2397    protected ElementDefinitionBindingComponent binding;
2398
2399    /**
2400     * Identifies a concept from an external specification that roughly corresponds to this element.
2401     */
2402    @Child(name = "mapping", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2403    @Description(shortDefinition="Map element to another set of definitions", formalDefinition="Identifies a concept from an external specification that roughly corresponds to this element." )
2404    protected List<ElementDefinitionMappingComponent> mapping;
2405
2406    private static final long serialVersionUID = -447087484L;
2407
2408  /*
2409   * Constructor
2410   */
2411    public ElementDefinition() {
2412      super();
2413    }
2414
2415  /*
2416   * Constructor
2417   */
2418    public ElementDefinition(StringType path) {
2419      super();
2420      this.path = path;
2421    }
2422
2423    /**
2424     * @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
2425     */
2426    public StringType getPathElement() { 
2427      if (this.path == null)
2428        if (Configuration.errorOnAutoCreate())
2429          throw new Error("Attempt to auto-create ElementDefinition.path");
2430        else if (Configuration.doAutoCreate())
2431          this.path = new StringType(); // bb
2432      return this.path;
2433    }
2434
2435    public boolean hasPathElement() { 
2436      return this.path != null && !this.path.isEmpty();
2437    }
2438
2439    public boolean hasPath() { 
2440      return this.path != null && !this.path.isEmpty();
2441    }
2442
2443    /**
2444     * @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
2445     */
2446    public ElementDefinition setPathElement(StringType value) { 
2447      this.path = value;
2448      return this;
2449    }
2450
2451    /**
2452     * @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.
2453     */
2454    public String getPath() { 
2455      return this.path == null ? null : this.path.getValue();
2456    }
2457
2458    /**
2459     * @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.
2460     */
2461    public ElementDefinition setPath(String value) { 
2462        if (this.path == null)
2463          this.path = new StringType();
2464        this.path.setValue(value);
2465      return this;
2466    }
2467
2468    /**
2469     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
2470     */
2471    public List<Enumeration<PropertyRepresentation>> getRepresentation() { 
2472      if (this.representation == null)
2473        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
2474      return this.representation;
2475    }
2476
2477    public ElementDefinition setRepresentation(List<Enumeration<PropertyRepresentation>> representation) {
2478        this.representation = representation;
2479        return this;
2480    }
2481
2482    public boolean hasRepresentation() {
2483      if (this.representation == null)
2484        return false;
2485      for (Enumeration<PropertyRepresentation> item : this.representation)
2486        if (!item.isEmpty())
2487          return true;
2488      return false;
2489    }
2490
2491    /**
2492     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
2493     */
2494    // syntactic sugar
2495    public Enumeration<PropertyRepresentation> addRepresentationElement() {//2 
2496      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
2497      if (this.representation == null)
2498        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
2499      this.representation.add(t);
2500      return t;
2501    }
2502
2503    /**
2504     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
2505     */
2506    public ElementDefinition addRepresentation(PropertyRepresentation value) { //1
2507      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
2508      t.setValue(value);
2509      if (this.representation == null)
2510        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
2511      this.representation.add(t);
2512      return this;
2513    }
2514
2515    /**
2516     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
2517     */
2518    public boolean hasRepresentation(PropertyRepresentation value) { 
2519      if (this.representation == null)
2520        return false;
2521      for (Enumeration<PropertyRepresentation> v : this.representation)
2522        if (v.equals(value)) // code
2523          return true;
2524      return false;
2525    }
2526
2527    /**
2528     * @return {@link #name} (The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2529     */
2530    public StringType getNameElement() { 
2531      if (this.name == null)
2532        if (Configuration.errorOnAutoCreate())
2533          throw new Error("Attempt to auto-create ElementDefinition.name");
2534        else if (Configuration.doAutoCreate())
2535          this.name = new StringType(); // bb
2536      return this.name;
2537    }
2538
2539    public boolean hasNameElement() { 
2540      return this.name != null && !this.name.isEmpty();
2541    }
2542
2543    public boolean hasName() { 
2544      return this.name != null && !this.name.isEmpty();
2545    }
2546
2547    /**
2548     * @param value {@link #name} (The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2549     */
2550    public ElementDefinition setNameElement(StringType value) { 
2551      this.name = value;
2552      return this;
2553    }
2554
2555    /**
2556     * @return The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.
2557     */
2558    public String getName() { 
2559      return this.name == null ? null : this.name.getValue();
2560    }
2561
2562    /**
2563     * @param value The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.
2564     */
2565    public ElementDefinition setName(String value) { 
2566      if (Utilities.noString(value))
2567        this.name = null;
2568      else {
2569        if (this.name == null)
2570          this.name = new StringType();
2571        this.name.setValue(value);
2572      }
2573      return this;
2574    }
2575
2576    /**
2577     * @return {@link #label} (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
2578     */
2579    public StringType getLabelElement() { 
2580      if (this.label == null)
2581        if (Configuration.errorOnAutoCreate())
2582          throw new Error("Attempt to auto-create ElementDefinition.label");
2583        else if (Configuration.doAutoCreate())
2584          this.label = new StringType(); // bb
2585      return this.label;
2586    }
2587
2588    public boolean hasLabelElement() { 
2589      return this.label != null && !this.label.isEmpty();
2590    }
2591
2592    public boolean hasLabel() { 
2593      return this.label != null && !this.label.isEmpty();
2594    }
2595
2596    /**
2597     * @param value {@link #label} (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
2598     */
2599    public ElementDefinition setLabelElement(StringType value) { 
2600      this.label = value;
2601      return this;
2602    }
2603
2604    /**
2605     * @return The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
2606     */
2607    public String getLabel() { 
2608      return this.label == null ? null : this.label.getValue();
2609    }
2610
2611    /**
2612     * @param value The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
2613     */
2614    public ElementDefinition setLabel(String value) { 
2615      if (Utilities.noString(value))
2616        this.label = null;
2617      else {
2618        if (this.label == null)
2619          this.label = new StringType();
2620        this.label.setValue(value);
2621      }
2622      return this;
2623    }
2624
2625    /**
2626     * @return {@link #code} (A code that provides the meaning for the element according to a particular terminology.)
2627     */
2628    public List<Coding> getCode() { 
2629      if (this.code == null)
2630        this.code = new ArrayList<Coding>();
2631      return this.code;
2632    }
2633
2634    public boolean hasCode() { 
2635      if (this.code == null)
2636        return false;
2637      for (Coding item : this.code)
2638        if (!item.isEmpty())
2639          return true;
2640      return false;
2641    }
2642
2643    /**
2644     * @return {@link #code} (A code that provides the meaning for the element according to a particular terminology.)
2645     */
2646    // syntactic sugar
2647    public Coding addCode() { //3
2648      Coding t = new Coding();
2649      if (this.code == null)
2650        this.code = new ArrayList<Coding>();
2651      this.code.add(t);
2652      return t;
2653    }
2654
2655    // syntactic sugar
2656    public ElementDefinition addCode(Coding t) { //3
2657      if (t == null)
2658        return this;
2659      if (this.code == null)
2660        this.code = new ArrayList<Coding>();
2661      this.code.add(t);
2662      return this;
2663    }
2664
2665    /**
2666     * @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).)
2667     */
2668    public ElementDefinitionSlicingComponent getSlicing() { 
2669      if (this.slicing == null)
2670        if (Configuration.errorOnAutoCreate())
2671          throw new Error("Attempt to auto-create ElementDefinition.slicing");
2672        else if (Configuration.doAutoCreate())
2673          this.slicing = new ElementDefinitionSlicingComponent(); // cc
2674      return this.slicing;
2675    }
2676
2677    public boolean hasSlicing() { 
2678      return this.slicing != null && !this.slicing.isEmpty();
2679    }
2680
2681    /**
2682     * @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).)
2683     */
2684    public ElementDefinition setSlicing(ElementDefinitionSlicingComponent value) { 
2685      this.slicing = value;
2686      return this;
2687    }
2688
2689    /**
2690     * @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
2691     */
2692    public StringType getShortElement() { 
2693      if (this.short_ == null)
2694        if (Configuration.errorOnAutoCreate())
2695          throw new Error("Attempt to auto-create ElementDefinition.short_");
2696        else if (Configuration.doAutoCreate())
2697          this.short_ = new StringType(); // bb
2698      return this.short_;
2699    }
2700
2701    public boolean hasShortElement() { 
2702      return this.short_ != null && !this.short_.isEmpty();
2703    }
2704
2705    public boolean hasShort() { 
2706      return this.short_ != null && !this.short_.isEmpty();
2707    }
2708
2709    /**
2710     * @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
2711     */
2712    public ElementDefinition setShortElement(StringType value) { 
2713      this.short_ = value;
2714      return this;
2715    }
2716
2717    /**
2718     * @return A concise description of what this element means (e.g. for use in autogenerated summaries).
2719     */
2720    public String getShort() { 
2721      return this.short_ == null ? null : this.short_.getValue();
2722    }
2723
2724    /**
2725     * @param value A concise description of what this element means (e.g. for use in autogenerated summaries).
2726     */
2727    public ElementDefinition setShort(String value) { 
2728      if (Utilities.noString(value))
2729        this.short_ = null;
2730      else {
2731        if (this.short_ == null)
2732          this.short_ = new StringType();
2733        this.short_.setValue(value);
2734      }
2735      return this;
2736    }
2737
2738    /**
2739     * @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
2740     */
2741    public MarkdownType getDefinitionElement() { 
2742      if (this.definition == null)
2743        if (Configuration.errorOnAutoCreate())
2744          throw new Error("Attempt to auto-create ElementDefinition.definition");
2745        else if (Configuration.doAutoCreate())
2746          this.definition = new MarkdownType(); // bb
2747      return this.definition;
2748    }
2749
2750    public boolean hasDefinitionElement() { 
2751      return this.definition != null && !this.definition.isEmpty();
2752    }
2753
2754    public boolean hasDefinition() { 
2755      return this.definition != null && !this.definition.isEmpty();
2756    }
2757
2758    /**
2759     * @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
2760     */
2761    public ElementDefinition setDefinitionElement(MarkdownType value) { 
2762      this.definition = value;
2763      return this;
2764    }
2765
2766    /**
2767     * @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.
2768     */
2769    public String getDefinition() { 
2770      return this.definition == null ? null : this.definition.getValue();
2771    }
2772
2773    /**
2774     * @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.
2775     */
2776    public ElementDefinition setDefinition(String value) { 
2777      if (value == null)
2778        this.definition = null;
2779      else {
2780        if (this.definition == null)
2781          this.definition = new MarkdownType();
2782        this.definition.setValue(value);
2783      }
2784      return this;
2785    }
2786
2787    /**
2788     * @return {@link #comments} (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 "getComments" gives direct access to the value
2789     */
2790    public MarkdownType getCommentsElement() { 
2791      if (this.comments == null)
2792        if (Configuration.errorOnAutoCreate())
2793          throw new Error("Attempt to auto-create ElementDefinition.comments");
2794        else if (Configuration.doAutoCreate())
2795          this.comments = new MarkdownType(); // bb
2796      return this.comments;
2797    }
2798
2799    public boolean hasCommentsElement() { 
2800      return this.comments != null && !this.comments.isEmpty();
2801    }
2802
2803    public boolean hasComments() { 
2804      return this.comments != null && !this.comments.isEmpty();
2805    }
2806
2807    /**
2808     * @param value {@link #comments} (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 "getComments" gives direct access to the value
2809     */
2810    public ElementDefinition setCommentsElement(MarkdownType value) { 
2811      this.comments = value;
2812      return this;
2813    }
2814
2815    /**
2816     * @return Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
2817     */
2818    public String getComments() { 
2819      return this.comments == null ? null : this.comments.getValue();
2820    }
2821
2822    /**
2823     * @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.
2824     */
2825    public ElementDefinition setComments(String value) { 
2826      if (value == null)
2827        this.comments = null;
2828      else {
2829        if (this.comments == null)
2830          this.comments = new MarkdownType();
2831        this.comments.setValue(value);
2832      }
2833      return this;
2834    }
2835
2836    /**
2837     * @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
2838     */
2839    public MarkdownType getRequirementsElement() { 
2840      if (this.requirements == null)
2841        if (Configuration.errorOnAutoCreate())
2842          throw new Error("Attempt to auto-create ElementDefinition.requirements");
2843        else if (Configuration.doAutoCreate())
2844          this.requirements = new MarkdownType(); // bb
2845      return this.requirements;
2846    }
2847
2848    public boolean hasRequirementsElement() { 
2849      return this.requirements != null && !this.requirements.isEmpty();
2850    }
2851
2852    public boolean hasRequirements() { 
2853      return this.requirements != null && !this.requirements.isEmpty();
2854    }
2855
2856    /**
2857     * @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
2858     */
2859    public ElementDefinition setRequirementsElement(MarkdownType value) { 
2860      this.requirements = value;
2861      return this;
2862    }
2863
2864    /**
2865     * @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.
2866     */
2867    public String getRequirements() { 
2868      return this.requirements == null ? null : this.requirements.getValue();
2869    }
2870
2871    /**
2872     * @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.
2873     */
2874    public ElementDefinition setRequirements(String value) { 
2875      if (value == null)
2876        this.requirements = null;
2877      else {
2878        if (this.requirements == null)
2879          this.requirements = new MarkdownType();
2880        this.requirements.setValue(value);
2881      }
2882      return this;
2883    }
2884
2885    /**
2886     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
2887     */
2888    public List<StringType> getAlias() { 
2889      if (this.alias == null)
2890        this.alias = new ArrayList<StringType>();
2891      return this.alias;
2892    }
2893
2894    public boolean hasAlias() { 
2895      if (this.alias == null)
2896        return false;
2897      for (StringType item : this.alias)
2898        if (!item.isEmpty())
2899          return true;
2900      return false;
2901    }
2902
2903    /**
2904     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
2905     */
2906    // syntactic sugar
2907    public StringType addAliasElement() {//2 
2908      StringType t = new StringType();
2909      if (this.alias == null)
2910        this.alias = new ArrayList<StringType>();
2911      this.alias.add(t);
2912      return t;
2913    }
2914
2915    /**
2916     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
2917     */
2918    public ElementDefinition addAlias(String value) { //1
2919      StringType t = new StringType();
2920      t.setValue(value);
2921      if (this.alias == null)
2922        this.alias = new ArrayList<StringType>();
2923      this.alias.add(t);
2924      return this;
2925    }
2926
2927    /**
2928     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
2929     */
2930    public boolean hasAlias(String value) { 
2931      if (this.alias == null)
2932        return false;
2933      for (StringType v : this.alias)
2934        if (v.equals(value)) // string
2935          return true;
2936      return false;
2937    }
2938
2939    /**
2940     * @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
2941     */
2942    public IntegerType getMinElement() { 
2943      if (this.min == null)
2944        if (Configuration.errorOnAutoCreate())
2945          throw new Error("Attempt to auto-create ElementDefinition.min");
2946        else if (Configuration.doAutoCreate())
2947          this.min = new IntegerType(); // bb
2948      return this.min;
2949    }
2950
2951    public boolean hasMinElement() { 
2952      return this.min != null && !this.min.isEmpty();
2953    }
2954
2955    public boolean hasMin() { 
2956      return this.min != null && !this.min.isEmpty();
2957    }
2958
2959    /**
2960     * @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
2961     */
2962    public ElementDefinition setMinElement(IntegerType value) { 
2963      this.min = value;
2964      return this;
2965    }
2966
2967    /**
2968     * @return The minimum number of times this element SHALL appear in the instance.
2969     */
2970    public int getMin() { 
2971      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
2972    }
2973
2974    /**
2975     * @param value The minimum number of times this element SHALL appear in the instance.
2976     */
2977    public ElementDefinition setMin(int value) { 
2978        if (this.min == null)
2979          this.min = new IntegerType();
2980        this.min.setValue(value);
2981      return this;
2982    }
2983
2984    /**
2985     * @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
2986     */
2987    public StringType getMaxElement() { 
2988      if (this.max == null)
2989        if (Configuration.errorOnAutoCreate())
2990          throw new Error("Attempt to auto-create ElementDefinition.max");
2991        else if (Configuration.doAutoCreate())
2992          this.max = new StringType(); // bb
2993      return this.max;
2994    }
2995
2996    public boolean hasMaxElement() { 
2997      return this.max != null && !this.max.isEmpty();
2998    }
2999
3000    public boolean hasMax() { 
3001      return this.max != null && !this.max.isEmpty();
3002    }
3003
3004    /**
3005     * @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
3006     */
3007    public ElementDefinition setMaxElement(StringType value) { 
3008      this.max = value;
3009      return this;
3010    }
3011
3012    /**
3013     * @return The maximum number of times this element is permitted to appear in the instance.
3014     */
3015    public String getMax() { 
3016      return this.max == null ? null : this.max.getValue();
3017    }
3018
3019    /**
3020     * @param value The maximum number of times this element is permitted to appear in the instance.
3021     */
3022    public ElementDefinition setMax(String value) { 
3023      if (Utilities.noString(value))
3024        this.max = null;
3025      else {
3026        if (this.max == null)
3027          this.max = new StringType();
3028        this.max.setValue(value);
3029      }
3030      return this;
3031    }
3032
3033    /**
3034     * @return {@link #base} (Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.)
3035     */
3036    public ElementDefinitionBaseComponent getBase() { 
3037      if (this.base == null)
3038        if (Configuration.errorOnAutoCreate())
3039          throw new Error("Attempt to auto-create ElementDefinition.base");
3040        else if (Configuration.doAutoCreate())
3041          this.base = new ElementDefinitionBaseComponent(); // cc
3042      return this.base;
3043    }
3044
3045    public boolean hasBase() { 
3046      return this.base != null && !this.base.isEmpty();
3047    }
3048
3049    /**
3050     * @param value {@link #base} (Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.)
3051     */
3052    public ElementDefinition setBase(ElementDefinitionBaseComponent value) { 
3053      this.base = value;
3054      return this;
3055    }
3056
3057    /**
3058     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
3059     */
3060    public List<TypeRefComponent> getType() { 
3061      if (this.type == null)
3062        this.type = new ArrayList<TypeRefComponent>();
3063      return this.type;
3064    }
3065
3066    public boolean hasType() { 
3067      if (this.type == null)
3068        return false;
3069      for (TypeRefComponent item : this.type)
3070        if (!item.isEmpty())
3071          return true;
3072      return false;
3073    }
3074
3075    /**
3076     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
3077     */
3078    // syntactic sugar
3079    public TypeRefComponent addType() { //3
3080      TypeRefComponent t = new TypeRefComponent();
3081      if (this.type == null)
3082        this.type = new ArrayList<TypeRefComponent>();
3083      this.type.add(t);
3084      return t;
3085    }
3086
3087    // syntactic sugar
3088    public ElementDefinition addType(TypeRefComponent t) { //3
3089      if (t == null)
3090        return this;
3091      if (this.type == null)
3092        this.type = new ArrayList<TypeRefComponent>();
3093      this.type.add(t);
3094      return this;
3095    }
3096
3097    /**
3098     * @return {@link #nameReference} (Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.). This is the underlying object with id, value and extensions. The accessor "getNameReference" gives direct access to the value
3099     */
3100    public StringType getNameReferenceElement() { 
3101      if (this.nameReference == null)
3102        if (Configuration.errorOnAutoCreate())
3103          throw new Error("Attempt to auto-create ElementDefinition.nameReference");
3104        else if (Configuration.doAutoCreate())
3105          this.nameReference = new StringType(); // bb
3106      return this.nameReference;
3107    }
3108
3109    public boolean hasNameReferenceElement() { 
3110      return this.nameReference != null && !this.nameReference.isEmpty();
3111    }
3112
3113    public boolean hasNameReference() { 
3114      return this.nameReference != null && !this.nameReference.isEmpty();
3115    }
3116
3117    /**
3118     * @param value {@link #nameReference} (Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.). This is the underlying object with id, value and extensions. The accessor "getNameReference" gives direct access to the value
3119     */
3120    public ElementDefinition setNameReferenceElement(StringType value) { 
3121      this.nameReference = value;
3122      return this;
3123    }
3124
3125    /**
3126     * @return Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.
3127     */
3128    public String getNameReference() { 
3129      return this.nameReference == null ? null : this.nameReference.getValue();
3130    }
3131
3132    /**
3133     * @param value Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.
3134     */
3135    public ElementDefinition setNameReference(String value) { 
3136      if (Utilities.noString(value))
3137        this.nameReference = null;
3138      else {
3139        if (this.nameReference == null)
3140          this.nameReference = new StringType();
3141        this.nameReference.setValue(value);
3142      }
3143      return this;
3144    }
3145
3146    /**
3147     * @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').)
3148     */
3149    public org.hl7.fhir.dstu2.model.Type getDefaultValue() { 
3150      return this.defaultValue;
3151    }
3152
3153    public boolean hasDefaultValue() { 
3154      return this.defaultValue != null && !this.defaultValue.isEmpty();
3155    }
3156
3157    /**
3158     * @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').)
3159     */
3160    public ElementDefinition setDefaultValue(org.hl7.fhir.dstu2.model.Type value) { 
3161      this.defaultValue = value;
3162      return this;
3163    }
3164
3165    /**
3166     * @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
3167     */
3168    public MarkdownType getMeaningWhenMissingElement() { 
3169      if (this.meaningWhenMissing == null)
3170        if (Configuration.errorOnAutoCreate())
3171          throw new Error("Attempt to auto-create ElementDefinition.meaningWhenMissing");
3172        else if (Configuration.doAutoCreate())
3173          this.meaningWhenMissing = new MarkdownType(); // bb
3174      return this.meaningWhenMissing;
3175    }
3176
3177    public boolean hasMeaningWhenMissingElement() { 
3178      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
3179    }
3180
3181    public boolean hasMeaningWhenMissing() { 
3182      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
3183    }
3184
3185    /**
3186     * @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
3187     */
3188    public ElementDefinition setMeaningWhenMissingElement(MarkdownType value) { 
3189      this.meaningWhenMissing = value;
3190      return this;
3191    }
3192
3193    /**
3194     * @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'.
3195     */
3196    public String getMeaningWhenMissing() { 
3197      return this.meaningWhenMissing == null ? null : this.meaningWhenMissing.getValue();
3198    }
3199
3200    /**
3201     * @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'.
3202     */
3203    public ElementDefinition setMeaningWhenMissing(String value) { 
3204      if (value == null)
3205        this.meaningWhenMissing = null;
3206      else {
3207        if (this.meaningWhenMissing == null)
3208          this.meaningWhenMissing = new MarkdownType();
3209        this.meaningWhenMissing.setValue(value);
3210      }
3211      return this;
3212    }
3213
3214    /**
3215     * @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.)
3216     */
3217    public org.hl7.fhir.dstu2.model.Type getFixed() { 
3218      return this.fixed;
3219    }
3220
3221    public boolean hasFixed() { 
3222      return this.fixed != null && !this.fixed.isEmpty();
3223    }
3224
3225    /**
3226     * @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.)
3227     */
3228    public ElementDefinition setFixed(org.hl7.fhir.dstu2.model.Type value) { 
3229      this.fixed = value;
3230      return this;
3231    }
3232
3233    /**
3234     * @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.).)
3235     */
3236    public org.hl7.fhir.dstu2.model.Type getPattern() { 
3237      return this.pattern;
3238    }
3239
3240    public boolean hasPattern() { 
3241      return this.pattern != null && !this.pattern.isEmpty();
3242    }
3243
3244    /**
3245     * @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.).)
3246     */
3247    public ElementDefinition setPattern(org.hl7.fhir.dstu2.model.Type value) { 
3248      this.pattern = value;
3249      return this;
3250    }
3251
3252    /**
3253     * @return {@link #example} (A sample value for this element demonstrating the type of information that would typically be captured.)
3254     */
3255    public org.hl7.fhir.dstu2.model.Type getExample() { 
3256      return this.example;
3257    }
3258
3259    public boolean hasExample() { 
3260      return this.example != null && !this.example.isEmpty();
3261    }
3262
3263    /**
3264     * @param value {@link #example} (A sample value for this element demonstrating the type of information that would typically be captured.)
3265     */
3266    public ElementDefinition setExample(org.hl7.fhir.dstu2.model.Type value) { 
3267      this.example = value;
3268      return this;
3269    }
3270
3271    /**
3272     * @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.)
3273     */
3274    public org.hl7.fhir.dstu2.model.Type getMinValue() { 
3275      return this.minValue;
3276    }
3277
3278    public boolean hasMinValue() { 
3279      return this.minValue != null && !this.minValue.isEmpty();
3280    }
3281
3282    /**
3283     * @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.)
3284     */
3285    public ElementDefinition setMinValue(org.hl7.fhir.dstu2.model.Type value) { 
3286      this.minValue = value;
3287      return this;
3288    }
3289
3290    /**
3291     * @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.)
3292     */
3293    public org.hl7.fhir.dstu2.model.Type getMaxValue() { 
3294      return this.maxValue;
3295    }
3296
3297    public boolean hasMaxValue() { 
3298      return this.maxValue != null && !this.maxValue.isEmpty();
3299    }
3300
3301    /**
3302     * @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.)
3303     */
3304    public ElementDefinition setMaxValue(org.hl7.fhir.dstu2.model.Type value) { 
3305      this.maxValue = value;
3306      return this;
3307    }
3308
3309    /**
3310     * @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
3311     */
3312    public IntegerType getMaxLengthElement() { 
3313      if (this.maxLength == null)
3314        if (Configuration.errorOnAutoCreate())
3315          throw new Error("Attempt to auto-create ElementDefinition.maxLength");
3316        else if (Configuration.doAutoCreate())
3317          this.maxLength = new IntegerType(); // bb
3318      return this.maxLength;
3319    }
3320
3321    public boolean hasMaxLengthElement() { 
3322      return this.maxLength != null && !this.maxLength.isEmpty();
3323    }
3324
3325    public boolean hasMaxLength() { 
3326      return this.maxLength != null && !this.maxLength.isEmpty();
3327    }
3328
3329    /**
3330     * @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
3331     */
3332    public ElementDefinition setMaxLengthElement(IntegerType value) { 
3333      this.maxLength = value;
3334      return this;
3335    }
3336
3337    /**
3338     * @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.
3339     */
3340    public int getMaxLength() { 
3341      return this.maxLength == null || this.maxLength.isEmpty() ? 0 : this.maxLength.getValue();
3342    }
3343
3344    /**
3345     * @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.
3346     */
3347    public ElementDefinition setMaxLength(int value) { 
3348        if (this.maxLength == null)
3349          this.maxLength = new IntegerType();
3350        this.maxLength.setValue(value);
3351      return this;
3352    }
3353
3354    /**
3355     * @return {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3356     */
3357    public List<IdType> getCondition() { 
3358      if (this.condition == null)
3359        this.condition = new ArrayList<IdType>();
3360      return this.condition;
3361    }
3362
3363    public boolean hasCondition() { 
3364      if (this.condition == null)
3365        return false;
3366      for (IdType item : this.condition)
3367        if (!item.isEmpty())
3368          return true;
3369      return false;
3370    }
3371
3372    /**
3373     * @return {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3374     */
3375    // syntactic sugar
3376    public IdType addConditionElement() {//2 
3377      IdType t = new IdType();
3378      if (this.condition == null)
3379        this.condition = new ArrayList<IdType>();
3380      this.condition.add(t);
3381      return t;
3382    }
3383
3384    /**
3385     * @param value {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3386     */
3387    public ElementDefinition addCondition(String value) { //1
3388      IdType t = new IdType();
3389      t.setValue(value);
3390      if (this.condition == null)
3391        this.condition = new ArrayList<IdType>();
3392      this.condition.add(t);
3393      return this;
3394    }
3395
3396    /**
3397     * @param value {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3398     */
3399    public boolean hasCondition(String value) { 
3400      if (this.condition == null)
3401        return false;
3402      for (IdType v : this.condition)
3403        if (v.equals(value)) // id
3404          return true;
3405      return false;
3406    }
3407
3408    /**
3409     * @return {@link #constraint} (Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.)
3410     */
3411    public List<ElementDefinitionConstraintComponent> getConstraint() { 
3412      if (this.constraint == null)
3413        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3414      return this.constraint;
3415    }
3416
3417    public boolean hasConstraint() { 
3418      if (this.constraint == null)
3419        return false;
3420      for (ElementDefinitionConstraintComponent item : this.constraint)
3421        if (!item.isEmpty())
3422          return true;
3423      return false;
3424    }
3425
3426    /**
3427     * @return {@link #constraint} (Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.)
3428     */
3429    // syntactic sugar
3430    public ElementDefinitionConstraintComponent addConstraint() { //3
3431      ElementDefinitionConstraintComponent t = new ElementDefinitionConstraintComponent();
3432      if (this.constraint == null)
3433        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3434      this.constraint.add(t);
3435      return t;
3436    }
3437
3438    // syntactic sugar
3439    public ElementDefinition addConstraint(ElementDefinitionConstraintComponent t) { //3
3440      if (t == null)
3441        return this;
3442      if (this.constraint == null)
3443        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3444      this.constraint.add(t);
3445      return this;
3446    }
3447
3448    /**
3449     * @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
3450     */
3451    public BooleanType getMustSupportElement() { 
3452      if (this.mustSupport == null)
3453        if (Configuration.errorOnAutoCreate())
3454          throw new Error("Attempt to auto-create ElementDefinition.mustSupport");
3455        else if (Configuration.doAutoCreate())
3456          this.mustSupport = new BooleanType(); // bb
3457      return this.mustSupport;
3458    }
3459
3460    public boolean hasMustSupportElement() { 
3461      return this.mustSupport != null && !this.mustSupport.isEmpty();
3462    }
3463
3464    public boolean hasMustSupport() { 
3465      return this.mustSupport != null && !this.mustSupport.isEmpty();
3466    }
3467
3468    /**
3469     * @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
3470     */
3471    public ElementDefinition setMustSupportElement(BooleanType value) { 
3472      this.mustSupport = value;
3473      return this;
3474    }
3475
3476    /**
3477     * @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.
3478     */
3479    public boolean getMustSupport() { 
3480      return this.mustSupport == null || this.mustSupport.isEmpty() ? false : this.mustSupport.getValue();
3481    }
3482
3483    /**
3484     * @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.
3485     */
3486    public ElementDefinition setMustSupport(boolean value) { 
3487        if (this.mustSupport == null)
3488          this.mustSupport = new BooleanType();
3489        this.mustSupport.setValue(value);
3490      return this;
3491    }
3492
3493    /**
3494     * @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
3495     */
3496    public BooleanType getIsModifierElement() { 
3497      if (this.isModifier == null)
3498        if (Configuration.errorOnAutoCreate())
3499          throw new Error("Attempt to auto-create ElementDefinition.isModifier");
3500        else if (Configuration.doAutoCreate())
3501          this.isModifier = new BooleanType(); // bb
3502      return this.isModifier;
3503    }
3504
3505    public boolean hasIsModifierElement() { 
3506      return this.isModifier != null && !this.isModifier.isEmpty();
3507    }
3508
3509    public boolean hasIsModifier() { 
3510      return this.isModifier != null && !this.isModifier.isEmpty();
3511    }
3512
3513    /**
3514     * @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
3515     */
3516    public ElementDefinition setIsModifierElement(BooleanType value) { 
3517      this.isModifier = value;
3518      return this;
3519    }
3520
3521    /**
3522     * @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.
3523     */
3524    public boolean getIsModifier() { 
3525      return this.isModifier == null || this.isModifier.isEmpty() ? false : this.isModifier.getValue();
3526    }
3527
3528    /**
3529     * @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.
3530     */
3531    public ElementDefinition setIsModifier(boolean value) { 
3532        if (this.isModifier == null)
3533          this.isModifier = new BooleanType();
3534        this.isModifier.setValue(value);
3535      return this;
3536    }
3537
3538    /**
3539     * @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
3540     */
3541    public BooleanType getIsSummaryElement() { 
3542      if (this.isSummary == null)
3543        if (Configuration.errorOnAutoCreate())
3544          throw new Error("Attempt to auto-create ElementDefinition.isSummary");
3545        else if (Configuration.doAutoCreate())
3546          this.isSummary = new BooleanType(); // bb
3547      return this.isSummary;
3548    }
3549
3550    public boolean hasIsSummaryElement() { 
3551      return this.isSummary != null && !this.isSummary.isEmpty();
3552    }
3553
3554    public boolean hasIsSummary() { 
3555      return this.isSummary != null && !this.isSummary.isEmpty();
3556    }
3557
3558    /**
3559     * @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
3560     */
3561    public ElementDefinition setIsSummaryElement(BooleanType value) { 
3562      this.isSummary = value;
3563      return this;
3564    }
3565
3566    /**
3567     * @return Whether the element should be included if a client requests a search with the parameter _summary=true.
3568     */
3569    public boolean getIsSummary() { 
3570      return this.isSummary == null || this.isSummary.isEmpty() ? false : this.isSummary.getValue();
3571    }
3572
3573    /**
3574     * @param value Whether the element should be included if a client requests a search with the parameter _summary=true.
3575     */
3576    public ElementDefinition setIsSummary(boolean value) { 
3577        if (this.isSummary == null)
3578          this.isSummary = new BooleanType();
3579        this.isSummary.setValue(value);
3580      return this;
3581    }
3582
3583    /**
3584     * @return {@link #binding} (Binds to a value set if this element is coded (code, Coding, CodeableConcept).)
3585     */
3586    public ElementDefinitionBindingComponent getBinding() { 
3587      if (this.binding == null)
3588        if (Configuration.errorOnAutoCreate())
3589          throw new Error("Attempt to auto-create ElementDefinition.binding");
3590        else if (Configuration.doAutoCreate())
3591          this.binding = new ElementDefinitionBindingComponent(); // cc
3592      return this.binding;
3593    }
3594
3595    public boolean hasBinding() { 
3596      return this.binding != null && !this.binding.isEmpty();
3597    }
3598
3599    /**
3600     * @param value {@link #binding} (Binds to a value set if this element is coded (code, Coding, CodeableConcept).)
3601     */
3602    public ElementDefinition setBinding(ElementDefinitionBindingComponent value) { 
3603      this.binding = value;
3604      return this;
3605    }
3606
3607    /**
3608     * @return {@link #mapping} (Identifies a concept from an external specification that roughly corresponds to this element.)
3609     */
3610    public List<ElementDefinitionMappingComponent> getMapping() { 
3611      if (this.mapping == null)
3612        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
3613      return this.mapping;
3614    }
3615
3616    public boolean hasMapping() { 
3617      if (this.mapping == null)
3618        return false;
3619      for (ElementDefinitionMappingComponent item : this.mapping)
3620        if (!item.isEmpty())
3621          return true;
3622      return false;
3623    }
3624
3625    /**
3626     * @return {@link #mapping} (Identifies a concept from an external specification that roughly corresponds to this element.)
3627     */
3628    // syntactic sugar
3629    public ElementDefinitionMappingComponent addMapping() { //3
3630      ElementDefinitionMappingComponent t = new ElementDefinitionMappingComponent();
3631      if (this.mapping == null)
3632        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
3633      this.mapping.add(t);
3634      return t;
3635    }
3636
3637    // syntactic sugar
3638    public ElementDefinition addMapping(ElementDefinitionMappingComponent t) { //3
3639      if (t == null)
3640        return this;
3641      if (this.mapping == null)
3642        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
3643      this.mapping.add(t);
3644      return this;
3645    }
3646
3647      protected void listChildren(List<Property> childrenList) {
3648        super.listChildren(childrenList);
3649        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));
3650        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));
3651        childrenList.add(new Property("name", "string", "The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.", 0, java.lang.Integer.MAX_VALUE, name));
3652        childrenList.add(new Property("label", "string", "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));
3653        childrenList.add(new Property("code", "Coding", "A code that provides the meaning for the element according to a particular terminology.", 0, java.lang.Integer.MAX_VALUE, code));
3654        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));
3655        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_));
3656        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));
3657        childrenList.add(new Property("comments", "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, comments));
3658        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));
3659        childrenList.add(new Property("alias", "string", "Identifies additional names by which this element might also be known.", 0, java.lang.Integer.MAX_VALUE, alias));
3660        childrenList.add(new Property("min", "integer", "The minimum number of times this element SHALL appear in the instance.", 0, java.lang.Integer.MAX_VALUE, min));
3661        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));
3662        childrenList.add(new Property("base", "", "Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.", 0, java.lang.Integer.MAX_VALUE, base));
3663        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));
3664        childrenList.add(new Property("nameReference", "string", "Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.", 0, java.lang.Integer.MAX_VALUE, nameReference));
3665        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));
3666        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));
3667        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));
3668        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));
3669        childrenList.add(new Property("example[x]", "*", "A sample value for this element demonstrating the type of information that would typically be captured.", 0, java.lang.Integer.MAX_VALUE, example));
3670        childrenList.add(new Property("minValue[x]", "*", "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));
3671        childrenList.add(new Property("maxValue[x]", "*", "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));
3672        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));
3673        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));
3674        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));
3675        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));
3676        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));
3677        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));
3678        childrenList.add(new Property("binding", "", "Binds to a value set if this element is coded (code, Coding, CodeableConcept).", 0, java.lang.Integer.MAX_VALUE, binding));
3679        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));
3680      }
3681
3682      @Override
3683      public void setProperty(String name, Base value) throws FHIRException {
3684        if (name.equals("path"))
3685          this.path = castToString(value); // StringType
3686        else if (name.equals("representation"))
3687          this.getRepresentation().add(new PropertyRepresentationEnumFactory().fromType(value));
3688        else if (name.equals("name"))
3689          this.name = castToString(value); // StringType
3690        else if (name.equals("label"))
3691          this.label = castToString(value); // StringType
3692        else if (name.equals("code"))
3693          this.getCode().add(castToCoding(value));
3694        else if (name.equals("slicing"))
3695          this.slicing = (ElementDefinitionSlicingComponent) value; // ElementDefinitionSlicingComponent
3696        else if (name.equals("short"))
3697          this.short_ = castToString(value); // StringType
3698        else if (name.equals("definition"))
3699          this.definition = castToMarkdown(value); // MarkdownType
3700        else if (name.equals("comments"))
3701          this.comments = castToMarkdown(value); // MarkdownType
3702        else if (name.equals("requirements"))
3703          this.requirements = castToMarkdown(value); // MarkdownType
3704        else if (name.equals("alias"))
3705          this.getAlias().add(castToString(value));
3706        else if (name.equals("min"))
3707          this.min = castToInteger(value); // IntegerType
3708        else if (name.equals("max"))
3709          this.max = castToString(value); // StringType
3710        else if (name.equals("base"))
3711          this.base = (ElementDefinitionBaseComponent) value; // ElementDefinitionBaseComponent
3712        else if (name.equals("type"))
3713          this.getType().add((TypeRefComponent) value);
3714        else if (name.equals("nameReference"))
3715          this.nameReference = castToString(value); // StringType
3716        else if (name.equals("defaultValue[x]"))
3717          this.defaultValue = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3718        else if (name.equals("meaningWhenMissing"))
3719          this.meaningWhenMissing = castToMarkdown(value); // MarkdownType
3720        else if (name.equals("fixed[x]"))
3721          this.fixed = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3722        else if (name.equals("pattern[x]"))
3723          this.pattern = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3724        else if (name.equals("example[x]"))
3725          this.example = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3726        else if (name.equals("minValue[x]"))
3727          this.minValue = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3728        else if (name.equals("maxValue[x]"))
3729          this.maxValue = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3730        else if (name.equals("maxLength"))
3731          this.maxLength = castToInteger(value); // IntegerType
3732        else if (name.equals("condition"))
3733          this.getCondition().add(castToId(value));
3734        else if (name.equals("constraint"))
3735          this.getConstraint().add((ElementDefinitionConstraintComponent) value);
3736        else if (name.equals("mustSupport"))
3737          this.mustSupport = castToBoolean(value); // BooleanType
3738        else if (name.equals("isModifier"))
3739          this.isModifier = castToBoolean(value); // BooleanType
3740        else if (name.equals("isSummary"))
3741          this.isSummary = castToBoolean(value); // BooleanType
3742        else if (name.equals("binding"))
3743          this.binding = (ElementDefinitionBindingComponent) value; // ElementDefinitionBindingComponent
3744        else if (name.equals("mapping"))
3745          this.getMapping().add((ElementDefinitionMappingComponent) value);
3746        else
3747          super.setProperty(name, value);
3748      }
3749
3750      @Override
3751      public Base addChild(String name) throws FHIRException {
3752        if (name.equals("path")) {
3753          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
3754        }
3755        else if (name.equals("representation")) {
3756          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.representation");
3757        }
3758        else if (name.equals("name")) {
3759          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.name");
3760        }
3761        else if (name.equals("label")) {
3762          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.label");
3763        }
3764        else if (name.equals("code")) {
3765          return addCode();
3766        }
3767        else if (name.equals("slicing")) {
3768          this.slicing = new ElementDefinitionSlicingComponent();
3769          return this.slicing;
3770        }
3771        else if (name.equals("short")) {
3772          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.short");
3773        }
3774        else if (name.equals("definition")) {
3775          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.definition");
3776        }
3777        else if (name.equals("comments")) {
3778          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.comments");
3779        }
3780        else if (name.equals("requirements")) {
3781          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.requirements");
3782        }
3783        else if (name.equals("alias")) {
3784          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.alias");
3785        }
3786        else if (name.equals("min")) {
3787          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.min");
3788        }
3789        else if (name.equals("max")) {
3790          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.max");
3791        }
3792        else if (name.equals("base")) {
3793          this.base = new ElementDefinitionBaseComponent();
3794          return this.base;
3795        }
3796        else if (name.equals("type")) {
3797          return addType();
3798        }
3799        else if (name.equals("nameReference")) {
3800          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.nameReference");
3801        }
3802        else if (name.equals("defaultValueBoolean")) {
3803          this.defaultValue = new BooleanType();
3804          return this.defaultValue;
3805        }
3806        else if (name.equals("defaultValueInteger")) {
3807          this.defaultValue = new IntegerType();
3808          return this.defaultValue;
3809        }
3810        else if (name.equals("defaultValueDecimal")) {
3811          this.defaultValue = new DecimalType();
3812          return this.defaultValue;
3813        }
3814        else if (name.equals("defaultValueBase64Binary")) {
3815          this.defaultValue = new Base64BinaryType();
3816          return this.defaultValue;
3817        }
3818        else if (name.equals("defaultValueInstant")) {
3819          this.defaultValue = new InstantType();
3820          return this.defaultValue;
3821        }
3822        else if (name.equals("defaultValueString")) {
3823          this.defaultValue = new StringType();
3824          return this.defaultValue;
3825        }
3826        else if (name.equals("defaultValueUri")) {
3827          this.defaultValue = new UriType();
3828          return this.defaultValue;
3829        }
3830        else if (name.equals("defaultValueDate")) {
3831          this.defaultValue = new DateType();
3832          return this.defaultValue;
3833        }
3834        else if (name.equals("defaultValueDateTime")) {
3835          this.defaultValue = new DateTimeType();
3836          return this.defaultValue;
3837        }
3838        else if (name.equals("defaultValueTime")) {
3839          this.defaultValue = new TimeType();
3840          return this.defaultValue;
3841        }
3842        else if (name.equals("defaultValueCode")) {
3843          this.defaultValue = new CodeType();
3844          return this.defaultValue;
3845        }
3846        else if (name.equals("defaultValueOid")) {
3847          this.defaultValue = new OidType();
3848          return this.defaultValue;
3849        }
3850        else if (name.equals("defaultValueId")) {
3851          this.defaultValue = new IdType();
3852          return this.defaultValue;
3853        }
3854        else if (name.equals("defaultValueUnsignedInt")) {
3855          this.defaultValue = new UnsignedIntType();
3856          return this.defaultValue;
3857        }
3858        else if (name.equals("defaultValuePositiveInt")) {
3859          this.defaultValue = new PositiveIntType();
3860          return this.defaultValue;
3861        }
3862        else if (name.equals("defaultValueMarkdown")) {
3863          this.defaultValue = new MarkdownType();
3864          return this.defaultValue;
3865        }
3866        else if (name.equals("defaultValueAnnotation")) {
3867          this.defaultValue = new Annotation();
3868          return this.defaultValue;
3869        }
3870        else if (name.equals("defaultValueAttachment")) {
3871          this.defaultValue = new Attachment();
3872          return this.defaultValue;
3873        }
3874        else if (name.equals("defaultValueIdentifier")) {
3875          this.defaultValue = new Identifier();
3876          return this.defaultValue;
3877        }
3878        else if (name.equals("defaultValueCodeableConcept")) {
3879          this.defaultValue = new CodeableConcept();
3880          return this.defaultValue;
3881        }
3882        else if (name.equals("defaultValueCoding")) {
3883          this.defaultValue = new Coding();
3884          return this.defaultValue;
3885        }
3886        else if (name.equals("defaultValueQuantity")) {
3887          this.defaultValue = new Quantity();
3888          return this.defaultValue;
3889        }
3890        else if (name.equals("defaultValueRange")) {
3891          this.defaultValue = new Range();
3892          return this.defaultValue;
3893        }
3894        else if (name.equals("defaultValuePeriod")) {
3895          this.defaultValue = new Period();
3896          return this.defaultValue;
3897        }
3898        else if (name.equals("defaultValueRatio")) {
3899          this.defaultValue = new Ratio();
3900          return this.defaultValue;
3901        }
3902        else if (name.equals("defaultValueSampledData")) {
3903          this.defaultValue = new SampledData();
3904          return this.defaultValue;
3905        }
3906        else if (name.equals("defaultValueSignature")) {
3907          this.defaultValue = new Signature();
3908          return this.defaultValue;
3909        }
3910        else if (name.equals("defaultValueHumanName")) {
3911          this.defaultValue = new HumanName();
3912          return this.defaultValue;
3913        }
3914        else if (name.equals("defaultValueAddress")) {
3915          this.defaultValue = new Address();
3916          return this.defaultValue;
3917        }
3918        else if (name.equals("defaultValueContactPoint")) {
3919          this.defaultValue = new ContactPoint();
3920          return this.defaultValue;
3921        }
3922        else if (name.equals("defaultValueTiming")) {
3923          this.defaultValue = new Timing();
3924          return this.defaultValue;
3925        }
3926        else if (name.equals("defaultValueReference")) {
3927          this.defaultValue = new Reference();
3928          return this.defaultValue;
3929        }
3930        else if (name.equals("defaultValueMeta")) {
3931          this.defaultValue = new Meta();
3932          return this.defaultValue;
3933        }
3934        else if (name.equals("meaningWhenMissing")) {
3935          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.meaningWhenMissing");
3936        }
3937        else if (name.equals("fixedBoolean")) {
3938          this.fixed = new BooleanType();
3939          return this.fixed;
3940        }
3941        else if (name.equals("fixedInteger")) {
3942          this.fixed = new IntegerType();
3943          return this.fixed;
3944        }
3945        else if (name.equals("fixedDecimal")) {
3946          this.fixed = new DecimalType();
3947          return this.fixed;
3948        }
3949        else if (name.equals("fixedBase64Binary")) {
3950          this.fixed = new Base64BinaryType();
3951          return this.fixed;
3952        }
3953        else if (name.equals("fixedInstant")) {
3954          this.fixed = new InstantType();
3955          return this.fixed;
3956        }
3957        else if (name.equals("fixedString")) {
3958          this.fixed = new StringType();
3959          return this.fixed;
3960        }
3961        else if (name.equals("fixedUri")) {
3962          this.fixed = new UriType();
3963          return this.fixed;
3964        }
3965        else if (name.equals("fixedDate")) {
3966          this.fixed = new DateType();
3967          return this.fixed;
3968        }
3969        else if (name.equals("fixedDateTime")) {
3970          this.fixed = new DateTimeType();
3971          return this.fixed;
3972        }
3973        else if (name.equals("fixedTime")) {
3974          this.fixed = new TimeType();
3975          return this.fixed;
3976        }
3977        else if (name.equals("fixedCode")) {
3978          this.fixed = new CodeType();
3979          return this.fixed;
3980        }
3981        else if (name.equals("fixedOid")) {
3982          this.fixed = new OidType();
3983          return this.fixed;
3984        }
3985        else if (name.equals("fixedId")) {
3986          this.fixed = new IdType();
3987          return this.fixed;
3988        }
3989        else if (name.equals("fixedUnsignedInt")) {
3990          this.fixed = new UnsignedIntType();
3991          return this.fixed;
3992        }
3993        else if (name.equals("fixedPositiveInt")) {
3994          this.fixed = new PositiveIntType();
3995          return this.fixed;
3996        }
3997        else if (name.equals("fixedMarkdown")) {
3998          this.fixed = new MarkdownType();
3999          return this.fixed;
4000        }
4001        else if (name.equals("fixedAnnotation")) {
4002          this.fixed = new Annotation();
4003          return this.fixed;
4004        }
4005        else if (name.equals("fixedAttachment")) {
4006          this.fixed = new Attachment();
4007          return this.fixed;
4008        }
4009        else if (name.equals("fixedIdentifier")) {
4010          this.fixed = new Identifier();
4011          return this.fixed;
4012        }
4013        else if (name.equals("fixedCodeableConcept")) {
4014          this.fixed = new CodeableConcept();
4015          return this.fixed;
4016        }
4017        else if (name.equals("fixedCoding")) {
4018          this.fixed = new Coding();
4019          return this.fixed;
4020        }
4021        else if (name.equals("fixedQuantity")) {
4022          this.fixed = new Quantity();
4023          return this.fixed;
4024        }
4025        else if (name.equals("fixedRange")) {
4026          this.fixed = new Range();
4027          return this.fixed;
4028        }
4029        else if (name.equals("fixedPeriod")) {
4030          this.fixed = new Period();
4031          return this.fixed;
4032        }
4033        else if (name.equals("fixedRatio")) {
4034          this.fixed = new Ratio();
4035          return this.fixed;
4036        }
4037        else if (name.equals("fixedSampledData")) {
4038          this.fixed = new SampledData();
4039          return this.fixed;
4040        }
4041        else if (name.equals("fixedSignature")) {
4042          this.fixed = new Signature();
4043          return this.fixed;
4044        }
4045        else if (name.equals("fixedHumanName")) {
4046          this.fixed = new HumanName();
4047          return this.fixed;
4048        }
4049        else if (name.equals("fixedAddress")) {
4050          this.fixed = new Address();
4051          return this.fixed;
4052        }
4053        else if (name.equals("fixedContactPoint")) {
4054          this.fixed = new ContactPoint();
4055          return this.fixed;
4056        }
4057        else if (name.equals("fixedTiming")) {
4058          this.fixed = new Timing();
4059          return this.fixed;
4060        }
4061        else if (name.equals("fixedReference")) {
4062          this.fixed = new Reference();
4063          return this.fixed;
4064        }
4065        else if (name.equals("fixedMeta")) {
4066          this.fixed = new Meta();
4067          return this.fixed;
4068        }
4069        else if (name.equals("patternBoolean")) {
4070          this.pattern = new BooleanType();
4071          return this.pattern;
4072        }
4073        else if (name.equals("patternInteger")) {
4074          this.pattern = new IntegerType();
4075          return this.pattern;
4076        }
4077        else if (name.equals("patternDecimal")) {
4078          this.pattern = new DecimalType();
4079          return this.pattern;
4080        }
4081        else if (name.equals("patternBase64Binary")) {
4082          this.pattern = new Base64BinaryType();
4083          return this.pattern;
4084        }
4085        else if (name.equals("patternInstant")) {
4086          this.pattern = new InstantType();
4087          return this.pattern;
4088        }
4089        else if (name.equals("patternString")) {
4090          this.pattern = new StringType();
4091          return this.pattern;
4092        }
4093        else if (name.equals("patternUri")) {
4094          this.pattern = new UriType();
4095          return this.pattern;
4096        }
4097        else if (name.equals("patternDate")) {
4098          this.pattern = new DateType();
4099          return this.pattern;
4100        }
4101        else if (name.equals("patternDateTime")) {
4102          this.pattern = new DateTimeType();
4103          return this.pattern;
4104        }
4105        else if (name.equals("patternTime")) {
4106          this.pattern = new TimeType();
4107          return this.pattern;
4108        }
4109        else if (name.equals("patternCode")) {
4110          this.pattern = new CodeType();
4111          return this.pattern;
4112        }
4113        else if (name.equals("patternOid")) {
4114          this.pattern = new OidType();
4115          return this.pattern;
4116        }
4117        else if (name.equals("patternId")) {
4118          this.pattern = new IdType();
4119          return this.pattern;
4120        }
4121        else if (name.equals("patternUnsignedInt")) {
4122          this.pattern = new UnsignedIntType();
4123          return this.pattern;
4124        }
4125        else if (name.equals("patternPositiveInt")) {
4126          this.pattern = new PositiveIntType();
4127          return this.pattern;
4128        }
4129        else if (name.equals("patternMarkdown")) {
4130          this.pattern = new MarkdownType();
4131          return this.pattern;
4132        }
4133        else if (name.equals("patternAnnotation")) {
4134          this.pattern = new Annotation();
4135          return this.pattern;
4136        }
4137        else if (name.equals("patternAttachment")) {
4138          this.pattern = new Attachment();
4139          return this.pattern;
4140        }
4141        else if (name.equals("patternIdentifier")) {
4142          this.pattern = new Identifier();
4143          return this.pattern;
4144        }
4145        else if (name.equals("patternCodeableConcept")) {
4146          this.pattern = new CodeableConcept();
4147          return this.pattern;
4148        }
4149        else if (name.equals("patternCoding")) {
4150          this.pattern = new Coding();
4151          return this.pattern;
4152        }
4153        else if (name.equals("patternQuantity")) {
4154          this.pattern = new Quantity();
4155          return this.pattern;
4156        }
4157        else if (name.equals("patternRange")) {
4158          this.pattern = new Range();
4159          return this.pattern;
4160        }
4161        else if (name.equals("patternPeriod")) {
4162          this.pattern = new Period();
4163          return this.pattern;
4164        }
4165        else if (name.equals("patternRatio")) {
4166          this.pattern = new Ratio();
4167          return this.pattern;
4168        }
4169        else if (name.equals("patternSampledData")) {
4170          this.pattern = new SampledData();
4171          return this.pattern;
4172        }
4173        else if (name.equals("patternSignature")) {
4174          this.pattern = new Signature();
4175          return this.pattern;
4176        }
4177        else if (name.equals("patternHumanName")) {
4178          this.pattern = new HumanName();
4179          return this.pattern;
4180        }
4181        else if (name.equals("patternAddress")) {
4182          this.pattern = new Address();
4183          return this.pattern;
4184        }
4185        else if (name.equals("patternContactPoint")) {
4186          this.pattern = new ContactPoint();
4187          return this.pattern;
4188        }
4189        else if (name.equals("patternTiming")) {
4190          this.pattern = new Timing();
4191          return this.pattern;
4192        }
4193        else if (name.equals("patternReference")) {
4194          this.pattern = new Reference();
4195          return this.pattern;
4196        }
4197        else if (name.equals("patternMeta")) {
4198          this.pattern = new Meta();
4199          return this.pattern;
4200        }
4201        else if (name.equals("exampleBoolean")) {
4202          this.example = new BooleanType();
4203          return this.example;
4204        }
4205        else if (name.equals("exampleInteger")) {
4206          this.example = new IntegerType();
4207          return this.example;
4208        }
4209        else if (name.equals("exampleDecimal")) {
4210          this.example = new DecimalType();
4211          return this.example;
4212        }
4213        else if (name.equals("exampleBase64Binary")) {
4214          this.example = new Base64BinaryType();
4215          return this.example;
4216        }
4217        else if (name.equals("exampleInstant")) {
4218          this.example = new InstantType();
4219          return this.example;
4220        }
4221        else if (name.equals("exampleString")) {
4222          this.example = new StringType();
4223          return this.example;
4224        }
4225        else if (name.equals("exampleUri")) {
4226          this.example = new UriType();
4227          return this.example;
4228        }
4229        else if (name.equals("exampleDate")) {
4230          this.example = new DateType();
4231          return this.example;
4232        }
4233        else if (name.equals("exampleDateTime")) {
4234          this.example = new DateTimeType();
4235          return this.example;
4236        }
4237        else if (name.equals("exampleTime")) {
4238          this.example = new TimeType();
4239          return this.example;
4240        }
4241        else if (name.equals("exampleCode")) {
4242          this.example = new CodeType();
4243          return this.example;
4244        }
4245        else if (name.equals("exampleOid")) {
4246          this.example = new OidType();
4247          return this.example;
4248        }
4249        else if (name.equals("exampleId")) {
4250          this.example = new IdType();
4251          return this.example;
4252        }
4253        else if (name.equals("exampleUnsignedInt")) {
4254          this.example = new UnsignedIntType();
4255          return this.example;
4256        }
4257        else if (name.equals("examplePositiveInt")) {
4258          this.example = new PositiveIntType();
4259          return this.example;
4260        }
4261        else if (name.equals("exampleMarkdown")) {
4262          this.example = new MarkdownType();
4263          return this.example;
4264        }
4265        else if (name.equals("exampleAnnotation")) {
4266          this.example = new Annotation();
4267          return this.example;
4268        }
4269        else if (name.equals("exampleAttachment")) {
4270          this.example = new Attachment();
4271          return this.example;
4272        }
4273        else if (name.equals("exampleIdentifier")) {
4274          this.example = new Identifier();
4275          return this.example;
4276        }
4277        else if (name.equals("exampleCodeableConcept")) {
4278          this.example = new CodeableConcept();
4279          return this.example;
4280        }
4281        else if (name.equals("exampleCoding")) {
4282          this.example = new Coding();
4283          return this.example;
4284        }
4285        else if (name.equals("exampleQuantity")) {
4286          this.example = new Quantity();
4287          return this.example;
4288        }
4289        else if (name.equals("exampleRange")) {
4290          this.example = new Range();
4291          return this.example;
4292        }
4293        else if (name.equals("examplePeriod")) {
4294          this.example = new Period();
4295          return this.example;
4296        }
4297        else if (name.equals("exampleRatio")) {
4298          this.example = new Ratio();
4299          return this.example;
4300        }
4301        else if (name.equals("exampleSampledData")) {
4302          this.example = new SampledData();
4303          return this.example;
4304        }
4305        else if (name.equals("exampleSignature")) {
4306          this.example = new Signature();
4307          return this.example;
4308        }
4309        else if (name.equals("exampleHumanName")) {
4310          this.example = new HumanName();
4311          return this.example;
4312        }
4313        else if (name.equals("exampleAddress")) {
4314          this.example = new Address();
4315          return this.example;
4316        }
4317        else if (name.equals("exampleContactPoint")) {
4318          this.example = new ContactPoint();
4319          return this.example;
4320        }
4321        else if (name.equals("exampleTiming")) {
4322          this.example = new Timing();
4323          return this.example;
4324        }
4325        else if (name.equals("exampleReference")) {
4326          this.example = new Reference();
4327          return this.example;
4328        }
4329        else if (name.equals("exampleMeta")) {
4330          this.example = new Meta();
4331          return this.example;
4332        }
4333        else if (name.equals("minValueBoolean")) {
4334          this.minValue = new BooleanType();
4335          return this.minValue;
4336        }
4337        else if (name.equals("minValueInteger")) {
4338          this.minValue = new IntegerType();
4339          return this.minValue;
4340        }
4341        else if (name.equals("minValueDecimal")) {
4342          this.minValue = new DecimalType();
4343          return this.minValue;
4344        }
4345        else if (name.equals("minValueBase64Binary")) {
4346          this.minValue = new Base64BinaryType();
4347          return this.minValue;
4348        }
4349        else if (name.equals("minValueInstant")) {
4350          this.minValue = new InstantType();
4351          return this.minValue;
4352        }
4353        else if (name.equals("minValueString")) {
4354          this.minValue = new StringType();
4355          return this.minValue;
4356        }
4357        else if (name.equals("minValueUri")) {
4358          this.minValue = new UriType();
4359          return this.minValue;
4360        }
4361        else if (name.equals("minValueDate")) {
4362          this.minValue = new DateType();
4363          return this.minValue;
4364        }
4365        else if (name.equals("minValueDateTime")) {
4366          this.minValue = new DateTimeType();
4367          return this.minValue;
4368        }
4369        else if (name.equals("minValueTime")) {
4370          this.minValue = new TimeType();
4371          return this.minValue;
4372        }
4373        else if (name.equals("minValueCode")) {
4374          this.minValue = new CodeType();
4375          return this.minValue;
4376        }
4377        else if (name.equals("minValueOid")) {
4378          this.minValue = new OidType();
4379          return this.minValue;
4380        }
4381        else if (name.equals("minValueId")) {
4382          this.minValue = new IdType();
4383          return this.minValue;
4384        }
4385        else if (name.equals("minValueUnsignedInt")) {
4386          this.minValue = new UnsignedIntType();
4387          return this.minValue;
4388        }
4389        else if (name.equals("minValuePositiveInt")) {
4390          this.minValue = new PositiveIntType();
4391          return this.minValue;
4392        }
4393        else if (name.equals("minValueMarkdown")) {
4394          this.minValue = new MarkdownType();
4395          return this.minValue;
4396        }
4397        else if (name.equals("minValueAnnotation")) {
4398          this.minValue = new Annotation();
4399          return this.minValue;
4400        }
4401        else if (name.equals("minValueAttachment")) {
4402          this.minValue = new Attachment();
4403          return this.minValue;
4404        }
4405        else if (name.equals("minValueIdentifier")) {
4406          this.minValue = new Identifier();
4407          return this.minValue;
4408        }
4409        else if (name.equals("minValueCodeableConcept")) {
4410          this.minValue = new CodeableConcept();
4411          return this.minValue;
4412        }
4413        else if (name.equals("minValueCoding")) {
4414          this.minValue = new Coding();
4415          return this.minValue;
4416        }
4417        else if (name.equals("minValueQuantity")) {
4418          this.minValue = new Quantity();
4419          return this.minValue;
4420        }
4421        else if (name.equals("minValueRange")) {
4422          this.minValue = new Range();
4423          return this.minValue;
4424        }
4425        else if (name.equals("minValuePeriod")) {
4426          this.minValue = new Period();
4427          return this.minValue;
4428        }
4429        else if (name.equals("minValueRatio")) {
4430          this.minValue = new Ratio();
4431          return this.minValue;
4432        }
4433        else if (name.equals("minValueSampledData")) {
4434          this.minValue = new SampledData();
4435          return this.minValue;
4436        }
4437        else if (name.equals("minValueSignature")) {
4438          this.minValue = new Signature();
4439          return this.minValue;
4440        }
4441        else if (name.equals("minValueHumanName")) {
4442          this.minValue = new HumanName();
4443          return this.minValue;
4444        }
4445        else if (name.equals("minValueAddress")) {
4446          this.minValue = new Address();
4447          return this.minValue;
4448        }
4449        else if (name.equals("minValueContactPoint")) {
4450          this.minValue = new ContactPoint();
4451          return this.minValue;
4452        }
4453        else if (name.equals("minValueTiming")) {
4454          this.minValue = new Timing();
4455          return this.minValue;
4456        }
4457        else if (name.equals("minValueReference")) {
4458          this.minValue = new Reference();
4459          return this.minValue;
4460        }
4461        else if (name.equals("minValueMeta")) {
4462          this.minValue = new Meta();
4463          return this.minValue;
4464        }
4465        else if (name.equals("maxValueBoolean")) {
4466          this.maxValue = new BooleanType();
4467          return this.maxValue;
4468        }
4469        else if (name.equals("maxValueInteger")) {
4470          this.maxValue = new IntegerType();
4471          return this.maxValue;
4472        }
4473        else if (name.equals("maxValueDecimal")) {
4474          this.maxValue = new DecimalType();
4475          return this.maxValue;
4476        }
4477        else if (name.equals("maxValueBase64Binary")) {
4478          this.maxValue = new Base64BinaryType();
4479          return this.maxValue;
4480        }
4481        else if (name.equals("maxValueInstant")) {
4482          this.maxValue = new InstantType();
4483          return this.maxValue;
4484        }
4485        else if (name.equals("maxValueString")) {
4486          this.maxValue = new StringType();
4487          return this.maxValue;
4488        }
4489        else if (name.equals("maxValueUri")) {
4490          this.maxValue = new UriType();
4491          return this.maxValue;
4492        }
4493        else if (name.equals("maxValueDate")) {
4494          this.maxValue = new DateType();
4495          return this.maxValue;
4496        }
4497        else if (name.equals("maxValueDateTime")) {
4498          this.maxValue = new DateTimeType();
4499          return this.maxValue;
4500        }
4501        else if (name.equals("maxValueTime")) {
4502          this.maxValue = new TimeType();
4503          return this.maxValue;
4504        }
4505        else if (name.equals("maxValueCode")) {
4506          this.maxValue = new CodeType();
4507          return this.maxValue;
4508        }
4509        else if (name.equals("maxValueOid")) {
4510          this.maxValue = new OidType();
4511          return this.maxValue;
4512        }
4513        else if (name.equals("maxValueId")) {
4514          this.maxValue = new IdType();
4515          return this.maxValue;
4516        }
4517        else if (name.equals("maxValueUnsignedInt")) {
4518          this.maxValue = new UnsignedIntType();
4519          return this.maxValue;
4520        }
4521        else if (name.equals("maxValuePositiveInt")) {
4522          this.maxValue = new PositiveIntType();
4523          return this.maxValue;
4524        }
4525        else if (name.equals("maxValueMarkdown")) {
4526          this.maxValue = new MarkdownType();
4527          return this.maxValue;
4528        }
4529        else if (name.equals("maxValueAnnotation")) {
4530          this.maxValue = new Annotation();
4531          return this.maxValue;
4532        }
4533        else if (name.equals("maxValueAttachment")) {
4534          this.maxValue = new Attachment();
4535          return this.maxValue;
4536        }
4537        else if (name.equals("maxValueIdentifier")) {
4538          this.maxValue = new Identifier();
4539          return this.maxValue;
4540        }
4541        else if (name.equals("maxValueCodeableConcept")) {
4542          this.maxValue = new CodeableConcept();
4543          return this.maxValue;
4544        }
4545        else if (name.equals("maxValueCoding")) {
4546          this.maxValue = new Coding();
4547          return this.maxValue;
4548        }
4549        else if (name.equals("maxValueQuantity")) {
4550          this.maxValue = new Quantity();
4551          return this.maxValue;
4552        }
4553        else if (name.equals("maxValueRange")) {
4554          this.maxValue = new Range();
4555          return this.maxValue;
4556        }
4557        else if (name.equals("maxValuePeriod")) {
4558          this.maxValue = new Period();
4559          return this.maxValue;
4560        }
4561        else if (name.equals("maxValueRatio")) {
4562          this.maxValue = new Ratio();
4563          return this.maxValue;
4564        }
4565        else if (name.equals("maxValueSampledData")) {
4566          this.maxValue = new SampledData();
4567          return this.maxValue;
4568        }
4569        else if (name.equals("maxValueSignature")) {
4570          this.maxValue = new Signature();
4571          return this.maxValue;
4572        }
4573        else if (name.equals("maxValueHumanName")) {
4574          this.maxValue = new HumanName();
4575          return this.maxValue;
4576        }
4577        else if (name.equals("maxValueAddress")) {
4578          this.maxValue = new Address();
4579          return this.maxValue;
4580        }
4581        else if (name.equals("maxValueContactPoint")) {
4582          this.maxValue = new ContactPoint();
4583          return this.maxValue;
4584        }
4585        else if (name.equals("maxValueTiming")) {
4586          this.maxValue = new Timing();
4587          return this.maxValue;
4588        }
4589        else if (name.equals("maxValueReference")) {
4590          this.maxValue = new Reference();
4591          return this.maxValue;
4592        }
4593        else if (name.equals("maxValueMeta")) {
4594          this.maxValue = new Meta();
4595          return this.maxValue;
4596        }
4597        else if (name.equals("maxLength")) {
4598          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.maxLength");
4599        }
4600        else if (name.equals("condition")) {
4601          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.condition");
4602        }
4603        else if (name.equals("constraint")) {
4604          return addConstraint();
4605        }
4606        else if (name.equals("mustSupport")) {
4607          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.mustSupport");
4608        }
4609        else if (name.equals("isModifier")) {
4610          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.isModifier");
4611        }
4612        else if (name.equals("isSummary")) {
4613          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.isSummary");
4614        }
4615        else if (name.equals("binding")) {
4616          this.binding = new ElementDefinitionBindingComponent();
4617          return this.binding;
4618        }
4619        else if (name.equals("mapping")) {
4620          return addMapping();
4621        }
4622        else
4623          return super.addChild(name);
4624      }
4625
4626  public String fhirType() {
4627    return "ElementDefinition";
4628
4629  }
4630
4631      public ElementDefinition copy() {
4632        ElementDefinition dst = new ElementDefinition();
4633        copyValues(dst);
4634        dst.path = path == null ? null : path.copy();
4635        if (representation != null) {
4636          dst.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
4637          for (Enumeration<PropertyRepresentation> i : representation)
4638            dst.representation.add(i.copy());
4639        };
4640        dst.name = name == null ? null : name.copy();
4641        dst.label = label == null ? null : label.copy();
4642        if (code != null) {
4643          dst.code = new ArrayList<Coding>();
4644          for (Coding i : code)
4645            dst.code.add(i.copy());
4646        };
4647        dst.slicing = slicing == null ? null : slicing.copy();
4648        dst.short_ = short_ == null ? null : short_.copy();
4649        dst.definition = definition == null ? null : definition.copy();
4650        dst.comments = comments == null ? null : comments.copy();
4651        dst.requirements = requirements == null ? null : requirements.copy();
4652        if (alias != null) {
4653          dst.alias = new ArrayList<StringType>();
4654          for (StringType i : alias)
4655            dst.alias.add(i.copy());
4656        };
4657        dst.min = min == null ? null : min.copy();
4658        dst.max = max == null ? null : max.copy();
4659        dst.base = base == null ? null : base.copy();
4660        if (type != null) {
4661          dst.type = new ArrayList<TypeRefComponent>();
4662          for (TypeRefComponent i : type)
4663            dst.type.add(i.copy());
4664        };
4665        dst.nameReference = nameReference == null ? null : nameReference.copy();
4666        dst.defaultValue = defaultValue == null ? null : defaultValue.copy();
4667        dst.meaningWhenMissing = meaningWhenMissing == null ? null : meaningWhenMissing.copy();
4668        dst.fixed = fixed == null ? null : fixed.copy();
4669        dst.pattern = pattern == null ? null : pattern.copy();
4670        dst.example = example == null ? null : example.copy();
4671        dst.minValue = minValue == null ? null : minValue.copy();
4672        dst.maxValue = maxValue == null ? null : maxValue.copy();
4673        dst.maxLength = maxLength == null ? null : maxLength.copy();
4674        if (condition != null) {
4675          dst.condition = new ArrayList<IdType>();
4676          for (IdType i : condition)
4677            dst.condition.add(i.copy());
4678        };
4679        if (constraint != null) {
4680          dst.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
4681          for (ElementDefinitionConstraintComponent i : constraint)
4682            dst.constraint.add(i.copy());
4683        };
4684        dst.mustSupport = mustSupport == null ? null : mustSupport.copy();
4685        dst.isModifier = isModifier == null ? null : isModifier.copy();
4686        dst.isSummary = isSummary == null ? null : isSummary.copy();
4687        dst.binding = binding == null ? null : binding.copy();
4688        if (mapping != null) {
4689          dst.mapping = new ArrayList<ElementDefinitionMappingComponent>();
4690          for (ElementDefinitionMappingComponent i : mapping)
4691            dst.mapping.add(i.copy());
4692        };
4693        return dst;
4694      }
4695
4696      protected ElementDefinition typedCopy() {
4697        return copy();
4698      }
4699
4700      @Override
4701      public boolean equalsDeep(Base other) {
4702        if (!super.equalsDeep(other))
4703          return false;
4704        if (!(other instanceof ElementDefinition))
4705          return false;
4706        ElementDefinition o = (ElementDefinition) other;
4707        return compareDeep(path, o.path, true) && compareDeep(representation, o.representation, true) && compareDeep(name, o.name, true)
4708           && compareDeep(label, o.label, true) && compareDeep(code, o.code, true) && compareDeep(slicing, o.slicing, true)
4709           && compareDeep(short_, o.short_, true) && compareDeep(definition, o.definition, true) && compareDeep(comments, o.comments, true)
4710           && compareDeep(requirements, o.requirements, true) && compareDeep(alias, o.alias, true) && compareDeep(min, o.min, true)
4711           && compareDeep(max, o.max, true) && compareDeep(base, o.base, true) && compareDeep(type, o.type, true)
4712           && compareDeep(nameReference, o.nameReference, true) && compareDeep(defaultValue, o.defaultValue, true)
4713           && compareDeep(meaningWhenMissing, o.meaningWhenMissing, true) && compareDeep(fixed, o.fixed, true)
4714           && compareDeep(pattern, o.pattern, true) && compareDeep(example, o.example, true) && compareDeep(minValue, o.minValue, true)
4715           && compareDeep(maxValue, o.maxValue, true) && compareDeep(maxLength, o.maxLength, true) && compareDeep(condition, o.condition, true)
4716           && compareDeep(constraint, o.constraint, true) && compareDeep(mustSupport, o.mustSupport, true)
4717           && compareDeep(isModifier, o.isModifier, true) && compareDeep(isSummary, o.isSummary, true) && compareDeep(binding, o.binding, true)
4718           && compareDeep(mapping, o.mapping, true);
4719      }
4720
4721      @Override
4722      public boolean equalsShallow(Base other) {
4723        if (!super.equalsShallow(other))
4724          return false;
4725        if (!(other instanceof ElementDefinition))
4726          return false;
4727        ElementDefinition o = (ElementDefinition) other;
4728        return compareValues(path, o.path, true) && compareValues(representation, o.representation, true) && compareValues(name, o.name, true)
4729           && compareValues(label, o.label, true) && compareValues(short_, o.short_, true) && compareValues(definition, o.definition, true)
4730           && compareValues(comments, o.comments, true) && compareValues(requirements, o.requirements, true) && compareValues(alias, o.alias, true)
4731           && compareValues(min, o.min, true) && compareValues(max, o.max, true) && compareValues(nameReference, o.nameReference, true)
4732           && compareValues(meaningWhenMissing, o.meaningWhenMissing, true) && compareValues(maxLength, o.maxLength, true)
4733           && compareValues(condition, o.condition, true) && compareValues(mustSupport, o.mustSupport, true) && compareValues(isModifier, o.isModifier, true)
4734           && compareValues(isSummary, o.isSummary, true);
4735      }
4736
4737      public boolean isEmpty() {
4738        return super.isEmpty() && (path == null || path.isEmpty()) && (representation == null || representation.isEmpty())
4739           && (name == null || name.isEmpty()) && (label == null || label.isEmpty()) && (code == null || code.isEmpty())
4740           && (slicing == null || slicing.isEmpty()) && (short_ == null || short_.isEmpty()) && (definition == null || definition.isEmpty())
4741           && (comments == null || comments.isEmpty()) && (requirements == null || requirements.isEmpty())
4742           && (alias == null || alias.isEmpty()) && (min == null || min.isEmpty()) && (max == null || max.isEmpty())
4743           && (base == null || base.isEmpty()) && (type == null || type.isEmpty()) && (nameReference == null || nameReference.isEmpty())
4744           && (defaultValue == null || defaultValue.isEmpty()) && (meaningWhenMissing == null || meaningWhenMissing.isEmpty())
4745           && (fixed == null || fixed.isEmpty()) && (pattern == null || pattern.isEmpty()) && (example == null || example.isEmpty())
4746           && (minValue == null || minValue.isEmpty()) && (maxValue == null || maxValue.isEmpty()) && (maxLength == null || maxLength.isEmpty())
4747           && (condition == null || condition.isEmpty()) && (constraint == null || constraint.isEmpty())
4748           && (mustSupport == null || mustSupport.isEmpty()) && (isModifier == null || isModifier.isEmpty())
4749           && (isSummary == null || isSummary.isEmpty()) && (binding == null || binding.isEmpty()) && (mapping == null || mapping.isEmpty())
4750          ;
4751      }
4752
4753
4754}