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