001package org.hl7.fhir.dstu2016may.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
038import org.hl7.fhir.utilities.Utilities;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045/**
046 * The Library resource provides a representation container for knowledge artifact component definitions. It is effectively an exposure of the header information for a CQL/ELM library.
047 */
048@ResourceDef(name="Library", profile="http://hl7.org/fhir/Profile/Library")
049public class Library extends DomainResource {
050
051    @Block()
052    public static class LibraryModelComponent extends BackboneElement implements IBaseBackboneElement {
053        /**
054         * The name element defines the local name of the model as used within the library.
055         */
056        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
057        @Description(shortDefinition="Name of the model", formalDefinition="The name element defines the local name of the model as used within the library." )
058        protected StringType name;
059
060        /**
061         * The identifier element specifies the global, non-version-specific identifier for the model.
062         */
063        @Child(name = "identifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
064        @Description(shortDefinition="The identifier of the model", formalDefinition="The identifier element specifies the global, non-version-specific identifier for the model." )
065        protected StringType identifier;
066
067        /**
068         * The version element, if present, identifies the specific version of the model to be used. If no version is specified, the most recent published version of the model is implied.
069         */
070        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
071        @Description(shortDefinition="The version of the model, if any", formalDefinition="The version element, if present, identifies the specific version of the model to be used. If no version is specified, the most recent published version of the model is implied." )
072        protected StringType version;
073
074        private static final long serialVersionUID = -862601139L;
075
076    /**
077     * Constructor
078     */
079      public LibraryModelComponent() {
080        super();
081      }
082
083    /**
084     * Constructor
085     */
086      public LibraryModelComponent(StringType identifier) {
087        super();
088        this.identifier = identifier;
089      }
090
091        /**
092         * @return {@link #name} (The name element defines the local name of the model as used within the library.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
093         */
094        public StringType getNameElement() { 
095          if (this.name == null)
096            if (Configuration.errorOnAutoCreate())
097              throw new Error("Attempt to auto-create LibraryModelComponent.name");
098            else if (Configuration.doAutoCreate())
099              this.name = new StringType(); // bb
100          return this.name;
101        }
102
103        public boolean hasNameElement() { 
104          return this.name != null && !this.name.isEmpty();
105        }
106
107        public boolean hasName() { 
108          return this.name != null && !this.name.isEmpty();
109        }
110
111        /**
112         * @param value {@link #name} (The name element defines the local name of the model as used within the library.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
113         */
114        public LibraryModelComponent setNameElement(StringType value) { 
115          this.name = value;
116          return this;
117        }
118
119        /**
120         * @return The name element defines the local name of the model as used within the library.
121         */
122        public String getName() { 
123          return this.name == null ? null : this.name.getValue();
124        }
125
126        /**
127         * @param value The name element defines the local name of the model as used within the library.
128         */
129        public LibraryModelComponent setName(String value) { 
130          if (Utilities.noString(value))
131            this.name = null;
132          else {
133            if (this.name == null)
134              this.name = new StringType();
135            this.name.setValue(value);
136          }
137          return this;
138        }
139
140        /**
141         * @return {@link #identifier} (The identifier element specifies the global, non-version-specific identifier for the model.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
142         */
143        public StringType getIdentifierElement() { 
144          if (this.identifier == null)
145            if (Configuration.errorOnAutoCreate())
146              throw new Error("Attempt to auto-create LibraryModelComponent.identifier");
147            else if (Configuration.doAutoCreate())
148              this.identifier = new StringType(); // bb
149          return this.identifier;
150        }
151
152        public boolean hasIdentifierElement() { 
153          return this.identifier != null && !this.identifier.isEmpty();
154        }
155
156        public boolean hasIdentifier() { 
157          return this.identifier != null && !this.identifier.isEmpty();
158        }
159
160        /**
161         * @param value {@link #identifier} (The identifier element specifies the global, non-version-specific identifier for the model.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
162         */
163        public LibraryModelComponent setIdentifierElement(StringType value) { 
164          this.identifier = value;
165          return this;
166        }
167
168        /**
169         * @return The identifier element specifies the global, non-version-specific identifier for the model.
170         */
171        public String getIdentifier() { 
172          return this.identifier == null ? null : this.identifier.getValue();
173        }
174
175        /**
176         * @param value The identifier element specifies the global, non-version-specific identifier for the model.
177         */
178        public LibraryModelComponent setIdentifier(String value) { 
179            if (this.identifier == null)
180              this.identifier = new StringType();
181            this.identifier.setValue(value);
182          return this;
183        }
184
185        /**
186         * @return {@link #version} (The version element, if present, identifies the specific version of the model to be used. If no version is specified, the most recent published version of the model is implied.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
187         */
188        public StringType getVersionElement() { 
189          if (this.version == null)
190            if (Configuration.errorOnAutoCreate())
191              throw new Error("Attempt to auto-create LibraryModelComponent.version");
192            else if (Configuration.doAutoCreate())
193              this.version = new StringType(); // bb
194          return this.version;
195        }
196
197        public boolean hasVersionElement() { 
198          return this.version != null && !this.version.isEmpty();
199        }
200
201        public boolean hasVersion() { 
202          return this.version != null && !this.version.isEmpty();
203        }
204
205        /**
206         * @param value {@link #version} (The version element, if present, identifies the specific version of the model to be used. If no version is specified, the most recent published version of the model is implied.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
207         */
208        public LibraryModelComponent setVersionElement(StringType value) { 
209          this.version = value;
210          return this;
211        }
212
213        /**
214         * @return The version element, if present, identifies the specific version of the model to be used. If no version is specified, the most recent published version of the model is implied.
215         */
216        public String getVersion() { 
217          return this.version == null ? null : this.version.getValue();
218        }
219
220        /**
221         * @param value The version element, if present, identifies the specific version of the model to be used. If no version is specified, the most recent published version of the model is implied.
222         */
223        public LibraryModelComponent setVersion(String value) { 
224          if (Utilities.noString(value))
225            this.version = null;
226          else {
227            if (this.version == null)
228              this.version = new StringType();
229            this.version.setValue(value);
230          }
231          return this;
232        }
233
234        protected void listChildren(List<Property> childrenList) {
235          super.listChildren(childrenList);
236          childrenList.add(new Property("name", "string", "The name element defines the local name of the model as used within the library.", 0, java.lang.Integer.MAX_VALUE, name));
237          childrenList.add(new Property("identifier", "string", "The identifier element specifies the global, non-version-specific identifier for the model.", 0, java.lang.Integer.MAX_VALUE, identifier));
238          childrenList.add(new Property("version", "string", "The version element, if present, identifies the specific version of the model to be used. If no version is specified, the most recent published version of the model is implied.", 0, java.lang.Integer.MAX_VALUE, version));
239        }
240
241      @Override
242      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
243        switch (hash) {
244        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
245        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // StringType
246        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
247        default: return super.getProperty(hash, name, checkValid);
248        }
249
250      }
251
252      @Override
253      public void setProperty(int hash, String name, Base value) throws FHIRException {
254        switch (hash) {
255        case 3373707: // name
256          this.name = castToString(value); // StringType
257          break;
258        case -1618432855: // identifier
259          this.identifier = castToString(value); // StringType
260          break;
261        case 351608024: // version
262          this.version = castToString(value); // StringType
263          break;
264        default: super.setProperty(hash, name, value);
265        }
266
267      }
268
269      @Override
270      public void setProperty(String name, Base value) throws FHIRException {
271        if (name.equals("name"))
272          this.name = castToString(value); // StringType
273        else if (name.equals("identifier"))
274          this.identifier = castToString(value); // StringType
275        else if (name.equals("version"))
276          this.version = castToString(value); // StringType
277        else
278          super.setProperty(name, value);
279      }
280
281      @Override
282      public Base makeProperty(int hash, String name) throws FHIRException {
283        switch (hash) {
284        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
285        case -1618432855: throw new FHIRException("Cannot make property identifier as it is not a complex type"); // StringType
286        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
287        default: return super.makeProperty(hash, name);
288        }
289
290      }
291
292      @Override
293      public Base addChild(String name) throws FHIRException {
294        if (name.equals("name")) {
295          throw new FHIRException("Cannot call addChild on a primitive type Library.name");
296        }
297        else if (name.equals("identifier")) {
298          throw new FHIRException("Cannot call addChild on a primitive type Library.identifier");
299        }
300        else if (name.equals("version")) {
301          throw new FHIRException("Cannot call addChild on a primitive type Library.version");
302        }
303        else
304          return super.addChild(name);
305      }
306
307      public LibraryModelComponent copy() {
308        LibraryModelComponent dst = new LibraryModelComponent();
309        copyValues(dst);
310        dst.name = name == null ? null : name.copy();
311        dst.identifier = identifier == null ? null : identifier.copy();
312        dst.version = version == null ? null : version.copy();
313        return dst;
314      }
315
316      @Override
317      public boolean equalsDeep(Base other) {
318        if (!super.equalsDeep(other))
319          return false;
320        if (!(other instanceof LibraryModelComponent))
321          return false;
322        LibraryModelComponent o = (LibraryModelComponent) other;
323        return compareDeep(name, o.name, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
324          ;
325      }
326
327      @Override
328      public boolean equalsShallow(Base other) {
329        if (!super.equalsShallow(other))
330          return false;
331        if (!(other instanceof LibraryModelComponent))
332          return false;
333        LibraryModelComponent o = (LibraryModelComponent) other;
334        return compareValues(name, o.name, true) && compareValues(identifier, o.identifier, true) && compareValues(version, o.version, true)
335          ;
336      }
337
338      public boolean isEmpty() {
339        return super.isEmpty() && (name == null || name.isEmpty()) && (identifier == null || identifier.isEmpty())
340           && (version == null || version.isEmpty());
341      }
342
343  public String fhirType() {
344    return "Library.model";
345
346  }
347
348  }
349
350    @Block()
351    public static class LibraryLibraryComponent extends BackboneElement implements IBaseBackboneElement {
352        /**
353         * The name element defines the local name of the referenced library.
354         */
355        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
356        @Description(shortDefinition="Name of the library", formalDefinition="The name element defines the local name of the referenced library." )
357        protected StringType name;
358
359        /**
360         * The identifier element specifies the global, non-version-specific identifier for the library.
361         */
362        @Child(name = "identifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
363        @Description(shortDefinition="The identifier of the library", formalDefinition="The identifier element specifies the global, non-version-specific identifier for the library." )
364        protected StringType identifier;
365
366        /**
367         * The version element, if present, identifies the specific version of the library to be used. If no version is specified, the most recent published version of the library is implied.
368         */
369        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
370        @Description(shortDefinition="The version of the library, if any", formalDefinition="The version element, if present, identifies the specific version of the library to be used. If no version is specified, the most recent published version of the library is implied." )
371        protected StringType version;
372
373        /**
374         * The content of the referenced library as an Attachment, or a reference to the Library resource. If the document is an attachment, it may be a reference to a url from which the library document may be retrieved, or it may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.
375         */
376        @Child(name = "document", type = {Attachment.class, ModuleDefinition.class}, order=4, min=0, max=1, modifier=false, summary=true)
377        @Description(shortDefinition="The content of the library", formalDefinition="The content of the referenced library as an Attachment, or a reference to the Library resource. If the document is an attachment, it may be a reference to a url from which the library document may be retrieved, or it may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document." )
378        protected Type document;
379
380        private static final long serialVersionUID = 1633488790L;
381
382    /**
383     * Constructor
384     */
385      public LibraryLibraryComponent() {
386        super();
387      }
388
389    /**
390     * Constructor
391     */
392      public LibraryLibraryComponent(StringType identifier) {
393        super();
394        this.identifier = identifier;
395      }
396
397        /**
398         * @return {@link #name} (The name element defines the local name of the referenced library.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
399         */
400        public StringType getNameElement() { 
401          if (this.name == null)
402            if (Configuration.errorOnAutoCreate())
403              throw new Error("Attempt to auto-create LibraryLibraryComponent.name");
404            else if (Configuration.doAutoCreate())
405              this.name = new StringType(); // bb
406          return this.name;
407        }
408
409        public boolean hasNameElement() { 
410          return this.name != null && !this.name.isEmpty();
411        }
412
413        public boolean hasName() { 
414          return this.name != null && !this.name.isEmpty();
415        }
416
417        /**
418         * @param value {@link #name} (The name element defines the local name of the referenced library.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
419         */
420        public LibraryLibraryComponent setNameElement(StringType value) { 
421          this.name = value;
422          return this;
423        }
424
425        /**
426         * @return The name element defines the local name of the referenced library.
427         */
428        public String getName() { 
429          return this.name == null ? null : this.name.getValue();
430        }
431
432        /**
433         * @param value The name element defines the local name of the referenced library.
434         */
435        public LibraryLibraryComponent setName(String value) { 
436          if (Utilities.noString(value))
437            this.name = null;
438          else {
439            if (this.name == null)
440              this.name = new StringType();
441            this.name.setValue(value);
442          }
443          return this;
444        }
445
446        /**
447         * @return {@link #identifier} (The identifier element specifies the global, non-version-specific identifier for the library.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
448         */
449        public StringType getIdentifierElement() { 
450          if (this.identifier == null)
451            if (Configuration.errorOnAutoCreate())
452              throw new Error("Attempt to auto-create LibraryLibraryComponent.identifier");
453            else if (Configuration.doAutoCreate())
454              this.identifier = new StringType(); // bb
455          return this.identifier;
456        }
457
458        public boolean hasIdentifierElement() { 
459          return this.identifier != null && !this.identifier.isEmpty();
460        }
461
462        public boolean hasIdentifier() { 
463          return this.identifier != null && !this.identifier.isEmpty();
464        }
465
466        /**
467         * @param value {@link #identifier} (The identifier element specifies the global, non-version-specific identifier for the library.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
468         */
469        public LibraryLibraryComponent setIdentifierElement(StringType value) { 
470          this.identifier = value;
471          return this;
472        }
473
474        /**
475         * @return The identifier element specifies the global, non-version-specific identifier for the library.
476         */
477        public String getIdentifier() { 
478          return this.identifier == null ? null : this.identifier.getValue();
479        }
480
481        /**
482         * @param value The identifier element specifies the global, non-version-specific identifier for the library.
483         */
484        public LibraryLibraryComponent setIdentifier(String value) { 
485            if (this.identifier == null)
486              this.identifier = new StringType();
487            this.identifier.setValue(value);
488          return this;
489        }
490
491        /**
492         * @return {@link #version} (The version element, if present, identifies the specific version of the library to be used. If no version is specified, the most recent published version of the library is implied.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
493         */
494        public StringType getVersionElement() { 
495          if (this.version == null)
496            if (Configuration.errorOnAutoCreate())
497              throw new Error("Attempt to auto-create LibraryLibraryComponent.version");
498            else if (Configuration.doAutoCreate())
499              this.version = new StringType(); // bb
500          return this.version;
501        }
502
503        public boolean hasVersionElement() { 
504          return this.version != null && !this.version.isEmpty();
505        }
506
507        public boolean hasVersion() { 
508          return this.version != null && !this.version.isEmpty();
509        }
510
511        /**
512         * @param value {@link #version} (The version element, if present, identifies the specific version of the library to be used. If no version is specified, the most recent published version of the library is implied.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
513         */
514        public LibraryLibraryComponent setVersionElement(StringType value) { 
515          this.version = value;
516          return this;
517        }
518
519        /**
520         * @return The version element, if present, identifies the specific version of the library to be used. If no version is specified, the most recent published version of the library is implied.
521         */
522        public String getVersion() { 
523          return this.version == null ? null : this.version.getValue();
524        }
525
526        /**
527         * @param value The version element, if present, identifies the specific version of the library to be used. If no version is specified, the most recent published version of the library is implied.
528         */
529        public LibraryLibraryComponent setVersion(String value) { 
530          if (Utilities.noString(value))
531            this.version = null;
532          else {
533            if (this.version == null)
534              this.version = new StringType();
535            this.version.setValue(value);
536          }
537          return this;
538        }
539
540        /**
541         * @return {@link #document} (The content of the referenced library as an Attachment, or a reference to the Library resource. If the document is an attachment, it may be a reference to a url from which the library document may be retrieved, or it may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.)
542         */
543        public Type getDocument() { 
544          return this.document;
545        }
546
547        /**
548         * @return {@link #document} (The content of the referenced library as an Attachment, or a reference to the Library resource. If the document is an attachment, it may be a reference to a url from which the library document may be retrieved, or it may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.)
549         */
550        public Attachment getDocumentAttachment() throws FHIRException { 
551          if (!(this.document instanceof Attachment))
552            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.document.getClass().getName()+" was encountered");
553          return (Attachment) this.document;
554        }
555
556        public boolean hasDocumentAttachment() { 
557          return this.document instanceof Attachment;
558        }
559
560        /**
561         * @return {@link #document} (The content of the referenced library as an Attachment, or a reference to the Library resource. If the document is an attachment, it may be a reference to a url from which the library document may be retrieved, or it may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.)
562         */
563        public Reference getDocumentReference() throws FHIRException { 
564          if (!(this.document instanceof Reference))
565            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.document.getClass().getName()+" was encountered");
566          return (Reference) this.document;
567        }
568
569        public boolean hasDocumentReference() { 
570          return this.document instanceof Reference;
571        }
572
573        public boolean hasDocument() { 
574          return this.document != null && !this.document.isEmpty();
575        }
576
577        /**
578         * @param value {@link #document} (The content of the referenced library as an Attachment, or a reference to the Library resource. If the document is an attachment, it may be a reference to a url from which the library document may be retrieved, or it may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.)
579         */
580        public LibraryLibraryComponent setDocument(Type value) { 
581          this.document = value;
582          return this;
583        }
584
585        protected void listChildren(List<Property> childrenList) {
586          super.listChildren(childrenList);
587          childrenList.add(new Property("name", "string", "The name element defines the local name of the referenced library.", 0, java.lang.Integer.MAX_VALUE, name));
588          childrenList.add(new Property("identifier", "string", "The identifier element specifies the global, non-version-specific identifier for the library.", 0, java.lang.Integer.MAX_VALUE, identifier));
589          childrenList.add(new Property("version", "string", "The version element, if present, identifies the specific version of the library to be used. If no version is specified, the most recent published version of the library is implied.", 0, java.lang.Integer.MAX_VALUE, version));
590          childrenList.add(new Property("document[x]", "Attachment|Reference(ModuleDefinition)", "The content of the referenced library as an Attachment, or a reference to the Library resource. If the document is an attachment, it may be a reference to a url from which the library document may be retrieved, or it may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.", 0, java.lang.Integer.MAX_VALUE, document));
591        }
592
593      @Override
594      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
595        switch (hash) {
596        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
597        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // StringType
598        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
599        case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Type
600        default: return super.getProperty(hash, name, checkValid);
601        }
602
603      }
604
605      @Override
606      public void setProperty(int hash, String name, Base value) throws FHIRException {
607        switch (hash) {
608        case 3373707: // name
609          this.name = castToString(value); // StringType
610          break;
611        case -1618432855: // identifier
612          this.identifier = castToString(value); // StringType
613          break;
614        case 351608024: // version
615          this.version = castToString(value); // StringType
616          break;
617        case 861720859: // document
618          this.document = (Type) value; // Type
619          break;
620        default: super.setProperty(hash, name, value);
621        }
622
623      }
624
625      @Override
626      public void setProperty(String name, Base value) throws FHIRException {
627        if (name.equals("name"))
628          this.name = castToString(value); // StringType
629        else if (name.equals("identifier"))
630          this.identifier = castToString(value); // StringType
631        else if (name.equals("version"))
632          this.version = castToString(value); // StringType
633        else if (name.equals("document[x]"))
634          this.document = (Type) value; // Type
635        else
636          super.setProperty(name, value);
637      }
638
639      @Override
640      public Base makeProperty(int hash, String name) throws FHIRException {
641        switch (hash) {
642        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
643        case -1618432855: throw new FHIRException("Cannot make property identifier as it is not a complex type"); // StringType
644        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
645        case 506673541:  return getDocument(); // Type
646        default: return super.makeProperty(hash, name);
647        }
648
649      }
650
651      @Override
652      public Base addChild(String name) throws FHIRException {
653        if (name.equals("name")) {
654          throw new FHIRException("Cannot call addChild on a primitive type Library.name");
655        }
656        else if (name.equals("identifier")) {
657          throw new FHIRException("Cannot call addChild on a primitive type Library.identifier");
658        }
659        else if (name.equals("version")) {
660          throw new FHIRException("Cannot call addChild on a primitive type Library.version");
661        }
662        else if (name.equals("documentAttachment")) {
663          this.document = new Attachment();
664          return this.document;
665        }
666        else if (name.equals("documentReference")) {
667          this.document = new Reference();
668          return this.document;
669        }
670        else
671          return super.addChild(name);
672      }
673
674      public LibraryLibraryComponent copy() {
675        LibraryLibraryComponent dst = new LibraryLibraryComponent();
676        copyValues(dst);
677        dst.name = name == null ? null : name.copy();
678        dst.identifier = identifier == null ? null : identifier.copy();
679        dst.version = version == null ? null : version.copy();
680        dst.document = document == null ? null : document.copy();
681        return dst;
682      }
683
684      @Override
685      public boolean equalsDeep(Base other) {
686        if (!super.equalsDeep(other))
687          return false;
688        if (!(other instanceof LibraryLibraryComponent))
689          return false;
690        LibraryLibraryComponent o = (LibraryLibraryComponent) other;
691        return compareDeep(name, o.name, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
692           && compareDeep(document, o.document, true);
693      }
694
695      @Override
696      public boolean equalsShallow(Base other) {
697        if (!super.equalsShallow(other))
698          return false;
699        if (!(other instanceof LibraryLibraryComponent))
700          return false;
701        LibraryLibraryComponent o = (LibraryLibraryComponent) other;
702        return compareValues(name, o.name, true) && compareValues(identifier, o.identifier, true) && compareValues(version, o.version, true)
703          ;
704      }
705
706      public boolean isEmpty() {
707        return super.isEmpty() && (name == null || name.isEmpty()) && (identifier == null || identifier.isEmpty())
708           && (version == null || version.isEmpty()) && (document == null || document.isEmpty());
709      }
710
711  public String fhirType() {
712    return "Library.library";
713
714  }
715
716  }
717
718    @Block()
719    public static class LibraryCodeSystemComponent extends BackboneElement implements IBaseBackboneElement {
720        /**
721         * The name element specifies the local name of the code system as used within the library. This name is also used when the code system is referenced from a value set element to determine the version of the code system to be used when computed the expansion of the value set definition.
722         */
723        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
724        @Description(shortDefinition="Name of the code system", formalDefinition="The name element specifies the local name of the code system as used within the library. This name is also used when the code system is referenced from a value set element to determine the version of the code system to be used when computed the expansion of the value set definition." )
725        protected StringType name;
726
727        /**
728         * The identifier element specifies the global, non-version-specific identifier for the code system.
729         */
730        @Child(name = "identifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
731        @Description(shortDefinition="The identifier of the code system", formalDefinition="The identifier element specifies the global, non-version-specific identifier for the code system." )
732        protected StringType identifier;
733
734        /**
735         * The version element, if present, identifies the specific version of the library to be used. If no code system is specified, the most recent published version of the code system is implied.
736         */
737        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
738        @Description(shortDefinition="The version of the code system, if any", formalDefinition="The version element, if present, identifies the specific version of the library to be used. If no code system is specified, the most recent published version of the code system is implied." )
739        protected StringType version;
740
741        private static final long serialVersionUID = -862601139L;
742
743    /**
744     * Constructor
745     */
746      public LibraryCodeSystemComponent() {
747        super();
748      }
749
750    /**
751     * Constructor
752     */
753      public LibraryCodeSystemComponent(StringType identifier) {
754        super();
755        this.identifier = identifier;
756      }
757
758        /**
759         * @return {@link #name} (The name element specifies the local name of the code system as used within the library. This name is also used when the code system is referenced from a value set element to determine the version of the code system to be used when computed the expansion of the value set definition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
760         */
761        public StringType getNameElement() { 
762          if (this.name == null)
763            if (Configuration.errorOnAutoCreate())
764              throw new Error("Attempt to auto-create LibraryCodeSystemComponent.name");
765            else if (Configuration.doAutoCreate())
766              this.name = new StringType(); // bb
767          return this.name;
768        }
769
770        public boolean hasNameElement() { 
771          return this.name != null && !this.name.isEmpty();
772        }
773
774        public boolean hasName() { 
775          return this.name != null && !this.name.isEmpty();
776        }
777
778        /**
779         * @param value {@link #name} (The name element specifies the local name of the code system as used within the library. This name is also used when the code system is referenced from a value set element to determine the version of the code system to be used when computed the expansion of the value set definition.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
780         */
781        public LibraryCodeSystemComponent setNameElement(StringType value) { 
782          this.name = value;
783          return this;
784        }
785
786        /**
787         * @return The name element specifies the local name of the code system as used within the library. This name is also used when the code system is referenced from a value set element to determine the version of the code system to be used when computed the expansion of the value set definition.
788         */
789        public String getName() { 
790          return this.name == null ? null : this.name.getValue();
791        }
792
793        /**
794         * @param value The name element specifies the local name of the code system as used within the library. This name is also used when the code system is referenced from a value set element to determine the version of the code system to be used when computed the expansion of the value set definition.
795         */
796        public LibraryCodeSystemComponent setName(String value) { 
797          if (Utilities.noString(value))
798            this.name = null;
799          else {
800            if (this.name == null)
801              this.name = new StringType();
802            this.name.setValue(value);
803          }
804          return this;
805        }
806
807        /**
808         * @return {@link #identifier} (The identifier element specifies the global, non-version-specific identifier for the code system.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
809         */
810        public StringType getIdentifierElement() { 
811          if (this.identifier == null)
812            if (Configuration.errorOnAutoCreate())
813              throw new Error("Attempt to auto-create LibraryCodeSystemComponent.identifier");
814            else if (Configuration.doAutoCreate())
815              this.identifier = new StringType(); // bb
816          return this.identifier;
817        }
818
819        public boolean hasIdentifierElement() { 
820          return this.identifier != null && !this.identifier.isEmpty();
821        }
822
823        public boolean hasIdentifier() { 
824          return this.identifier != null && !this.identifier.isEmpty();
825        }
826
827        /**
828         * @param value {@link #identifier} (The identifier element specifies the global, non-version-specific identifier for the code system.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
829         */
830        public LibraryCodeSystemComponent setIdentifierElement(StringType value) { 
831          this.identifier = value;
832          return this;
833        }
834
835        /**
836         * @return The identifier element specifies the global, non-version-specific identifier for the code system.
837         */
838        public String getIdentifier() { 
839          return this.identifier == null ? null : this.identifier.getValue();
840        }
841
842        /**
843         * @param value The identifier element specifies the global, non-version-specific identifier for the code system.
844         */
845        public LibraryCodeSystemComponent setIdentifier(String value) { 
846            if (this.identifier == null)
847              this.identifier = new StringType();
848            this.identifier.setValue(value);
849          return this;
850        }
851
852        /**
853         * @return {@link #version} (The version element, if present, identifies the specific version of the library to be used. If no code system is specified, the most recent published version of the code system is implied.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
854         */
855        public StringType getVersionElement() { 
856          if (this.version == null)
857            if (Configuration.errorOnAutoCreate())
858              throw new Error("Attempt to auto-create LibraryCodeSystemComponent.version");
859            else if (Configuration.doAutoCreate())
860              this.version = new StringType(); // bb
861          return this.version;
862        }
863
864        public boolean hasVersionElement() { 
865          return this.version != null && !this.version.isEmpty();
866        }
867
868        public boolean hasVersion() { 
869          return this.version != null && !this.version.isEmpty();
870        }
871
872        /**
873         * @param value {@link #version} (The version element, if present, identifies the specific version of the library to be used. If no code system is specified, the most recent published version of the code system is implied.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
874         */
875        public LibraryCodeSystemComponent setVersionElement(StringType value) { 
876          this.version = value;
877          return this;
878        }
879
880        /**
881         * @return The version element, if present, identifies the specific version of the library to be used. If no code system is specified, the most recent published version of the code system is implied.
882         */
883        public String getVersion() { 
884          return this.version == null ? null : this.version.getValue();
885        }
886
887        /**
888         * @param value The version element, if present, identifies the specific version of the library to be used. If no code system is specified, the most recent published version of the code system is implied.
889         */
890        public LibraryCodeSystemComponent setVersion(String value) { 
891          if (Utilities.noString(value))
892            this.version = null;
893          else {
894            if (this.version == null)
895              this.version = new StringType();
896            this.version.setValue(value);
897          }
898          return this;
899        }
900
901        protected void listChildren(List<Property> childrenList) {
902          super.listChildren(childrenList);
903          childrenList.add(new Property("name", "string", "The name element specifies the local name of the code system as used within the library. This name is also used when the code system is referenced from a value set element to determine the version of the code system to be used when computed the expansion of the value set definition.", 0, java.lang.Integer.MAX_VALUE, name));
904          childrenList.add(new Property("identifier", "string", "The identifier element specifies the global, non-version-specific identifier for the code system.", 0, java.lang.Integer.MAX_VALUE, identifier));
905          childrenList.add(new Property("version", "string", "The version element, if present, identifies the specific version of the library to be used. If no code system is specified, the most recent published version of the code system is implied.", 0, java.lang.Integer.MAX_VALUE, version));
906        }
907
908      @Override
909      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
910        switch (hash) {
911        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
912        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // StringType
913        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
914        default: return super.getProperty(hash, name, checkValid);
915        }
916
917      }
918
919      @Override
920      public void setProperty(int hash, String name, Base value) throws FHIRException {
921        switch (hash) {
922        case 3373707: // name
923          this.name = castToString(value); // StringType
924          break;
925        case -1618432855: // identifier
926          this.identifier = castToString(value); // StringType
927          break;
928        case 351608024: // version
929          this.version = castToString(value); // StringType
930          break;
931        default: super.setProperty(hash, name, value);
932        }
933
934      }
935
936      @Override
937      public void setProperty(String name, Base value) throws FHIRException {
938        if (name.equals("name"))
939          this.name = castToString(value); // StringType
940        else if (name.equals("identifier"))
941          this.identifier = castToString(value); // StringType
942        else if (name.equals("version"))
943          this.version = castToString(value); // StringType
944        else
945          super.setProperty(name, value);
946      }
947
948      @Override
949      public Base makeProperty(int hash, String name) throws FHIRException {
950        switch (hash) {
951        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
952        case -1618432855: throw new FHIRException("Cannot make property identifier as it is not a complex type"); // StringType
953        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
954        default: return super.makeProperty(hash, name);
955        }
956
957      }
958
959      @Override
960      public Base addChild(String name) throws FHIRException {
961        if (name.equals("name")) {
962          throw new FHIRException("Cannot call addChild on a primitive type Library.name");
963        }
964        else if (name.equals("identifier")) {
965          throw new FHIRException("Cannot call addChild on a primitive type Library.identifier");
966        }
967        else if (name.equals("version")) {
968          throw new FHIRException("Cannot call addChild on a primitive type Library.version");
969        }
970        else
971          return super.addChild(name);
972      }
973
974      public LibraryCodeSystemComponent copy() {
975        LibraryCodeSystemComponent dst = new LibraryCodeSystemComponent();
976        copyValues(dst);
977        dst.name = name == null ? null : name.copy();
978        dst.identifier = identifier == null ? null : identifier.copy();
979        dst.version = version == null ? null : version.copy();
980        return dst;
981      }
982
983      @Override
984      public boolean equalsDeep(Base other) {
985        if (!super.equalsDeep(other))
986          return false;
987        if (!(other instanceof LibraryCodeSystemComponent))
988          return false;
989        LibraryCodeSystemComponent o = (LibraryCodeSystemComponent) other;
990        return compareDeep(name, o.name, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
991          ;
992      }
993
994      @Override
995      public boolean equalsShallow(Base other) {
996        if (!super.equalsShallow(other))
997          return false;
998        if (!(other instanceof LibraryCodeSystemComponent))
999          return false;
1000        LibraryCodeSystemComponent o = (LibraryCodeSystemComponent) other;
1001        return compareValues(name, o.name, true) && compareValues(identifier, o.identifier, true) && compareValues(version, o.version, true)
1002          ;
1003      }
1004
1005      public boolean isEmpty() {
1006        return super.isEmpty() && (name == null || name.isEmpty()) && (identifier == null || identifier.isEmpty())
1007           && (version == null || version.isEmpty());
1008      }
1009
1010  public String fhirType() {
1011    return "Library.codeSystem";
1012
1013  }
1014
1015  }
1016
1017    @Block()
1018    public static class LibraryValueSetComponent extends BackboneElement implements IBaseBackboneElement {
1019        /**
1020         * The name element specifies the local name of the value set used within the library.
1021         */
1022        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1023        @Description(shortDefinition="Name of the value set", formalDefinition="The name element specifies the local name of the value set used within the library." )
1024        protected StringType name;
1025
1026        /**
1027         * The identifier element specifies the global, non-version-specific identifier for the value set.
1028         */
1029        @Child(name = "identifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1030        @Description(shortDefinition="The identifier of the value set", formalDefinition="The identifier element specifies the global, non-version-specific identifier for the value set." )
1031        protected StringType identifier;
1032
1033        /**
1034         * The version element, if present, determines the specific version of the value set definition that is used by the library. If no version is specified, the latest published version of the value set definition is implied.
1035         */
1036        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1037        @Description(shortDefinition="The version of the value set", formalDefinition="The version element, if present, determines the specific version of the value set definition that is used by the library. If no version is specified, the latest published version of the value set definition is implied." )
1038        protected StringType version;
1039
1040        /**
1041         * The codeSystem element determines which code system binding to use to compute the expansion of the value set definition. The codeSystem element specified here will correspond to a code system element, which is used to determine the code system version.
1042         */
1043        @Child(name = "codeSystem", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1044        @Description(shortDefinition="The code system binding for this value set definition", formalDefinition="The codeSystem element determines which code system binding to use to compute the expansion of the value set definition. The codeSystem element specified here will correspond to a code system element, which is used to determine the code system version." )
1045        protected List<StringType> codeSystem;
1046
1047        private static final long serialVersionUID = 338950096L;
1048
1049    /**
1050     * Constructor
1051     */
1052      public LibraryValueSetComponent() {
1053        super();
1054      }
1055
1056    /**
1057     * Constructor
1058     */
1059      public LibraryValueSetComponent(StringType identifier) {
1060        super();
1061        this.identifier = identifier;
1062      }
1063
1064        /**
1065         * @return {@link #name} (The name element specifies the local name of the value set used within the library.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1066         */
1067        public StringType getNameElement() { 
1068          if (this.name == null)
1069            if (Configuration.errorOnAutoCreate())
1070              throw new Error("Attempt to auto-create LibraryValueSetComponent.name");
1071            else if (Configuration.doAutoCreate())
1072              this.name = new StringType(); // bb
1073          return this.name;
1074        }
1075
1076        public boolean hasNameElement() { 
1077          return this.name != null && !this.name.isEmpty();
1078        }
1079
1080        public boolean hasName() { 
1081          return this.name != null && !this.name.isEmpty();
1082        }
1083
1084        /**
1085         * @param value {@link #name} (The name element specifies the local name of the value set used within the library.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1086         */
1087        public LibraryValueSetComponent setNameElement(StringType value) { 
1088          this.name = value;
1089          return this;
1090        }
1091
1092        /**
1093         * @return The name element specifies the local name of the value set used within the library.
1094         */
1095        public String getName() { 
1096          return this.name == null ? null : this.name.getValue();
1097        }
1098
1099        /**
1100         * @param value The name element specifies the local name of the value set used within the library.
1101         */
1102        public LibraryValueSetComponent setName(String value) { 
1103          if (Utilities.noString(value))
1104            this.name = null;
1105          else {
1106            if (this.name == null)
1107              this.name = new StringType();
1108            this.name.setValue(value);
1109          }
1110          return this;
1111        }
1112
1113        /**
1114         * @return {@link #identifier} (The identifier element specifies the global, non-version-specific identifier for the value set.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
1115         */
1116        public StringType getIdentifierElement() { 
1117          if (this.identifier == null)
1118            if (Configuration.errorOnAutoCreate())
1119              throw new Error("Attempt to auto-create LibraryValueSetComponent.identifier");
1120            else if (Configuration.doAutoCreate())
1121              this.identifier = new StringType(); // bb
1122          return this.identifier;
1123        }
1124
1125        public boolean hasIdentifierElement() { 
1126          return this.identifier != null && !this.identifier.isEmpty();
1127        }
1128
1129        public boolean hasIdentifier() { 
1130          return this.identifier != null && !this.identifier.isEmpty();
1131        }
1132
1133        /**
1134         * @param value {@link #identifier} (The identifier element specifies the global, non-version-specific identifier for the value set.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
1135         */
1136        public LibraryValueSetComponent setIdentifierElement(StringType value) { 
1137          this.identifier = value;
1138          return this;
1139        }
1140
1141        /**
1142         * @return The identifier element specifies the global, non-version-specific identifier for the value set.
1143         */
1144        public String getIdentifier() { 
1145          return this.identifier == null ? null : this.identifier.getValue();
1146        }
1147
1148        /**
1149         * @param value The identifier element specifies the global, non-version-specific identifier for the value set.
1150         */
1151        public LibraryValueSetComponent setIdentifier(String value) { 
1152            if (this.identifier == null)
1153              this.identifier = new StringType();
1154            this.identifier.setValue(value);
1155          return this;
1156        }
1157
1158        /**
1159         * @return {@link #version} (The version element, if present, determines the specific version of the value set definition that is used by the library. If no version is specified, the latest published version of the value set definition is implied.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1160         */
1161        public StringType getVersionElement() { 
1162          if (this.version == null)
1163            if (Configuration.errorOnAutoCreate())
1164              throw new Error("Attempt to auto-create LibraryValueSetComponent.version");
1165            else if (Configuration.doAutoCreate())
1166              this.version = new StringType(); // bb
1167          return this.version;
1168        }
1169
1170        public boolean hasVersionElement() { 
1171          return this.version != null && !this.version.isEmpty();
1172        }
1173
1174        public boolean hasVersion() { 
1175          return this.version != null && !this.version.isEmpty();
1176        }
1177
1178        /**
1179         * @param value {@link #version} (The version element, if present, determines the specific version of the value set definition that is used by the library. If no version is specified, the latest published version of the value set definition is implied.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1180         */
1181        public LibraryValueSetComponent setVersionElement(StringType value) { 
1182          this.version = value;
1183          return this;
1184        }
1185
1186        /**
1187         * @return The version element, if present, determines the specific version of the value set definition that is used by the library. If no version is specified, the latest published version of the value set definition is implied.
1188         */
1189        public String getVersion() { 
1190          return this.version == null ? null : this.version.getValue();
1191        }
1192
1193        /**
1194         * @param value The version element, if present, determines the specific version of the value set definition that is used by the library. If no version is specified, the latest published version of the value set definition is implied.
1195         */
1196        public LibraryValueSetComponent setVersion(String value) { 
1197          if (Utilities.noString(value))
1198            this.version = null;
1199          else {
1200            if (this.version == null)
1201              this.version = new StringType();
1202            this.version.setValue(value);
1203          }
1204          return this;
1205        }
1206
1207        /**
1208         * @return {@link #codeSystem} (The codeSystem element determines which code system binding to use to compute the expansion of the value set definition. The codeSystem element specified here will correspond to a code system element, which is used to determine the code system version.)
1209         */
1210        public List<StringType> getCodeSystem() { 
1211          if (this.codeSystem == null)
1212            this.codeSystem = new ArrayList<StringType>();
1213          return this.codeSystem;
1214        }
1215
1216        public boolean hasCodeSystem() { 
1217          if (this.codeSystem == null)
1218            return false;
1219          for (StringType item : this.codeSystem)
1220            if (!item.isEmpty())
1221              return true;
1222          return false;
1223        }
1224
1225        /**
1226         * @return {@link #codeSystem} (The codeSystem element determines which code system binding to use to compute the expansion of the value set definition. The codeSystem element specified here will correspond to a code system element, which is used to determine the code system version.)
1227         */
1228    // syntactic sugar
1229        public StringType addCodeSystemElement() {//2 
1230          StringType t = new StringType();
1231          if (this.codeSystem == null)
1232            this.codeSystem = new ArrayList<StringType>();
1233          this.codeSystem.add(t);
1234          return t;
1235        }
1236
1237        /**
1238         * @param value {@link #codeSystem} (The codeSystem element determines which code system binding to use to compute the expansion of the value set definition. The codeSystem element specified here will correspond to a code system element, which is used to determine the code system version.)
1239         */
1240        public LibraryValueSetComponent addCodeSystem(String value) { //1
1241          StringType t = new StringType();
1242          t.setValue(value);
1243          if (this.codeSystem == null)
1244            this.codeSystem = new ArrayList<StringType>();
1245          this.codeSystem.add(t);
1246          return this;
1247        }
1248
1249        /**
1250         * @param value {@link #codeSystem} (The codeSystem element determines which code system binding to use to compute the expansion of the value set definition. The codeSystem element specified here will correspond to a code system element, which is used to determine the code system version.)
1251         */
1252        public boolean hasCodeSystem(String value) { 
1253          if (this.codeSystem == null)
1254            return false;
1255          for (StringType v : this.codeSystem)
1256            if (v.equals(value)) // string
1257              return true;
1258          return false;
1259        }
1260
1261        protected void listChildren(List<Property> childrenList) {
1262          super.listChildren(childrenList);
1263          childrenList.add(new Property("name", "string", "The name element specifies the local name of the value set used within the library.", 0, java.lang.Integer.MAX_VALUE, name));
1264          childrenList.add(new Property("identifier", "string", "The identifier element specifies the global, non-version-specific identifier for the value set.", 0, java.lang.Integer.MAX_VALUE, identifier));
1265          childrenList.add(new Property("version", "string", "The version element, if present, determines the specific version of the value set definition that is used by the library. If no version is specified, the latest published version of the value set definition is implied.", 0, java.lang.Integer.MAX_VALUE, version));
1266          childrenList.add(new Property("codeSystem", "string", "The codeSystem element determines which code system binding to use to compute the expansion of the value set definition. The codeSystem element specified here will correspond to a code system element, which is used to determine the code system version.", 0, java.lang.Integer.MAX_VALUE, codeSystem));
1267        }
1268
1269      @Override
1270      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1271        switch (hash) {
1272        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1273        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // StringType
1274        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
1275        case -916511108: /*codeSystem*/ return this.codeSystem == null ? new Base[0] : this.codeSystem.toArray(new Base[this.codeSystem.size()]); // StringType
1276        default: return super.getProperty(hash, name, checkValid);
1277        }
1278
1279      }
1280
1281      @Override
1282      public void setProperty(int hash, String name, Base value) throws FHIRException {
1283        switch (hash) {
1284        case 3373707: // name
1285          this.name = castToString(value); // StringType
1286          break;
1287        case -1618432855: // identifier
1288          this.identifier = castToString(value); // StringType
1289          break;
1290        case 351608024: // version
1291          this.version = castToString(value); // StringType
1292          break;
1293        case -916511108: // codeSystem
1294          this.getCodeSystem().add(castToString(value)); // StringType
1295          break;
1296        default: super.setProperty(hash, name, value);
1297        }
1298
1299      }
1300
1301      @Override
1302      public void setProperty(String name, Base value) throws FHIRException {
1303        if (name.equals("name"))
1304          this.name = castToString(value); // StringType
1305        else if (name.equals("identifier"))
1306          this.identifier = castToString(value); // StringType
1307        else if (name.equals("version"))
1308          this.version = castToString(value); // StringType
1309        else if (name.equals("codeSystem"))
1310          this.getCodeSystem().add(castToString(value));
1311        else
1312          super.setProperty(name, value);
1313      }
1314
1315      @Override
1316      public Base makeProperty(int hash, String name) throws FHIRException {
1317        switch (hash) {
1318        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
1319        case -1618432855: throw new FHIRException("Cannot make property identifier as it is not a complex type"); // StringType
1320        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
1321        case -916511108: throw new FHIRException("Cannot make property codeSystem as it is not a complex type"); // StringType
1322        default: return super.makeProperty(hash, name);
1323        }
1324
1325      }
1326
1327      @Override
1328      public Base addChild(String name) throws FHIRException {
1329        if (name.equals("name")) {
1330          throw new FHIRException("Cannot call addChild on a primitive type Library.name");
1331        }
1332        else if (name.equals("identifier")) {
1333          throw new FHIRException("Cannot call addChild on a primitive type Library.identifier");
1334        }
1335        else if (name.equals("version")) {
1336          throw new FHIRException("Cannot call addChild on a primitive type Library.version");
1337        }
1338        else if (name.equals("codeSystem")) {
1339          throw new FHIRException("Cannot call addChild on a primitive type Library.codeSystem");
1340        }
1341        else
1342          return super.addChild(name);
1343      }
1344
1345      public LibraryValueSetComponent copy() {
1346        LibraryValueSetComponent dst = new LibraryValueSetComponent();
1347        copyValues(dst);
1348        dst.name = name == null ? null : name.copy();
1349        dst.identifier = identifier == null ? null : identifier.copy();
1350        dst.version = version == null ? null : version.copy();
1351        if (codeSystem != null) {
1352          dst.codeSystem = new ArrayList<StringType>();
1353          for (StringType i : codeSystem)
1354            dst.codeSystem.add(i.copy());
1355        };
1356        return dst;
1357      }
1358
1359      @Override
1360      public boolean equalsDeep(Base other) {
1361        if (!super.equalsDeep(other))
1362          return false;
1363        if (!(other instanceof LibraryValueSetComponent))
1364          return false;
1365        LibraryValueSetComponent o = (LibraryValueSetComponent) other;
1366        return compareDeep(name, o.name, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
1367           && compareDeep(codeSystem, o.codeSystem, true);
1368      }
1369
1370      @Override
1371      public boolean equalsShallow(Base other) {
1372        if (!super.equalsShallow(other))
1373          return false;
1374        if (!(other instanceof LibraryValueSetComponent))
1375          return false;
1376        LibraryValueSetComponent o = (LibraryValueSetComponent) other;
1377        return compareValues(name, o.name, true) && compareValues(identifier, o.identifier, true) && compareValues(version, o.version, true)
1378           && compareValues(codeSystem, o.codeSystem, true);
1379      }
1380
1381      public boolean isEmpty() {
1382        return super.isEmpty() && (name == null || name.isEmpty()) && (identifier == null || identifier.isEmpty())
1383           && (version == null || version.isEmpty()) && (codeSystem == null || codeSystem.isEmpty())
1384          ;
1385      }
1386
1387  public String fhirType() {
1388    return "Library.valueSet";
1389
1390  }
1391
1392  }
1393
1394    /**
1395     * The metadata for the library, including publishing, life-cycle, version, documentation, and supporting evidence.
1396     */
1397    @Child(name = "moduleMetadata", type = {ModuleMetadata.class}, order=0, min=0, max=1, modifier=false, summary=true)
1398    @Description(shortDefinition="The metadata information for the library", formalDefinition="The metadata for the library, including publishing, life-cycle, version, documentation, and supporting evidence." )
1399    protected ModuleMetadata moduleMetadata;
1400
1401    /**
1402     * A model element describes the model and version used by the library.
1403     */
1404    @Child(name = "model", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1405    @Description(shortDefinition="A model used by the library", formalDefinition="A model element describes the model and version used by the library." )
1406    protected List<LibraryModelComponent> model;
1407
1408    /**
1409     * A library element describes a library referenced by this library.
1410     */
1411    @Child(name = "library", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1412    @Description(shortDefinition="A library referenced by this library", formalDefinition="A library element describes a library referenced by this library." )
1413    protected List<LibraryLibraryComponent> library;
1414
1415    /**
1416     * A code system definition used within the library.
1417     */
1418    @Child(name = "codeSystem", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1419    @Description(shortDefinition="A code system used by the library", formalDefinition="A code system definition used within the library." )
1420    protected List<LibraryCodeSystemComponent> codeSystem;
1421
1422    /**
1423     * A value set definition referenced by the library.
1424     */
1425    @Child(name = "valueSet", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1426    @Description(shortDefinition="A value set used by the library", formalDefinition="A value set definition referenced by the library." )
1427    protected List<LibraryValueSetComponent> valueSet;
1428
1429    /**
1430     * The parameter element defines parameters used by the library.
1431     */
1432    @Child(name = "parameter", type = {ParameterDefinition.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1433    @Description(shortDefinition="Parameters defined by the library", formalDefinition="The parameter element defines parameters used by the library." )
1434    protected List<ParameterDefinition> parameter;
1435
1436    /**
1437     * The dataRequirement element specifies a data requirement used by some expression within the library.
1438     */
1439    @Child(name = "dataRequirement", type = {DataRequirement.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1440    @Description(shortDefinition="Data requirements of the library", formalDefinition="The dataRequirement element specifies a data requirement used by some expression within the library." )
1441    protected List<DataRequirement> dataRequirement;
1442
1443    /**
1444     * The content of the library as an Attachment. The content may be a reference to a url, or may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.
1445     */
1446    @Child(name = "document", type = {Attachment.class}, order=7, min=1, max=1, modifier=false, summary=true)
1447    @Description(shortDefinition="The content of the library", formalDefinition="The content of the library as an Attachment. The content may be a reference to a url, or may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document." )
1448    protected Attachment document;
1449
1450    private static final long serialVersionUID = 36997599L;
1451
1452  /**
1453   * Constructor
1454   */
1455    public Library() {
1456      super();
1457    }
1458
1459  /**
1460   * Constructor
1461   */
1462    public Library(Attachment document) {
1463      super();
1464      this.document = document;
1465    }
1466
1467    /**
1468     * @return {@link #moduleMetadata} (The metadata for the library, including publishing, life-cycle, version, documentation, and supporting evidence.)
1469     */
1470    public ModuleMetadata getModuleMetadata() { 
1471      if (this.moduleMetadata == null)
1472        if (Configuration.errorOnAutoCreate())
1473          throw new Error("Attempt to auto-create Library.moduleMetadata");
1474        else if (Configuration.doAutoCreate())
1475          this.moduleMetadata = new ModuleMetadata(); // cc
1476      return this.moduleMetadata;
1477    }
1478
1479    public boolean hasModuleMetadata() { 
1480      return this.moduleMetadata != null && !this.moduleMetadata.isEmpty();
1481    }
1482
1483    /**
1484     * @param value {@link #moduleMetadata} (The metadata for the library, including publishing, life-cycle, version, documentation, and supporting evidence.)
1485     */
1486    public Library setModuleMetadata(ModuleMetadata value) { 
1487      this.moduleMetadata = value;
1488      return this;
1489    }
1490
1491    /**
1492     * @return {@link #model} (A model element describes the model and version used by the library.)
1493     */
1494    public List<LibraryModelComponent> getModel() { 
1495      if (this.model == null)
1496        this.model = new ArrayList<LibraryModelComponent>();
1497      return this.model;
1498    }
1499
1500    public boolean hasModel() { 
1501      if (this.model == null)
1502        return false;
1503      for (LibraryModelComponent item : this.model)
1504        if (!item.isEmpty())
1505          return true;
1506      return false;
1507    }
1508
1509    /**
1510     * @return {@link #model} (A model element describes the model and version used by the library.)
1511     */
1512    // syntactic sugar
1513    public LibraryModelComponent addModel() { //3
1514      LibraryModelComponent t = new LibraryModelComponent();
1515      if (this.model == null)
1516        this.model = new ArrayList<LibraryModelComponent>();
1517      this.model.add(t);
1518      return t;
1519    }
1520
1521    // syntactic sugar
1522    public Library addModel(LibraryModelComponent t) { //3
1523      if (t == null)
1524        return this;
1525      if (this.model == null)
1526        this.model = new ArrayList<LibraryModelComponent>();
1527      this.model.add(t);
1528      return this;
1529    }
1530
1531    /**
1532     * @return {@link #library} (A library element describes a library referenced by this library.)
1533     */
1534    public List<LibraryLibraryComponent> getLibrary() { 
1535      if (this.library == null)
1536        this.library = new ArrayList<LibraryLibraryComponent>();
1537      return this.library;
1538    }
1539
1540    public boolean hasLibrary() { 
1541      if (this.library == null)
1542        return false;
1543      for (LibraryLibraryComponent item : this.library)
1544        if (!item.isEmpty())
1545          return true;
1546      return false;
1547    }
1548
1549    /**
1550     * @return {@link #library} (A library element describes a library referenced by this library.)
1551     */
1552    // syntactic sugar
1553    public LibraryLibraryComponent addLibrary() { //3
1554      LibraryLibraryComponent t = new LibraryLibraryComponent();
1555      if (this.library == null)
1556        this.library = new ArrayList<LibraryLibraryComponent>();
1557      this.library.add(t);
1558      return t;
1559    }
1560
1561    // syntactic sugar
1562    public Library addLibrary(LibraryLibraryComponent t) { //3
1563      if (t == null)
1564        return this;
1565      if (this.library == null)
1566        this.library = new ArrayList<LibraryLibraryComponent>();
1567      this.library.add(t);
1568      return this;
1569    }
1570
1571    /**
1572     * @return {@link #codeSystem} (A code system definition used within the library.)
1573     */
1574    public List<LibraryCodeSystemComponent> getCodeSystem() { 
1575      if (this.codeSystem == null)
1576        this.codeSystem = new ArrayList<LibraryCodeSystemComponent>();
1577      return this.codeSystem;
1578    }
1579
1580    public boolean hasCodeSystem() { 
1581      if (this.codeSystem == null)
1582        return false;
1583      for (LibraryCodeSystemComponent item : this.codeSystem)
1584        if (!item.isEmpty())
1585          return true;
1586      return false;
1587    }
1588
1589    /**
1590     * @return {@link #codeSystem} (A code system definition used within the library.)
1591     */
1592    // syntactic sugar
1593    public LibraryCodeSystemComponent addCodeSystem() { //3
1594      LibraryCodeSystemComponent t = new LibraryCodeSystemComponent();
1595      if (this.codeSystem == null)
1596        this.codeSystem = new ArrayList<LibraryCodeSystemComponent>();
1597      this.codeSystem.add(t);
1598      return t;
1599    }
1600
1601    // syntactic sugar
1602    public Library addCodeSystem(LibraryCodeSystemComponent t) { //3
1603      if (t == null)
1604        return this;
1605      if (this.codeSystem == null)
1606        this.codeSystem = new ArrayList<LibraryCodeSystemComponent>();
1607      this.codeSystem.add(t);
1608      return this;
1609    }
1610
1611    /**
1612     * @return {@link #valueSet} (A value set definition referenced by the library.)
1613     */
1614    public List<LibraryValueSetComponent> getValueSet() { 
1615      if (this.valueSet == null)
1616        this.valueSet = new ArrayList<LibraryValueSetComponent>();
1617      return this.valueSet;
1618    }
1619
1620    public boolean hasValueSet() { 
1621      if (this.valueSet == null)
1622        return false;
1623      for (LibraryValueSetComponent item : this.valueSet)
1624        if (!item.isEmpty())
1625          return true;
1626      return false;
1627    }
1628
1629    /**
1630     * @return {@link #valueSet} (A value set definition referenced by the library.)
1631     */
1632    // syntactic sugar
1633    public LibraryValueSetComponent addValueSet() { //3
1634      LibraryValueSetComponent t = new LibraryValueSetComponent();
1635      if (this.valueSet == null)
1636        this.valueSet = new ArrayList<LibraryValueSetComponent>();
1637      this.valueSet.add(t);
1638      return t;
1639    }
1640
1641    // syntactic sugar
1642    public Library addValueSet(LibraryValueSetComponent t) { //3
1643      if (t == null)
1644        return this;
1645      if (this.valueSet == null)
1646        this.valueSet = new ArrayList<LibraryValueSetComponent>();
1647      this.valueSet.add(t);
1648      return this;
1649    }
1650
1651    /**
1652     * @return {@link #parameter} (The parameter element defines parameters used by the library.)
1653     */
1654    public List<ParameterDefinition> getParameter() { 
1655      if (this.parameter == null)
1656        this.parameter = new ArrayList<ParameterDefinition>();
1657      return this.parameter;
1658    }
1659
1660    public boolean hasParameter() { 
1661      if (this.parameter == null)
1662        return false;
1663      for (ParameterDefinition item : this.parameter)
1664        if (!item.isEmpty())
1665          return true;
1666      return false;
1667    }
1668
1669    /**
1670     * @return {@link #parameter} (The parameter element defines parameters used by the library.)
1671     */
1672    // syntactic sugar
1673    public ParameterDefinition addParameter() { //3
1674      ParameterDefinition t = new ParameterDefinition();
1675      if (this.parameter == null)
1676        this.parameter = new ArrayList<ParameterDefinition>();
1677      this.parameter.add(t);
1678      return t;
1679    }
1680
1681    // syntactic sugar
1682    public Library addParameter(ParameterDefinition t) { //3
1683      if (t == null)
1684        return this;
1685      if (this.parameter == null)
1686        this.parameter = new ArrayList<ParameterDefinition>();
1687      this.parameter.add(t);
1688      return this;
1689    }
1690
1691    /**
1692     * @return {@link #dataRequirement} (The dataRequirement element specifies a data requirement used by some expression within the library.)
1693     */
1694    public List<DataRequirement> getDataRequirement() { 
1695      if (this.dataRequirement == null)
1696        this.dataRequirement = new ArrayList<DataRequirement>();
1697      return this.dataRequirement;
1698    }
1699
1700    public boolean hasDataRequirement() { 
1701      if (this.dataRequirement == null)
1702        return false;
1703      for (DataRequirement item : this.dataRequirement)
1704        if (!item.isEmpty())
1705          return true;
1706      return false;
1707    }
1708
1709    /**
1710     * @return {@link #dataRequirement} (The dataRequirement element specifies a data requirement used by some expression within the library.)
1711     */
1712    // syntactic sugar
1713    public DataRequirement addDataRequirement() { //3
1714      DataRequirement t = new DataRequirement();
1715      if (this.dataRequirement == null)
1716        this.dataRequirement = new ArrayList<DataRequirement>();
1717      this.dataRequirement.add(t);
1718      return t;
1719    }
1720
1721    // syntactic sugar
1722    public Library addDataRequirement(DataRequirement t) { //3
1723      if (t == null)
1724        return this;
1725      if (this.dataRequirement == null)
1726        this.dataRequirement = new ArrayList<DataRequirement>();
1727      this.dataRequirement.add(t);
1728      return this;
1729    }
1730
1731    /**
1732     * @return {@link #document} (The content of the library as an Attachment. The content may be a reference to a url, or may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.)
1733     */
1734    public Attachment getDocument() { 
1735      if (this.document == null)
1736        if (Configuration.errorOnAutoCreate())
1737          throw new Error("Attempt to auto-create Library.document");
1738        else if (Configuration.doAutoCreate())
1739          this.document = new Attachment(); // cc
1740      return this.document;
1741    }
1742
1743    public boolean hasDocument() { 
1744      return this.document != null && !this.document.isEmpty();
1745    }
1746
1747    /**
1748     * @param value {@link #document} (The content of the library as an Attachment. The content may be a reference to a url, or may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.)
1749     */
1750    public Library setDocument(Attachment value) { 
1751      this.document = value;
1752      return this;
1753    }
1754
1755      protected void listChildren(List<Property> childrenList) {
1756        super.listChildren(childrenList);
1757        childrenList.add(new Property("moduleMetadata", "ModuleMetadata", "The metadata for the library, including publishing, life-cycle, version, documentation, and supporting evidence.", 0, java.lang.Integer.MAX_VALUE, moduleMetadata));
1758        childrenList.add(new Property("model", "", "A model element describes the model and version used by the library.", 0, java.lang.Integer.MAX_VALUE, model));
1759        childrenList.add(new Property("library", "", "A library element describes a library referenced by this library.", 0, java.lang.Integer.MAX_VALUE, library));
1760        childrenList.add(new Property("codeSystem", "", "A code system definition used within the library.", 0, java.lang.Integer.MAX_VALUE, codeSystem));
1761        childrenList.add(new Property("valueSet", "", "A value set definition referenced by the library.", 0, java.lang.Integer.MAX_VALUE, valueSet));
1762        childrenList.add(new Property("parameter", "ParameterDefinition", "The parameter element defines parameters used by the library.", 0, java.lang.Integer.MAX_VALUE, parameter));
1763        childrenList.add(new Property("dataRequirement", "DataRequirement", "The dataRequirement element specifies a data requirement used by some expression within the library.", 0, java.lang.Integer.MAX_VALUE, dataRequirement));
1764        childrenList.add(new Property("document", "Attachment", "The content of the library as an Attachment. The content may be a reference to a url, or may be directly embedded as a base-64 string. Either way, the content is expected to be a CQL or ELM document.", 0, java.lang.Integer.MAX_VALUE, document));
1765      }
1766
1767      @Override
1768      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1769        switch (hash) {
1770        case 455891387: /*moduleMetadata*/ return this.moduleMetadata == null ? new Base[0] : new Base[] {this.moduleMetadata}; // ModuleMetadata
1771        case 104069929: /*model*/ return this.model == null ? new Base[0] : this.model.toArray(new Base[this.model.size()]); // LibraryModelComponent
1772        case 166208699: /*library*/ return this.library == null ? new Base[0] : this.library.toArray(new Base[this.library.size()]); // LibraryLibraryComponent
1773        case -916511108: /*codeSystem*/ return this.codeSystem == null ? new Base[0] : this.codeSystem.toArray(new Base[this.codeSystem.size()]); // LibraryCodeSystemComponent
1774        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : this.valueSet.toArray(new Base[this.valueSet.size()]); // LibraryValueSetComponent
1775        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // ParameterDefinition
1776        case 629147193: /*dataRequirement*/ return this.dataRequirement == null ? new Base[0] : this.dataRequirement.toArray(new Base[this.dataRequirement.size()]); // DataRequirement
1777        case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Attachment
1778        default: return super.getProperty(hash, name, checkValid);
1779        }
1780
1781      }
1782
1783      @Override
1784      public void setProperty(int hash, String name, Base value) throws FHIRException {
1785        switch (hash) {
1786        case 455891387: // moduleMetadata
1787          this.moduleMetadata = castToModuleMetadata(value); // ModuleMetadata
1788          break;
1789        case 104069929: // model
1790          this.getModel().add((LibraryModelComponent) value); // LibraryModelComponent
1791          break;
1792        case 166208699: // library
1793          this.getLibrary().add((LibraryLibraryComponent) value); // LibraryLibraryComponent
1794          break;
1795        case -916511108: // codeSystem
1796          this.getCodeSystem().add((LibraryCodeSystemComponent) value); // LibraryCodeSystemComponent
1797          break;
1798        case -1410174671: // valueSet
1799          this.getValueSet().add((LibraryValueSetComponent) value); // LibraryValueSetComponent
1800          break;
1801        case 1954460585: // parameter
1802          this.getParameter().add(castToParameterDefinition(value)); // ParameterDefinition
1803          break;
1804        case 629147193: // dataRequirement
1805          this.getDataRequirement().add(castToDataRequirement(value)); // DataRequirement
1806          break;
1807        case 861720859: // document
1808          this.document = castToAttachment(value); // Attachment
1809          break;
1810        default: super.setProperty(hash, name, value);
1811        }
1812
1813      }
1814
1815      @Override
1816      public void setProperty(String name, Base value) throws FHIRException {
1817        if (name.equals("moduleMetadata"))
1818          this.moduleMetadata = castToModuleMetadata(value); // ModuleMetadata
1819        else if (name.equals("model"))
1820          this.getModel().add((LibraryModelComponent) value);
1821        else if (name.equals("library"))
1822          this.getLibrary().add((LibraryLibraryComponent) value);
1823        else if (name.equals("codeSystem"))
1824          this.getCodeSystem().add((LibraryCodeSystemComponent) value);
1825        else if (name.equals("valueSet"))
1826          this.getValueSet().add((LibraryValueSetComponent) value);
1827        else if (name.equals("parameter"))
1828          this.getParameter().add(castToParameterDefinition(value));
1829        else if (name.equals("dataRequirement"))
1830          this.getDataRequirement().add(castToDataRequirement(value));
1831        else if (name.equals("document"))
1832          this.document = castToAttachment(value); // Attachment
1833        else
1834          super.setProperty(name, value);
1835      }
1836
1837      @Override
1838      public Base makeProperty(int hash, String name) throws FHIRException {
1839        switch (hash) {
1840        case 455891387:  return getModuleMetadata(); // ModuleMetadata
1841        case 104069929:  return addModel(); // LibraryModelComponent
1842        case 166208699:  return addLibrary(); // LibraryLibraryComponent
1843        case -916511108:  return addCodeSystem(); // LibraryCodeSystemComponent
1844        case -1410174671:  return addValueSet(); // LibraryValueSetComponent
1845        case 1954460585:  return addParameter(); // ParameterDefinition
1846        case 629147193:  return addDataRequirement(); // DataRequirement
1847        case 861720859:  return getDocument(); // Attachment
1848        default: return super.makeProperty(hash, name);
1849        }
1850
1851      }
1852
1853      @Override
1854      public Base addChild(String name) throws FHIRException {
1855        if (name.equals("moduleMetadata")) {
1856          this.moduleMetadata = new ModuleMetadata();
1857          return this.moduleMetadata;
1858        }
1859        else if (name.equals("model")) {
1860          return addModel();
1861        }
1862        else if (name.equals("library")) {
1863          return addLibrary();
1864        }
1865        else if (name.equals("codeSystem")) {
1866          return addCodeSystem();
1867        }
1868        else if (name.equals("valueSet")) {
1869          return addValueSet();
1870        }
1871        else if (name.equals("parameter")) {
1872          return addParameter();
1873        }
1874        else if (name.equals("dataRequirement")) {
1875          return addDataRequirement();
1876        }
1877        else if (name.equals("document")) {
1878          this.document = new Attachment();
1879          return this.document;
1880        }
1881        else
1882          return super.addChild(name);
1883      }
1884
1885  public String fhirType() {
1886    return "Library";
1887
1888  }
1889
1890      public Library copy() {
1891        Library dst = new Library();
1892        copyValues(dst);
1893        dst.moduleMetadata = moduleMetadata == null ? null : moduleMetadata.copy();
1894        if (model != null) {
1895          dst.model = new ArrayList<LibraryModelComponent>();
1896          for (LibraryModelComponent i : model)
1897            dst.model.add(i.copy());
1898        };
1899        if (library != null) {
1900          dst.library = new ArrayList<LibraryLibraryComponent>();
1901          for (LibraryLibraryComponent i : library)
1902            dst.library.add(i.copy());
1903        };
1904        if (codeSystem != null) {
1905          dst.codeSystem = new ArrayList<LibraryCodeSystemComponent>();
1906          for (LibraryCodeSystemComponent i : codeSystem)
1907            dst.codeSystem.add(i.copy());
1908        };
1909        if (valueSet != null) {
1910          dst.valueSet = new ArrayList<LibraryValueSetComponent>();
1911          for (LibraryValueSetComponent i : valueSet)
1912            dst.valueSet.add(i.copy());
1913        };
1914        if (parameter != null) {
1915          dst.parameter = new ArrayList<ParameterDefinition>();
1916          for (ParameterDefinition i : parameter)
1917            dst.parameter.add(i.copy());
1918        };
1919        if (dataRequirement != null) {
1920          dst.dataRequirement = new ArrayList<DataRequirement>();
1921          for (DataRequirement i : dataRequirement)
1922            dst.dataRequirement.add(i.copy());
1923        };
1924        dst.document = document == null ? null : document.copy();
1925        return dst;
1926      }
1927
1928      protected Library typedCopy() {
1929        return copy();
1930      }
1931
1932      @Override
1933      public boolean equalsDeep(Base other) {
1934        if (!super.equalsDeep(other))
1935          return false;
1936        if (!(other instanceof Library))
1937          return false;
1938        Library o = (Library) other;
1939        return compareDeep(moduleMetadata, o.moduleMetadata, true) && compareDeep(model, o.model, true)
1940           && compareDeep(library, o.library, true) && compareDeep(codeSystem, o.codeSystem, true) && compareDeep(valueSet, o.valueSet, true)
1941           && compareDeep(parameter, o.parameter, true) && compareDeep(dataRequirement, o.dataRequirement, true)
1942           && compareDeep(document, o.document, true);
1943      }
1944
1945      @Override
1946      public boolean equalsShallow(Base other) {
1947        if (!super.equalsShallow(other))
1948          return false;
1949        if (!(other instanceof Library))
1950          return false;
1951        Library o = (Library) other;
1952        return true;
1953      }
1954
1955      public boolean isEmpty() {
1956        return super.isEmpty() && (moduleMetadata == null || moduleMetadata.isEmpty()) && (model == null || model.isEmpty())
1957           && (library == null || library.isEmpty()) && (codeSystem == null || codeSystem.isEmpty())
1958           && (valueSet == null || valueSet.isEmpty()) && (parameter == null || parameter.isEmpty())
1959           && (dataRequirement == null || dataRequirement.isEmpty()) && (document == null || document.isEmpty())
1960          ;
1961      }
1962
1963  @Override
1964  public ResourceType getResourceType() {
1965    return ResourceType.Library;
1966   }
1967
1968 /**
1969   * Search parameter: <b>topic</b>
1970   * <p>
1971   * Description: <b>Topics associated with the module</b><br>
1972   * Type: <b>token</b><br>
1973   * Path: <b>Library.moduleMetadata.topic</b><br>
1974   * </p>
1975   */
1976  @SearchParamDefinition(name="topic", path="Library.moduleMetadata.topic", description="Topics associated with the module", type="token" )
1977  public static final String SP_TOPIC = "topic";
1978 /**
1979   * <b>Fluent Client</b> search parameter constant for <b>topic</b>
1980   * <p>
1981   * Description: <b>Topics associated with the module</b><br>
1982   * Type: <b>token</b><br>
1983   * Path: <b>Library.moduleMetadata.topic</b><br>
1984   * </p>
1985   */
1986  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TOPIC = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TOPIC);
1987
1988 /**
1989   * Search parameter: <b>title</b>
1990   * <p>
1991   * Description: <b>Text search against the title</b><br>
1992   * Type: <b>string</b><br>
1993   * Path: <b>Library.moduleMetadata.title</b><br>
1994   * </p>
1995   */
1996  @SearchParamDefinition(name="title", path="Library.moduleMetadata.title", description="Text search against the title", type="string" )
1997  public static final String SP_TITLE = "title";
1998 /**
1999   * <b>Fluent Client</b> search parameter constant for <b>title</b>
2000   * <p>
2001   * Description: <b>Text search against the title</b><br>
2002   * Type: <b>string</b><br>
2003   * Path: <b>Library.moduleMetadata.title</b><br>
2004   * </p>
2005   */
2006  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
2007
2008 /**
2009   * Search parameter: <b>status</b>
2010   * <p>
2011   * Description: <b>Status of the module</b><br>
2012   * Type: <b>token</b><br>
2013   * Path: <b>Library.moduleMetadata.status</b><br>
2014   * </p>
2015   */
2016  @SearchParamDefinition(name="status", path="Library.moduleMetadata.status", description="Status of the module", type="token" )
2017  public static final String SP_STATUS = "status";
2018 /**
2019   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2020   * <p>
2021   * Description: <b>Status of the module</b><br>
2022   * Type: <b>token</b><br>
2023   * Path: <b>Library.moduleMetadata.status</b><br>
2024   * </p>
2025   */
2026  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2027
2028 /**
2029   * Search parameter: <b>description</b>
2030   * <p>
2031   * Description: <b>Text search against the description</b><br>
2032   * Type: <b>string</b><br>
2033   * Path: <b>Library.moduleMetadata.description</b><br>
2034   * </p>
2035   */
2036  @SearchParamDefinition(name="description", path="Library.moduleMetadata.description", description="Text search against the description", type="string" )
2037  public static final String SP_DESCRIPTION = "description";
2038 /**
2039   * <b>Fluent Client</b> search parameter constant for <b>description</b>
2040   * <p>
2041   * Description: <b>Text search against the description</b><br>
2042   * Type: <b>string</b><br>
2043   * Path: <b>Library.moduleMetadata.description</b><br>
2044   * </p>
2045   */
2046  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
2047
2048 /**
2049   * Search parameter: <b>identifier</b>
2050   * <p>
2051   * Description: <b>Logical identifier for the module (e.g. CMS-143)</b><br>
2052   * Type: <b>token</b><br>
2053   * Path: <b>Library.moduleMetadata.identifier</b><br>
2054   * </p>
2055   */
2056  @SearchParamDefinition(name="identifier", path="Library.moduleMetadata.identifier", description="Logical identifier for the module (e.g. CMS-143)", type="token" )
2057  public static final String SP_IDENTIFIER = "identifier";
2058 /**
2059   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2060   * <p>
2061   * Description: <b>Logical identifier for the module (e.g. CMS-143)</b><br>
2062   * Type: <b>token</b><br>
2063   * Path: <b>Library.moduleMetadata.identifier</b><br>
2064   * </p>
2065   */
2066  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2067
2068 /**
2069   * Search parameter: <b>version</b>
2070   * <p>
2071   * Description: <b>Version of the module (e.g. 1.0.0)</b><br>
2072   * Type: <b>string</b><br>
2073   * Path: <b>Library.moduleMetadata.version</b><br>
2074   * </p>
2075   */
2076  @SearchParamDefinition(name="version", path="Library.moduleMetadata.version", description="Version of the module (e.g. 1.0.0)", type="string" )
2077  public static final String SP_VERSION = "version";
2078 /**
2079   * <b>Fluent Client</b> search parameter constant for <b>version</b>
2080   * <p>
2081   * Description: <b>Version of the module (e.g. 1.0.0)</b><br>
2082   * Type: <b>string</b><br>
2083   * Path: <b>Library.moduleMetadata.version</b><br>
2084   * </p>
2085   */
2086  public static final ca.uhn.fhir.rest.gclient.StringClientParam VERSION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_VERSION);
2087
2088
2089}
2090