001package org.hl7.fhir.dstu2.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus;
041import org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatusEnumFactory;
042import ca.uhn.fhir.model.api.annotation.Block;
043import ca.uhn.fhir.model.api.annotation.Child;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.ResourceDef;
046import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
047import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
048import org.hl7.fhir.exceptions.FHIRException;
049import org.hl7.fhir.utilities.Utilities;
050/**
051 * A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined in FHIR, and also for describing extensions, and constraints on resources and data types.
052 */
053@ResourceDef(name="StructureDefinition", profile="http://hl7.org/fhir/Profile/StructureDefinition")
054public class StructureDefinition extends DomainResource {
055
056    public enum StructureDefinitionKind {
057        /**
058         * A data type - either a primitive or complex structure that defines a set of data elements. These can be used throughout Resource and extension definitions.
059         */
060        DATATYPE, 
061        /**
062         * A resource defined by the FHIR specification.
063         */
064        RESOURCE, 
065        /**
066         * A logical model - a conceptual package of data that will be mapped to resources for implementation.
067         */
068        LOGICAL, 
069        /**
070         * added to help the parsers
071         */
072        NULL;
073        public static StructureDefinitionKind fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("datatype".equals(codeString))
077          return DATATYPE;
078        if ("resource".equals(codeString))
079          return RESOURCE;
080        if ("logical".equals(codeString))
081          return LOGICAL;
082        throw new FHIRException("Unknown StructureDefinitionKind code '"+codeString+"'");
083        }
084        public String toCode() {
085          switch (this) {
086            case DATATYPE: return "datatype";
087            case RESOURCE: return "resource";
088            case LOGICAL: return "logical";
089            case NULL: return null;
090            default: return "?";
091          }
092        }
093        public String getSystem() {
094          switch (this) {
095            case DATATYPE: return "http://hl7.org/fhir/structure-definition-kind";
096            case RESOURCE: return "http://hl7.org/fhir/structure-definition-kind";
097            case LOGICAL: return "http://hl7.org/fhir/structure-definition-kind";
098            case NULL: return null;
099            default: return "?";
100          }
101        }
102        public String getDefinition() {
103          switch (this) {
104            case DATATYPE: return "A data type - either a primitive or complex structure that defines a set of data elements. These can be used throughout Resource and extension definitions.";
105            case RESOURCE: return "A resource defined by the FHIR specification.";
106            case LOGICAL: return "A logical model - a conceptual package of data that will be mapped to resources for implementation.";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111        public String getDisplay() {
112          switch (this) {
113            case DATATYPE: return "Data Type";
114            case RESOURCE: return "Resource";
115            case LOGICAL: return "Logical Model";
116            case NULL: return null;
117            default: return "?";
118          }
119        }
120    }
121
122  public static class StructureDefinitionKindEnumFactory implements EnumFactory<StructureDefinitionKind> {
123    public StructureDefinitionKind fromCode(String codeString) throws IllegalArgumentException {
124      if (codeString == null || "".equals(codeString))
125            if (codeString == null || "".equals(codeString))
126                return null;
127        if ("datatype".equals(codeString))
128          return StructureDefinitionKind.DATATYPE;
129        if ("resource".equals(codeString))
130          return StructureDefinitionKind.RESOURCE;
131        if ("logical".equals(codeString))
132          return StructureDefinitionKind.LOGICAL;
133        throw new IllegalArgumentException("Unknown StructureDefinitionKind code '"+codeString+"'");
134        }
135        public Enumeration<StructureDefinitionKind> fromType(Base code) throws FHIRException {
136          if (code == null || code.isEmpty())
137            return null;
138          String codeString = ((PrimitiveType) code).asStringValue();
139          if (codeString == null || "".equals(codeString))
140            return null;
141        if ("datatype".equals(codeString))
142          return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.DATATYPE);
143        if ("resource".equals(codeString))
144          return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.RESOURCE);
145        if ("logical".equals(codeString))
146          return new Enumeration<StructureDefinitionKind>(this, StructureDefinitionKind.LOGICAL);
147        throw new FHIRException("Unknown StructureDefinitionKind code '"+codeString+"'");
148        }
149    public String toCode(StructureDefinitionKind code) {
150      if (code == StructureDefinitionKind.DATATYPE)
151        return "datatype";
152      if (code == StructureDefinitionKind.RESOURCE)
153        return "resource";
154      if (code == StructureDefinitionKind.LOGICAL)
155        return "logical";
156      return "?";
157      }
158    }
159
160    public enum ExtensionContext {
161        /**
162         * The context is all elements matching a particular resource element path.
163         */
164        RESOURCE, 
165        /**
166         * The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name).
167         */
168        DATATYPE, 
169        /**
170         * The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure.  The context identifies the mapping target. The mapping should clearly identify where such an extension could be used.
171         */
172        MAPPING, 
173        /**
174         * The context is a particular extension from a particular profile, a uri that identifies the extension definition.
175         */
176        EXTENSION, 
177        /**
178         * added to help the parsers
179         */
180        NULL;
181        public static ExtensionContext fromCode(String codeString) throws FHIRException {
182            if (codeString == null || "".equals(codeString))
183                return null;
184        if ("resource".equals(codeString))
185          return RESOURCE;
186        if ("datatype".equals(codeString))
187          return DATATYPE;
188        if ("mapping".equals(codeString))
189          return MAPPING;
190        if ("extension".equals(codeString))
191          return EXTENSION;
192        throw new FHIRException("Unknown ExtensionContext code '"+codeString+"'");
193        }
194        public String toCode() {
195          switch (this) {
196            case RESOURCE: return "resource";
197            case DATATYPE: return "datatype";
198            case MAPPING: return "mapping";
199            case EXTENSION: return "extension";
200            case NULL: return null;
201            default: return "?";
202          }
203        }
204        public String getSystem() {
205          switch (this) {
206            case RESOURCE: return "http://hl7.org/fhir/extension-context";
207            case DATATYPE: return "http://hl7.org/fhir/extension-context";
208            case MAPPING: return "http://hl7.org/fhir/extension-context";
209            case EXTENSION: return "http://hl7.org/fhir/extension-context";
210            case NULL: return null;
211            default: return "?";
212          }
213        }
214        public String getDefinition() {
215          switch (this) {
216            case RESOURCE: return "The context is all elements matching a particular resource element path.";
217            case DATATYPE: return "The context is all nodes matching a particular data type element path (root or repeating element) or all elements referencing a particular primitive data type (expressed as the datatype name).";
218            case MAPPING: return "The context is all nodes whose mapping to a specified reference model corresponds to a particular mapping structure.  The context identifies the mapping target. The mapping should clearly identify where such an extension could be used.";
219            case EXTENSION: return "The context is a particular extension from a particular profile, a uri that identifies the extension definition.";
220            case NULL: return null;
221            default: return "?";
222          }
223        }
224        public String getDisplay() {
225          switch (this) {
226            case RESOURCE: return "Resource";
227            case DATATYPE: return "Datatype";
228            case MAPPING: return "Mapping";
229            case EXTENSION: return "Extension";
230            case NULL: return null;
231            default: return "?";
232          }
233        }
234    }
235
236  public static class ExtensionContextEnumFactory implements EnumFactory<ExtensionContext> {
237    public ExtensionContext fromCode(String codeString) throws IllegalArgumentException {
238      if (codeString == null || "".equals(codeString))
239            if (codeString == null || "".equals(codeString))
240                return null;
241        if ("resource".equals(codeString))
242          return ExtensionContext.RESOURCE;
243        if ("datatype".equals(codeString))
244          return ExtensionContext.DATATYPE;
245        if ("mapping".equals(codeString))
246          return ExtensionContext.MAPPING;
247        if ("extension".equals(codeString))
248          return ExtensionContext.EXTENSION;
249        throw new IllegalArgumentException("Unknown ExtensionContext code '"+codeString+"'");
250        }
251        public Enumeration<ExtensionContext> fromType(Base code) throws FHIRException {
252          if (code == null || code.isEmpty())
253            return null;
254          String codeString = ((PrimitiveType) code).asStringValue();
255          if (codeString == null || "".equals(codeString))
256            return null;
257        if ("resource".equals(codeString))
258          return new Enumeration<ExtensionContext>(this, ExtensionContext.RESOURCE);
259        if ("datatype".equals(codeString))
260          return new Enumeration<ExtensionContext>(this, ExtensionContext.DATATYPE);
261        if ("mapping".equals(codeString))
262          return new Enumeration<ExtensionContext>(this, ExtensionContext.MAPPING);
263        if ("extension".equals(codeString))
264          return new Enumeration<ExtensionContext>(this, ExtensionContext.EXTENSION);
265        throw new FHIRException("Unknown ExtensionContext code '"+codeString+"'");
266        }
267    public String toCode(ExtensionContext code) {
268      if (code == ExtensionContext.RESOURCE)
269        return "resource";
270      if (code == ExtensionContext.DATATYPE)
271        return "datatype";
272      if (code == ExtensionContext.MAPPING)
273        return "mapping";
274      if (code == ExtensionContext.EXTENSION)
275        return "extension";
276      return "?";
277      }
278    }
279
280    @Block()
281    public static class StructureDefinitionContactComponent extends BackboneElement implements IBaseBackboneElement {
282        /**
283         * The name of an individual to contact regarding the structure definition.
284         */
285        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
286        @Description(shortDefinition="Name of a individual to contact", formalDefinition="The name of an individual to contact regarding the structure definition." )
287        protected StringType name;
288
289        /**
290         * Contact details for individual (if a name was provided) or the publisher.
291         */
292        @Child(name = "telecom", type = {ContactPoint.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
293        @Description(shortDefinition="Contact details for individual or publisher", formalDefinition="Contact details for individual (if a name was provided) or the publisher." )
294        protected List<ContactPoint> telecom;
295
296        private static final long serialVersionUID = -1179697803L;
297
298    /*
299     * Constructor
300     */
301      public StructureDefinitionContactComponent() {
302        super();
303      }
304
305        /**
306         * @return {@link #name} (The name of an individual to contact regarding the structure definition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
307         */
308        public StringType getNameElement() { 
309          if (this.name == null)
310            if (Configuration.errorOnAutoCreate())
311              throw new Error("Attempt to auto-create StructureDefinitionContactComponent.name");
312            else if (Configuration.doAutoCreate())
313              this.name = new StringType(); // bb
314          return this.name;
315        }
316
317        public boolean hasNameElement() { 
318          return this.name != null && !this.name.isEmpty();
319        }
320
321        public boolean hasName() { 
322          return this.name != null && !this.name.isEmpty();
323        }
324
325        /**
326         * @param value {@link #name} (The name of an individual to contact regarding the structure definition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
327         */
328        public StructureDefinitionContactComponent setNameElement(StringType value) { 
329          this.name = value;
330          return this;
331        }
332
333        /**
334         * @return The name of an individual to contact regarding the structure definition.
335         */
336        public String getName() { 
337          return this.name == null ? null : this.name.getValue();
338        }
339
340        /**
341         * @param value The name of an individual to contact regarding the structure definition.
342         */
343        public StructureDefinitionContactComponent setName(String value) { 
344          if (Utilities.noString(value))
345            this.name = null;
346          else {
347            if (this.name == null)
348              this.name = new StringType();
349            this.name.setValue(value);
350          }
351          return this;
352        }
353
354        /**
355         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
356         */
357        public List<ContactPoint> getTelecom() { 
358          if (this.telecom == null)
359            this.telecom = new ArrayList<ContactPoint>();
360          return this.telecom;
361        }
362
363        public boolean hasTelecom() { 
364          if (this.telecom == null)
365            return false;
366          for (ContactPoint item : this.telecom)
367            if (!item.isEmpty())
368              return true;
369          return false;
370        }
371
372        /**
373         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
374         */
375    // syntactic sugar
376        public ContactPoint addTelecom() { //3
377          ContactPoint t = new ContactPoint();
378          if (this.telecom == null)
379            this.telecom = new ArrayList<ContactPoint>();
380          this.telecom.add(t);
381          return t;
382        }
383
384    // syntactic sugar
385        public StructureDefinitionContactComponent addTelecom(ContactPoint t) { //3
386          if (t == null)
387            return this;
388          if (this.telecom == null)
389            this.telecom = new ArrayList<ContactPoint>();
390          this.telecom.add(t);
391          return this;
392        }
393
394        protected void listChildren(List<Property> childrenList) {
395          super.listChildren(childrenList);
396          childrenList.add(new Property("name", "string", "The name of an individual to contact regarding the structure definition.", 0, java.lang.Integer.MAX_VALUE, name));
397          childrenList.add(new Property("telecom", "ContactPoint", "Contact details for individual (if a name was provided) or the publisher.", 0, java.lang.Integer.MAX_VALUE, telecom));
398        }
399
400      @Override
401      public void setProperty(String name, Base value) throws FHIRException {
402        if (name.equals("name"))
403          this.name = castToString(value); // StringType
404        else if (name.equals("telecom"))
405          this.getTelecom().add(castToContactPoint(value));
406        else
407          super.setProperty(name, value);
408      }
409
410      @Override
411      public Base addChild(String name) throws FHIRException {
412        if (name.equals("name")) {
413          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.name");
414        }
415        else if (name.equals("telecom")) {
416          return addTelecom();
417        }
418        else
419          return super.addChild(name);
420      }
421
422      public StructureDefinitionContactComponent copy() {
423        StructureDefinitionContactComponent dst = new StructureDefinitionContactComponent();
424        copyValues(dst);
425        dst.name = name == null ? null : name.copy();
426        if (telecom != null) {
427          dst.telecom = new ArrayList<ContactPoint>();
428          for (ContactPoint i : telecom)
429            dst.telecom.add(i.copy());
430        };
431        return dst;
432      }
433
434      @Override
435      public boolean equalsDeep(Base other) {
436        if (!super.equalsDeep(other))
437          return false;
438        if (!(other instanceof StructureDefinitionContactComponent))
439          return false;
440        StructureDefinitionContactComponent o = (StructureDefinitionContactComponent) other;
441        return compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true);
442      }
443
444      @Override
445      public boolean equalsShallow(Base other) {
446        if (!super.equalsShallow(other))
447          return false;
448        if (!(other instanceof StructureDefinitionContactComponent))
449          return false;
450        StructureDefinitionContactComponent o = (StructureDefinitionContactComponent) other;
451        return compareValues(name, o.name, true);
452      }
453
454      public boolean isEmpty() {
455        return super.isEmpty() && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty())
456          ;
457      }
458
459  public String fhirType() {
460    return "StructureDefinition.contact";
461
462  }
463
464  }
465
466    @Block()
467    public static class StructureDefinitionMappingComponent extends BackboneElement implements IBaseBackboneElement {
468        /**
469         * An Internal id that is used to identify this mapping set when specific mappings are made.
470         */
471        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=false)
472        @Description(shortDefinition="Internal id when this mapping is used", formalDefinition="An Internal id that is used to identify this mapping set when specific mappings are made." )
473        protected IdType identity;
474
475        /**
476         * An absolute URI that identifies the specification that this mapping is expressed to.
477         */
478        @Child(name = "uri", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=false)
479        @Description(shortDefinition="Identifies what this mapping refers to", formalDefinition="An absolute URI that identifies the specification that this mapping is expressed to." )
480        protected UriType uri;
481
482        /**
483         * A name for the specification that is being mapped to.
484         */
485        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
486        @Description(shortDefinition="Names what this mapping refers to", formalDefinition="A name for the specification that is being mapped to." )
487        protected StringType name;
488
489        /**
490         * Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
491         */
492        @Child(name = "comments", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
493        @Description(shortDefinition="Versions, Issues, Scope limitations etc.", formalDefinition="Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage." )
494        protected StringType comments;
495
496        private static final long serialVersionUID = 299630820L;
497
498    /*
499     * Constructor
500     */
501      public StructureDefinitionMappingComponent() {
502        super();
503      }
504
505    /*
506     * Constructor
507     */
508      public StructureDefinitionMappingComponent(IdType identity) {
509        super();
510        this.identity = identity;
511      }
512
513        /**
514         * @return {@link #identity} (An Internal id that is used to identify this mapping set when specific mappings are made.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
515         */
516        public IdType getIdentityElement() { 
517          if (this.identity == null)
518            if (Configuration.errorOnAutoCreate())
519              throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.identity");
520            else if (Configuration.doAutoCreate())
521              this.identity = new IdType(); // bb
522          return this.identity;
523        }
524
525        public boolean hasIdentityElement() { 
526          return this.identity != null && !this.identity.isEmpty();
527        }
528
529        public boolean hasIdentity() { 
530          return this.identity != null && !this.identity.isEmpty();
531        }
532
533        /**
534         * @param value {@link #identity} (An Internal id that is used to identify this mapping set when specific mappings are made.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
535         */
536        public StructureDefinitionMappingComponent setIdentityElement(IdType value) { 
537          this.identity = value;
538          return this;
539        }
540
541        /**
542         * @return An Internal id that is used to identify this mapping set when specific mappings are made.
543         */
544        public String getIdentity() { 
545          return this.identity == null ? null : this.identity.getValue();
546        }
547
548        /**
549         * @param value An Internal id that is used to identify this mapping set when specific mappings are made.
550         */
551        public StructureDefinitionMappingComponent setIdentity(String value) { 
552            if (this.identity == null)
553              this.identity = new IdType();
554            this.identity.setValue(value);
555          return this;
556        }
557
558        /**
559         * @return {@link #uri} (An absolute URI that identifies the specification that this mapping is expressed to.). This is the underlying object with id, value and extensions. The accessor "getUri" gives direct access to the value
560         */
561        public UriType getUriElement() { 
562          if (this.uri == null)
563            if (Configuration.errorOnAutoCreate())
564              throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.uri");
565            else if (Configuration.doAutoCreate())
566              this.uri = new UriType(); // bb
567          return this.uri;
568        }
569
570        public boolean hasUriElement() { 
571          return this.uri != null && !this.uri.isEmpty();
572        }
573
574        public boolean hasUri() { 
575          return this.uri != null && !this.uri.isEmpty();
576        }
577
578        /**
579         * @param value {@link #uri} (An absolute URI that identifies the specification that this mapping is expressed to.). This is the underlying object with id, value and extensions. The accessor "getUri" gives direct access to the value
580         */
581        public StructureDefinitionMappingComponent setUriElement(UriType value) { 
582          this.uri = value;
583          return this;
584        }
585
586        /**
587         * @return An absolute URI that identifies the specification that this mapping is expressed to.
588         */
589        public String getUri() { 
590          return this.uri == null ? null : this.uri.getValue();
591        }
592
593        /**
594         * @param value An absolute URI that identifies the specification that this mapping is expressed to.
595         */
596        public StructureDefinitionMappingComponent setUri(String value) { 
597          if (Utilities.noString(value))
598            this.uri = null;
599          else {
600            if (this.uri == null)
601              this.uri = new UriType();
602            this.uri.setValue(value);
603          }
604          return this;
605        }
606
607        /**
608         * @return {@link #name} (A name for the specification that is being mapped to.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
609         */
610        public StringType getNameElement() { 
611          if (this.name == null)
612            if (Configuration.errorOnAutoCreate())
613              throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.name");
614            else if (Configuration.doAutoCreate())
615              this.name = new StringType(); // bb
616          return this.name;
617        }
618
619        public boolean hasNameElement() { 
620          return this.name != null && !this.name.isEmpty();
621        }
622
623        public boolean hasName() { 
624          return this.name != null && !this.name.isEmpty();
625        }
626
627        /**
628         * @param value {@link #name} (A name for the specification that is being mapped to.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
629         */
630        public StructureDefinitionMappingComponent setNameElement(StringType value) { 
631          this.name = value;
632          return this;
633        }
634
635        /**
636         * @return A name for the specification that is being mapped to.
637         */
638        public String getName() { 
639          return this.name == null ? null : this.name.getValue();
640        }
641
642        /**
643         * @param value A name for the specification that is being mapped to.
644         */
645        public StructureDefinitionMappingComponent setName(String value) { 
646          if (Utilities.noString(value))
647            this.name = null;
648          else {
649            if (this.name == null)
650              this.name = new StringType();
651            this.name.setValue(value);
652          }
653          return this;
654        }
655
656        /**
657         * @return {@link #comments} (Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
658         */
659        public StringType getCommentsElement() { 
660          if (this.comments == null)
661            if (Configuration.errorOnAutoCreate())
662              throw new Error("Attempt to auto-create StructureDefinitionMappingComponent.comments");
663            else if (Configuration.doAutoCreate())
664              this.comments = new StringType(); // bb
665          return this.comments;
666        }
667
668        public boolean hasCommentsElement() { 
669          return this.comments != null && !this.comments.isEmpty();
670        }
671
672        public boolean hasComments() { 
673          return this.comments != null && !this.comments.isEmpty();
674        }
675
676        /**
677         * @param value {@link #comments} (Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
678         */
679        public StructureDefinitionMappingComponent setCommentsElement(StringType value) { 
680          this.comments = value;
681          return this;
682        }
683
684        /**
685         * @return Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
686         */
687        public String getComments() { 
688          return this.comments == null ? null : this.comments.getValue();
689        }
690
691        /**
692         * @param value Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.
693         */
694        public StructureDefinitionMappingComponent setComments(String value) { 
695          if (Utilities.noString(value))
696            this.comments = null;
697          else {
698            if (this.comments == null)
699              this.comments = new StringType();
700            this.comments.setValue(value);
701          }
702          return this;
703        }
704
705        protected void listChildren(List<Property> childrenList) {
706          super.listChildren(childrenList);
707          childrenList.add(new Property("identity", "id", "An Internal id that is used to identify this mapping set when specific mappings are made.", 0, java.lang.Integer.MAX_VALUE, identity));
708          childrenList.add(new Property("uri", "uri", "An absolute URI that identifies the specification that this mapping is expressed to.", 0, java.lang.Integer.MAX_VALUE, uri));
709          childrenList.add(new Property("name", "string", "A name for the specification that is being mapped to.", 0, java.lang.Integer.MAX_VALUE, name));
710          childrenList.add(new Property("comments", "string", "Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.", 0, java.lang.Integer.MAX_VALUE, comments));
711        }
712
713      @Override
714      public void setProperty(String name, Base value) throws FHIRException {
715        if (name.equals("identity"))
716          this.identity = castToId(value); // IdType
717        else if (name.equals("uri"))
718          this.uri = castToUri(value); // UriType
719        else if (name.equals("name"))
720          this.name = castToString(value); // StringType
721        else if (name.equals("comments"))
722          this.comments = castToString(value); // StringType
723        else
724          super.setProperty(name, value);
725      }
726
727      @Override
728      public Base addChild(String name) throws FHIRException {
729        if (name.equals("identity")) {
730          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.identity");
731        }
732        else if (name.equals("uri")) {
733          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.uri");
734        }
735        else if (name.equals("name")) {
736          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.name");
737        }
738        else if (name.equals("comments")) {
739          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.comments");
740        }
741        else
742          return super.addChild(name);
743      }
744
745      public StructureDefinitionMappingComponent copy() {
746        StructureDefinitionMappingComponent dst = new StructureDefinitionMappingComponent();
747        copyValues(dst);
748        dst.identity = identity == null ? null : identity.copy();
749        dst.uri = uri == null ? null : uri.copy();
750        dst.name = name == null ? null : name.copy();
751        dst.comments = comments == null ? null : comments.copy();
752        return dst;
753      }
754
755      @Override
756      public boolean equalsDeep(Base other) {
757        if (!super.equalsDeep(other))
758          return false;
759        if (!(other instanceof StructureDefinitionMappingComponent))
760          return false;
761        StructureDefinitionMappingComponent o = (StructureDefinitionMappingComponent) other;
762        return compareDeep(identity, o.identity, true) && compareDeep(uri, o.uri, true) && compareDeep(name, o.name, true)
763           && compareDeep(comments, o.comments, true);
764      }
765
766      @Override
767      public boolean equalsShallow(Base other) {
768        if (!super.equalsShallow(other))
769          return false;
770        if (!(other instanceof StructureDefinitionMappingComponent))
771          return false;
772        StructureDefinitionMappingComponent o = (StructureDefinitionMappingComponent) other;
773        return compareValues(identity, o.identity, true) && compareValues(uri, o.uri, true) && compareValues(name, o.name, true)
774           && compareValues(comments, o.comments, true);
775      }
776
777      public boolean isEmpty() {
778        return super.isEmpty() && (identity == null || identity.isEmpty()) && (uri == null || uri.isEmpty())
779           && (name == null || name.isEmpty()) && (comments == null || comments.isEmpty());
780      }
781
782  public String fhirType() {
783    return "StructureDefinition.mapping";
784
785  }
786
787  }
788
789    @Block()
790    public static class StructureDefinitionSnapshotComponent extends BackboneElement implements IBaseBackboneElement {
791        /**
792         * Captures constraints on each element within the resource.
793         */
794        @Child(name = "element", type = {ElementDefinition.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
795        @Description(shortDefinition="Definition of elements in the resource (if no StructureDefinition)", formalDefinition="Captures constraints on each element within the resource." )
796        protected List<ElementDefinition> element;
797
798        private static final long serialVersionUID = 53896641L;
799
800    /*
801     * Constructor
802     */
803      public StructureDefinitionSnapshotComponent() {
804        super();
805      }
806
807        /**
808         * @return {@link #element} (Captures constraints on each element within the resource.)
809         */
810        public List<ElementDefinition> getElement() { 
811          if (this.element == null)
812            this.element = new ArrayList<ElementDefinition>();
813          return this.element;
814        }
815
816        public boolean hasElement() { 
817          if (this.element == null)
818            return false;
819          for (ElementDefinition item : this.element)
820            if (!item.isEmpty())
821              return true;
822          return false;
823        }
824
825        /**
826         * @return {@link #element} (Captures constraints on each element within the resource.)
827         */
828    // syntactic sugar
829        public ElementDefinition addElement() { //3
830          ElementDefinition t = new ElementDefinition();
831          if (this.element == null)
832            this.element = new ArrayList<ElementDefinition>();
833          this.element.add(t);
834          return t;
835        }
836
837    // syntactic sugar
838        public StructureDefinitionSnapshotComponent addElement(ElementDefinition t) { //3
839          if (t == null)
840            return this;
841          if (this.element == null)
842            this.element = new ArrayList<ElementDefinition>();
843          this.element.add(t);
844          return this;
845        }
846
847        protected void listChildren(List<Property> childrenList) {
848          super.listChildren(childrenList);
849          childrenList.add(new Property("element", "ElementDefinition", "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element));
850        }
851
852      @Override
853      public void setProperty(String name, Base value) throws FHIRException {
854        if (name.equals("element"))
855          this.getElement().add(castToElementDefinition(value));
856        else
857          super.setProperty(name, value);
858      }
859
860      @Override
861      public Base addChild(String name) throws FHIRException {
862        if (name.equals("element")) {
863          return addElement();
864        }
865        else
866          return super.addChild(name);
867      }
868
869      public StructureDefinitionSnapshotComponent copy() {
870        StructureDefinitionSnapshotComponent dst = new StructureDefinitionSnapshotComponent();
871        copyValues(dst);
872        if (element != null) {
873          dst.element = new ArrayList<ElementDefinition>();
874          for (ElementDefinition i : element)
875            dst.element.add(i.copy());
876        };
877        return dst;
878      }
879
880      @Override
881      public boolean equalsDeep(Base other) {
882        if (!super.equalsDeep(other))
883          return false;
884        if (!(other instanceof StructureDefinitionSnapshotComponent))
885          return false;
886        StructureDefinitionSnapshotComponent o = (StructureDefinitionSnapshotComponent) other;
887        return compareDeep(element, o.element, true);
888      }
889
890      @Override
891      public boolean equalsShallow(Base other) {
892        if (!super.equalsShallow(other))
893          return false;
894        if (!(other instanceof StructureDefinitionSnapshotComponent))
895          return false;
896        StructureDefinitionSnapshotComponent o = (StructureDefinitionSnapshotComponent) other;
897        return true;
898      }
899
900      public boolean isEmpty() {
901        return super.isEmpty() && (element == null || element.isEmpty());
902      }
903
904  public String fhirType() {
905    return "StructureDefinition.snapshot";
906
907  }
908
909  }
910
911    @Block()
912    public static class StructureDefinitionDifferentialComponent extends BackboneElement implements IBaseBackboneElement {
913        /**
914         * Captures constraints on each element within the resource.
915         */
916        @Child(name = "element", type = {ElementDefinition.class}, order=1, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
917        @Description(shortDefinition="Definition of elements in the resource (if no StructureDefinition)", formalDefinition="Captures constraints on each element within the resource." )
918        protected List<ElementDefinition> element;
919
920        private static final long serialVersionUID = 53896641L;
921
922    /*
923     * Constructor
924     */
925      public StructureDefinitionDifferentialComponent() {
926        super();
927      }
928
929        /**
930         * @return {@link #element} (Captures constraints on each element within the resource.)
931         */
932        public List<ElementDefinition> getElement() { 
933          if (this.element == null)
934            this.element = new ArrayList<ElementDefinition>();
935          return this.element;
936        }
937
938        public boolean hasElement() { 
939          if (this.element == null)
940            return false;
941          for (ElementDefinition item : this.element)
942            if (!item.isEmpty())
943              return true;
944          return false;
945        }
946
947        /**
948         * @return {@link #element} (Captures constraints on each element within the resource.)
949         */
950    // syntactic sugar
951        public ElementDefinition addElement() { //3
952          ElementDefinition t = new ElementDefinition();
953          if (this.element == null)
954            this.element = new ArrayList<ElementDefinition>();
955          this.element.add(t);
956          return t;
957        }
958
959    // syntactic sugar
960        public StructureDefinitionDifferentialComponent addElement(ElementDefinition t) { //3
961          if (t == null)
962            return this;
963          if (this.element == null)
964            this.element = new ArrayList<ElementDefinition>();
965          this.element.add(t);
966          return this;
967        }
968
969        protected void listChildren(List<Property> childrenList) {
970          super.listChildren(childrenList);
971          childrenList.add(new Property("element", "ElementDefinition", "Captures constraints on each element within the resource.", 0, java.lang.Integer.MAX_VALUE, element));
972        }
973
974      @Override
975      public void setProperty(String name, Base value) throws FHIRException {
976        if (name.equals("element"))
977          this.getElement().add(castToElementDefinition(value));
978        else
979          super.setProperty(name, value);
980      }
981
982      @Override
983      public Base addChild(String name) throws FHIRException {
984        if (name.equals("element")) {
985          return addElement();
986        }
987        else
988          return super.addChild(name);
989      }
990
991      public StructureDefinitionDifferentialComponent copy() {
992        StructureDefinitionDifferentialComponent dst = new StructureDefinitionDifferentialComponent();
993        copyValues(dst);
994        if (element != null) {
995          dst.element = new ArrayList<ElementDefinition>();
996          for (ElementDefinition i : element)
997            dst.element.add(i.copy());
998        };
999        return dst;
1000      }
1001
1002      @Override
1003      public boolean equalsDeep(Base other) {
1004        if (!super.equalsDeep(other))
1005          return false;
1006        if (!(other instanceof StructureDefinitionDifferentialComponent))
1007          return false;
1008        StructureDefinitionDifferentialComponent o = (StructureDefinitionDifferentialComponent) other;
1009        return compareDeep(element, o.element, true);
1010      }
1011
1012      @Override
1013      public boolean equalsShallow(Base other) {
1014        if (!super.equalsShallow(other))
1015          return false;
1016        if (!(other instanceof StructureDefinitionDifferentialComponent))
1017          return false;
1018        StructureDefinitionDifferentialComponent o = (StructureDefinitionDifferentialComponent) other;
1019        return true;
1020      }
1021
1022      public boolean isEmpty() {
1023        return super.isEmpty() && (element == null || element.isEmpty());
1024      }
1025
1026  public String fhirType() {
1027    return "StructureDefinition.differential";
1028
1029  }
1030
1031  }
1032
1033    /**
1034     * An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.
1035     */
1036    @Child(name = "url", type = {UriType.class}, order=0, min=1, max=1, modifier=false, summary=true)
1037    @Description(shortDefinition="Absolute URL used to reference this StructureDefinition", formalDefinition="An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published." )
1038    protected UriType url;
1039
1040    /**
1041     * Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).
1042     */
1043    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1044    @Description(shortDefinition="Other identifiers for the StructureDefinition", formalDefinition="Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI)." )
1045    protected List<Identifier> identifier;
1046
1047    /**
1048     * The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.
1049     */
1050    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1051    @Description(shortDefinition="Logical id for this version of the StructureDefinition", formalDefinition="The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually." )
1052    protected StringType version;
1053
1054    /**
1055     * A free text natural language name identifying the StructureDefinition.
1056     */
1057    @Child(name = "name", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1058    @Description(shortDefinition="Informal name for this StructureDefinition", formalDefinition="A free text natural language name identifying the StructureDefinition." )
1059    protected StringType name;
1060
1061    /**
1062     * Defined so that applications can use this name when displaying the value of the extension to the user.
1063     */
1064    @Child(name = "display", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1065    @Description(shortDefinition="Use this name when displaying the value", formalDefinition="Defined so that applications can use this name when displaying the value of the extension to the user." )
1066    protected StringType display;
1067
1068    /**
1069     * The status of the StructureDefinition.
1070     */
1071    @Child(name = "status", type = {CodeType.class}, order=5, min=1, max=1, modifier=true, summary=true)
1072    @Description(shortDefinition="draft | active | retired", formalDefinition="The status of the StructureDefinition." )
1073    protected Enumeration<ConformanceResourceStatus> status;
1074
1075    /**
1076     * This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1077     */
1078    @Child(name = "experimental", type = {BooleanType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1079    @Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
1080    protected BooleanType experimental;
1081
1082    /**
1083     * The name of the individual or organization that published the structure definition.
1084     */
1085    @Child(name = "publisher", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1086    @Description(shortDefinition="Name of the publisher (Organization or individual)", formalDefinition="The name of the individual or organization that published the structure definition." )
1087    protected StringType publisher;
1088
1089    /**
1090     * Contacts to assist a user in finding and communicating with the publisher.
1091     */
1092    @Child(name = "contact", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1093    @Description(shortDefinition="Contact details of the publisher", formalDefinition="Contacts to assist a user in finding and communicating with the publisher." )
1094    protected List<StructureDefinitionContactComponent> contact;
1095
1096    /**
1097     * The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.
1098     */
1099    @Child(name = "date", type = {DateTimeType.class}, order=9, min=0, max=1, modifier=false, summary=true)
1100    @Description(shortDefinition="Date for this version of the StructureDefinition", formalDefinition="The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes." )
1101    protected DateTimeType date;
1102
1103    /**
1104     * A free text natural language description of the StructureDefinition and its use.
1105     */
1106    @Child(name = "description", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
1107    @Description(shortDefinition="Natural language description of the StructureDefinition", formalDefinition="A free text natural language description of the StructureDefinition and its use." )
1108    protected StringType description;
1109
1110    /**
1111     * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.
1112     */
1113    @Child(name = "useContext", type = {CodeableConcept.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1114    @Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions." )
1115    protected List<CodeableConcept> useContext;
1116
1117    /**
1118     * Explains why this structure definition is needed and why it's been constrained as it has.
1119     */
1120    @Child(name = "requirements", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
1121    @Description(shortDefinition="Scope and Usage this structure definition is for", formalDefinition="Explains why this structure definition is needed and why it's been constrained as it has." )
1122    protected StringType requirements;
1123
1124    /**
1125     * A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.
1126     */
1127    @Child(name = "copyright", type = {StringType.class}, order=13, min=0, max=1, modifier=false, summary=false)
1128    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings." )
1129    protected StringType copyright;
1130
1131    /**
1132     * A set of terms from external terminologies that may be used to assist with indexing and searching of templates.
1133     */
1134    @Child(name = "code", type = {Coding.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1135    @Description(shortDefinition="Assist with indexing and finding", formalDefinition="A set of terms from external terminologies that may be used to assist with indexing and searching of templates." )
1136    protected List<Coding> code;
1137
1138    /**
1139     * The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.
1140     */
1141    @Child(name = "fhirVersion", type = {IdType.class}, order=15, min=0, max=1, modifier=false, summary=true)
1142    @Description(shortDefinition="FHIR Version this StructureDefinition targets", formalDefinition="The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version." )
1143    protected IdType fhirVersion;
1144
1145    /**
1146     * An external specification that the content is mapped to.
1147     */
1148    @Child(name = "mapping", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1149    @Description(shortDefinition="External specification that the content is mapped to", formalDefinition="An external specification that the content is mapped to." )
1150    protected List<StructureDefinitionMappingComponent> mapping;
1151
1152    /**
1153     * Defines the kind of structure that this definition is describing.
1154     */
1155    @Child(name = "kind", type = {CodeType.class}, order=17, min=1, max=1, modifier=false, summary=true)
1156    @Description(shortDefinition="datatype | resource | logical", formalDefinition="Defines the kind of structure that this definition is describing." )
1157    protected Enumeration<StructureDefinitionKind> kind;
1158
1159    /**
1160     * The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.
1161     */
1162    @Child(name = "constrainedType", type = {CodeType.class}, order=18, min=0, max=1, modifier=false, summary=true)
1163    @Description(shortDefinition="Any datatype or resource, including abstract ones", formalDefinition="The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure." )
1164    protected CodeType constrainedType;
1165
1166    /**
1167     * Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.
1168     */
1169    @Child(name = "abstract", type = {BooleanType.class}, order=19, min=1, max=1, modifier=false, summary=true)
1170    @Description(shortDefinition="Whether the structure is abstract", formalDefinition="Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type." )
1171    protected BooleanType abstract_;
1172
1173    /**
1174     * If this is an extension, Identifies the context within FHIR resources where the extension can be used.
1175     */
1176    @Child(name = "contextType", type = {CodeType.class}, order=20, min=0, max=1, modifier=false, summary=true)
1177    @Description(shortDefinition="resource | datatype | mapping | extension", formalDefinition="If this is an extension, Identifies the context within FHIR resources where the extension can be used." )
1178    protected Enumeration<ExtensionContext> contextType;
1179
1180    /**
1181     * Identifies the types of resource or data type elements to which the extension can be applied.
1182     */
1183    @Child(name = "context", type = {StringType.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1184    @Description(shortDefinition="Where the extension can be used in instances", formalDefinition="Identifies the types of resource or data type elements to which the extension can be applied." )
1185    protected List<StringType> context;
1186
1187    /**
1188     * An absolute URI that is the base structure from which this set of constraints is derived.
1189     */
1190    @Child(name = "base", type = {UriType.class}, order=22, min=0, max=1, modifier=false, summary=true)
1191    @Description(shortDefinition="Structure that this set of constraints applies to", formalDefinition="An absolute URI that is the base structure from which this set of constraints is derived." )
1192    protected UriType base;
1193
1194    /**
1195     * A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.
1196     */
1197    @Child(name = "snapshot", type = {}, order=23, min=0, max=1, modifier=false, summary=false)
1198    @Description(shortDefinition="Snapshot view of the structure", formalDefinition="A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition." )
1199    protected StructureDefinitionSnapshotComponent snapshot;
1200
1201    /**
1202     * A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.
1203     */
1204    @Child(name = "differential", type = {}, order=24, min=0, max=1, modifier=false, summary=false)
1205    @Description(shortDefinition="Differential view of the structure", formalDefinition="A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies." )
1206    protected StructureDefinitionDifferentialComponent differential;
1207
1208    private static final long serialVersionUID = -580779569L;
1209
1210  /*
1211   * Constructor
1212   */
1213    public StructureDefinition() {
1214      super();
1215    }
1216
1217  /*
1218   * Constructor
1219   */
1220    public StructureDefinition(UriType url, StringType name, Enumeration<ConformanceResourceStatus> status, Enumeration<StructureDefinitionKind> kind, BooleanType abstract_) {
1221      super();
1222      this.url = url;
1223      this.name = name;
1224      this.status = status;
1225      this.kind = kind;
1226      this.abstract_ = abstract_;
1227    }
1228
1229    /**
1230     * @return {@link #url} (An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1231     */
1232    public UriType getUrlElement() { 
1233      if (this.url == null)
1234        if (Configuration.errorOnAutoCreate())
1235          throw new Error("Attempt to auto-create StructureDefinition.url");
1236        else if (Configuration.doAutoCreate())
1237          this.url = new UriType(); // bb
1238      return this.url;
1239    }
1240
1241    public boolean hasUrlElement() { 
1242      return this.url != null && !this.url.isEmpty();
1243    }
1244
1245    public boolean hasUrl() { 
1246      return this.url != null && !this.url.isEmpty();
1247    }
1248
1249    /**
1250     * @param value {@link #url} (An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
1251     */
1252    public StructureDefinition setUrlElement(UriType value) { 
1253      this.url = value;
1254      return this;
1255    }
1256
1257    /**
1258     * @return An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.
1259     */
1260    public String getUrl() { 
1261      return this.url == null ? null : this.url.getValue();
1262    }
1263
1264    /**
1265     * @param value An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.
1266     */
1267    public StructureDefinition setUrl(String value) { 
1268        if (this.url == null)
1269          this.url = new UriType();
1270        this.url.setValue(value);
1271      return this;
1272    }
1273
1274    /**
1275     * @return {@link #identifier} (Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).)
1276     */
1277    public List<Identifier> getIdentifier() { 
1278      if (this.identifier == null)
1279        this.identifier = new ArrayList<Identifier>();
1280      return this.identifier;
1281    }
1282
1283    public boolean hasIdentifier() { 
1284      if (this.identifier == null)
1285        return false;
1286      for (Identifier item : this.identifier)
1287        if (!item.isEmpty())
1288          return true;
1289      return false;
1290    }
1291
1292    /**
1293     * @return {@link #identifier} (Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).)
1294     */
1295    // syntactic sugar
1296    public Identifier addIdentifier() { //3
1297      Identifier t = new Identifier();
1298      if (this.identifier == null)
1299        this.identifier = new ArrayList<Identifier>();
1300      this.identifier.add(t);
1301      return t;
1302    }
1303
1304    // syntactic sugar
1305    public StructureDefinition addIdentifier(Identifier t) { //3
1306      if (t == null)
1307        return this;
1308      if (this.identifier == null)
1309        this.identifier = new ArrayList<Identifier>();
1310      this.identifier.add(t);
1311      return this;
1312    }
1313
1314    /**
1315     * @return {@link #version} (The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1316     */
1317    public StringType getVersionElement() { 
1318      if (this.version == null)
1319        if (Configuration.errorOnAutoCreate())
1320          throw new Error("Attempt to auto-create StructureDefinition.version");
1321        else if (Configuration.doAutoCreate())
1322          this.version = new StringType(); // bb
1323      return this.version;
1324    }
1325
1326    public boolean hasVersionElement() { 
1327      return this.version != null && !this.version.isEmpty();
1328    }
1329
1330    public boolean hasVersion() { 
1331      return this.version != null && !this.version.isEmpty();
1332    }
1333
1334    /**
1335     * @param value {@link #version} (The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1336     */
1337    public StructureDefinition setVersionElement(StringType value) { 
1338      this.version = value;
1339      return this;
1340    }
1341
1342    /**
1343     * @return The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.
1344     */
1345    public String getVersion() { 
1346      return this.version == null ? null : this.version.getValue();
1347    }
1348
1349    /**
1350     * @param value The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.
1351     */
1352    public StructureDefinition setVersion(String value) { 
1353      if (Utilities.noString(value))
1354        this.version = null;
1355      else {
1356        if (this.version == null)
1357          this.version = new StringType();
1358        this.version.setValue(value);
1359      }
1360      return this;
1361    }
1362
1363    /**
1364     * @return {@link #name} (A free text natural language name identifying the StructureDefinition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1365     */
1366    public StringType getNameElement() { 
1367      if (this.name == null)
1368        if (Configuration.errorOnAutoCreate())
1369          throw new Error("Attempt to auto-create StructureDefinition.name");
1370        else if (Configuration.doAutoCreate())
1371          this.name = new StringType(); // bb
1372      return this.name;
1373    }
1374
1375    public boolean hasNameElement() { 
1376      return this.name != null && !this.name.isEmpty();
1377    }
1378
1379    public boolean hasName() { 
1380      return this.name != null && !this.name.isEmpty();
1381    }
1382
1383    /**
1384     * @param value {@link #name} (A free text natural language name identifying the StructureDefinition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1385     */
1386    public StructureDefinition setNameElement(StringType value) { 
1387      this.name = value;
1388      return this;
1389    }
1390
1391    /**
1392     * @return A free text natural language name identifying the StructureDefinition.
1393     */
1394    public String getName() { 
1395      return this.name == null ? null : this.name.getValue();
1396    }
1397
1398    /**
1399     * @param value A free text natural language name identifying the StructureDefinition.
1400     */
1401    public StructureDefinition setName(String value) { 
1402        if (this.name == null)
1403          this.name = new StringType();
1404        this.name.setValue(value);
1405      return this;
1406    }
1407
1408    /**
1409     * @return {@link #display} (Defined so that applications can use this name when displaying the value of the extension to the user.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
1410     */
1411    public StringType getDisplayElement() { 
1412      if (this.display == null)
1413        if (Configuration.errorOnAutoCreate())
1414          throw new Error("Attempt to auto-create StructureDefinition.display");
1415        else if (Configuration.doAutoCreate())
1416          this.display = new StringType(); // bb
1417      return this.display;
1418    }
1419
1420    public boolean hasDisplayElement() { 
1421      return this.display != null && !this.display.isEmpty();
1422    }
1423
1424    public boolean hasDisplay() { 
1425      return this.display != null && !this.display.isEmpty();
1426    }
1427
1428    /**
1429     * @param value {@link #display} (Defined so that applications can use this name when displaying the value of the extension to the user.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
1430     */
1431    public StructureDefinition setDisplayElement(StringType value) { 
1432      this.display = value;
1433      return this;
1434    }
1435
1436    /**
1437     * @return Defined so that applications can use this name when displaying the value of the extension to the user.
1438     */
1439    public String getDisplay() { 
1440      return this.display == null ? null : this.display.getValue();
1441    }
1442
1443    /**
1444     * @param value Defined so that applications can use this name when displaying the value of the extension to the user.
1445     */
1446    public StructureDefinition setDisplay(String value) { 
1447      if (Utilities.noString(value))
1448        this.display = null;
1449      else {
1450        if (this.display == null)
1451          this.display = new StringType();
1452        this.display.setValue(value);
1453      }
1454      return this;
1455    }
1456
1457    /**
1458     * @return {@link #status} (The status of the StructureDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1459     */
1460    public Enumeration<ConformanceResourceStatus> getStatusElement() { 
1461      if (this.status == null)
1462        if (Configuration.errorOnAutoCreate())
1463          throw new Error("Attempt to auto-create StructureDefinition.status");
1464        else if (Configuration.doAutoCreate())
1465          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
1466      return this.status;
1467    }
1468
1469    public boolean hasStatusElement() { 
1470      return this.status != null && !this.status.isEmpty();
1471    }
1472
1473    public boolean hasStatus() { 
1474      return this.status != null && !this.status.isEmpty();
1475    }
1476
1477    /**
1478     * @param value {@link #status} (The status of the StructureDefinition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1479     */
1480    public StructureDefinition setStatusElement(Enumeration<ConformanceResourceStatus> value) { 
1481      this.status = value;
1482      return this;
1483    }
1484
1485    /**
1486     * @return The status of the StructureDefinition.
1487     */
1488    public ConformanceResourceStatus getStatus() { 
1489      return this.status == null ? null : this.status.getValue();
1490    }
1491
1492    /**
1493     * @param value The status of the StructureDefinition.
1494     */
1495    public StructureDefinition setStatus(ConformanceResourceStatus value) { 
1496        if (this.status == null)
1497          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
1498        this.status.setValue(value);
1499      return this;
1500    }
1501
1502    /**
1503     * @return {@link #experimental} (This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
1504     */
1505    public BooleanType getExperimentalElement() { 
1506      if (this.experimental == null)
1507        if (Configuration.errorOnAutoCreate())
1508          throw new Error("Attempt to auto-create StructureDefinition.experimental");
1509        else if (Configuration.doAutoCreate())
1510          this.experimental = new BooleanType(); // bb
1511      return this.experimental;
1512    }
1513
1514    public boolean hasExperimentalElement() { 
1515      return this.experimental != null && !this.experimental.isEmpty();
1516    }
1517
1518    public boolean hasExperimental() { 
1519      return this.experimental != null && !this.experimental.isEmpty();
1520    }
1521
1522    /**
1523     * @param value {@link #experimental} (This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
1524     */
1525    public StructureDefinition setExperimentalElement(BooleanType value) { 
1526      this.experimental = value;
1527      return this;
1528    }
1529
1530    /**
1531     * @return This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1532     */
1533    public boolean getExperimental() { 
1534      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
1535    }
1536
1537    /**
1538     * @param value This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1539     */
1540    public StructureDefinition setExperimental(boolean value) { 
1541        if (this.experimental == null)
1542          this.experimental = new BooleanType();
1543        this.experimental.setValue(value);
1544      return this;
1545    }
1546
1547    /**
1548     * @return {@link #publisher} (The name of the individual or organization that published the structure definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1549     */
1550    public StringType getPublisherElement() { 
1551      if (this.publisher == null)
1552        if (Configuration.errorOnAutoCreate())
1553          throw new Error("Attempt to auto-create StructureDefinition.publisher");
1554        else if (Configuration.doAutoCreate())
1555          this.publisher = new StringType(); // bb
1556      return this.publisher;
1557    }
1558
1559    public boolean hasPublisherElement() { 
1560      return this.publisher != null && !this.publisher.isEmpty();
1561    }
1562
1563    public boolean hasPublisher() { 
1564      return this.publisher != null && !this.publisher.isEmpty();
1565    }
1566
1567    /**
1568     * @param value {@link #publisher} (The name of the individual or organization that published the structure definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1569     */
1570    public StructureDefinition setPublisherElement(StringType value) { 
1571      this.publisher = value;
1572      return this;
1573    }
1574
1575    /**
1576     * @return The name of the individual or organization that published the structure definition.
1577     */
1578    public String getPublisher() { 
1579      return this.publisher == null ? null : this.publisher.getValue();
1580    }
1581
1582    /**
1583     * @param value The name of the individual or organization that published the structure definition.
1584     */
1585    public StructureDefinition setPublisher(String value) { 
1586      if (Utilities.noString(value))
1587        this.publisher = null;
1588      else {
1589        if (this.publisher == null)
1590          this.publisher = new StringType();
1591        this.publisher.setValue(value);
1592      }
1593      return this;
1594    }
1595
1596    /**
1597     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
1598     */
1599    public List<StructureDefinitionContactComponent> getContact() { 
1600      if (this.contact == null)
1601        this.contact = new ArrayList<StructureDefinitionContactComponent>();
1602      return this.contact;
1603    }
1604
1605    public boolean hasContact() { 
1606      if (this.contact == null)
1607        return false;
1608      for (StructureDefinitionContactComponent item : this.contact)
1609        if (!item.isEmpty())
1610          return true;
1611      return false;
1612    }
1613
1614    /**
1615     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
1616     */
1617    // syntactic sugar
1618    public StructureDefinitionContactComponent addContact() { //3
1619      StructureDefinitionContactComponent t = new StructureDefinitionContactComponent();
1620      if (this.contact == null)
1621        this.contact = new ArrayList<StructureDefinitionContactComponent>();
1622      this.contact.add(t);
1623      return t;
1624    }
1625
1626    // syntactic sugar
1627    public StructureDefinition addContact(StructureDefinitionContactComponent t) { //3
1628      if (t == null)
1629        return this;
1630      if (this.contact == null)
1631        this.contact = new ArrayList<StructureDefinitionContactComponent>();
1632      this.contact.add(t);
1633      return this;
1634    }
1635
1636    /**
1637     * @return {@link #date} (The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1638     */
1639    public DateTimeType getDateElement() { 
1640      if (this.date == null)
1641        if (Configuration.errorOnAutoCreate())
1642          throw new Error("Attempt to auto-create StructureDefinition.date");
1643        else if (Configuration.doAutoCreate())
1644          this.date = new DateTimeType(); // bb
1645      return this.date;
1646    }
1647
1648    public boolean hasDateElement() { 
1649      return this.date != null && !this.date.isEmpty();
1650    }
1651
1652    public boolean hasDate() { 
1653      return this.date != null && !this.date.isEmpty();
1654    }
1655
1656    /**
1657     * @param value {@link #date} (The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1658     */
1659    public StructureDefinition setDateElement(DateTimeType value) { 
1660      this.date = value;
1661      return this;
1662    }
1663
1664    /**
1665     * @return The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.
1666     */
1667    public Date getDate() { 
1668      return this.date == null ? null : this.date.getValue();
1669    }
1670
1671    /**
1672     * @param value The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.
1673     */
1674    public StructureDefinition setDate(Date value) { 
1675      if (value == null)
1676        this.date = null;
1677      else {
1678        if (this.date == null)
1679          this.date = new DateTimeType();
1680        this.date.setValue(value);
1681      }
1682      return this;
1683    }
1684
1685    /**
1686     * @return {@link #description} (A free text natural language description of the StructureDefinition and its use.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1687     */
1688    public StringType getDescriptionElement() { 
1689      if (this.description == null)
1690        if (Configuration.errorOnAutoCreate())
1691          throw new Error("Attempt to auto-create StructureDefinition.description");
1692        else if (Configuration.doAutoCreate())
1693          this.description = new StringType(); // bb
1694      return this.description;
1695    }
1696
1697    public boolean hasDescriptionElement() { 
1698      return this.description != null && !this.description.isEmpty();
1699    }
1700
1701    public boolean hasDescription() { 
1702      return this.description != null && !this.description.isEmpty();
1703    }
1704
1705    /**
1706     * @param value {@link #description} (A free text natural language description of the StructureDefinition and its use.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1707     */
1708    public StructureDefinition setDescriptionElement(StringType value) { 
1709      this.description = value;
1710      return this;
1711    }
1712
1713    /**
1714     * @return A free text natural language description of the StructureDefinition and its use.
1715     */
1716    public String getDescription() { 
1717      return this.description == null ? null : this.description.getValue();
1718    }
1719
1720    /**
1721     * @param value A free text natural language description of the StructureDefinition and its use.
1722     */
1723    public StructureDefinition setDescription(String value) { 
1724      if (Utilities.noString(value))
1725        this.description = null;
1726      else {
1727        if (this.description == null)
1728          this.description = new StringType();
1729        this.description.setValue(value);
1730      }
1731      return this;
1732    }
1733
1734    /**
1735     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.)
1736     */
1737    public List<CodeableConcept> getUseContext() { 
1738      if (this.useContext == null)
1739        this.useContext = new ArrayList<CodeableConcept>();
1740      return this.useContext;
1741    }
1742
1743    public boolean hasUseContext() { 
1744      if (this.useContext == null)
1745        return false;
1746      for (CodeableConcept item : this.useContext)
1747        if (!item.isEmpty())
1748          return true;
1749      return false;
1750    }
1751
1752    /**
1753     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.)
1754     */
1755    // syntactic sugar
1756    public CodeableConcept addUseContext() { //3
1757      CodeableConcept t = new CodeableConcept();
1758      if (this.useContext == null)
1759        this.useContext = new ArrayList<CodeableConcept>();
1760      this.useContext.add(t);
1761      return t;
1762    }
1763
1764    // syntactic sugar
1765    public StructureDefinition addUseContext(CodeableConcept t) { //3
1766      if (t == null)
1767        return this;
1768      if (this.useContext == null)
1769        this.useContext = new ArrayList<CodeableConcept>();
1770      this.useContext.add(t);
1771      return this;
1772    }
1773
1774    /**
1775     * @return {@link #requirements} (Explains why this structure definition is needed and why it's been constrained as it has.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
1776     */
1777    public StringType getRequirementsElement() { 
1778      if (this.requirements == null)
1779        if (Configuration.errorOnAutoCreate())
1780          throw new Error("Attempt to auto-create StructureDefinition.requirements");
1781        else if (Configuration.doAutoCreate())
1782          this.requirements = new StringType(); // bb
1783      return this.requirements;
1784    }
1785
1786    public boolean hasRequirementsElement() { 
1787      return this.requirements != null && !this.requirements.isEmpty();
1788    }
1789
1790    public boolean hasRequirements() { 
1791      return this.requirements != null && !this.requirements.isEmpty();
1792    }
1793
1794    /**
1795     * @param value {@link #requirements} (Explains why this structure definition is needed and why it's been constrained as it has.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
1796     */
1797    public StructureDefinition setRequirementsElement(StringType value) { 
1798      this.requirements = value;
1799      return this;
1800    }
1801
1802    /**
1803     * @return Explains why this structure definition is needed and why it's been constrained as it has.
1804     */
1805    public String getRequirements() { 
1806      return this.requirements == null ? null : this.requirements.getValue();
1807    }
1808
1809    /**
1810     * @param value Explains why this structure definition is needed and why it's been constrained as it has.
1811     */
1812    public StructureDefinition setRequirements(String value) { 
1813      if (Utilities.noString(value))
1814        this.requirements = null;
1815      else {
1816        if (this.requirements == null)
1817          this.requirements = new StringType();
1818        this.requirements.setValue(value);
1819      }
1820      return this;
1821    }
1822
1823    /**
1824     * @return {@link #copyright} (A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1825     */
1826    public StringType getCopyrightElement() { 
1827      if (this.copyright == null)
1828        if (Configuration.errorOnAutoCreate())
1829          throw new Error("Attempt to auto-create StructureDefinition.copyright");
1830        else if (Configuration.doAutoCreate())
1831          this.copyright = new StringType(); // bb
1832      return this.copyright;
1833    }
1834
1835    public boolean hasCopyrightElement() { 
1836      return this.copyright != null && !this.copyright.isEmpty();
1837    }
1838
1839    public boolean hasCopyright() { 
1840      return this.copyright != null && !this.copyright.isEmpty();
1841    }
1842
1843    /**
1844     * @param value {@link #copyright} (A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1845     */
1846    public StructureDefinition setCopyrightElement(StringType value) { 
1847      this.copyright = value;
1848      return this;
1849    }
1850
1851    /**
1852     * @return A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.
1853     */
1854    public String getCopyright() { 
1855      return this.copyright == null ? null : this.copyright.getValue();
1856    }
1857
1858    /**
1859     * @param value A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.
1860     */
1861    public StructureDefinition setCopyright(String value) { 
1862      if (Utilities.noString(value))
1863        this.copyright = null;
1864      else {
1865        if (this.copyright == null)
1866          this.copyright = new StringType();
1867        this.copyright.setValue(value);
1868      }
1869      return this;
1870    }
1871
1872    /**
1873     * @return {@link #code} (A set of terms from external terminologies that may be used to assist with indexing and searching of templates.)
1874     */
1875    public List<Coding> getCode() { 
1876      if (this.code == null)
1877        this.code = new ArrayList<Coding>();
1878      return this.code;
1879    }
1880
1881    public boolean hasCode() { 
1882      if (this.code == null)
1883        return false;
1884      for (Coding item : this.code)
1885        if (!item.isEmpty())
1886          return true;
1887      return false;
1888    }
1889
1890    /**
1891     * @return {@link #code} (A set of terms from external terminologies that may be used to assist with indexing and searching of templates.)
1892     */
1893    // syntactic sugar
1894    public Coding addCode() { //3
1895      Coding t = new Coding();
1896      if (this.code == null)
1897        this.code = new ArrayList<Coding>();
1898      this.code.add(t);
1899      return t;
1900    }
1901
1902    // syntactic sugar
1903    public StructureDefinition addCode(Coding t) { //3
1904      if (t == null)
1905        return this;
1906      if (this.code == null)
1907        this.code = new ArrayList<Coding>();
1908      this.code.add(t);
1909      return this;
1910    }
1911
1912    /**
1913     * @return {@link #fhirVersion} (The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.). This is the underlying object with id, value and extensions. The accessor "getFhirVersion" gives direct access to the value
1914     */
1915    public IdType getFhirVersionElement() { 
1916      if (this.fhirVersion == null)
1917        if (Configuration.errorOnAutoCreate())
1918          throw new Error("Attempt to auto-create StructureDefinition.fhirVersion");
1919        else if (Configuration.doAutoCreate())
1920          this.fhirVersion = new IdType(); // bb
1921      return this.fhirVersion;
1922    }
1923
1924    public boolean hasFhirVersionElement() { 
1925      return this.fhirVersion != null && !this.fhirVersion.isEmpty();
1926    }
1927
1928    public boolean hasFhirVersion() { 
1929      return this.fhirVersion != null && !this.fhirVersion.isEmpty();
1930    }
1931
1932    /**
1933     * @param value {@link #fhirVersion} (The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.). This is the underlying object with id, value and extensions. The accessor "getFhirVersion" gives direct access to the value
1934     */
1935    public StructureDefinition setFhirVersionElement(IdType value) { 
1936      this.fhirVersion = value;
1937      return this;
1938    }
1939
1940    /**
1941     * @return The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.
1942     */
1943    public String getFhirVersion() { 
1944      return this.fhirVersion == null ? null : this.fhirVersion.getValue();
1945    }
1946
1947    /**
1948     * @param value The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.
1949     */
1950    public StructureDefinition setFhirVersion(String value) { 
1951      if (Utilities.noString(value))
1952        this.fhirVersion = null;
1953      else {
1954        if (this.fhirVersion == null)
1955          this.fhirVersion = new IdType();
1956        this.fhirVersion.setValue(value);
1957      }
1958      return this;
1959    }
1960
1961    /**
1962     * @return {@link #mapping} (An external specification that the content is mapped to.)
1963     */
1964    public List<StructureDefinitionMappingComponent> getMapping() { 
1965      if (this.mapping == null)
1966        this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
1967      return this.mapping;
1968    }
1969
1970    public boolean hasMapping() { 
1971      if (this.mapping == null)
1972        return false;
1973      for (StructureDefinitionMappingComponent item : this.mapping)
1974        if (!item.isEmpty())
1975          return true;
1976      return false;
1977    }
1978
1979    /**
1980     * @return {@link #mapping} (An external specification that the content is mapped to.)
1981     */
1982    // syntactic sugar
1983    public StructureDefinitionMappingComponent addMapping() { //3
1984      StructureDefinitionMappingComponent t = new StructureDefinitionMappingComponent();
1985      if (this.mapping == null)
1986        this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
1987      this.mapping.add(t);
1988      return t;
1989    }
1990
1991    // syntactic sugar
1992    public StructureDefinition addMapping(StructureDefinitionMappingComponent t) { //3
1993      if (t == null)
1994        return this;
1995      if (this.mapping == null)
1996        this.mapping = new ArrayList<StructureDefinitionMappingComponent>();
1997      this.mapping.add(t);
1998      return this;
1999    }
2000
2001    /**
2002     * @return {@link #kind} (Defines the kind of structure that this definition is describing.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
2003     */
2004    public Enumeration<StructureDefinitionKind> getKindElement() { 
2005      if (this.kind == null)
2006        if (Configuration.errorOnAutoCreate())
2007          throw new Error("Attempt to auto-create StructureDefinition.kind");
2008        else if (Configuration.doAutoCreate())
2009          this.kind = new Enumeration<StructureDefinitionKind>(new StructureDefinitionKindEnumFactory()); // bb
2010      return this.kind;
2011    }
2012
2013    public boolean hasKindElement() { 
2014      return this.kind != null && !this.kind.isEmpty();
2015    }
2016
2017    public boolean hasKind() { 
2018      return this.kind != null && !this.kind.isEmpty();
2019    }
2020
2021    /**
2022     * @param value {@link #kind} (Defines the kind of structure that this definition is describing.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
2023     */
2024    public StructureDefinition setKindElement(Enumeration<StructureDefinitionKind> value) { 
2025      this.kind = value;
2026      return this;
2027    }
2028
2029    /**
2030     * @return Defines the kind of structure that this definition is describing.
2031     */
2032    public StructureDefinitionKind getKind() { 
2033      return this.kind == null ? null : this.kind.getValue();
2034    }
2035
2036    /**
2037     * @param value Defines the kind of structure that this definition is describing.
2038     */
2039    public StructureDefinition setKind(StructureDefinitionKind value) { 
2040        if (this.kind == null)
2041          this.kind = new Enumeration<StructureDefinitionKind>(new StructureDefinitionKindEnumFactory());
2042        this.kind.setValue(value);
2043      return this;
2044    }
2045
2046    /**
2047     * @return {@link #constrainedType} (The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.). This is the underlying object with id, value and extensions. The accessor "getConstrainedType" gives direct access to the value
2048     */
2049    public CodeType getConstrainedTypeElement() { 
2050      if (this.constrainedType == null)
2051        if (Configuration.errorOnAutoCreate())
2052          throw new Error("Attempt to auto-create StructureDefinition.constrainedType");
2053        else if (Configuration.doAutoCreate())
2054          this.constrainedType = new CodeType(); // bb
2055      return this.constrainedType;
2056    }
2057
2058    public boolean hasConstrainedTypeElement() { 
2059      return this.constrainedType != null && !this.constrainedType.isEmpty();
2060    }
2061
2062    public boolean hasConstrainedType() { 
2063      return this.constrainedType != null && !this.constrainedType.isEmpty();
2064    }
2065
2066    /**
2067     * @param value {@link #constrainedType} (The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.). This is the underlying object with id, value and extensions. The accessor "getConstrainedType" gives direct access to the value
2068     */
2069    public StructureDefinition setConstrainedTypeElement(CodeType value) { 
2070      this.constrainedType = value;
2071      return this;
2072    }
2073
2074    /**
2075     * @return The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.
2076     */
2077    public String getConstrainedType() { 
2078      return this.constrainedType == null ? null : this.constrainedType.getValue();
2079    }
2080
2081    /**
2082     * @param value The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.
2083     */
2084    public StructureDefinition setConstrainedType(String value) { 
2085      if (Utilities.noString(value))
2086        this.constrainedType = null;
2087      else {
2088        if (this.constrainedType == null)
2089          this.constrainedType = new CodeType();
2090        this.constrainedType.setValue(value);
2091      }
2092      return this;
2093    }
2094
2095    /**
2096     * @return {@link #abstract_} (Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.). This is the underlying object with id, value and extensions. The accessor "getAbstract" gives direct access to the value
2097     */
2098    public BooleanType getAbstractElement() { 
2099      if (this.abstract_ == null)
2100        if (Configuration.errorOnAutoCreate())
2101          throw new Error("Attempt to auto-create StructureDefinition.abstract_");
2102        else if (Configuration.doAutoCreate())
2103          this.abstract_ = new BooleanType(); // bb
2104      return this.abstract_;
2105    }
2106
2107    public boolean hasAbstractElement() { 
2108      return this.abstract_ != null && !this.abstract_.isEmpty();
2109    }
2110
2111    public boolean hasAbstract() { 
2112      return this.abstract_ != null && !this.abstract_.isEmpty();
2113    }
2114
2115    /**
2116     * @param value {@link #abstract_} (Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.). This is the underlying object with id, value and extensions. The accessor "getAbstract" gives direct access to the value
2117     */
2118    public StructureDefinition setAbstractElement(BooleanType value) { 
2119      this.abstract_ = value;
2120      return this;
2121    }
2122
2123    /**
2124     * @return Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.
2125     */
2126    public boolean getAbstract() { 
2127      return this.abstract_ == null || this.abstract_.isEmpty() ? false : this.abstract_.getValue();
2128    }
2129
2130    /**
2131     * @param value Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.
2132     */
2133    public StructureDefinition setAbstract(boolean value) { 
2134        if (this.abstract_ == null)
2135          this.abstract_ = new BooleanType();
2136        this.abstract_.setValue(value);
2137      return this;
2138    }
2139
2140    /**
2141     * @return {@link #contextType} (If this is an extension, Identifies the context within FHIR resources where the extension can be used.). This is the underlying object with id, value and extensions. The accessor "getContextType" gives direct access to the value
2142     */
2143    public Enumeration<ExtensionContext> getContextTypeElement() { 
2144      if (this.contextType == null)
2145        if (Configuration.errorOnAutoCreate())
2146          throw new Error("Attempt to auto-create StructureDefinition.contextType");
2147        else if (Configuration.doAutoCreate())
2148          this.contextType = new Enumeration<ExtensionContext>(new ExtensionContextEnumFactory()); // bb
2149      return this.contextType;
2150    }
2151
2152    public boolean hasContextTypeElement() { 
2153      return this.contextType != null && !this.contextType.isEmpty();
2154    }
2155
2156    public boolean hasContextType() { 
2157      return this.contextType != null && !this.contextType.isEmpty();
2158    }
2159
2160    /**
2161     * @param value {@link #contextType} (If this is an extension, Identifies the context within FHIR resources where the extension can be used.). This is the underlying object with id, value and extensions. The accessor "getContextType" gives direct access to the value
2162     */
2163    public StructureDefinition setContextTypeElement(Enumeration<ExtensionContext> value) { 
2164      this.contextType = value;
2165      return this;
2166    }
2167
2168    /**
2169     * @return If this is an extension, Identifies the context within FHIR resources where the extension can be used.
2170     */
2171    public ExtensionContext getContextType() { 
2172      return this.contextType == null ? null : this.contextType.getValue();
2173    }
2174
2175    /**
2176     * @param value If this is an extension, Identifies the context within FHIR resources where the extension can be used.
2177     */
2178    public StructureDefinition setContextType(ExtensionContext value) { 
2179      if (value == null)
2180        this.contextType = null;
2181      else {
2182        if (this.contextType == null)
2183          this.contextType = new Enumeration<ExtensionContext>(new ExtensionContextEnumFactory());
2184        this.contextType.setValue(value);
2185      }
2186      return this;
2187    }
2188
2189    /**
2190     * @return {@link #context} (Identifies the types of resource or data type elements to which the extension can be applied.)
2191     */
2192    public List<StringType> getContext() { 
2193      if (this.context == null)
2194        this.context = new ArrayList<StringType>();
2195      return this.context;
2196    }
2197
2198    public boolean hasContext() { 
2199      if (this.context == null)
2200        return false;
2201      for (StringType item : this.context)
2202        if (!item.isEmpty())
2203          return true;
2204      return false;
2205    }
2206
2207    /**
2208     * @return {@link #context} (Identifies the types of resource or data type elements to which the extension can be applied.)
2209     */
2210    // syntactic sugar
2211    public StringType addContextElement() {//2 
2212      StringType t = new StringType();
2213      if (this.context == null)
2214        this.context = new ArrayList<StringType>();
2215      this.context.add(t);
2216      return t;
2217    }
2218
2219    /**
2220     * @param value {@link #context} (Identifies the types of resource or data type elements to which the extension can be applied.)
2221     */
2222    public StructureDefinition addContext(String value) { //1
2223      StringType t = new StringType();
2224      t.setValue(value);
2225      if (this.context == null)
2226        this.context = new ArrayList<StringType>();
2227      this.context.add(t);
2228      return this;
2229    }
2230
2231    /**
2232     * @param value {@link #context} (Identifies the types of resource or data type elements to which the extension can be applied.)
2233     */
2234    public boolean hasContext(String value) { 
2235      if (this.context == null)
2236        return false;
2237      for (StringType v : this.context)
2238        if (v.equals(value)) // string
2239          return true;
2240      return false;
2241    }
2242
2243    /**
2244     * @return {@link #base} (An absolute URI that is the base structure from which this set of constraints is derived.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
2245     */
2246    public UriType getBaseElement() { 
2247      if (this.base == null)
2248        if (Configuration.errorOnAutoCreate())
2249          throw new Error("Attempt to auto-create StructureDefinition.base");
2250        else if (Configuration.doAutoCreate())
2251          this.base = new UriType(); // bb
2252      return this.base;
2253    }
2254
2255    public boolean hasBaseElement() { 
2256      return this.base != null && !this.base.isEmpty();
2257    }
2258
2259    public boolean hasBase() { 
2260      return this.base != null && !this.base.isEmpty();
2261    }
2262
2263    /**
2264     * @param value {@link #base} (An absolute URI that is the base structure from which this set of constraints is derived.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
2265     */
2266    public StructureDefinition setBaseElement(UriType value) { 
2267      this.base = value;
2268      return this;
2269    }
2270
2271    /**
2272     * @return An absolute URI that is the base structure from which this set of constraints is derived.
2273     */
2274    public String getBase() { 
2275      return this.base == null ? null : this.base.getValue();
2276    }
2277
2278    /**
2279     * @param value An absolute URI that is the base structure from which this set of constraints is derived.
2280     */
2281    public StructureDefinition setBase(String value) { 
2282      if (Utilities.noString(value))
2283        this.base = null;
2284      else {
2285        if (this.base == null)
2286          this.base = new UriType();
2287        this.base.setValue(value);
2288      }
2289      return this;
2290    }
2291
2292    /**
2293     * @return {@link #snapshot} (A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.)
2294     */
2295    public StructureDefinitionSnapshotComponent getSnapshot() { 
2296      if (this.snapshot == null)
2297        if (Configuration.errorOnAutoCreate())
2298          throw new Error("Attempt to auto-create StructureDefinition.snapshot");
2299        else if (Configuration.doAutoCreate())
2300          this.snapshot = new StructureDefinitionSnapshotComponent(); // cc
2301      return this.snapshot;
2302    }
2303
2304    public boolean hasSnapshot() { 
2305      return this.snapshot != null && !this.snapshot.isEmpty();
2306    }
2307
2308    /**
2309     * @param value {@link #snapshot} (A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.)
2310     */
2311    public StructureDefinition setSnapshot(StructureDefinitionSnapshotComponent value) { 
2312      this.snapshot = value;
2313      return this;
2314    }
2315
2316    /**
2317     * @return {@link #differential} (A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.)
2318     */
2319    public StructureDefinitionDifferentialComponent getDifferential() { 
2320      if (this.differential == null)
2321        if (Configuration.errorOnAutoCreate())
2322          throw new Error("Attempt to auto-create StructureDefinition.differential");
2323        else if (Configuration.doAutoCreate())
2324          this.differential = new StructureDefinitionDifferentialComponent(); // cc
2325      return this.differential;
2326    }
2327
2328    public boolean hasDifferential() { 
2329      return this.differential != null && !this.differential.isEmpty();
2330    }
2331
2332    /**
2333     * @param value {@link #differential} (A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.)
2334     */
2335    public StructureDefinition setDifferential(StructureDefinitionDifferentialComponent value) { 
2336      this.differential = value;
2337      return this;
2338    }
2339
2340      protected void listChildren(List<Property> childrenList) {
2341        super.listChildren(childrenList);
2342        childrenList.add(new Property("url", "uri", "An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published.", 0, java.lang.Integer.MAX_VALUE, url));
2343        childrenList.add(new Property("identifier", "Identifier", "Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance  (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI).", 0, java.lang.Integer.MAX_VALUE, identifier));
2344        childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually.", 0, java.lang.Integer.MAX_VALUE, version));
2345        childrenList.add(new Property("name", "string", "A free text natural language name identifying the StructureDefinition.", 0, java.lang.Integer.MAX_VALUE, name));
2346        childrenList.add(new Property("display", "string", "Defined so that applications can use this name when displaying the value of the extension to the user.", 0, java.lang.Integer.MAX_VALUE, display));
2347        childrenList.add(new Property("status", "code", "The status of the StructureDefinition.", 0, java.lang.Integer.MAX_VALUE, status));
2348        childrenList.add(new Property("experimental", "boolean", "This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
2349        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the structure definition.", 0, java.lang.Integer.MAX_VALUE, publisher));
2350        childrenList.add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
2351        childrenList.add(new Property("date", "dateTime", "The date this version of the structure definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.", 0, java.lang.Integer.MAX_VALUE, date));
2352        childrenList.add(new Property("description", "string", "A free text natural language description of the StructureDefinition and its use.", 0, java.lang.Integer.MAX_VALUE, description));
2353        childrenList.add(new Property("useContext", "CodeableConcept", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions.", 0, java.lang.Integer.MAX_VALUE, useContext));
2354        childrenList.add(new Property("requirements", "string", "Explains why this structure definition is needed and why it's been constrained as it has.", 0, java.lang.Integer.MAX_VALUE, requirements));
2355        childrenList.add(new Property("copyright", "string", "A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings.", 0, java.lang.Integer.MAX_VALUE, copyright));
2356        childrenList.add(new Property("code", "Coding", "A set of terms from external terminologies that may be used to assist with indexing and searching of templates.", 0, java.lang.Integer.MAX_VALUE, code));
2357        childrenList.add(new Property("fhirVersion", "id", "The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 1.0.2 for this version.", 0, java.lang.Integer.MAX_VALUE, fhirVersion));
2358        childrenList.add(new Property("mapping", "", "An external specification that the content is mapped to.", 0, java.lang.Integer.MAX_VALUE, mapping));
2359        childrenList.add(new Property("kind", "code", "Defines the kind of structure that this definition is describing.", 0, java.lang.Integer.MAX_VALUE, kind));
2360        childrenList.add(new Property("constrainedType", "code", "The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure.", 0, java.lang.Integer.MAX_VALUE, constrainedType));
2361        childrenList.add(new Property("abstract", "boolean", "Whether structure this definition describes is abstract or not  - that is, whether an actual exchanged item can ever be of this type.", 0, java.lang.Integer.MAX_VALUE, abstract_));
2362        childrenList.add(new Property("contextType", "code", "If this is an extension, Identifies the context within FHIR resources where the extension can be used.", 0, java.lang.Integer.MAX_VALUE, contextType));
2363        childrenList.add(new Property("context", "string", "Identifies the types of resource or data type elements to which the extension can be applied.", 0, java.lang.Integer.MAX_VALUE, context));
2364        childrenList.add(new Property("base", "uri", "An absolute URI that is the base structure from which this set of constraints is derived.", 0, java.lang.Integer.MAX_VALUE, base));
2365        childrenList.add(new Property("snapshot", "", "A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.", 0, java.lang.Integer.MAX_VALUE, snapshot));
2366        childrenList.add(new Property("differential", "", "A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.", 0, java.lang.Integer.MAX_VALUE, differential));
2367      }
2368
2369      @Override
2370      public void setProperty(String name, Base value) throws FHIRException {
2371        if (name.equals("url"))
2372          this.url = castToUri(value); // UriType
2373        else if (name.equals("identifier"))
2374          this.getIdentifier().add(castToIdentifier(value));
2375        else if (name.equals("version"))
2376          this.version = castToString(value); // StringType
2377        else if (name.equals("name"))
2378          this.name = castToString(value); // StringType
2379        else if (name.equals("display"))
2380          this.display = castToString(value); // StringType
2381        else if (name.equals("status"))
2382          this.status = new ConformanceResourceStatusEnumFactory().fromType(value); // Enumeration<ConformanceResourceStatus>
2383        else if (name.equals("experimental"))
2384          this.experimental = castToBoolean(value); // BooleanType
2385        else if (name.equals("publisher"))
2386          this.publisher = castToString(value); // StringType
2387        else if (name.equals("contact"))
2388          this.getContact().add((StructureDefinitionContactComponent) value);
2389        else if (name.equals("date"))
2390          this.date = castToDateTime(value); // DateTimeType
2391        else if (name.equals("description"))
2392          this.description = castToString(value); // StringType
2393        else if (name.equals("useContext"))
2394          this.getUseContext().add(castToCodeableConcept(value));
2395        else if (name.equals("requirements"))
2396          this.requirements = castToString(value); // StringType
2397        else if (name.equals("copyright"))
2398          this.copyright = castToString(value); // StringType
2399        else if (name.equals("code"))
2400          this.getCode().add(castToCoding(value));
2401        else if (name.equals("fhirVersion"))
2402          this.fhirVersion = castToId(value); // IdType
2403        else if (name.equals("mapping"))
2404          this.getMapping().add((StructureDefinitionMappingComponent) value);
2405        else if (name.equals("kind"))
2406          this.kind = new StructureDefinitionKindEnumFactory().fromType(value); // Enumeration<StructureDefinitionKind>
2407        else if (name.equals("constrainedType"))
2408          this.constrainedType = castToCode(value); // CodeType
2409        else if (name.equals("abstract"))
2410          this.abstract_ = castToBoolean(value); // BooleanType
2411        else if (name.equals("contextType"))
2412          this.contextType = new ExtensionContextEnumFactory().fromType(value); // Enumeration<ExtensionContext>
2413        else if (name.equals("context"))
2414          this.getContext().add(castToString(value));
2415        else if (name.equals("base"))
2416          this.base = castToUri(value); // UriType
2417        else if (name.equals("snapshot"))
2418          this.snapshot = (StructureDefinitionSnapshotComponent) value; // StructureDefinitionSnapshotComponent
2419        else if (name.equals("differential"))
2420          this.differential = (StructureDefinitionDifferentialComponent) value; // StructureDefinitionDifferentialComponent
2421        else
2422          super.setProperty(name, value);
2423      }
2424
2425      @Override
2426      public Base addChild(String name) throws FHIRException {
2427        if (name.equals("url")) {
2428          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.url");
2429        }
2430        else if (name.equals("identifier")) {
2431          return addIdentifier();
2432        }
2433        else if (name.equals("version")) {
2434          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.version");
2435        }
2436        else if (name.equals("name")) {
2437          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.name");
2438        }
2439        else if (name.equals("display")) {
2440          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.display");
2441        }
2442        else if (name.equals("status")) {
2443          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.status");
2444        }
2445        else if (name.equals("experimental")) {
2446          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.experimental");
2447        }
2448        else if (name.equals("publisher")) {
2449          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.publisher");
2450        }
2451        else if (name.equals("contact")) {
2452          return addContact();
2453        }
2454        else if (name.equals("date")) {
2455          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.date");
2456        }
2457        else if (name.equals("description")) {
2458          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.description");
2459        }
2460        else if (name.equals("useContext")) {
2461          return addUseContext();
2462        }
2463        else if (name.equals("requirements")) {
2464          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.requirements");
2465        }
2466        else if (name.equals("copyright")) {
2467          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.copyright");
2468        }
2469        else if (name.equals("code")) {
2470          return addCode();
2471        }
2472        else if (name.equals("fhirVersion")) {
2473          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.fhirVersion");
2474        }
2475        else if (name.equals("mapping")) {
2476          return addMapping();
2477        }
2478        else if (name.equals("kind")) {
2479          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.kind");
2480        }
2481        else if (name.equals("constrainedType")) {
2482          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.constrainedType");
2483        }
2484        else if (name.equals("abstract")) {
2485          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.abstract");
2486        }
2487        else if (name.equals("contextType")) {
2488          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.contextType");
2489        }
2490        else if (name.equals("context")) {
2491          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.context");
2492        }
2493        else if (name.equals("base")) {
2494          throw new FHIRException("Cannot call addChild on a primitive type StructureDefinition.base");
2495        }
2496        else if (name.equals("snapshot")) {
2497          this.snapshot = new StructureDefinitionSnapshotComponent();
2498          return this.snapshot;
2499        }
2500        else if (name.equals("differential")) {
2501          this.differential = new StructureDefinitionDifferentialComponent();
2502          return this.differential;
2503        }
2504        else
2505          return super.addChild(name);
2506      }
2507
2508  public String fhirType() {
2509    return "StructureDefinition";
2510
2511  }
2512
2513      public StructureDefinition copy() {
2514        StructureDefinition dst = new StructureDefinition();
2515        copyValues(dst);
2516        dst.url = url == null ? null : url.copy();
2517        if (identifier != null) {
2518          dst.identifier = new ArrayList<Identifier>();
2519          for (Identifier i : identifier)
2520            dst.identifier.add(i.copy());
2521        };
2522        dst.version = version == null ? null : version.copy();
2523        dst.name = name == null ? null : name.copy();
2524        dst.display = display == null ? null : display.copy();
2525        dst.status = status == null ? null : status.copy();
2526        dst.experimental = experimental == null ? null : experimental.copy();
2527        dst.publisher = publisher == null ? null : publisher.copy();
2528        if (contact != null) {
2529          dst.contact = new ArrayList<StructureDefinitionContactComponent>();
2530          for (StructureDefinitionContactComponent i : contact)
2531            dst.contact.add(i.copy());
2532        };
2533        dst.date = date == null ? null : date.copy();
2534        dst.description = description == null ? null : description.copy();
2535        if (useContext != null) {
2536          dst.useContext = new ArrayList<CodeableConcept>();
2537          for (CodeableConcept i : useContext)
2538            dst.useContext.add(i.copy());
2539        };
2540        dst.requirements = requirements == null ? null : requirements.copy();
2541        dst.copyright = copyright == null ? null : copyright.copy();
2542        if (code != null) {
2543          dst.code = new ArrayList<Coding>();
2544          for (Coding i : code)
2545            dst.code.add(i.copy());
2546        };
2547        dst.fhirVersion = fhirVersion == null ? null : fhirVersion.copy();
2548        if (mapping != null) {
2549          dst.mapping = new ArrayList<StructureDefinitionMappingComponent>();
2550          for (StructureDefinitionMappingComponent i : mapping)
2551            dst.mapping.add(i.copy());
2552        };
2553        dst.kind = kind == null ? null : kind.copy();
2554        dst.constrainedType = constrainedType == null ? null : constrainedType.copy();
2555        dst.abstract_ = abstract_ == null ? null : abstract_.copy();
2556        dst.contextType = contextType == null ? null : contextType.copy();
2557        if (context != null) {
2558          dst.context = new ArrayList<StringType>();
2559          for (StringType i : context)
2560            dst.context.add(i.copy());
2561        };
2562        dst.base = base == null ? null : base.copy();
2563        dst.snapshot = snapshot == null ? null : snapshot.copy();
2564        dst.differential = differential == null ? null : differential.copy();
2565        return dst;
2566      }
2567
2568      protected StructureDefinition typedCopy() {
2569        return copy();
2570      }
2571
2572      @Override
2573      public boolean equalsDeep(Base other) {
2574        if (!super.equalsDeep(other))
2575          return false;
2576        if (!(other instanceof StructureDefinition))
2577          return false;
2578        StructureDefinition o = (StructureDefinition) other;
2579        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
2580           && compareDeep(name, o.name, true) && compareDeep(display, o.display, true) && compareDeep(status, o.status, true)
2581           && compareDeep(experimental, o.experimental, true) && compareDeep(publisher, o.publisher, true)
2582           && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true) && compareDeep(description, o.description, true)
2583           && compareDeep(useContext, o.useContext, true) && compareDeep(requirements, o.requirements, true)
2584           && compareDeep(copyright, o.copyright, true) && compareDeep(code, o.code, true) && compareDeep(fhirVersion, o.fhirVersion, true)
2585           && compareDeep(mapping, o.mapping, true) && compareDeep(kind, o.kind, true) && compareDeep(constrainedType, o.constrainedType, true)
2586           && compareDeep(abstract_, o.abstract_, true) && compareDeep(contextType, o.contextType, true) && compareDeep(context, o.context, true)
2587           && compareDeep(base, o.base, true) && compareDeep(snapshot, o.snapshot, true) && compareDeep(differential, o.differential, true)
2588          ;
2589      }
2590
2591      @Override
2592      public boolean equalsShallow(Base other) {
2593        if (!super.equalsShallow(other))
2594          return false;
2595        if (!(other instanceof StructureDefinition))
2596          return false;
2597        StructureDefinition o = (StructureDefinition) other;
2598        return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
2599           && compareValues(display, o.display, true) && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true)
2600           && compareValues(publisher, o.publisher, true) && compareValues(date, o.date, true) && compareValues(description, o.description, true)
2601           && compareValues(requirements, o.requirements, true) && compareValues(copyright, o.copyright, true)
2602           && compareValues(fhirVersion, o.fhirVersion, true) && compareValues(kind, o.kind, true) && compareValues(constrainedType, o.constrainedType, true)
2603           && compareValues(abstract_, o.abstract_, true) && compareValues(contextType, o.contextType, true) && compareValues(context, o.context, true)
2604           && compareValues(base, o.base, true);
2605      }
2606
2607      public boolean isEmpty() {
2608        return super.isEmpty() && (url == null || url.isEmpty()) && (identifier == null || identifier.isEmpty())
2609           && (version == null || version.isEmpty()) && (name == null || name.isEmpty()) && (display == null || display.isEmpty())
2610           && (status == null || status.isEmpty()) && (experimental == null || experimental.isEmpty())
2611           && (publisher == null || publisher.isEmpty()) && (contact == null || contact.isEmpty()) && (date == null || date.isEmpty())
2612           && (description == null || description.isEmpty()) && (useContext == null || useContext.isEmpty())
2613           && (requirements == null || requirements.isEmpty()) && (copyright == null || copyright.isEmpty())
2614           && (code == null || code.isEmpty()) && (fhirVersion == null || fhirVersion.isEmpty()) && (mapping == null || mapping.isEmpty())
2615           && (kind == null || kind.isEmpty()) && (constrainedType == null || constrainedType.isEmpty())
2616           && (abstract_ == null || abstract_.isEmpty()) && (contextType == null || contextType.isEmpty())
2617           && (context == null || context.isEmpty()) && (base == null || base.isEmpty()) && (snapshot == null || snapshot.isEmpty())
2618           && (differential == null || differential.isEmpty());
2619      }
2620
2621  @Override
2622  public ResourceType getResourceType() {
2623    return ResourceType.StructureDefinition;
2624   }
2625
2626  @SearchParamDefinition(name="date", path="StructureDefinition.date", description="The profile publication date", type="date" )
2627  public static final String SP_DATE = "date";
2628  @SearchParamDefinition(name="identifier", path="StructureDefinition.identifier", description="The identifier of the profile", type="token" )
2629  public static final String SP_IDENTIFIER = "identifier";
2630  @SearchParamDefinition(name="code", path="StructureDefinition.code", description="A code for the profile", type="token" )
2631  public static final String SP_CODE = "code";
2632  @SearchParamDefinition(name="valueset", path="StructureDefinition.snapshot.element.binding.valueSet[x]", description="A vocabulary binding reference", type="reference" )
2633  public static final String SP_VALUESET = "valueset";
2634  @SearchParamDefinition(name="kind", path="StructureDefinition.kind", description="datatype | resource | logical", type="token" )
2635  public static final String SP_KIND = "kind";
2636  @SearchParamDefinition(name="display", path="StructureDefinition.display", description="Use this name when displaying the value", type="string" )
2637  public static final String SP_DISPLAY = "display";
2638  @SearchParamDefinition(name="description", path="StructureDefinition.description", description="Text search in the description of the profile", type="string" )
2639  public static final String SP_DESCRIPTION = "description";
2640  @SearchParamDefinition(name="experimental", path="StructureDefinition.experimental", description="If for testing purposes, not real usage", type="token" )
2641  public static final String SP_EXPERIMENTAL = "experimental";
2642  @SearchParamDefinition(name="context-type", path="StructureDefinition.contextType", description="resource | datatype | mapping | extension", type="token" )
2643  public static final String SP_CONTEXTTYPE = "context-type";
2644  @SearchParamDefinition(name="abstract", path="StructureDefinition.abstract", description="Whether the structure is abstract", type="token" )
2645  public static final String SP_ABSTRACT = "abstract";
2646  @SearchParamDefinition(name="type", path="StructureDefinition.constrainedType", description="Any datatype or resource, including abstract ones", type="token" )
2647  public static final String SP_TYPE = "type";
2648  @SearchParamDefinition(name="version", path="StructureDefinition.version", description="The version identifier of the profile", type="token" )
2649  public static final String SP_VERSION = "version";
2650  @SearchParamDefinition(name="url", path="StructureDefinition.url", description="Absolute URL used to reference this StructureDefinition", type="uri" )
2651  public static final String SP_URL = "url";
2652  @SearchParamDefinition(name="path", path="StructureDefinition.snapshot.element.path | StructureDefinition.differential.element.path", description="A path that is constrained in the profile", type="token" )
2653  public static final String SP_PATH = "path";
2654  @SearchParamDefinition(name="ext-context", path="StructureDefinition.context", description="Where the extension can be used in instances", type="string" )
2655  public static final String SP_EXTCONTEXT = "ext-context";
2656  @SearchParamDefinition(name="name", path="StructureDefinition.name", description="Name of the profile", type="string" )
2657  public static final String SP_NAME = "name";
2658  @SearchParamDefinition(name="context", path="StructureDefinition.useContext", description="A use context assigned to the structure", type="token" )
2659  public static final String SP_CONTEXT = "context";
2660  @SearchParamDefinition(name="base-path", path="StructureDefinition.snapshot.element.base.path | StructureDefinition.differential.element.base.path", description="Path that identifies the base element", type="token" )
2661  public static final String SP_BASEPATH = "base-path";
2662  @SearchParamDefinition(name="publisher", path="StructureDefinition.publisher", description="Name of the publisher of the profile", type="string" )
2663  public static final String SP_PUBLISHER = "publisher";
2664  @SearchParamDefinition(name="status", path="StructureDefinition.status", description="The current status of the profile", type="token" )
2665  public static final String SP_STATUS = "status";
2666  @SearchParamDefinition(name="base", path="StructureDefinition.base", description="Structure that this set of constraints applies to", type="uri" )
2667  public static final String SP_BASE = "base";
2668
2669}