001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.ResourceDef; 038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.ChildOrder; 041import ca.uhn.fhir.model.api.annotation.Description; 042import ca.uhn.fhir.model.api.annotation.Block; 043import org.hl7.fhir.instance.model.api.*; 044import org.hl7.fhir.exceptions.FHIRException; 045/** 046 * Todo. 047 */ 048@ResourceDef(name="SubstanceReferenceInformation", profile="http://hl7.org/fhir/Profile/SubstanceReferenceInformation") 049public class SubstanceReferenceInformation extends DomainResource { 050 051 @Block() 052 public static class SubstanceReferenceInformationGeneComponent extends BackboneElement implements IBaseBackboneElement { 053 /** 054 * Todo. 055 */ 056 @Child(name = "geneSequenceOrigin", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 057 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 058 protected CodeableConcept geneSequenceOrigin; 059 060 /** 061 * Todo. 062 */ 063 @Child(name = "gene", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 064 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 065 protected CodeableConcept gene; 066 067 /** 068 * Todo. 069 */ 070 @Child(name = "source", type = {DocumentReference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 071 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 072 protected List<Reference> source; 073 /** 074 * The actual objects that are the target of the reference (Todo.) 075 */ 076 protected List<DocumentReference> sourceTarget; 077 078 079 private static final long serialVersionUID = 1615185105L; 080 081 /** 082 * Constructor 083 */ 084 public SubstanceReferenceInformationGeneComponent() { 085 super(); 086 } 087 088 /** 089 * @return {@link #geneSequenceOrigin} (Todo.) 090 */ 091 public CodeableConcept getGeneSequenceOrigin() { 092 if (this.geneSequenceOrigin == null) 093 if (Configuration.errorOnAutoCreate()) 094 throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneComponent.geneSequenceOrigin"); 095 else if (Configuration.doAutoCreate()) 096 this.geneSequenceOrigin = new CodeableConcept(); // cc 097 return this.geneSequenceOrigin; 098 } 099 100 public boolean hasGeneSequenceOrigin() { 101 return this.geneSequenceOrigin != null && !this.geneSequenceOrigin.isEmpty(); 102 } 103 104 /** 105 * @param value {@link #geneSequenceOrigin} (Todo.) 106 */ 107 public SubstanceReferenceInformationGeneComponent setGeneSequenceOrigin(CodeableConcept value) { 108 this.geneSequenceOrigin = value; 109 return this; 110 } 111 112 /** 113 * @return {@link #gene} (Todo.) 114 */ 115 public CodeableConcept getGene() { 116 if (this.gene == null) 117 if (Configuration.errorOnAutoCreate()) 118 throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneComponent.gene"); 119 else if (Configuration.doAutoCreate()) 120 this.gene = new CodeableConcept(); // cc 121 return this.gene; 122 } 123 124 public boolean hasGene() { 125 return this.gene != null && !this.gene.isEmpty(); 126 } 127 128 /** 129 * @param value {@link #gene} (Todo.) 130 */ 131 public SubstanceReferenceInformationGeneComponent setGene(CodeableConcept value) { 132 this.gene = value; 133 return this; 134 } 135 136 /** 137 * @return {@link #source} (Todo.) 138 */ 139 public List<Reference> getSource() { 140 if (this.source == null) 141 this.source = new ArrayList<Reference>(); 142 return this.source; 143 } 144 145 /** 146 * @return Returns a reference to <code>this</code> for easy method chaining 147 */ 148 public SubstanceReferenceInformationGeneComponent setSource(List<Reference> theSource) { 149 this.source = theSource; 150 return this; 151 } 152 153 public boolean hasSource() { 154 if (this.source == null) 155 return false; 156 for (Reference item : this.source) 157 if (!item.isEmpty()) 158 return true; 159 return false; 160 } 161 162 public Reference addSource() { //3 163 Reference t = new Reference(); 164 if (this.source == null) 165 this.source = new ArrayList<Reference>(); 166 this.source.add(t); 167 return t; 168 } 169 170 public SubstanceReferenceInformationGeneComponent addSource(Reference t) { //3 171 if (t == null) 172 return this; 173 if (this.source == null) 174 this.source = new ArrayList<Reference>(); 175 this.source.add(t); 176 return this; 177 } 178 179 /** 180 * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist 181 */ 182 public Reference getSourceFirstRep() { 183 if (getSource().isEmpty()) { 184 addSource(); 185 } 186 return getSource().get(0); 187 } 188 189 /** 190 * @deprecated Use Reference#setResource(IBaseResource) instead 191 */ 192 @Deprecated 193 public List<DocumentReference> getSourceTarget() { 194 if (this.sourceTarget == null) 195 this.sourceTarget = new ArrayList<DocumentReference>(); 196 return this.sourceTarget; 197 } 198 199 /** 200 * @deprecated Use Reference#setResource(IBaseResource) instead 201 */ 202 @Deprecated 203 public DocumentReference addSourceTarget() { 204 DocumentReference r = new DocumentReference(); 205 if (this.sourceTarget == null) 206 this.sourceTarget = new ArrayList<DocumentReference>(); 207 this.sourceTarget.add(r); 208 return r; 209 } 210 211 protected void listChildren(List<Property> children) { 212 super.listChildren(children); 213 children.add(new Property("geneSequenceOrigin", "CodeableConcept", "Todo.", 0, 1, geneSequenceOrigin)); 214 children.add(new Property("gene", "CodeableConcept", "Todo.", 0, 1, gene)); 215 children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 216 } 217 218 @Override 219 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 220 switch (_hash) { 221 case -1089463108: /*geneSequenceOrigin*/ return new Property("geneSequenceOrigin", "CodeableConcept", "Todo.", 0, 1, geneSequenceOrigin); 222 case 3169045: /*gene*/ return new Property("gene", "CodeableConcept", "Todo.", 0, 1, gene); 223 case -896505829: /*source*/ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source); 224 default: return super.getNamedProperty(_hash, _name, _checkValid); 225 } 226 227 } 228 229 @Override 230 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 231 switch (hash) { 232 case -1089463108: /*geneSequenceOrigin*/ return this.geneSequenceOrigin == null ? new Base[0] : new Base[] {this.geneSequenceOrigin}; // CodeableConcept 233 case 3169045: /*gene*/ return this.gene == null ? new Base[0] : new Base[] {this.gene}; // CodeableConcept 234 case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 235 default: return super.getProperty(hash, name, checkValid); 236 } 237 238 } 239 240 @Override 241 public Base setProperty(int hash, String name, Base value) throws FHIRException { 242 switch (hash) { 243 case -1089463108: // geneSequenceOrigin 244 this.geneSequenceOrigin = castToCodeableConcept(value); // CodeableConcept 245 return value; 246 case 3169045: // gene 247 this.gene = castToCodeableConcept(value); // CodeableConcept 248 return value; 249 case -896505829: // source 250 this.getSource().add(castToReference(value)); // Reference 251 return value; 252 default: return super.setProperty(hash, name, value); 253 } 254 255 } 256 257 @Override 258 public Base setProperty(String name, Base value) throws FHIRException { 259 if (name.equals("geneSequenceOrigin")) { 260 this.geneSequenceOrigin = castToCodeableConcept(value); // CodeableConcept 261 } else if (name.equals("gene")) { 262 this.gene = castToCodeableConcept(value); // CodeableConcept 263 } else if (name.equals("source")) { 264 this.getSource().add(castToReference(value)); 265 } else 266 return super.setProperty(name, value); 267 return value; 268 } 269 270 @Override 271 public Base makeProperty(int hash, String name) throws FHIRException { 272 switch (hash) { 273 case -1089463108: return getGeneSequenceOrigin(); 274 case 3169045: return getGene(); 275 case -896505829: return addSource(); 276 default: return super.makeProperty(hash, name); 277 } 278 279 } 280 281 @Override 282 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 283 switch (hash) { 284 case -1089463108: /*geneSequenceOrigin*/ return new String[] {"CodeableConcept"}; 285 case 3169045: /*gene*/ return new String[] {"CodeableConcept"}; 286 case -896505829: /*source*/ return new String[] {"Reference"}; 287 default: return super.getTypesForProperty(hash, name); 288 } 289 290 } 291 292 @Override 293 public Base addChild(String name) throws FHIRException { 294 if (name.equals("geneSequenceOrigin")) { 295 this.geneSequenceOrigin = new CodeableConcept(); 296 return this.geneSequenceOrigin; 297 } 298 else if (name.equals("gene")) { 299 this.gene = new CodeableConcept(); 300 return this.gene; 301 } 302 else if (name.equals("source")) { 303 return addSource(); 304 } 305 else 306 return super.addChild(name); 307 } 308 309 public SubstanceReferenceInformationGeneComponent copy() { 310 SubstanceReferenceInformationGeneComponent dst = new SubstanceReferenceInformationGeneComponent(); 311 copyValues(dst); 312 dst.geneSequenceOrigin = geneSequenceOrigin == null ? null : geneSequenceOrigin.copy(); 313 dst.gene = gene == null ? null : gene.copy(); 314 if (source != null) { 315 dst.source = new ArrayList<Reference>(); 316 for (Reference i : source) 317 dst.source.add(i.copy()); 318 }; 319 return dst; 320 } 321 322 @Override 323 public boolean equalsDeep(Base other_) { 324 if (!super.equalsDeep(other_)) 325 return false; 326 if (!(other_ instanceof SubstanceReferenceInformationGeneComponent)) 327 return false; 328 SubstanceReferenceInformationGeneComponent o = (SubstanceReferenceInformationGeneComponent) other_; 329 return compareDeep(geneSequenceOrigin, o.geneSequenceOrigin, true) && compareDeep(gene, o.gene, true) 330 && compareDeep(source, o.source, true); 331 } 332 333 @Override 334 public boolean equalsShallow(Base other_) { 335 if (!super.equalsShallow(other_)) 336 return false; 337 if (!(other_ instanceof SubstanceReferenceInformationGeneComponent)) 338 return false; 339 SubstanceReferenceInformationGeneComponent o = (SubstanceReferenceInformationGeneComponent) other_; 340 return true; 341 } 342 343 public boolean isEmpty() { 344 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(geneSequenceOrigin, gene, source 345 ); 346 } 347 348 public String fhirType() { 349 return "SubstanceReferenceInformation.gene"; 350 351 } 352 353 } 354 355 @Block() 356 public static class SubstanceReferenceInformationGeneElementComponent extends BackboneElement implements IBaseBackboneElement { 357 /** 358 * Todo. 359 */ 360 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 361 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 362 protected CodeableConcept type; 363 364 /** 365 * Todo. 366 */ 367 @Child(name = "element", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=true) 368 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 369 protected Identifier element; 370 371 /** 372 * Todo. 373 */ 374 @Child(name = "source", type = {DocumentReference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 375 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 376 protected List<Reference> source; 377 /** 378 * The actual objects that are the target of the reference (Todo.) 379 */ 380 protected List<DocumentReference> sourceTarget; 381 382 383 private static final long serialVersionUID = 2055145950L; 384 385 /** 386 * Constructor 387 */ 388 public SubstanceReferenceInformationGeneElementComponent() { 389 super(); 390 } 391 392 /** 393 * @return {@link #type} (Todo.) 394 */ 395 public CodeableConcept getType() { 396 if (this.type == null) 397 if (Configuration.errorOnAutoCreate()) 398 throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneElementComponent.type"); 399 else if (Configuration.doAutoCreate()) 400 this.type = new CodeableConcept(); // cc 401 return this.type; 402 } 403 404 public boolean hasType() { 405 return this.type != null && !this.type.isEmpty(); 406 } 407 408 /** 409 * @param value {@link #type} (Todo.) 410 */ 411 public SubstanceReferenceInformationGeneElementComponent setType(CodeableConcept value) { 412 this.type = value; 413 return this; 414 } 415 416 /** 417 * @return {@link #element} (Todo.) 418 */ 419 public Identifier getElement() { 420 if (this.element == null) 421 if (Configuration.errorOnAutoCreate()) 422 throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneElementComponent.element"); 423 else if (Configuration.doAutoCreate()) 424 this.element = new Identifier(); // cc 425 return this.element; 426 } 427 428 public boolean hasElement() { 429 return this.element != null && !this.element.isEmpty(); 430 } 431 432 /** 433 * @param value {@link #element} (Todo.) 434 */ 435 public SubstanceReferenceInformationGeneElementComponent setElement(Identifier value) { 436 this.element = value; 437 return this; 438 } 439 440 /** 441 * @return {@link #source} (Todo.) 442 */ 443 public List<Reference> getSource() { 444 if (this.source == null) 445 this.source = new ArrayList<Reference>(); 446 return this.source; 447 } 448 449 /** 450 * @return Returns a reference to <code>this</code> for easy method chaining 451 */ 452 public SubstanceReferenceInformationGeneElementComponent setSource(List<Reference> theSource) { 453 this.source = theSource; 454 return this; 455 } 456 457 public boolean hasSource() { 458 if (this.source == null) 459 return false; 460 for (Reference item : this.source) 461 if (!item.isEmpty()) 462 return true; 463 return false; 464 } 465 466 public Reference addSource() { //3 467 Reference t = new Reference(); 468 if (this.source == null) 469 this.source = new ArrayList<Reference>(); 470 this.source.add(t); 471 return t; 472 } 473 474 public SubstanceReferenceInformationGeneElementComponent addSource(Reference t) { //3 475 if (t == null) 476 return this; 477 if (this.source == null) 478 this.source = new ArrayList<Reference>(); 479 this.source.add(t); 480 return this; 481 } 482 483 /** 484 * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist 485 */ 486 public Reference getSourceFirstRep() { 487 if (getSource().isEmpty()) { 488 addSource(); 489 } 490 return getSource().get(0); 491 } 492 493 /** 494 * @deprecated Use Reference#setResource(IBaseResource) instead 495 */ 496 @Deprecated 497 public List<DocumentReference> getSourceTarget() { 498 if (this.sourceTarget == null) 499 this.sourceTarget = new ArrayList<DocumentReference>(); 500 return this.sourceTarget; 501 } 502 503 /** 504 * @deprecated Use Reference#setResource(IBaseResource) instead 505 */ 506 @Deprecated 507 public DocumentReference addSourceTarget() { 508 DocumentReference r = new DocumentReference(); 509 if (this.sourceTarget == null) 510 this.sourceTarget = new ArrayList<DocumentReference>(); 511 this.sourceTarget.add(r); 512 return r; 513 } 514 515 protected void listChildren(List<Property> children) { 516 super.listChildren(children); 517 children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type)); 518 children.add(new Property("element", "Identifier", "Todo.", 0, 1, element)); 519 children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 520 } 521 522 @Override 523 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 524 switch (_hash) { 525 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "Todo.", 0, 1, type); 526 case -1662836996: /*element*/ return new Property("element", "Identifier", "Todo.", 0, 1, element); 527 case -896505829: /*source*/ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source); 528 default: return super.getNamedProperty(_hash, _name, _checkValid); 529 } 530 531 } 532 533 @Override 534 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 535 switch (hash) { 536 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 537 case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // Identifier 538 case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 539 default: return super.getProperty(hash, name, checkValid); 540 } 541 542 } 543 544 @Override 545 public Base setProperty(int hash, String name, Base value) throws FHIRException { 546 switch (hash) { 547 case 3575610: // type 548 this.type = castToCodeableConcept(value); // CodeableConcept 549 return value; 550 case -1662836996: // element 551 this.element = castToIdentifier(value); // Identifier 552 return value; 553 case -896505829: // source 554 this.getSource().add(castToReference(value)); // Reference 555 return value; 556 default: return super.setProperty(hash, name, value); 557 } 558 559 } 560 561 @Override 562 public Base setProperty(String name, Base value) throws FHIRException { 563 if (name.equals("type")) { 564 this.type = castToCodeableConcept(value); // CodeableConcept 565 } else if (name.equals("element")) { 566 this.element = castToIdentifier(value); // Identifier 567 } else if (name.equals("source")) { 568 this.getSource().add(castToReference(value)); 569 } else 570 return super.setProperty(name, value); 571 return value; 572 } 573 574 @Override 575 public Base makeProperty(int hash, String name) throws FHIRException { 576 switch (hash) { 577 case 3575610: return getType(); 578 case -1662836996: return getElement(); 579 case -896505829: return addSource(); 580 default: return super.makeProperty(hash, name); 581 } 582 583 } 584 585 @Override 586 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 587 switch (hash) { 588 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 589 case -1662836996: /*element*/ return new String[] {"Identifier"}; 590 case -896505829: /*source*/ return new String[] {"Reference"}; 591 default: return super.getTypesForProperty(hash, name); 592 } 593 594 } 595 596 @Override 597 public Base addChild(String name) throws FHIRException { 598 if (name.equals("type")) { 599 this.type = new CodeableConcept(); 600 return this.type; 601 } 602 else if (name.equals("element")) { 603 this.element = new Identifier(); 604 return this.element; 605 } 606 else if (name.equals("source")) { 607 return addSource(); 608 } 609 else 610 return super.addChild(name); 611 } 612 613 public SubstanceReferenceInformationGeneElementComponent copy() { 614 SubstanceReferenceInformationGeneElementComponent dst = new SubstanceReferenceInformationGeneElementComponent(); 615 copyValues(dst); 616 dst.type = type == null ? null : type.copy(); 617 dst.element = element == null ? null : element.copy(); 618 if (source != null) { 619 dst.source = new ArrayList<Reference>(); 620 for (Reference i : source) 621 dst.source.add(i.copy()); 622 }; 623 return dst; 624 } 625 626 @Override 627 public boolean equalsDeep(Base other_) { 628 if (!super.equalsDeep(other_)) 629 return false; 630 if (!(other_ instanceof SubstanceReferenceInformationGeneElementComponent)) 631 return false; 632 SubstanceReferenceInformationGeneElementComponent o = (SubstanceReferenceInformationGeneElementComponent) other_; 633 return compareDeep(type, o.type, true) && compareDeep(element, o.element, true) && compareDeep(source, o.source, true) 634 ; 635 } 636 637 @Override 638 public boolean equalsShallow(Base other_) { 639 if (!super.equalsShallow(other_)) 640 return false; 641 if (!(other_ instanceof SubstanceReferenceInformationGeneElementComponent)) 642 return false; 643 SubstanceReferenceInformationGeneElementComponent o = (SubstanceReferenceInformationGeneElementComponent) other_; 644 return true; 645 } 646 647 public boolean isEmpty() { 648 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, element, source); 649 } 650 651 public String fhirType() { 652 return "SubstanceReferenceInformation.geneElement"; 653 654 } 655 656 } 657 658 @Block() 659 public static class SubstanceReferenceInformationClassificationComponent extends BackboneElement implements IBaseBackboneElement { 660 /** 661 * Todo. 662 */ 663 @Child(name = "domain", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 664 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 665 protected CodeableConcept domain; 666 667 /** 668 * Todo. 669 */ 670 @Child(name = "classification", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 671 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 672 protected CodeableConcept classification; 673 674 /** 675 * Todo. 676 */ 677 @Child(name = "subtype", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 678 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 679 protected List<CodeableConcept> subtype; 680 681 /** 682 * Todo. 683 */ 684 @Child(name = "source", type = {DocumentReference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 685 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 686 protected List<Reference> source; 687 /** 688 * The actual objects that are the target of the reference (Todo.) 689 */ 690 protected List<DocumentReference> sourceTarget; 691 692 693 private static final long serialVersionUID = -430084579L; 694 695 /** 696 * Constructor 697 */ 698 public SubstanceReferenceInformationClassificationComponent() { 699 super(); 700 } 701 702 /** 703 * @return {@link #domain} (Todo.) 704 */ 705 public CodeableConcept getDomain() { 706 if (this.domain == null) 707 if (Configuration.errorOnAutoCreate()) 708 throw new Error("Attempt to auto-create SubstanceReferenceInformationClassificationComponent.domain"); 709 else if (Configuration.doAutoCreate()) 710 this.domain = new CodeableConcept(); // cc 711 return this.domain; 712 } 713 714 public boolean hasDomain() { 715 return this.domain != null && !this.domain.isEmpty(); 716 } 717 718 /** 719 * @param value {@link #domain} (Todo.) 720 */ 721 public SubstanceReferenceInformationClassificationComponent setDomain(CodeableConcept value) { 722 this.domain = value; 723 return this; 724 } 725 726 /** 727 * @return {@link #classification} (Todo.) 728 */ 729 public CodeableConcept getClassification() { 730 if (this.classification == null) 731 if (Configuration.errorOnAutoCreate()) 732 throw new Error("Attempt to auto-create SubstanceReferenceInformationClassificationComponent.classification"); 733 else if (Configuration.doAutoCreate()) 734 this.classification = new CodeableConcept(); // cc 735 return this.classification; 736 } 737 738 public boolean hasClassification() { 739 return this.classification != null && !this.classification.isEmpty(); 740 } 741 742 /** 743 * @param value {@link #classification} (Todo.) 744 */ 745 public SubstanceReferenceInformationClassificationComponent setClassification(CodeableConcept value) { 746 this.classification = value; 747 return this; 748 } 749 750 /** 751 * @return {@link #subtype} (Todo.) 752 */ 753 public List<CodeableConcept> getSubtype() { 754 if (this.subtype == null) 755 this.subtype = new ArrayList<CodeableConcept>(); 756 return this.subtype; 757 } 758 759 /** 760 * @return Returns a reference to <code>this</code> for easy method chaining 761 */ 762 public SubstanceReferenceInformationClassificationComponent setSubtype(List<CodeableConcept> theSubtype) { 763 this.subtype = theSubtype; 764 return this; 765 } 766 767 public boolean hasSubtype() { 768 if (this.subtype == null) 769 return false; 770 for (CodeableConcept item : this.subtype) 771 if (!item.isEmpty()) 772 return true; 773 return false; 774 } 775 776 public CodeableConcept addSubtype() { //3 777 CodeableConcept t = new CodeableConcept(); 778 if (this.subtype == null) 779 this.subtype = new ArrayList<CodeableConcept>(); 780 this.subtype.add(t); 781 return t; 782 } 783 784 public SubstanceReferenceInformationClassificationComponent addSubtype(CodeableConcept t) { //3 785 if (t == null) 786 return this; 787 if (this.subtype == null) 788 this.subtype = new ArrayList<CodeableConcept>(); 789 this.subtype.add(t); 790 return this; 791 } 792 793 /** 794 * @return The first repetition of repeating field {@link #subtype}, creating it if it does not already exist 795 */ 796 public CodeableConcept getSubtypeFirstRep() { 797 if (getSubtype().isEmpty()) { 798 addSubtype(); 799 } 800 return getSubtype().get(0); 801 } 802 803 /** 804 * @return {@link #source} (Todo.) 805 */ 806 public List<Reference> getSource() { 807 if (this.source == null) 808 this.source = new ArrayList<Reference>(); 809 return this.source; 810 } 811 812 /** 813 * @return Returns a reference to <code>this</code> for easy method chaining 814 */ 815 public SubstanceReferenceInformationClassificationComponent setSource(List<Reference> theSource) { 816 this.source = theSource; 817 return this; 818 } 819 820 public boolean hasSource() { 821 if (this.source == null) 822 return false; 823 for (Reference item : this.source) 824 if (!item.isEmpty()) 825 return true; 826 return false; 827 } 828 829 public Reference addSource() { //3 830 Reference t = new Reference(); 831 if (this.source == null) 832 this.source = new ArrayList<Reference>(); 833 this.source.add(t); 834 return t; 835 } 836 837 public SubstanceReferenceInformationClassificationComponent addSource(Reference t) { //3 838 if (t == null) 839 return this; 840 if (this.source == null) 841 this.source = new ArrayList<Reference>(); 842 this.source.add(t); 843 return this; 844 } 845 846 /** 847 * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist 848 */ 849 public Reference getSourceFirstRep() { 850 if (getSource().isEmpty()) { 851 addSource(); 852 } 853 return getSource().get(0); 854 } 855 856 /** 857 * @deprecated Use Reference#setResource(IBaseResource) instead 858 */ 859 @Deprecated 860 public List<DocumentReference> getSourceTarget() { 861 if (this.sourceTarget == null) 862 this.sourceTarget = new ArrayList<DocumentReference>(); 863 return this.sourceTarget; 864 } 865 866 /** 867 * @deprecated Use Reference#setResource(IBaseResource) instead 868 */ 869 @Deprecated 870 public DocumentReference addSourceTarget() { 871 DocumentReference r = new DocumentReference(); 872 if (this.sourceTarget == null) 873 this.sourceTarget = new ArrayList<DocumentReference>(); 874 this.sourceTarget.add(r); 875 return r; 876 } 877 878 protected void listChildren(List<Property> children) { 879 super.listChildren(children); 880 children.add(new Property("domain", "CodeableConcept", "Todo.", 0, 1, domain)); 881 children.add(new Property("classification", "CodeableConcept", "Todo.", 0, 1, classification)); 882 children.add(new Property("subtype", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, subtype)); 883 children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 884 } 885 886 @Override 887 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 888 switch (_hash) { 889 case -1326197564: /*domain*/ return new Property("domain", "CodeableConcept", "Todo.", 0, 1, domain); 890 case 382350310: /*classification*/ return new Property("classification", "CodeableConcept", "Todo.", 0, 1, classification); 891 case -1867567750: /*subtype*/ return new Property("subtype", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, subtype); 892 case -896505829: /*source*/ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source); 893 default: return super.getNamedProperty(_hash, _name, _checkValid); 894 } 895 896 } 897 898 @Override 899 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 900 switch (hash) { 901 case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : new Base[] {this.domain}; // CodeableConcept 902 case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // CodeableConcept 903 case -1867567750: /*subtype*/ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept 904 case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 905 default: return super.getProperty(hash, name, checkValid); 906 } 907 908 } 909 910 @Override 911 public Base setProperty(int hash, String name, Base value) throws FHIRException { 912 switch (hash) { 913 case -1326197564: // domain 914 this.domain = castToCodeableConcept(value); // CodeableConcept 915 return value; 916 case 382350310: // classification 917 this.classification = castToCodeableConcept(value); // CodeableConcept 918 return value; 919 case -1867567750: // subtype 920 this.getSubtype().add(castToCodeableConcept(value)); // CodeableConcept 921 return value; 922 case -896505829: // source 923 this.getSource().add(castToReference(value)); // Reference 924 return value; 925 default: return super.setProperty(hash, name, value); 926 } 927 928 } 929 930 @Override 931 public Base setProperty(String name, Base value) throws FHIRException { 932 if (name.equals("domain")) { 933 this.domain = castToCodeableConcept(value); // CodeableConcept 934 } else if (name.equals("classification")) { 935 this.classification = castToCodeableConcept(value); // CodeableConcept 936 } else if (name.equals("subtype")) { 937 this.getSubtype().add(castToCodeableConcept(value)); 938 } else if (name.equals("source")) { 939 this.getSource().add(castToReference(value)); 940 } else 941 return super.setProperty(name, value); 942 return value; 943 } 944 945 @Override 946 public Base makeProperty(int hash, String name) throws FHIRException { 947 switch (hash) { 948 case -1326197564: return getDomain(); 949 case 382350310: return getClassification(); 950 case -1867567750: return addSubtype(); 951 case -896505829: return addSource(); 952 default: return super.makeProperty(hash, name); 953 } 954 955 } 956 957 @Override 958 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 959 switch (hash) { 960 case -1326197564: /*domain*/ return new String[] {"CodeableConcept"}; 961 case 382350310: /*classification*/ return new String[] {"CodeableConcept"}; 962 case -1867567750: /*subtype*/ return new String[] {"CodeableConcept"}; 963 case -896505829: /*source*/ return new String[] {"Reference"}; 964 default: return super.getTypesForProperty(hash, name); 965 } 966 967 } 968 969 @Override 970 public Base addChild(String name) throws FHIRException { 971 if (name.equals("domain")) { 972 this.domain = new CodeableConcept(); 973 return this.domain; 974 } 975 else if (name.equals("classification")) { 976 this.classification = new CodeableConcept(); 977 return this.classification; 978 } 979 else if (name.equals("subtype")) { 980 return addSubtype(); 981 } 982 else if (name.equals("source")) { 983 return addSource(); 984 } 985 else 986 return super.addChild(name); 987 } 988 989 public SubstanceReferenceInformationClassificationComponent copy() { 990 SubstanceReferenceInformationClassificationComponent dst = new SubstanceReferenceInformationClassificationComponent(); 991 copyValues(dst); 992 dst.domain = domain == null ? null : domain.copy(); 993 dst.classification = classification == null ? null : classification.copy(); 994 if (subtype != null) { 995 dst.subtype = new ArrayList<CodeableConcept>(); 996 for (CodeableConcept i : subtype) 997 dst.subtype.add(i.copy()); 998 }; 999 if (source != null) { 1000 dst.source = new ArrayList<Reference>(); 1001 for (Reference i : source) 1002 dst.source.add(i.copy()); 1003 }; 1004 return dst; 1005 } 1006 1007 @Override 1008 public boolean equalsDeep(Base other_) { 1009 if (!super.equalsDeep(other_)) 1010 return false; 1011 if (!(other_ instanceof SubstanceReferenceInformationClassificationComponent)) 1012 return false; 1013 SubstanceReferenceInformationClassificationComponent o = (SubstanceReferenceInformationClassificationComponent) other_; 1014 return compareDeep(domain, o.domain, true) && compareDeep(classification, o.classification, true) 1015 && compareDeep(subtype, o.subtype, true) && compareDeep(source, o.source, true); 1016 } 1017 1018 @Override 1019 public boolean equalsShallow(Base other_) { 1020 if (!super.equalsShallow(other_)) 1021 return false; 1022 if (!(other_ instanceof SubstanceReferenceInformationClassificationComponent)) 1023 return false; 1024 SubstanceReferenceInformationClassificationComponent o = (SubstanceReferenceInformationClassificationComponent) other_; 1025 return true; 1026 } 1027 1028 public boolean isEmpty() { 1029 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(domain, classification, subtype 1030 , source); 1031 } 1032 1033 public String fhirType() { 1034 return "SubstanceReferenceInformation.classification"; 1035 1036 } 1037 1038 } 1039 1040 @Block() 1041 public static class SubstanceReferenceInformationRelationshipComponent extends BackboneElement implements IBaseBackboneElement { 1042 /** 1043 * Todo. 1044 */ 1045 @Child(name = "substance", type = {SubstanceSpecification.class, CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 1046 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1047 protected Type substance; 1048 1049 /** 1050 * Todo. 1051 */ 1052 @Child(name = "relationship", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 1053 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1054 protected CodeableConcept relationship; 1055 1056 /** 1057 * Todo. 1058 */ 1059 @Child(name = "interaction", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 1060 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1061 protected CodeableConcept interaction; 1062 1063 /** 1064 * Todo. 1065 */ 1066 @Child(name = "isDefining", type = {BooleanType.class}, order=4, min=0, max=1, modifier=false, summary=true) 1067 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1068 protected BooleanType isDefining; 1069 1070 /** 1071 * Todo. 1072 */ 1073 @Child(name = "amount", type = {Quantity.class, Range.class, StringType.class}, order=5, min=0, max=1, modifier=false, summary=true) 1074 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1075 protected Type amount; 1076 1077 /** 1078 * Todo. 1079 */ 1080 @Child(name = "amountType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true) 1081 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1082 protected CodeableConcept amountType; 1083 1084 /** 1085 * Todo. 1086 */ 1087 @Child(name = "amountText", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true) 1088 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1089 protected StringType amountText; 1090 1091 /** 1092 * Todo. 1093 */ 1094 @Child(name = "source", type = {DocumentReference.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1095 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1096 protected List<Reference> source; 1097 /** 1098 * The actual objects that are the target of the reference (Todo.) 1099 */ 1100 protected List<DocumentReference> sourceTarget; 1101 1102 1103 private static final long serialVersionUID = -2035399193L; 1104 1105 /** 1106 * Constructor 1107 */ 1108 public SubstanceReferenceInformationRelationshipComponent() { 1109 super(); 1110 } 1111 1112 /** 1113 * @return {@link #substance} (Todo.) 1114 */ 1115 public Type getSubstance() { 1116 return this.substance; 1117 } 1118 1119 /** 1120 * @return {@link #substance} (Todo.) 1121 */ 1122 public Reference getSubstanceReference() throws FHIRException { 1123 if (this.substance == null) 1124 return null; 1125 if (!(this.substance instanceof Reference)) 1126 throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.substance.getClass().getName()+" was encountered"); 1127 return (Reference) this.substance; 1128 } 1129 1130 public boolean hasSubstanceReference() { 1131 return this != null && this.substance instanceof Reference; 1132 } 1133 1134 /** 1135 * @return {@link #substance} (Todo.) 1136 */ 1137 public CodeableConcept getSubstanceCodeableConcept() throws FHIRException { 1138 if (this.substance == null) 1139 return null; 1140 if (!(this.substance instanceof CodeableConcept)) 1141 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.substance.getClass().getName()+" was encountered"); 1142 return (CodeableConcept) this.substance; 1143 } 1144 1145 public boolean hasSubstanceCodeableConcept() { 1146 return this != null && this.substance instanceof CodeableConcept; 1147 } 1148 1149 public boolean hasSubstance() { 1150 return this.substance != null && !this.substance.isEmpty(); 1151 } 1152 1153 /** 1154 * @param value {@link #substance} (Todo.) 1155 */ 1156 public SubstanceReferenceInformationRelationshipComponent setSubstance(Type value) { 1157 if (value != null && !(value instanceof Reference || value instanceof CodeableConcept)) 1158 throw new Error("Not the right type for SubstanceReferenceInformation.relationship.substance[x]: "+value.fhirType()); 1159 this.substance = value; 1160 return this; 1161 } 1162 1163 /** 1164 * @return {@link #relationship} (Todo.) 1165 */ 1166 public CodeableConcept getRelationship() { 1167 if (this.relationship == null) 1168 if (Configuration.errorOnAutoCreate()) 1169 throw new Error("Attempt to auto-create SubstanceReferenceInformationRelationshipComponent.relationship"); 1170 else if (Configuration.doAutoCreate()) 1171 this.relationship = new CodeableConcept(); // cc 1172 return this.relationship; 1173 } 1174 1175 public boolean hasRelationship() { 1176 return this.relationship != null && !this.relationship.isEmpty(); 1177 } 1178 1179 /** 1180 * @param value {@link #relationship} (Todo.) 1181 */ 1182 public SubstanceReferenceInformationRelationshipComponent setRelationship(CodeableConcept value) { 1183 this.relationship = value; 1184 return this; 1185 } 1186 1187 /** 1188 * @return {@link #interaction} (Todo.) 1189 */ 1190 public CodeableConcept getInteraction() { 1191 if (this.interaction == null) 1192 if (Configuration.errorOnAutoCreate()) 1193 throw new Error("Attempt to auto-create SubstanceReferenceInformationRelationshipComponent.interaction"); 1194 else if (Configuration.doAutoCreate()) 1195 this.interaction = new CodeableConcept(); // cc 1196 return this.interaction; 1197 } 1198 1199 public boolean hasInteraction() { 1200 return this.interaction != null && !this.interaction.isEmpty(); 1201 } 1202 1203 /** 1204 * @param value {@link #interaction} (Todo.) 1205 */ 1206 public SubstanceReferenceInformationRelationshipComponent setInteraction(CodeableConcept value) { 1207 this.interaction = value; 1208 return this; 1209 } 1210 1211 /** 1212 * @return {@link #isDefining} (Todo.). This is the underlying object with id, value and extensions. The accessor "getIsDefining" gives direct access to the value 1213 */ 1214 public BooleanType getIsDefiningElement() { 1215 if (this.isDefining == null) 1216 if (Configuration.errorOnAutoCreate()) 1217 throw new Error("Attempt to auto-create SubstanceReferenceInformationRelationshipComponent.isDefining"); 1218 else if (Configuration.doAutoCreate()) 1219 this.isDefining = new BooleanType(); // bb 1220 return this.isDefining; 1221 } 1222 1223 public boolean hasIsDefiningElement() { 1224 return this.isDefining != null && !this.isDefining.isEmpty(); 1225 } 1226 1227 public boolean hasIsDefining() { 1228 return this.isDefining != null && !this.isDefining.isEmpty(); 1229 } 1230 1231 /** 1232 * @param value {@link #isDefining} (Todo.). This is the underlying object with id, value and extensions. The accessor "getIsDefining" gives direct access to the value 1233 */ 1234 public SubstanceReferenceInformationRelationshipComponent setIsDefiningElement(BooleanType value) { 1235 this.isDefining = value; 1236 return this; 1237 } 1238 1239 /** 1240 * @return Todo. 1241 */ 1242 public boolean getIsDefining() { 1243 return this.isDefining == null || this.isDefining.isEmpty() ? false : this.isDefining.getValue(); 1244 } 1245 1246 /** 1247 * @param value Todo. 1248 */ 1249 public SubstanceReferenceInformationRelationshipComponent setIsDefining(boolean value) { 1250 if (this.isDefining == null) 1251 this.isDefining = new BooleanType(); 1252 this.isDefining.setValue(value); 1253 return this; 1254 } 1255 1256 /** 1257 * @return {@link #amount} (Todo.) 1258 */ 1259 public Type getAmount() { 1260 return this.amount; 1261 } 1262 1263 /** 1264 * @return {@link #amount} (Todo.) 1265 */ 1266 public Quantity getAmountQuantity() throws FHIRException { 1267 if (this.amount == null) 1268 return null; 1269 if (!(this.amount instanceof Quantity)) 1270 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.amount.getClass().getName()+" was encountered"); 1271 return (Quantity) this.amount; 1272 } 1273 1274 public boolean hasAmountQuantity() { 1275 return this != null && this.amount instanceof Quantity; 1276 } 1277 1278 /** 1279 * @return {@link #amount} (Todo.) 1280 */ 1281 public Range getAmountRange() throws FHIRException { 1282 if (this.amount == null) 1283 return null; 1284 if (!(this.amount instanceof Range)) 1285 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.amount.getClass().getName()+" was encountered"); 1286 return (Range) this.amount; 1287 } 1288 1289 public boolean hasAmountRange() { 1290 return this != null && this.amount instanceof Range; 1291 } 1292 1293 /** 1294 * @return {@link #amount} (Todo.) 1295 */ 1296 public StringType getAmountStringType() throws FHIRException { 1297 if (this.amount == null) 1298 return null; 1299 if (!(this.amount instanceof StringType)) 1300 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.amount.getClass().getName()+" was encountered"); 1301 return (StringType) this.amount; 1302 } 1303 1304 public boolean hasAmountStringType() { 1305 return this != null && this.amount instanceof StringType; 1306 } 1307 1308 public boolean hasAmount() { 1309 return this.amount != null && !this.amount.isEmpty(); 1310 } 1311 1312 /** 1313 * @param value {@link #amount} (Todo.) 1314 */ 1315 public SubstanceReferenceInformationRelationshipComponent setAmount(Type value) { 1316 if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof StringType)) 1317 throw new Error("Not the right type for SubstanceReferenceInformation.relationship.amount[x]: "+value.fhirType()); 1318 this.amount = value; 1319 return this; 1320 } 1321 1322 /** 1323 * @return {@link #amountType} (Todo.) 1324 */ 1325 public CodeableConcept getAmountType() { 1326 if (this.amountType == null) 1327 if (Configuration.errorOnAutoCreate()) 1328 throw new Error("Attempt to auto-create SubstanceReferenceInformationRelationshipComponent.amountType"); 1329 else if (Configuration.doAutoCreate()) 1330 this.amountType = new CodeableConcept(); // cc 1331 return this.amountType; 1332 } 1333 1334 public boolean hasAmountType() { 1335 return this.amountType != null && !this.amountType.isEmpty(); 1336 } 1337 1338 /** 1339 * @param value {@link #amountType} (Todo.) 1340 */ 1341 public SubstanceReferenceInformationRelationshipComponent setAmountType(CodeableConcept value) { 1342 this.amountType = value; 1343 return this; 1344 } 1345 1346 /** 1347 * @return {@link #amountText} (Todo.). This is the underlying object with id, value and extensions. The accessor "getAmountText" gives direct access to the value 1348 */ 1349 public StringType getAmountTextElement() { 1350 if (this.amountText == null) 1351 if (Configuration.errorOnAutoCreate()) 1352 throw new Error("Attempt to auto-create SubstanceReferenceInformationRelationshipComponent.amountText"); 1353 else if (Configuration.doAutoCreate()) 1354 this.amountText = new StringType(); // bb 1355 return this.amountText; 1356 } 1357 1358 public boolean hasAmountTextElement() { 1359 return this.amountText != null && !this.amountText.isEmpty(); 1360 } 1361 1362 public boolean hasAmountText() { 1363 return this.amountText != null && !this.amountText.isEmpty(); 1364 } 1365 1366 /** 1367 * @param value {@link #amountText} (Todo.). This is the underlying object with id, value and extensions. The accessor "getAmountText" gives direct access to the value 1368 */ 1369 public SubstanceReferenceInformationRelationshipComponent setAmountTextElement(StringType value) { 1370 this.amountText = value; 1371 return this; 1372 } 1373 1374 /** 1375 * @return Todo. 1376 */ 1377 public String getAmountText() { 1378 return this.amountText == null ? null : this.amountText.getValue(); 1379 } 1380 1381 /** 1382 * @param value Todo. 1383 */ 1384 public SubstanceReferenceInformationRelationshipComponent setAmountText(String value) { 1385 if (Utilities.noString(value)) 1386 this.amountText = null; 1387 else { 1388 if (this.amountText == null) 1389 this.amountText = new StringType(); 1390 this.amountText.setValue(value); 1391 } 1392 return this; 1393 } 1394 1395 /** 1396 * @return {@link #source} (Todo.) 1397 */ 1398 public List<Reference> getSource() { 1399 if (this.source == null) 1400 this.source = new ArrayList<Reference>(); 1401 return this.source; 1402 } 1403 1404 /** 1405 * @return Returns a reference to <code>this</code> for easy method chaining 1406 */ 1407 public SubstanceReferenceInformationRelationshipComponent setSource(List<Reference> theSource) { 1408 this.source = theSource; 1409 return this; 1410 } 1411 1412 public boolean hasSource() { 1413 if (this.source == null) 1414 return false; 1415 for (Reference item : this.source) 1416 if (!item.isEmpty()) 1417 return true; 1418 return false; 1419 } 1420 1421 public Reference addSource() { //3 1422 Reference t = new Reference(); 1423 if (this.source == null) 1424 this.source = new ArrayList<Reference>(); 1425 this.source.add(t); 1426 return t; 1427 } 1428 1429 public SubstanceReferenceInformationRelationshipComponent addSource(Reference t) { //3 1430 if (t == null) 1431 return this; 1432 if (this.source == null) 1433 this.source = new ArrayList<Reference>(); 1434 this.source.add(t); 1435 return this; 1436 } 1437 1438 /** 1439 * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist 1440 */ 1441 public Reference getSourceFirstRep() { 1442 if (getSource().isEmpty()) { 1443 addSource(); 1444 } 1445 return getSource().get(0); 1446 } 1447 1448 /** 1449 * @deprecated Use Reference#setResource(IBaseResource) instead 1450 */ 1451 @Deprecated 1452 public List<DocumentReference> getSourceTarget() { 1453 if (this.sourceTarget == null) 1454 this.sourceTarget = new ArrayList<DocumentReference>(); 1455 return this.sourceTarget; 1456 } 1457 1458 /** 1459 * @deprecated Use Reference#setResource(IBaseResource) instead 1460 */ 1461 @Deprecated 1462 public DocumentReference addSourceTarget() { 1463 DocumentReference r = new DocumentReference(); 1464 if (this.sourceTarget == null) 1465 this.sourceTarget = new ArrayList<DocumentReference>(); 1466 this.sourceTarget.add(r); 1467 return r; 1468 } 1469 1470 protected void listChildren(List<Property> children) { 1471 super.listChildren(children); 1472 children.add(new Property("substance[x]", "Reference(SubstanceSpecification)|CodeableConcept", "Todo.", 0, 1, substance)); 1473 children.add(new Property("relationship", "CodeableConcept", "Todo.", 0, 1, relationship)); 1474 children.add(new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction)); 1475 children.add(new Property("isDefining", "boolean", "Todo.", 0, 1, isDefining)); 1476 children.add(new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount)); 1477 children.add(new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType)); 1478 children.add(new Property("amountText", "string", "Todo.", 0, 1, amountText)); 1479 children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 1480 } 1481 1482 @Override 1483 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1484 switch (_hash) { 1485 case 2127194384: /*substance[x]*/ return new Property("substance[x]", "Reference(SubstanceSpecification)|CodeableConcept", "Todo.", 0, 1, substance); 1486 case 530040176: /*substance*/ return new Property("substance[x]", "Reference(SubstanceSpecification)|CodeableConcept", "Todo.", 0, 1, substance); 1487 case 516208571: /*substanceReference*/ return new Property("substance[x]", "Reference(SubstanceSpecification)|CodeableConcept", "Todo.", 0, 1, substance); 1488 case -1974119407: /*substanceCodeableConcept*/ return new Property("substance[x]", "Reference(SubstanceSpecification)|CodeableConcept", "Todo.", 0, 1, substance); 1489 case -261851592: /*relationship*/ return new Property("relationship", "CodeableConcept", "Todo.", 0, 1, relationship); 1490 case 1844104722: /*interaction*/ return new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction); 1491 case -141812990: /*isDefining*/ return new Property("isDefining", "boolean", "Todo.", 0, 1, isDefining); 1492 case 646780200: /*amount[x]*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1493 case -1413853096: /*amount*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1494 case 1664303363: /*amountQuantity*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1495 case -1223462971: /*amountRange*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1496 case 773651081: /*amountString*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1497 case -1424857166: /*amountType*/ return new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType); 1498 case -1424876123: /*amountText*/ return new Property("amountText", "string", "Todo.", 0, 1, amountText); 1499 case -896505829: /*source*/ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source); 1500 default: return super.getNamedProperty(_hash, _name, _checkValid); 1501 } 1502 1503 } 1504 1505 @Override 1506 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1507 switch (hash) { 1508 case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // Type 1509 case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // CodeableConcept 1510 case 1844104722: /*interaction*/ return this.interaction == null ? new Base[0] : new Base[] {this.interaction}; // CodeableConcept 1511 case -141812990: /*isDefining*/ return this.isDefining == null ? new Base[0] : new Base[] {this.isDefining}; // BooleanType 1512 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Type 1513 case -1424857166: /*amountType*/ return this.amountType == null ? new Base[0] : new Base[] {this.amountType}; // CodeableConcept 1514 case -1424876123: /*amountText*/ return this.amountText == null ? new Base[0] : new Base[] {this.amountText}; // StringType 1515 case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 1516 default: return super.getProperty(hash, name, checkValid); 1517 } 1518 1519 } 1520 1521 @Override 1522 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1523 switch (hash) { 1524 case 530040176: // substance 1525 this.substance = castToType(value); // Type 1526 return value; 1527 case -261851592: // relationship 1528 this.relationship = castToCodeableConcept(value); // CodeableConcept 1529 return value; 1530 case 1844104722: // interaction 1531 this.interaction = castToCodeableConcept(value); // CodeableConcept 1532 return value; 1533 case -141812990: // isDefining 1534 this.isDefining = castToBoolean(value); // BooleanType 1535 return value; 1536 case -1413853096: // amount 1537 this.amount = castToType(value); // Type 1538 return value; 1539 case -1424857166: // amountType 1540 this.amountType = castToCodeableConcept(value); // CodeableConcept 1541 return value; 1542 case -1424876123: // amountText 1543 this.amountText = castToString(value); // StringType 1544 return value; 1545 case -896505829: // source 1546 this.getSource().add(castToReference(value)); // Reference 1547 return value; 1548 default: return super.setProperty(hash, name, value); 1549 } 1550 1551 } 1552 1553 @Override 1554 public Base setProperty(String name, Base value) throws FHIRException { 1555 if (name.equals("substance[x]")) { 1556 this.substance = castToType(value); // Type 1557 } else if (name.equals("relationship")) { 1558 this.relationship = castToCodeableConcept(value); // CodeableConcept 1559 } else if (name.equals("interaction")) { 1560 this.interaction = castToCodeableConcept(value); // CodeableConcept 1561 } else if (name.equals("isDefining")) { 1562 this.isDefining = castToBoolean(value); // BooleanType 1563 } else if (name.equals("amount[x]")) { 1564 this.amount = castToType(value); // Type 1565 } else if (name.equals("amountType")) { 1566 this.amountType = castToCodeableConcept(value); // CodeableConcept 1567 } else if (name.equals("amountText")) { 1568 this.amountText = castToString(value); // StringType 1569 } else if (name.equals("source")) { 1570 this.getSource().add(castToReference(value)); 1571 } else 1572 return super.setProperty(name, value); 1573 return value; 1574 } 1575 1576 @Override 1577 public Base makeProperty(int hash, String name) throws FHIRException { 1578 switch (hash) { 1579 case 2127194384: return getSubstance(); 1580 case 530040176: return getSubstance(); 1581 case -261851592: return getRelationship(); 1582 case 1844104722: return getInteraction(); 1583 case -141812990: return getIsDefiningElement(); 1584 case 646780200: return getAmount(); 1585 case -1413853096: return getAmount(); 1586 case -1424857166: return getAmountType(); 1587 case -1424876123: return getAmountTextElement(); 1588 case -896505829: return addSource(); 1589 default: return super.makeProperty(hash, name); 1590 } 1591 1592 } 1593 1594 @Override 1595 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1596 switch (hash) { 1597 case 530040176: /*substance*/ return new String[] {"Reference", "CodeableConcept"}; 1598 case -261851592: /*relationship*/ return new String[] {"CodeableConcept"}; 1599 case 1844104722: /*interaction*/ return new String[] {"CodeableConcept"}; 1600 case -141812990: /*isDefining*/ return new String[] {"boolean"}; 1601 case -1413853096: /*amount*/ return new String[] {"Quantity", "Range", "string"}; 1602 case -1424857166: /*amountType*/ return new String[] {"CodeableConcept"}; 1603 case -1424876123: /*amountText*/ return new String[] {"string"}; 1604 case -896505829: /*source*/ return new String[] {"Reference"}; 1605 default: return super.getTypesForProperty(hash, name); 1606 } 1607 1608 } 1609 1610 @Override 1611 public Base addChild(String name) throws FHIRException { 1612 if (name.equals("substanceReference")) { 1613 this.substance = new Reference(); 1614 return this.substance; 1615 } 1616 else if (name.equals("substanceCodeableConcept")) { 1617 this.substance = new CodeableConcept(); 1618 return this.substance; 1619 } 1620 else if (name.equals("relationship")) { 1621 this.relationship = new CodeableConcept(); 1622 return this.relationship; 1623 } 1624 else if (name.equals("interaction")) { 1625 this.interaction = new CodeableConcept(); 1626 return this.interaction; 1627 } 1628 else if (name.equals("isDefining")) { 1629 throw new FHIRException("Cannot call addChild on a primitive type SubstanceReferenceInformation.isDefining"); 1630 } 1631 else if (name.equals("amountQuantity")) { 1632 this.amount = new Quantity(); 1633 return this.amount; 1634 } 1635 else if (name.equals("amountRange")) { 1636 this.amount = new Range(); 1637 return this.amount; 1638 } 1639 else if (name.equals("amountString")) { 1640 this.amount = new StringType(); 1641 return this.amount; 1642 } 1643 else if (name.equals("amountType")) { 1644 this.amountType = new CodeableConcept(); 1645 return this.amountType; 1646 } 1647 else if (name.equals("amountText")) { 1648 throw new FHIRException("Cannot call addChild on a primitive type SubstanceReferenceInformation.amountText"); 1649 } 1650 else if (name.equals("source")) { 1651 return addSource(); 1652 } 1653 else 1654 return super.addChild(name); 1655 } 1656 1657 public SubstanceReferenceInformationRelationshipComponent copy() { 1658 SubstanceReferenceInformationRelationshipComponent dst = new SubstanceReferenceInformationRelationshipComponent(); 1659 copyValues(dst); 1660 dst.substance = substance == null ? null : substance.copy(); 1661 dst.relationship = relationship == null ? null : relationship.copy(); 1662 dst.interaction = interaction == null ? null : interaction.copy(); 1663 dst.isDefining = isDefining == null ? null : isDefining.copy(); 1664 dst.amount = amount == null ? null : amount.copy(); 1665 dst.amountType = amountType == null ? null : amountType.copy(); 1666 dst.amountText = amountText == null ? null : amountText.copy(); 1667 if (source != null) { 1668 dst.source = new ArrayList<Reference>(); 1669 for (Reference i : source) 1670 dst.source.add(i.copy()); 1671 }; 1672 return dst; 1673 } 1674 1675 @Override 1676 public boolean equalsDeep(Base other_) { 1677 if (!super.equalsDeep(other_)) 1678 return false; 1679 if (!(other_ instanceof SubstanceReferenceInformationRelationshipComponent)) 1680 return false; 1681 SubstanceReferenceInformationRelationshipComponent o = (SubstanceReferenceInformationRelationshipComponent) other_; 1682 return compareDeep(substance, o.substance, true) && compareDeep(relationship, o.relationship, true) 1683 && compareDeep(interaction, o.interaction, true) && compareDeep(isDefining, o.isDefining, true) 1684 && compareDeep(amount, o.amount, true) && compareDeep(amountType, o.amountType, true) && compareDeep(amountText, o.amountText, true) 1685 && compareDeep(source, o.source, true); 1686 } 1687 1688 @Override 1689 public boolean equalsShallow(Base other_) { 1690 if (!super.equalsShallow(other_)) 1691 return false; 1692 if (!(other_ instanceof SubstanceReferenceInformationRelationshipComponent)) 1693 return false; 1694 SubstanceReferenceInformationRelationshipComponent o = (SubstanceReferenceInformationRelationshipComponent) other_; 1695 return compareValues(isDefining, o.isDefining, true) && compareValues(amountText, o.amountText, true) 1696 ; 1697 } 1698 1699 public boolean isEmpty() { 1700 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(substance, relationship, interaction 1701 , isDefining, amount, amountType, amountText, source); 1702 } 1703 1704 public String fhirType() { 1705 return "SubstanceReferenceInformation.relationship"; 1706 1707 } 1708 1709 } 1710 1711 @Block() 1712 public static class SubstanceReferenceInformationTargetComponent extends BackboneElement implements IBaseBackboneElement { 1713 /** 1714 * Todo. 1715 */ 1716 @Child(name = "target", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true) 1717 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1718 protected Identifier target; 1719 1720 /** 1721 * Todo. 1722 */ 1723 @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 1724 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1725 protected CodeableConcept type; 1726 1727 /** 1728 * Todo. 1729 */ 1730 @Child(name = "interaction", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 1731 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1732 protected CodeableConcept interaction; 1733 1734 /** 1735 * Todo. 1736 */ 1737 @Child(name = "organism", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true) 1738 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1739 protected CodeableConcept organism; 1740 1741 /** 1742 * Todo. 1743 */ 1744 @Child(name = "organismType", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true) 1745 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1746 protected CodeableConcept organismType; 1747 1748 /** 1749 * Todo. 1750 */ 1751 @Child(name = "source", type = {DocumentReference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1752 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1753 protected List<Reference> source; 1754 /** 1755 * The actual objects that are the target of the reference (Todo.) 1756 */ 1757 protected List<DocumentReference> sourceTarget; 1758 1759 1760 /** 1761 * Todo. 1762 */ 1763 @Child(name = "amount", type = {Quantity.class, Range.class, StringType.class}, order=7, min=0, max=1, modifier=false, summary=true) 1764 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1765 protected Type amount; 1766 1767 /** 1768 * Todo. 1769 */ 1770 @Child(name = "amountType", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true) 1771 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1772 protected CodeableConcept amountType; 1773 1774 private static final long serialVersionUID = -1484285449L; 1775 1776 /** 1777 * Constructor 1778 */ 1779 public SubstanceReferenceInformationTargetComponent() { 1780 super(); 1781 } 1782 1783 /** 1784 * @return {@link #target} (Todo.) 1785 */ 1786 public Identifier getTarget() { 1787 if (this.target == null) 1788 if (Configuration.errorOnAutoCreate()) 1789 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.target"); 1790 else if (Configuration.doAutoCreate()) 1791 this.target = new Identifier(); // cc 1792 return this.target; 1793 } 1794 1795 public boolean hasTarget() { 1796 return this.target != null && !this.target.isEmpty(); 1797 } 1798 1799 /** 1800 * @param value {@link #target} (Todo.) 1801 */ 1802 public SubstanceReferenceInformationTargetComponent setTarget(Identifier value) { 1803 this.target = value; 1804 return this; 1805 } 1806 1807 /** 1808 * @return {@link #type} (Todo.) 1809 */ 1810 public CodeableConcept getType() { 1811 if (this.type == null) 1812 if (Configuration.errorOnAutoCreate()) 1813 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.type"); 1814 else if (Configuration.doAutoCreate()) 1815 this.type = new CodeableConcept(); // cc 1816 return this.type; 1817 } 1818 1819 public boolean hasType() { 1820 return this.type != null && !this.type.isEmpty(); 1821 } 1822 1823 /** 1824 * @param value {@link #type} (Todo.) 1825 */ 1826 public SubstanceReferenceInformationTargetComponent setType(CodeableConcept value) { 1827 this.type = value; 1828 return this; 1829 } 1830 1831 /** 1832 * @return {@link #interaction} (Todo.) 1833 */ 1834 public CodeableConcept getInteraction() { 1835 if (this.interaction == null) 1836 if (Configuration.errorOnAutoCreate()) 1837 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.interaction"); 1838 else if (Configuration.doAutoCreate()) 1839 this.interaction = new CodeableConcept(); // cc 1840 return this.interaction; 1841 } 1842 1843 public boolean hasInteraction() { 1844 return this.interaction != null && !this.interaction.isEmpty(); 1845 } 1846 1847 /** 1848 * @param value {@link #interaction} (Todo.) 1849 */ 1850 public SubstanceReferenceInformationTargetComponent setInteraction(CodeableConcept value) { 1851 this.interaction = value; 1852 return this; 1853 } 1854 1855 /** 1856 * @return {@link #organism} (Todo.) 1857 */ 1858 public CodeableConcept getOrganism() { 1859 if (this.organism == null) 1860 if (Configuration.errorOnAutoCreate()) 1861 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.organism"); 1862 else if (Configuration.doAutoCreate()) 1863 this.organism = new CodeableConcept(); // cc 1864 return this.organism; 1865 } 1866 1867 public boolean hasOrganism() { 1868 return this.organism != null && !this.organism.isEmpty(); 1869 } 1870 1871 /** 1872 * @param value {@link #organism} (Todo.) 1873 */ 1874 public SubstanceReferenceInformationTargetComponent setOrganism(CodeableConcept value) { 1875 this.organism = value; 1876 return this; 1877 } 1878 1879 /** 1880 * @return {@link #organismType} (Todo.) 1881 */ 1882 public CodeableConcept getOrganismType() { 1883 if (this.organismType == null) 1884 if (Configuration.errorOnAutoCreate()) 1885 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.organismType"); 1886 else if (Configuration.doAutoCreate()) 1887 this.organismType = new CodeableConcept(); // cc 1888 return this.organismType; 1889 } 1890 1891 public boolean hasOrganismType() { 1892 return this.organismType != null && !this.organismType.isEmpty(); 1893 } 1894 1895 /** 1896 * @param value {@link #organismType} (Todo.) 1897 */ 1898 public SubstanceReferenceInformationTargetComponent setOrganismType(CodeableConcept value) { 1899 this.organismType = value; 1900 return this; 1901 } 1902 1903 /** 1904 * @return {@link #source} (Todo.) 1905 */ 1906 public List<Reference> getSource() { 1907 if (this.source == null) 1908 this.source = new ArrayList<Reference>(); 1909 return this.source; 1910 } 1911 1912 /** 1913 * @return Returns a reference to <code>this</code> for easy method chaining 1914 */ 1915 public SubstanceReferenceInformationTargetComponent setSource(List<Reference> theSource) { 1916 this.source = theSource; 1917 return this; 1918 } 1919 1920 public boolean hasSource() { 1921 if (this.source == null) 1922 return false; 1923 for (Reference item : this.source) 1924 if (!item.isEmpty()) 1925 return true; 1926 return false; 1927 } 1928 1929 public Reference addSource() { //3 1930 Reference t = new Reference(); 1931 if (this.source == null) 1932 this.source = new ArrayList<Reference>(); 1933 this.source.add(t); 1934 return t; 1935 } 1936 1937 public SubstanceReferenceInformationTargetComponent addSource(Reference t) { //3 1938 if (t == null) 1939 return this; 1940 if (this.source == null) 1941 this.source = new ArrayList<Reference>(); 1942 this.source.add(t); 1943 return this; 1944 } 1945 1946 /** 1947 * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist 1948 */ 1949 public Reference getSourceFirstRep() { 1950 if (getSource().isEmpty()) { 1951 addSource(); 1952 } 1953 return getSource().get(0); 1954 } 1955 1956 /** 1957 * @deprecated Use Reference#setResource(IBaseResource) instead 1958 */ 1959 @Deprecated 1960 public List<DocumentReference> getSourceTarget() { 1961 if (this.sourceTarget == null) 1962 this.sourceTarget = new ArrayList<DocumentReference>(); 1963 return this.sourceTarget; 1964 } 1965 1966 /** 1967 * @deprecated Use Reference#setResource(IBaseResource) instead 1968 */ 1969 @Deprecated 1970 public DocumentReference addSourceTarget() { 1971 DocumentReference r = new DocumentReference(); 1972 if (this.sourceTarget == null) 1973 this.sourceTarget = new ArrayList<DocumentReference>(); 1974 this.sourceTarget.add(r); 1975 return r; 1976 } 1977 1978 /** 1979 * @return {@link #amount} (Todo.) 1980 */ 1981 public Type getAmount() { 1982 return this.amount; 1983 } 1984 1985 /** 1986 * @return {@link #amount} (Todo.) 1987 */ 1988 public Quantity getAmountQuantity() throws FHIRException { 1989 if (this.amount == null) 1990 return null; 1991 if (!(this.amount instanceof Quantity)) 1992 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.amount.getClass().getName()+" was encountered"); 1993 return (Quantity) this.amount; 1994 } 1995 1996 public boolean hasAmountQuantity() { 1997 return this != null && this.amount instanceof Quantity; 1998 } 1999 2000 /** 2001 * @return {@link #amount} (Todo.) 2002 */ 2003 public Range getAmountRange() throws FHIRException { 2004 if (this.amount == null) 2005 return null; 2006 if (!(this.amount instanceof Range)) 2007 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.amount.getClass().getName()+" was encountered"); 2008 return (Range) this.amount; 2009 } 2010 2011 public boolean hasAmountRange() { 2012 return this != null && this.amount instanceof Range; 2013 } 2014 2015 /** 2016 * @return {@link #amount} (Todo.) 2017 */ 2018 public StringType getAmountStringType() throws FHIRException { 2019 if (this.amount == null) 2020 return null; 2021 if (!(this.amount instanceof StringType)) 2022 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.amount.getClass().getName()+" was encountered"); 2023 return (StringType) this.amount; 2024 } 2025 2026 public boolean hasAmountStringType() { 2027 return this != null && this.amount instanceof StringType; 2028 } 2029 2030 public boolean hasAmount() { 2031 return this.amount != null && !this.amount.isEmpty(); 2032 } 2033 2034 /** 2035 * @param value {@link #amount} (Todo.) 2036 */ 2037 public SubstanceReferenceInformationTargetComponent setAmount(Type value) { 2038 if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof StringType)) 2039 throw new Error("Not the right type for SubstanceReferenceInformation.target.amount[x]: "+value.fhirType()); 2040 this.amount = value; 2041 return this; 2042 } 2043 2044 /** 2045 * @return {@link #amountType} (Todo.) 2046 */ 2047 public CodeableConcept getAmountType() { 2048 if (this.amountType == null) 2049 if (Configuration.errorOnAutoCreate()) 2050 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.amountType"); 2051 else if (Configuration.doAutoCreate()) 2052 this.amountType = new CodeableConcept(); // cc 2053 return this.amountType; 2054 } 2055 2056 public boolean hasAmountType() { 2057 return this.amountType != null && !this.amountType.isEmpty(); 2058 } 2059 2060 /** 2061 * @param value {@link #amountType} (Todo.) 2062 */ 2063 public SubstanceReferenceInformationTargetComponent setAmountType(CodeableConcept value) { 2064 this.amountType = value; 2065 return this; 2066 } 2067 2068 protected void listChildren(List<Property> children) { 2069 super.listChildren(children); 2070 children.add(new Property("target", "Identifier", "Todo.", 0, 1, target)); 2071 children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type)); 2072 children.add(new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction)); 2073 children.add(new Property("organism", "CodeableConcept", "Todo.", 0, 1, organism)); 2074 children.add(new Property("organismType", "CodeableConcept", "Todo.", 0, 1, organismType)); 2075 children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 2076 children.add(new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount)); 2077 children.add(new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType)); 2078 } 2079 2080 @Override 2081 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2082 switch (_hash) { 2083 case -880905839: /*target*/ return new Property("target", "Identifier", "Todo.", 0, 1, target); 2084 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "Todo.", 0, 1, type); 2085 case 1844104722: /*interaction*/ return new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction); 2086 case 1316389074: /*organism*/ return new Property("organism", "CodeableConcept", "Todo.", 0, 1, organism); 2087 case 988662572: /*organismType*/ return new Property("organismType", "CodeableConcept", "Todo.", 0, 1, organismType); 2088 case -896505829: /*source*/ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source); 2089 case 646780200: /*amount[x]*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 2090 case -1413853096: /*amount*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 2091 case 1664303363: /*amountQuantity*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 2092 case -1223462971: /*amountRange*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 2093 case 773651081: /*amountString*/ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 2094 case -1424857166: /*amountType*/ return new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType); 2095 default: return super.getNamedProperty(_hash, _name, _checkValid); 2096 } 2097 2098 } 2099 2100 @Override 2101 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2102 switch (hash) { 2103 case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Identifier 2104 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 2105 case 1844104722: /*interaction*/ return this.interaction == null ? new Base[0] : new Base[] {this.interaction}; // CodeableConcept 2106 case 1316389074: /*organism*/ return this.organism == null ? new Base[0] : new Base[] {this.organism}; // CodeableConcept 2107 case 988662572: /*organismType*/ return this.organismType == null ? new Base[0] : new Base[] {this.organismType}; // CodeableConcept 2108 case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 2109 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Type 2110 case -1424857166: /*amountType*/ return this.amountType == null ? new Base[0] : new Base[] {this.amountType}; // CodeableConcept 2111 default: return super.getProperty(hash, name, checkValid); 2112 } 2113 2114 } 2115 2116 @Override 2117 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2118 switch (hash) { 2119 case -880905839: // target 2120 this.target = castToIdentifier(value); // Identifier 2121 return value; 2122 case 3575610: // type 2123 this.type = castToCodeableConcept(value); // CodeableConcept 2124 return value; 2125 case 1844104722: // interaction 2126 this.interaction = castToCodeableConcept(value); // CodeableConcept 2127 return value; 2128 case 1316389074: // organism 2129 this.organism = castToCodeableConcept(value); // CodeableConcept 2130 return value; 2131 case 988662572: // organismType 2132 this.organismType = castToCodeableConcept(value); // CodeableConcept 2133 return value; 2134 case -896505829: // source 2135 this.getSource().add(castToReference(value)); // Reference 2136 return value; 2137 case -1413853096: // amount 2138 this.amount = castToType(value); // Type 2139 return value; 2140 case -1424857166: // amountType 2141 this.amountType = castToCodeableConcept(value); // CodeableConcept 2142 return value; 2143 default: return super.setProperty(hash, name, value); 2144 } 2145 2146 } 2147 2148 @Override 2149 public Base setProperty(String name, Base value) throws FHIRException { 2150 if (name.equals("target")) { 2151 this.target = castToIdentifier(value); // Identifier 2152 } else if (name.equals("type")) { 2153 this.type = castToCodeableConcept(value); // CodeableConcept 2154 } else if (name.equals("interaction")) { 2155 this.interaction = castToCodeableConcept(value); // CodeableConcept 2156 } else if (name.equals("organism")) { 2157 this.organism = castToCodeableConcept(value); // CodeableConcept 2158 } else if (name.equals("organismType")) { 2159 this.organismType = castToCodeableConcept(value); // CodeableConcept 2160 } else if (name.equals("source")) { 2161 this.getSource().add(castToReference(value)); 2162 } else if (name.equals("amount[x]")) { 2163 this.amount = castToType(value); // Type 2164 } else if (name.equals("amountType")) { 2165 this.amountType = castToCodeableConcept(value); // CodeableConcept 2166 } else 2167 return super.setProperty(name, value); 2168 return value; 2169 } 2170 2171 @Override 2172 public Base makeProperty(int hash, String name) throws FHIRException { 2173 switch (hash) { 2174 case -880905839: return getTarget(); 2175 case 3575610: return getType(); 2176 case 1844104722: return getInteraction(); 2177 case 1316389074: return getOrganism(); 2178 case 988662572: return getOrganismType(); 2179 case -896505829: return addSource(); 2180 case 646780200: return getAmount(); 2181 case -1413853096: return getAmount(); 2182 case -1424857166: return getAmountType(); 2183 default: return super.makeProperty(hash, name); 2184 } 2185 2186 } 2187 2188 @Override 2189 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2190 switch (hash) { 2191 case -880905839: /*target*/ return new String[] {"Identifier"}; 2192 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 2193 case 1844104722: /*interaction*/ return new String[] {"CodeableConcept"}; 2194 case 1316389074: /*organism*/ return new String[] {"CodeableConcept"}; 2195 case 988662572: /*organismType*/ return new String[] {"CodeableConcept"}; 2196 case -896505829: /*source*/ return new String[] {"Reference"}; 2197 case -1413853096: /*amount*/ return new String[] {"Quantity", "Range", "string"}; 2198 case -1424857166: /*amountType*/ return new String[] {"CodeableConcept"}; 2199 default: return super.getTypesForProperty(hash, name); 2200 } 2201 2202 } 2203 2204 @Override 2205 public Base addChild(String name) throws FHIRException { 2206 if (name.equals("target")) { 2207 this.target = new Identifier(); 2208 return this.target; 2209 } 2210 else if (name.equals("type")) { 2211 this.type = new CodeableConcept(); 2212 return this.type; 2213 } 2214 else if (name.equals("interaction")) { 2215 this.interaction = new CodeableConcept(); 2216 return this.interaction; 2217 } 2218 else if (name.equals("organism")) { 2219 this.organism = new CodeableConcept(); 2220 return this.organism; 2221 } 2222 else if (name.equals("organismType")) { 2223 this.organismType = new CodeableConcept(); 2224 return this.organismType; 2225 } 2226 else if (name.equals("source")) { 2227 return addSource(); 2228 } 2229 else if (name.equals("amountQuantity")) { 2230 this.amount = new Quantity(); 2231 return this.amount; 2232 } 2233 else if (name.equals("amountRange")) { 2234 this.amount = new Range(); 2235 return this.amount; 2236 } 2237 else if (name.equals("amountString")) { 2238 this.amount = new StringType(); 2239 return this.amount; 2240 } 2241 else if (name.equals("amountType")) { 2242 this.amountType = new CodeableConcept(); 2243 return this.amountType; 2244 } 2245 else 2246 return super.addChild(name); 2247 } 2248 2249 public SubstanceReferenceInformationTargetComponent copy() { 2250 SubstanceReferenceInformationTargetComponent dst = new SubstanceReferenceInformationTargetComponent(); 2251 copyValues(dst); 2252 dst.target = target == null ? null : target.copy(); 2253 dst.type = type == null ? null : type.copy(); 2254 dst.interaction = interaction == null ? null : interaction.copy(); 2255 dst.organism = organism == null ? null : organism.copy(); 2256 dst.organismType = organismType == null ? null : organismType.copy(); 2257 if (source != null) { 2258 dst.source = new ArrayList<Reference>(); 2259 for (Reference i : source) 2260 dst.source.add(i.copy()); 2261 }; 2262 dst.amount = amount == null ? null : amount.copy(); 2263 dst.amountType = amountType == null ? null : amountType.copy(); 2264 return dst; 2265 } 2266 2267 @Override 2268 public boolean equalsDeep(Base other_) { 2269 if (!super.equalsDeep(other_)) 2270 return false; 2271 if (!(other_ instanceof SubstanceReferenceInformationTargetComponent)) 2272 return false; 2273 SubstanceReferenceInformationTargetComponent o = (SubstanceReferenceInformationTargetComponent) other_; 2274 return compareDeep(target, o.target, true) && compareDeep(type, o.type, true) && compareDeep(interaction, o.interaction, true) 2275 && compareDeep(organism, o.organism, true) && compareDeep(organismType, o.organismType, true) && compareDeep(source, o.source, true) 2276 && compareDeep(amount, o.amount, true) && compareDeep(amountType, o.amountType, true); 2277 } 2278 2279 @Override 2280 public boolean equalsShallow(Base other_) { 2281 if (!super.equalsShallow(other_)) 2282 return false; 2283 if (!(other_ instanceof SubstanceReferenceInformationTargetComponent)) 2284 return false; 2285 SubstanceReferenceInformationTargetComponent o = (SubstanceReferenceInformationTargetComponent) other_; 2286 return true; 2287 } 2288 2289 public boolean isEmpty() { 2290 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(target, type, interaction 2291 , organism, organismType, source, amount, amountType); 2292 } 2293 2294 public String fhirType() { 2295 return "SubstanceReferenceInformation.target"; 2296 2297 } 2298 2299 } 2300 2301 /** 2302 * Todo. 2303 */ 2304 @Child(name = "comment", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=true) 2305 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 2306 protected StringType comment; 2307 2308 /** 2309 * Todo. 2310 */ 2311 @Child(name = "gene", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 2312 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 2313 protected List<SubstanceReferenceInformationGeneComponent> gene; 2314 2315 /** 2316 * Todo. 2317 */ 2318 @Child(name = "geneElement", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 2319 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 2320 protected List<SubstanceReferenceInformationGeneElementComponent> geneElement; 2321 2322 /** 2323 * Todo. 2324 */ 2325 @Child(name = "classification", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 2326 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 2327 protected List<SubstanceReferenceInformationClassificationComponent> classification; 2328 2329 /** 2330 * Todo. 2331 */ 2332 @Child(name = "relationship", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 2333 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 2334 protected List<SubstanceReferenceInformationRelationshipComponent> relationship; 2335 2336 /** 2337 * Todo. 2338 */ 2339 @Child(name = "target", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 2340 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 2341 protected List<SubstanceReferenceInformationTargetComponent> target; 2342 2343 private static final long serialVersionUID = -1644936638L; 2344 2345 /** 2346 * Constructor 2347 */ 2348 public SubstanceReferenceInformation() { 2349 super(); 2350 } 2351 2352 /** 2353 * @return {@link #comment} (Todo.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value 2354 */ 2355 public StringType getCommentElement() { 2356 if (this.comment == null) 2357 if (Configuration.errorOnAutoCreate()) 2358 throw new Error("Attempt to auto-create SubstanceReferenceInformation.comment"); 2359 else if (Configuration.doAutoCreate()) 2360 this.comment = new StringType(); // bb 2361 return this.comment; 2362 } 2363 2364 public boolean hasCommentElement() { 2365 return this.comment != null && !this.comment.isEmpty(); 2366 } 2367 2368 public boolean hasComment() { 2369 return this.comment != null && !this.comment.isEmpty(); 2370 } 2371 2372 /** 2373 * @param value {@link #comment} (Todo.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value 2374 */ 2375 public SubstanceReferenceInformation setCommentElement(StringType value) { 2376 this.comment = value; 2377 return this; 2378 } 2379 2380 /** 2381 * @return Todo. 2382 */ 2383 public String getComment() { 2384 return this.comment == null ? null : this.comment.getValue(); 2385 } 2386 2387 /** 2388 * @param value Todo. 2389 */ 2390 public SubstanceReferenceInformation setComment(String value) { 2391 if (Utilities.noString(value)) 2392 this.comment = null; 2393 else { 2394 if (this.comment == null) 2395 this.comment = new StringType(); 2396 this.comment.setValue(value); 2397 } 2398 return this; 2399 } 2400 2401 /** 2402 * @return {@link #gene} (Todo.) 2403 */ 2404 public List<SubstanceReferenceInformationGeneComponent> getGene() { 2405 if (this.gene == null) 2406 this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>(); 2407 return this.gene; 2408 } 2409 2410 /** 2411 * @return Returns a reference to <code>this</code> for easy method chaining 2412 */ 2413 public SubstanceReferenceInformation setGene(List<SubstanceReferenceInformationGeneComponent> theGene) { 2414 this.gene = theGene; 2415 return this; 2416 } 2417 2418 public boolean hasGene() { 2419 if (this.gene == null) 2420 return false; 2421 for (SubstanceReferenceInformationGeneComponent item : this.gene) 2422 if (!item.isEmpty()) 2423 return true; 2424 return false; 2425 } 2426 2427 public SubstanceReferenceInformationGeneComponent addGene() { //3 2428 SubstanceReferenceInformationGeneComponent t = new SubstanceReferenceInformationGeneComponent(); 2429 if (this.gene == null) 2430 this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>(); 2431 this.gene.add(t); 2432 return t; 2433 } 2434 2435 public SubstanceReferenceInformation addGene(SubstanceReferenceInformationGeneComponent t) { //3 2436 if (t == null) 2437 return this; 2438 if (this.gene == null) 2439 this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>(); 2440 this.gene.add(t); 2441 return this; 2442 } 2443 2444 /** 2445 * @return The first repetition of repeating field {@link #gene}, creating it if it does not already exist 2446 */ 2447 public SubstanceReferenceInformationGeneComponent getGeneFirstRep() { 2448 if (getGene().isEmpty()) { 2449 addGene(); 2450 } 2451 return getGene().get(0); 2452 } 2453 2454 /** 2455 * @return {@link #geneElement} (Todo.) 2456 */ 2457 public List<SubstanceReferenceInformationGeneElementComponent> getGeneElement() { 2458 if (this.geneElement == null) 2459 this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>(); 2460 return this.geneElement; 2461 } 2462 2463 /** 2464 * @return Returns a reference to <code>this</code> for easy method chaining 2465 */ 2466 public SubstanceReferenceInformation setGeneElement(List<SubstanceReferenceInformationGeneElementComponent> theGeneElement) { 2467 this.geneElement = theGeneElement; 2468 return this; 2469 } 2470 2471 public boolean hasGeneElement() { 2472 if (this.geneElement == null) 2473 return false; 2474 for (SubstanceReferenceInformationGeneElementComponent item : this.geneElement) 2475 if (!item.isEmpty()) 2476 return true; 2477 return false; 2478 } 2479 2480 public SubstanceReferenceInformationGeneElementComponent addGeneElement() { //3 2481 SubstanceReferenceInformationGeneElementComponent t = new SubstanceReferenceInformationGeneElementComponent(); 2482 if (this.geneElement == null) 2483 this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>(); 2484 this.geneElement.add(t); 2485 return t; 2486 } 2487 2488 public SubstanceReferenceInformation addGeneElement(SubstanceReferenceInformationGeneElementComponent t) { //3 2489 if (t == null) 2490 return this; 2491 if (this.geneElement == null) 2492 this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>(); 2493 this.geneElement.add(t); 2494 return this; 2495 } 2496 2497 /** 2498 * @return The first repetition of repeating field {@link #geneElement}, creating it if it does not already exist 2499 */ 2500 public SubstanceReferenceInformationGeneElementComponent getGeneElementFirstRep() { 2501 if (getGeneElement().isEmpty()) { 2502 addGeneElement(); 2503 } 2504 return getGeneElement().get(0); 2505 } 2506 2507 /** 2508 * @return {@link #classification} (Todo.) 2509 */ 2510 public List<SubstanceReferenceInformationClassificationComponent> getClassification() { 2511 if (this.classification == null) 2512 this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>(); 2513 return this.classification; 2514 } 2515 2516 /** 2517 * @return Returns a reference to <code>this</code> for easy method chaining 2518 */ 2519 public SubstanceReferenceInformation setClassification(List<SubstanceReferenceInformationClassificationComponent> theClassification) { 2520 this.classification = theClassification; 2521 return this; 2522 } 2523 2524 public boolean hasClassification() { 2525 if (this.classification == null) 2526 return false; 2527 for (SubstanceReferenceInformationClassificationComponent item : this.classification) 2528 if (!item.isEmpty()) 2529 return true; 2530 return false; 2531 } 2532 2533 public SubstanceReferenceInformationClassificationComponent addClassification() { //3 2534 SubstanceReferenceInformationClassificationComponent t = new SubstanceReferenceInformationClassificationComponent(); 2535 if (this.classification == null) 2536 this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>(); 2537 this.classification.add(t); 2538 return t; 2539 } 2540 2541 public SubstanceReferenceInformation addClassification(SubstanceReferenceInformationClassificationComponent t) { //3 2542 if (t == null) 2543 return this; 2544 if (this.classification == null) 2545 this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>(); 2546 this.classification.add(t); 2547 return this; 2548 } 2549 2550 /** 2551 * @return The first repetition of repeating field {@link #classification}, creating it if it does not already exist 2552 */ 2553 public SubstanceReferenceInformationClassificationComponent getClassificationFirstRep() { 2554 if (getClassification().isEmpty()) { 2555 addClassification(); 2556 } 2557 return getClassification().get(0); 2558 } 2559 2560 /** 2561 * @return {@link #relationship} (Todo.) 2562 */ 2563 public List<SubstanceReferenceInformationRelationshipComponent> getRelationship() { 2564 if (this.relationship == null) 2565 this.relationship = new ArrayList<SubstanceReferenceInformationRelationshipComponent>(); 2566 return this.relationship; 2567 } 2568 2569 /** 2570 * @return Returns a reference to <code>this</code> for easy method chaining 2571 */ 2572 public SubstanceReferenceInformation setRelationship(List<SubstanceReferenceInformationRelationshipComponent> theRelationship) { 2573 this.relationship = theRelationship; 2574 return this; 2575 } 2576 2577 public boolean hasRelationship() { 2578 if (this.relationship == null) 2579 return false; 2580 for (SubstanceReferenceInformationRelationshipComponent item : this.relationship) 2581 if (!item.isEmpty()) 2582 return true; 2583 return false; 2584 } 2585 2586 public SubstanceReferenceInformationRelationshipComponent addRelationship() { //3 2587 SubstanceReferenceInformationRelationshipComponent t = new SubstanceReferenceInformationRelationshipComponent(); 2588 if (this.relationship == null) 2589 this.relationship = new ArrayList<SubstanceReferenceInformationRelationshipComponent>(); 2590 this.relationship.add(t); 2591 return t; 2592 } 2593 2594 public SubstanceReferenceInformation addRelationship(SubstanceReferenceInformationRelationshipComponent t) { //3 2595 if (t == null) 2596 return this; 2597 if (this.relationship == null) 2598 this.relationship = new ArrayList<SubstanceReferenceInformationRelationshipComponent>(); 2599 this.relationship.add(t); 2600 return this; 2601 } 2602 2603 /** 2604 * @return The first repetition of repeating field {@link #relationship}, creating it if it does not already exist 2605 */ 2606 public SubstanceReferenceInformationRelationshipComponent getRelationshipFirstRep() { 2607 if (getRelationship().isEmpty()) { 2608 addRelationship(); 2609 } 2610 return getRelationship().get(0); 2611 } 2612 2613 /** 2614 * @return {@link #target} (Todo.) 2615 */ 2616 public List<SubstanceReferenceInformationTargetComponent> getTarget() { 2617 if (this.target == null) 2618 this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>(); 2619 return this.target; 2620 } 2621 2622 /** 2623 * @return Returns a reference to <code>this</code> for easy method chaining 2624 */ 2625 public SubstanceReferenceInformation setTarget(List<SubstanceReferenceInformationTargetComponent> theTarget) { 2626 this.target = theTarget; 2627 return this; 2628 } 2629 2630 public boolean hasTarget() { 2631 if (this.target == null) 2632 return false; 2633 for (SubstanceReferenceInformationTargetComponent item : this.target) 2634 if (!item.isEmpty()) 2635 return true; 2636 return false; 2637 } 2638 2639 public SubstanceReferenceInformationTargetComponent addTarget() { //3 2640 SubstanceReferenceInformationTargetComponent t = new SubstanceReferenceInformationTargetComponent(); 2641 if (this.target == null) 2642 this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>(); 2643 this.target.add(t); 2644 return t; 2645 } 2646 2647 public SubstanceReferenceInformation addTarget(SubstanceReferenceInformationTargetComponent t) { //3 2648 if (t == null) 2649 return this; 2650 if (this.target == null) 2651 this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>(); 2652 this.target.add(t); 2653 return this; 2654 } 2655 2656 /** 2657 * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist 2658 */ 2659 public SubstanceReferenceInformationTargetComponent getTargetFirstRep() { 2660 if (getTarget().isEmpty()) { 2661 addTarget(); 2662 } 2663 return getTarget().get(0); 2664 } 2665 2666 protected void listChildren(List<Property> children) { 2667 super.listChildren(children); 2668 children.add(new Property("comment", "string", "Todo.", 0, 1, comment)); 2669 children.add(new Property("gene", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, gene)); 2670 children.add(new Property("geneElement", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, geneElement)); 2671 children.add(new Property("classification", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, classification)); 2672 children.add(new Property("relationship", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, relationship)); 2673 children.add(new Property("target", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, target)); 2674 } 2675 2676 @Override 2677 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2678 switch (_hash) { 2679 case 950398559: /*comment*/ return new Property("comment", "string", "Todo.", 0, 1, comment); 2680 case 3169045: /*gene*/ return new Property("gene", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, gene); 2681 case -94918105: /*geneElement*/ return new Property("geneElement", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, geneElement); 2682 case 382350310: /*classification*/ return new Property("classification", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, classification); 2683 case -261851592: /*relationship*/ return new Property("relationship", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, relationship); 2684 case -880905839: /*target*/ return new Property("target", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, target); 2685 default: return super.getNamedProperty(_hash, _name, _checkValid); 2686 } 2687 2688 } 2689 2690 @Override 2691 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2692 switch (hash) { 2693 case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType 2694 case 3169045: /*gene*/ return this.gene == null ? new Base[0] : this.gene.toArray(new Base[this.gene.size()]); // SubstanceReferenceInformationGeneComponent 2695 case -94918105: /*geneElement*/ return this.geneElement == null ? new Base[0] : this.geneElement.toArray(new Base[this.geneElement.size()]); // SubstanceReferenceInformationGeneElementComponent 2696 case 382350310: /*classification*/ return this.classification == null ? new Base[0] : this.classification.toArray(new Base[this.classification.size()]); // SubstanceReferenceInformationClassificationComponent 2697 case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : this.relationship.toArray(new Base[this.relationship.size()]); // SubstanceReferenceInformationRelationshipComponent 2698 case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // SubstanceReferenceInformationTargetComponent 2699 default: return super.getProperty(hash, name, checkValid); 2700 } 2701 2702 } 2703 2704 @Override 2705 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2706 switch (hash) { 2707 case 950398559: // comment 2708 this.comment = castToString(value); // StringType 2709 return value; 2710 case 3169045: // gene 2711 this.getGene().add((SubstanceReferenceInformationGeneComponent) value); // SubstanceReferenceInformationGeneComponent 2712 return value; 2713 case -94918105: // geneElement 2714 this.getGeneElement().add((SubstanceReferenceInformationGeneElementComponent) value); // SubstanceReferenceInformationGeneElementComponent 2715 return value; 2716 case 382350310: // classification 2717 this.getClassification().add((SubstanceReferenceInformationClassificationComponent) value); // SubstanceReferenceInformationClassificationComponent 2718 return value; 2719 case -261851592: // relationship 2720 this.getRelationship().add((SubstanceReferenceInformationRelationshipComponent) value); // SubstanceReferenceInformationRelationshipComponent 2721 return value; 2722 case -880905839: // target 2723 this.getTarget().add((SubstanceReferenceInformationTargetComponent) value); // SubstanceReferenceInformationTargetComponent 2724 return value; 2725 default: return super.setProperty(hash, name, value); 2726 } 2727 2728 } 2729 2730 @Override 2731 public Base setProperty(String name, Base value) throws FHIRException { 2732 if (name.equals("comment")) { 2733 this.comment = castToString(value); // StringType 2734 } else if (name.equals("gene")) { 2735 this.getGene().add((SubstanceReferenceInformationGeneComponent) value); 2736 } else if (name.equals("geneElement")) { 2737 this.getGeneElement().add((SubstanceReferenceInformationGeneElementComponent) value); 2738 } else if (name.equals("classification")) { 2739 this.getClassification().add((SubstanceReferenceInformationClassificationComponent) value); 2740 } else if (name.equals("relationship")) { 2741 this.getRelationship().add((SubstanceReferenceInformationRelationshipComponent) value); 2742 } else if (name.equals("target")) { 2743 this.getTarget().add((SubstanceReferenceInformationTargetComponent) value); 2744 } else 2745 return super.setProperty(name, value); 2746 return value; 2747 } 2748 2749 @Override 2750 public Base makeProperty(int hash, String name) throws FHIRException { 2751 switch (hash) { 2752 case 950398559: return getCommentElement(); 2753 case 3169045: return addGene(); 2754 case -94918105: return addGeneElement(); 2755 case 382350310: return addClassification(); 2756 case -261851592: return addRelationship(); 2757 case -880905839: return addTarget(); 2758 default: return super.makeProperty(hash, name); 2759 } 2760 2761 } 2762 2763 @Override 2764 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2765 switch (hash) { 2766 case 950398559: /*comment*/ return new String[] {"string"}; 2767 case 3169045: /*gene*/ return new String[] {}; 2768 case -94918105: /*geneElement*/ return new String[] {}; 2769 case 382350310: /*classification*/ return new String[] {}; 2770 case -261851592: /*relationship*/ return new String[] {}; 2771 case -880905839: /*target*/ return new String[] {}; 2772 default: return super.getTypesForProperty(hash, name); 2773 } 2774 2775 } 2776 2777 @Override 2778 public Base addChild(String name) throws FHIRException { 2779 if (name.equals("comment")) { 2780 throw new FHIRException("Cannot call addChild on a primitive type SubstanceReferenceInformation.comment"); 2781 } 2782 else if (name.equals("gene")) { 2783 return addGene(); 2784 } 2785 else if (name.equals("geneElement")) { 2786 return addGeneElement(); 2787 } 2788 else if (name.equals("classification")) { 2789 return addClassification(); 2790 } 2791 else if (name.equals("relationship")) { 2792 return addRelationship(); 2793 } 2794 else if (name.equals("target")) { 2795 return addTarget(); 2796 } 2797 else 2798 return super.addChild(name); 2799 } 2800 2801 public String fhirType() { 2802 return "SubstanceReferenceInformation"; 2803 2804 } 2805 2806 public SubstanceReferenceInformation copy() { 2807 SubstanceReferenceInformation dst = new SubstanceReferenceInformation(); 2808 copyValues(dst); 2809 dst.comment = comment == null ? null : comment.copy(); 2810 if (gene != null) { 2811 dst.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>(); 2812 for (SubstanceReferenceInformationGeneComponent i : gene) 2813 dst.gene.add(i.copy()); 2814 }; 2815 if (geneElement != null) { 2816 dst.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>(); 2817 for (SubstanceReferenceInformationGeneElementComponent i : geneElement) 2818 dst.geneElement.add(i.copy()); 2819 }; 2820 if (classification != null) { 2821 dst.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>(); 2822 for (SubstanceReferenceInformationClassificationComponent i : classification) 2823 dst.classification.add(i.copy()); 2824 }; 2825 if (relationship != null) { 2826 dst.relationship = new ArrayList<SubstanceReferenceInformationRelationshipComponent>(); 2827 for (SubstanceReferenceInformationRelationshipComponent i : relationship) 2828 dst.relationship.add(i.copy()); 2829 }; 2830 if (target != null) { 2831 dst.target = new ArrayList<SubstanceReferenceInformationTargetComponent>(); 2832 for (SubstanceReferenceInformationTargetComponent i : target) 2833 dst.target.add(i.copy()); 2834 }; 2835 return dst; 2836 } 2837 2838 protected SubstanceReferenceInformation typedCopy() { 2839 return copy(); 2840 } 2841 2842 @Override 2843 public boolean equalsDeep(Base other_) { 2844 if (!super.equalsDeep(other_)) 2845 return false; 2846 if (!(other_ instanceof SubstanceReferenceInformation)) 2847 return false; 2848 SubstanceReferenceInformation o = (SubstanceReferenceInformation) other_; 2849 return compareDeep(comment, o.comment, true) && compareDeep(gene, o.gene, true) && compareDeep(geneElement, o.geneElement, true) 2850 && compareDeep(classification, o.classification, true) && compareDeep(relationship, o.relationship, true) 2851 && compareDeep(target, o.target, true); 2852 } 2853 2854 @Override 2855 public boolean equalsShallow(Base other_) { 2856 if (!super.equalsShallow(other_)) 2857 return false; 2858 if (!(other_ instanceof SubstanceReferenceInformation)) 2859 return false; 2860 SubstanceReferenceInformation o = (SubstanceReferenceInformation) other_; 2861 return compareValues(comment, o.comment, true); 2862 } 2863 2864 public boolean isEmpty() { 2865 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(comment, gene, geneElement 2866 , classification, relationship, target); 2867 } 2868 2869 @Override 2870 public ResourceType getResourceType() { 2871 return ResourceType.SubstanceReferenceInformation; 2872 } 2873 2874 2875} 2876