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