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