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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 033import java.util.ArrayList; 034import java.util.List; 035 036import org.hl7.fhir.exceptions.FHIRException; 037import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 038import org.hl7.fhir.utilities.Utilities; 039 040import ca.uhn.fhir.model.api.annotation.Block; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.Description; 043import ca.uhn.fhir.model.api.annotation.ResourceDef; 044 045/** 046 * Todo. 047 */ 048@ResourceDef(name = "SubstanceReferenceInformation", profile = "http://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformation") 049public class SubstanceReferenceInformation extends DomainResource { 050 051 @Block() 052 public static class SubstanceReferenceInformationGeneComponent extends BackboneElement 053 implements IBaseBackboneElement { 054 /** 055 * Todo. 056 */ 057 @Child(name = "geneSequenceOrigin", type = { 058 CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 059 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 060 protected CodeableConcept geneSequenceOrigin; 061 062 /** 063 * Todo. 064 */ 065 @Child(name = "gene", type = { 066 CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 067 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 068 protected CodeableConcept gene; 069 070 /** 071 * Todo. 072 */ 073 @Child(name = "source", type = { 074 DocumentReference.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 075 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 076 protected List<Reference> source; 077 /** 078 * The actual objects that are the target of the reference (Todo.) 079 */ 080 protected List<DocumentReference> sourceTarget; 081 082 private static final long serialVersionUID = 1615185105L; 083 084 /** 085 * Constructor 086 */ 087 public SubstanceReferenceInformationGeneComponent() { 088 super(); 089 } 090 091 /** 092 * @return {@link #geneSequenceOrigin} (Todo.) 093 */ 094 public CodeableConcept getGeneSequenceOrigin() { 095 if (this.geneSequenceOrigin == null) 096 if (Configuration.errorOnAutoCreate()) 097 throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneComponent.geneSequenceOrigin"); 098 else if (Configuration.doAutoCreate()) 099 this.geneSequenceOrigin = new CodeableConcept(); // cc 100 return this.geneSequenceOrigin; 101 } 102 103 public boolean hasGeneSequenceOrigin() { 104 return this.geneSequenceOrigin != null && !this.geneSequenceOrigin.isEmpty(); 105 } 106 107 /** 108 * @param value {@link #geneSequenceOrigin} (Todo.) 109 */ 110 public SubstanceReferenceInformationGeneComponent setGeneSequenceOrigin(CodeableConcept value) { 111 this.geneSequenceOrigin = value; 112 return this; 113 } 114 115 /** 116 * @return {@link #gene} (Todo.) 117 */ 118 public CodeableConcept getGene() { 119 if (this.gene == null) 120 if (Configuration.errorOnAutoCreate()) 121 throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneComponent.gene"); 122 else if (Configuration.doAutoCreate()) 123 this.gene = new CodeableConcept(); // cc 124 return this.gene; 125 } 126 127 public boolean hasGene() { 128 return this.gene != null && !this.gene.isEmpty(); 129 } 130 131 /** 132 * @param value {@link #gene} (Todo.) 133 */ 134 public SubstanceReferenceInformationGeneComponent setGene(CodeableConcept value) { 135 this.gene = value; 136 return this; 137 } 138 139 /** 140 * @return {@link #source} (Todo.) 141 */ 142 public List<Reference> getSource() { 143 if (this.source == null) 144 this.source = new ArrayList<Reference>(); 145 return this.source; 146 } 147 148 /** 149 * @return Returns a reference to <code>this</code> for easy method chaining 150 */ 151 public SubstanceReferenceInformationGeneComponent setSource(List<Reference> theSource) { 152 this.source = theSource; 153 return this; 154 } 155 156 public boolean hasSource() { 157 if (this.source == null) 158 return false; 159 for (Reference item : this.source) 160 if (!item.isEmpty()) 161 return true; 162 return false; 163 } 164 165 public Reference addSource() { // 3 166 Reference t = new Reference(); 167 if (this.source == null) 168 this.source = new ArrayList<Reference>(); 169 this.source.add(t); 170 return t; 171 } 172 173 public SubstanceReferenceInformationGeneComponent addSource(Reference t) { // 3 174 if (t == null) 175 return this; 176 if (this.source == null) 177 this.source = new ArrayList<Reference>(); 178 this.source.add(t); 179 return this; 180 } 181 182 /** 183 * @return The first repetition of repeating field {@link #source}, creating it 184 * if it does not already exist 185 */ 186 public Reference getSourceFirstRep() { 187 if (getSource().isEmpty()) { 188 addSource(); 189 } 190 return getSource().get(0); 191 } 192 193 /** 194 * @deprecated Use Reference#setResource(IBaseResource) instead 195 */ 196 @Deprecated 197 public List<DocumentReference> getSourceTarget() { 198 if (this.sourceTarget == null) 199 this.sourceTarget = new ArrayList<DocumentReference>(); 200 return this.sourceTarget; 201 } 202 203 /** 204 * @deprecated Use Reference#setResource(IBaseResource) instead 205 */ 206 @Deprecated 207 public DocumentReference addSourceTarget() { 208 DocumentReference r = new DocumentReference(); 209 if (this.sourceTarget == null) 210 this.sourceTarget = new ArrayList<DocumentReference>(); 211 this.sourceTarget.add(r); 212 return r; 213 } 214 215 protected void listChildren(List<Property> children) { 216 super.listChildren(children); 217 children.add(new Property("geneSequenceOrigin", "CodeableConcept", "Todo.", 0, 1, geneSequenceOrigin)); 218 children.add(new Property("gene", "CodeableConcept", "Todo.", 0, 1, gene)); 219 children 220 .add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 221 } 222 223 @Override 224 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 225 switch (_hash) { 226 case -1089463108: 227 /* geneSequenceOrigin */ return new Property("geneSequenceOrigin", "CodeableConcept", "Todo.", 0, 1, 228 geneSequenceOrigin); 229 case 3169045: 230 /* gene */ return new Property("gene", "CodeableConcept", "Todo.", 0, 1, gene); 231 case -896505829: 232 /* source */ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, 233 java.lang.Integer.MAX_VALUE, source); 234 default: 235 return super.getNamedProperty(_hash, _name, _checkValid); 236 } 237 238 } 239 240 @Override 241 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 242 switch (hash) { 243 case -1089463108: 244 /* geneSequenceOrigin */ return this.geneSequenceOrigin == null ? new Base[0] 245 : new Base[] { this.geneSequenceOrigin }; // CodeableConcept 246 case 3169045: 247 /* gene */ return this.gene == null ? new Base[0] : new Base[] { this.gene }; // CodeableConcept 248 case -896505829: 249 /* source */ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 250 default: 251 return super.getProperty(hash, name, checkValid); 252 } 253 254 } 255 256 @Override 257 public Base setProperty(int hash, String name, Base value) throws FHIRException { 258 switch (hash) { 259 case -1089463108: // geneSequenceOrigin 260 this.geneSequenceOrigin = castToCodeableConcept(value); // CodeableConcept 261 return value; 262 case 3169045: // gene 263 this.gene = castToCodeableConcept(value); // CodeableConcept 264 return value; 265 case -896505829: // source 266 this.getSource().add(castToReference(value)); // Reference 267 return value; 268 default: 269 return super.setProperty(hash, name, value); 270 } 271 272 } 273 274 @Override 275 public Base setProperty(String name, Base value) throws FHIRException { 276 if (name.equals("geneSequenceOrigin")) { 277 this.geneSequenceOrigin = castToCodeableConcept(value); // CodeableConcept 278 } else if (name.equals("gene")) { 279 this.gene = castToCodeableConcept(value); // CodeableConcept 280 } else if (name.equals("source")) { 281 this.getSource().add(castToReference(value)); 282 } else 283 return super.setProperty(name, value); 284 return value; 285 } 286 287 @Override 288 public Base makeProperty(int hash, String name) throws FHIRException { 289 switch (hash) { 290 case -1089463108: 291 return getGeneSequenceOrigin(); 292 case 3169045: 293 return getGene(); 294 case -896505829: 295 return addSource(); 296 default: 297 return super.makeProperty(hash, name); 298 } 299 300 } 301 302 @Override 303 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 304 switch (hash) { 305 case -1089463108: 306 /* geneSequenceOrigin */ return new String[] { "CodeableConcept" }; 307 case 3169045: 308 /* gene */ return new String[] { "CodeableConcept" }; 309 case -896505829: 310 /* source */ return new String[] { "Reference" }; 311 default: 312 return super.getTypesForProperty(hash, name); 313 } 314 315 } 316 317 @Override 318 public Base addChild(String name) throws FHIRException { 319 if (name.equals("geneSequenceOrigin")) { 320 this.geneSequenceOrigin = new CodeableConcept(); 321 return this.geneSequenceOrigin; 322 } else if (name.equals("gene")) { 323 this.gene = new CodeableConcept(); 324 return this.gene; 325 } else if (name.equals("source")) { 326 return addSource(); 327 } else 328 return super.addChild(name); 329 } 330 331 public SubstanceReferenceInformationGeneComponent copy() { 332 SubstanceReferenceInformationGeneComponent dst = new SubstanceReferenceInformationGeneComponent(); 333 copyValues(dst); 334 return dst; 335 } 336 337 public void copyValues(SubstanceReferenceInformationGeneComponent dst) { 338 super.copyValues(dst); 339 dst.geneSequenceOrigin = geneSequenceOrigin == null ? null : geneSequenceOrigin.copy(); 340 dst.gene = gene == null ? null : gene.copy(); 341 if (source != null) { 342 dst.source = new ArrayList<Reference>(); 343 for (Reference i : source) 344 dst.source.add(i.copy()); 345 } 346 ; 347 } 348 349 @Override 350 public boolean equalsDeep(Base other_) { 351 if (!super.equalsDeep(other_)) 352 return false; 353 if (!(other_ instanceof SubstanceReferenceInformationGeneComponent)) 354 return false; 355 SubstanceReferenceInformationGeneComponent o = (SubstanceReferenceInformationGeneComponent) other_; 356 return compareDeep(geneSequenceOrigin, o.geneSequenceOrigin, true) && compareDeep(gene, o.gene, true) 357 && compareDeep(source, o.source, true); 358 } 359 360 @Override 361 public boolean equalsShallow(Base other_) { 362 if (!super.equalsShallow(other_)) 363 return false; 364 if (!(other_ instanceof SubstanceReferenceInformationGeneComponent)) 365 return false; 366 SubstanceReferenceInformationGeneComponent o = (SubstanceReferenceInformationGeneComponent) other_; 367 return true; 368 } 369 370 public boolean isEmpty() { 371 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(geneSequenceOrigin, gene, source); 372 } 373 374 public String fhirType() { 375 return "SubstanceReferenceInformation.gene"; 376 377 } 378 379 } 380 381 @Block() 382 public static class SubstanceReferenceInformationGeneElementComponent extends BackboneElement 383 implements IBaseBackboneElement { 384 /** 385 * Todo. 386 */ 387 @Child(name = "type", type = { 388 CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 389 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 390 protected CodeableConcept type; 391 392 /** 393 * Todo. 394 */ 395 @Child(name = "element", type = { Identifier.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 396 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 397 protected Identifier element; 398 399 /** 400 * Todo. 401 */ 402 @Child(name = "source", type = { 403 DocumentReference.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 404 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 405 protected List<Reference> source; 406 /** 407 * The actual objects that are the target of the reference (Todo.) 408 */ 409 protected List<DocumentReference> sourceTarget; 410 411 private static final long serialVersionUID = 2055145950L; 412 413 /** 414 * Constructor 415 */ 416 public SubstanceReferenceInformationGeneElementComponent() { 417 super(); 418 } 419 420 /** 421 * @return {@link #type} (Todo.) 422 */ 423 public CodeableConcept getType() { 424 if (this.type == null) 425 if (Configuration.errorOnAutoCreate()) 426 throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneElementComponent.type"); 427 else if (Configuration.doAutoCreate()) 428 this.type = new CodeableConcept(); // cc 429 return this.type; 430 } 431 432 public boolean hasType() { 433 return this.type != null && !this.type.isEmpty(); 434 } 435 436 /** 437 * @param value {@link #type} (Todo.) 438 */ 439 public SubstanceReferenceInformationGeneElementComponent setType(CodeableConcept value) { 440 this.type = value; 441 return this; 442 } 443 444 /** 445 * @return {@link #element} (Todo.) 446 */ 447 public Identifier getElement() { 448 if (this.element == null) 449 if (Configuration.errorOnAutoCreate()) 450 throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneElementComponent.element"); 451 else if (Configuration.doAutoCreate()) 452 this.element = new Identifier(); // cc 453 return this.element; 454 } 455 456 public boolean hasElement() { 457 return this.element != null && !this.element.isEmpty(); 458 } 459 460 /** 461 * @param value {@link #element} (Todo.) 462 */ 463 public SubstanceReferenceInformationGeneElementComponent setElement(Identifier value) { 464 this.element = value; 465 return this; 466 } 467 468 /** 469 * @return {@link #source} (Todo.) 470 */ 471 public List<Reference> getSource() { 472 if (this.source == null) 473 this.source = new ArrayList<Reference>(); 474 return this.source; 475 } 476 477 /** 478 * @return Returns a reference to <code>this</code> for easy method chaining 479 */ 480 public SubstanceReferenceInformationGeneElementComponent setSource(List<Reference> theSource) { 481 this.source = theSource; 482 return this; 483 } 484 485 public boolean hasSource() { 486 if (this.source == null) 487 return false; 488 for (Reference item : this.source) 489 if (!item.isEmpty()) 490 return true; 491 return false; 492 } 493 494 public Reference addSource() { // 3 495 Reference t = new Reference(); 496 if (this.source == null) 497 this.source = new ArrayList<Reference>(); 498 this.source.add(t); 499 return t; 500 } 501 502 public SubstanceReferenceInformationGeneElementComponent addSource(Reference t) { // 3 503 if (t == null) 504 return this; 505 if (this.source == null) 506 this.source = new ArrayList<Reference>(); 507 this.source.add(t); 508 return this; 509 } 510 511 /** 512 * @return The first repetition of repeating field {@link #source}, creating it 513 * if it does not already exist 514 */ 515 public Reference getSourceFirstRep() { 516 if (getSource().isEmpty()) { 517 addSource(); 518 } 519 return getSource().get(0); 520 } 521 522 /** 523 * @deprecated Use Reference#setResource(IBaseResource) instead 524 */ 525 @Deprecated 526 public List<DocumentReference> getSourceTarget() { 527 if (this.sourceTarget == null) 528 this.sourceTarget = new ArrayList<DocumentReference>(); 529 return this.sourceTarget; 530 } 531 532 /** 533 * @deprecated Use Reference#setResource(IBaseResource) instead 534 */ 535 @Deprecated 536 public DocumentReference addSourceTarget() { 537 DocumentReference r = new DocumentReference(); 538 if (this.sourceTarget == null) 539 this.sourceTarget = new ArrayList<DocumentReference>(); 540 this.sourceTarget.add(r); 541 return r; 542 } 543 544 protected void listChildren(List<Property> children) { 545 super.listChildren(children); 546 children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type)); 547 children.add(new Property("element", "Identifier", "Todo.", 0, 1, element)); 548 children 549 .add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 550 } 551 552 @Override 553 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 554 switch (_hash) { 555 case 3575610: 556 /* type */ return new Property("type", "CodeableConcept", "Todo.", 0, 1, type); 557 case -1662836996: 558 /* element */ return new Property("element", "Identifier", "Todo.", 0, 1, element); 559 case -896505829: 560 /* source */ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, 561 java.lang.Integer.MAX_VALUE, source); 562 default: 563 return super.getNamedProperty(_hash, _name, _checkValid); 564 } 565 566 } 567 568 @Override 569 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 570 switch (hash) { 571 case 3575610: 572 /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept 573 case -1662836996: 574 /* element */ return this.element == null ? new Base[0] : new Base[] { this.element }; // Identifier 575 case -896505829: 576 /* source */ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 577 default: 578 return super.getProperty(hash, name, checkValid); 579 } 580 581 } 582 583 @Override 584 public Base setProperty(int hash, String name, Base value) throws FHIRException { 585 switch (hash) { 586 case 3575610: // type 587 this.type = castToCodeableConcept(value); // CodeableConcept 588 return value; 589 case -1662836996: // element 590 this.element = castToIdentifier(value); // Identifier 591 return value; 592 case -896505829: // source 593 this.getSource().add(castToReference(value)); // Reference 594 return value; 595 default: 596 return super.setProperty(hash, name, value); 597 } 598 599 } 600 601 @Override 602 public Base setProperty(String name, Base value) throws FHIRException { 603 if (name.equals("type")) { 604 this.type = castToCodeableConcept(value); // CodeableConcept 605 } else if (name.equals("element")) { 606 this.element = castToIdentifier(value); // Identifier 607 } else if (name.equals("source")) { 608 this.getSource().add(castToReference(value)); 609 } else 610 return super.setProperty(name, value); 611 return value; 612 } 613 614 @Override 615 public Base makeProperty(int hash, String name) throws FHIRException { 616 switch (hash) { 617 case 3575610: 618 return getType(); 619 case -1662836996: 620 return getElement(); 621 case -896505829: 622 return addSource(); 623 default: 624 return super.makeProperty(hash, name); 625 } 626 627 } 628 629 @Override 630 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 631 switch (hash) { 632 case 3575610: 633 /* type */ return new String[] { "CodeableConcept" }; 634 case -1662836996: 635 /* element */ return new String[] { "Identifier" }; 636 case -896505829: 637 /* source */ return new String[] { "Reference" }; 638 default: 639 return super.getTypesForProperty(hash, name); 640 } 641 642 } 643 644 @Override 645 public Base addChild(String name) throws FHIRException { 646 if (name.equals("type")) { 647 this.type = new CodeableConcept(); 648 return this.type; 649 } else if (name.equals("element")) { 650 this.element = new Identifier(); 651 return this.element; 652 } else if (name.equals("source")) { 653 return addSource(); 654 } else 655 return super.addChild(name); 656 } 657 658 public SubstanceReferenceInformationGeneElementComponent copy() { 659 SubstanceReferenceInformationGeneElementComponent dst = new SubstanceReferenceInformationGeneElementComponent(); 660 copyValues(dst); 661 return dst; 662 } 663 664 public void copyValues(SubstanceReferenceInformationGeneElementComponent dst) { 665 super.copyValues(dst); 666 dst.type = type == null ? null : type.copy(); 667 dst.element = element == null ? null : element.copy(); 668 if (source != null) { 669 dst.source = new ArrayList<Reference>(); 670 for (Reference i : source) 671 dst.source.add(i.copy()); 672 } 673 ; 674 } 675 676 @Override 677 public boolean equalsDeep(Base other_) { 678 if (!super.equalsDeep(other_)) 679 return false; 680 if (!(other_ instanceof SubstanceReferenceInformationGeneElementComponent)) 681 return false; 682 SubstanceReferenceInformationGeneElementComponent o = (SubstanceReferenceInformationGeneElementComponent) other_; 683 return compareDeep(type, o.type, true) && compareDeep(element, o.element, true) 684 && compareDeep(source, o.source, true); 685 } 686 687 @Override 688 public boolean equalsShallow(Base other_) { 689 if (!super.equalsShallow(other_)) 690 return false; 691 if (!(other_ instanceof SubstanceReferenceInformationGeneElementComponent)) 692 return false; 693 SubstanceReferenceInformationGeneElementComponent o = (SubstanceReferenceInformationGeneElementComponent) other_; 694 return true; 695 } 696 697 public boolean isEmpty() { 698 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, element, source); 699 } 700 701 public String fhirType() { 702 return "SubstanceReferenceInformation.geneElement"; 703 704 } 705 706 } 707 708 @Block() 709 public static class SubstanceReferenceInformationClassificationComponent extends BackboneElement 710 implements IBaseBackboneElement { 711 /** 712 * Todo. 713 */ 714 @Child(name = "domain", type = { 715 CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 716 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 717 protected CodeableConcept domain; 718 719 /** 720 * Todo. 721 */ 722 @Child(name = "classification", type = { 723 CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 724 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 725 protected CodeableConcept classification; 726 727 /** 728 * Todo. 729 */ 730 @Child(name = "subtype", type = { 731 CodeableConcept.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 732 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 733 protected List<CodeableConcept> subtype; 734 735 /** 736 * Todo. 737 */ 738 @Child(name = "source", type = { 739 DocumentReference.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 740 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 741 protected List<Reference> source; 742 /** 743 * The actual objects that are the target of the reference (Todo.) 744 */ 745 protected List<DocumentReference> sourceTarget; 746 747 private static final long serialVersionUID = -430084579L; 748 749 /** 750 * Constructor 751 */ 752 public SubstanceReferenceInformationClassificationComponent() { 753 super(); 754 } 755 756 /** 757 * @return {@link #domain} (Todo.) 758 */ 759 public CodeableConcept getDomain() { 760 if (this.domain == null) 761 if (Configuration.errorOnAutoCreate()) 762 throw new Error("Attempt to auto-create SubstanceReferenceInformationClassificationComponent.domain"); 763 else if (Configuration.doAutoCreate()) 764 this.domain = new CodeableConcept(); // cc 765 return this.domain; 766 } 767 768 public boolean hasDomain() { 769 return this.domain != null && !this.domain.isEmpty(); 770 } 771 772 /** 773 * @param value {@link #domain} (Todo.) 774 */ 775 public SubstanceReferenceInformationClassificationComponent setDomain(CodeableConcept value) { 776 this.domain = value; 777 return this; 778 } 779 780 /** 781 * @return {@link #classification} (Todo.) 782 */ 783 public CodeableConcept getClassification() { 784 if (this.classification == null) 785 if (Configuration.errorOnAutoCreate()) 786 throw new Error("Attempt to auto-create SubstanceReferenceInformationClassificationComponent.classification"); 787 else if (Configuration.doAutoCreate()) 788 this.classification = new CodeableConcept(); // cc 789 return this.classification; 790 } 791 792 public boolean hasClassification() { 793 return this.classification != null && !this.classification.isEmpty(); 794 } 795 796 /** 797 * @param value {@link #classification} (Todo.) 798 */ 799 public SubstanceReferenceInformationClassificationComponent setClassification(CodeableConcept value) { 800 this.classification = value; 801 return this; 802 } 803 804 /** 805 * @return {@link #subtype} (Todo.) 806 */ 807 public List<CodeableConcept> getSubtype() { 808 if (this.subtype == null) 809 this.subtype = new ArrayList<CodeableConcept>(); 810 return this.subtype; 811 } 812 813 /** 814 * @return Returns a reference to <code>this</code> for easy method chaining 815 */ 816 public SubstanceReferenceInformationClassificationComponent setSubtype(List<CodeableConcept> theSubtype) { 817 this.subtype = theSubtype; 818 return this; 819 } 820 821 public boolean hasSubtype() { 822 if (this.subtype == null) 823 return false; 824 for (CodeableConcept item : this.subtype) 825 if (!item.isEmpty()) 826 return true; 827 return false; 828 } 829 830 public CodeableConcept addSubtype() { // 3 831 CodeableConcept t = new CodeableConcept(); 832 if (this.subtype == null) 833 this.subtype = new ArrayList<CodeableConcept>(); 834 this.subtype.add(t); 835 return t; 836 } 837 838 public SubstanceReferenceInformationClassificationComponent addSubtype(CodeableConcept t) { // 3 839 if (t == null) 840 return this; 841 if (this.subtype == null) 842 this.subtype = new ArrayList<CodeableConcept>(); 843 this.subtype.add(t); 844 return this; 845 } 846 847 /** 848 * @return The first repetition of repeating field {@link #subtype}, creating it 849 * if it does not already exist 850 */ 851 public CodeableConcept getSubtypeFirstRep() { 852 if (getSubtype().isEmpty()) { 853 addSubtype(); 854 } 855 return getSubtype().get(0); 856 } 857 858 /** 859 * @return {@link #source} (Todo.) 860 */ 861 public List<Reference> getSource() { 862 if (this.source == null) 863 this.source = new ArrayList<Reference>(); 864 return this.source; 865 } 866 867 /** 868 * @return Returns a reference to <code>this</code> for easy method chaining 869 */ 870 public SubstanceReferenceInformationClassificationComponent setSource(List<Reference> theSource) { 871 this.source = theSource; 872 return this; 873 } 874 875 public boolean hasSource() { 876 if (this.source == null) 877 return false; 878 for (Reference item : this.source) 879 if (!item.isEmpty()) 880 return true; 881 return false; 882 } 883 884 public Reference addSource() { // 3 885 Reference t = new Reference(); 886 if (this.source == null) 887 this.source = new ArrayList<Reference>(); 888 this.source.add(t); 889 return t; 890 } 891 892 public SubstanceReferenceInformationClassificationComponent addSource(Reference t) { // 3 893 if (t == null) 894 return this; 895 if (this.source == null) 896 this.source = new ArrayList<Reference>(); 897 this.source.add(t); 898 return this; 899 } 900 901 /** 902 * @return The first repetition of repeating field {@link #source}, creating it 903 * if it does not already exist 904 */ 905 public Reference getSourceFirstRep() { 906 if (getSource().isEmpty()) { 907 addSource(); 908 } 909 return getSource().get(0); 910 } 911 912 /** 913 * @deprecated Use Reference#setResource(IBaseResource) instead 914 */ 915 @Deprecated 916 public List<DocumentReference> getSourceTarget() { 917 if (this.sourceTarget == null) 918 this.sourceTarget = new ArrayList<DocumentReference>(); 919 return this.sourceTarget; 920 } 921 922 /** 923 * @deprecated Use Reference#setResource(IBaseResource) instead 924 */ 925 @Deprecated 926 public DocumentReference addSourceTarget() { 927 DocumentReference r = new DocumentReference(); 928 if (this.sourceTarget == null) 929 this.sourceTarget = new ArrayList<DocumentReference>(); 930 this.sourceTarget.add(r); 931 return r; 932 } 933 934 protected void listChildren(List<Property> children) { 935 super.listChildren(children); 936 children.add(new Property("domain", "CodeableConcept", "Todo.", 0, 1, domain)); 937 children.add(new Property("classification", "CodeableConcept", "Todo.", 0, 1, classification)); 938 children.add(new Property("subtype", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, subtype)); 939 children 940 .add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 941 } 942 943 @Override 944 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 945 switch (_hash) { 946 case -1326197564: 947 /* domain */ return new Property("domain", "CodeableConcept", "Todo.", 0, 1, domain); 948 case 382350310: 949 /* classification */ return new Property("classification", "CodeableConcept", "Todo.", 0, 1, classification); 950 case -1867567750: 951 /* subtype */ return new Property("subtype", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, 952 subtype); 953 case -896505829: 954 /* source */ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, 955 java.lang.Integer.MAX_VALUE, source); 956 default: 957 return super.getNamedProperty(_hash, _name, _checkValid); 958 } 959 960 } 961 962 @Override 963 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 964 switch (hash) { 965 case -1326197564: 966 /* domain */ return this.domain == null ? new Base[0] : new Base[] { this.domain }; // CodeableConcept 967 case 382350310: 968 /* classification */ return this.classification == null ? new Base[0] : new Base[] { this.classification }; // CodeableConcept 969 case -1867567750: 970 /* subtype */ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept 971 case -896505829: 972 /* source */ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 973 default: 974 return super.getProperty(hash, name, checkValid); 975 } 976 977 } 978 979 @Override 980 public Base setProperty(int hash, String name, Base value) throws FHIRException { 981 switch (hash) { 982 case -1326197564: // domain 983 this.domain = castToCodeableConcept(value); // CodeableConcept 984 return value; 985 case 382350310: // classification 986 this.classification = castToCodeableConcept(value); // CodeableConcept 987 return value; 988 case -1867567750: // subtype 989 this.getSubtype().add(castToCodeableConcept(value)); // CodeableConcept 990 return value; 991 case -896505829: // source 992 this.getSource().add(castToReference(value)); // Reference 993 return value; 994 default: 995 return super.setProperty(hash, name, value); 996 } 997 998 } 999 1000 @Override 1001 public Base setProperty(String name, Base value) throws FHIRException { 1002 if (name.equals("domain")) { 1003 this.domain = castToCodeableConcept(value); // CodeableConcept 1004 } else if (name.equals("classification")) { 1005 this.classification = castToCodeableConcept(value); // CodeableConcept 1006 } else if (name.equals("subtype")) { 1007 this.getSubtype().add(castToCodeableConcept(value)); 1008 } else if (name.equals("source")) { 1009 this.getSource().add(castToReference(value)); 1010 } else 1011 return super.setProperty(name, value); 1012 return value; 1013 } 1014 1015 @Override 1016 public Base makeProperty(int hash, String name) throws FHIRException { 1017 switch (hash) { 1018 case -1326197564: 1019 return getDomain(); 1020 case 382350310: 1021 return getClassification(); 1022 case -1867567750: 1023 return addSubtype(); 1024 case -896505829: 1025 return addSource(); 1026 default: 1027 return super.makeProperty(hash, name); 1028 } 1029 1030 } 1031 1032 @Override 1033 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1034 switch (hash) { 1035 case -1326197564: 1036 /* domain */ return new String[] { "CodeableConcept" }; 1037 case 382350310: 1038 /* classification */ return new String[] { "CodeableConcept" }; 1039 case -1867567750: 1040 /* subtype */ return new String[] { "CodeableConcept" }; 1041 case -896505829: 1042 /* source */ return new String[] { "Reference" }; 1043 default: 1044 return super.getTypesForProperty(hash, name); 1045 } 1046 1047 } 1048 1049 @Override 1050 public Base addChild(String name) throws FHIRException { 1051 if (name.equals("domain")) { 1052 this.domain = new CodeableConcept(); 1053 return this.domain; 1054 } else if (name.equals("classification")) { 1055 this.classification = new CodeableConcept(); 1056 return this.classification; 1057 } else if (name.equals("subtype")) { 1058 return addSubtype(); 1059 } else if (name.equals("source")) { 1060 return addSource(); 1061 } else 1062 return super.addChild(name); 1063 } 1064 1065 public SubstanceReferenceInformationClassificationComponent copy() { 1066 SubstanceReferenceInformationClassificationComponent dst = new SubstanceReferenceInformationClassificationComponent(); 1067 copyValues(dst); 1068 return dst; 1069 } 1070 1071 public void copyValues(SubstanceReferenceInformationClassificationComponent dst) { 1072 super.copyValues(dst); 1073 dst.domain = domain == null ? null : domain.copy(); 1074 dst.classification = classification == null ? null : classification.copy(); 1075 if (subtype != null) { 1076 dst.subtype = new ArrayList<CodeableConcept>(); 1077 for (CodeableConcept i : subtype) 1078 dst.subtype.add(i.copy()); 1079 } 1080 ; 1081 if (source != null) { 1082 dst.source = new ArrayList<Reference>(); 1083 for (Reference i : source) 1084 dst.source.add(i.copy()); 1085 } 1086 ; 1087 } 1088 1089 @Override 1090 public boolean equalsDeep(Base other_) { 1091 if (!super.equalsDeep(other_)) 1092 return false; 1093 if (!(other_ instanceof SubstanceReferenceInformationClassificationComponent)) 1094 return false; 1095 SubstanceReferenceInformationClassificationComponent o = (SubstanceReferenceInformationClassificationComponent) other_; 1096 return compareDeep(domain, o.domain, true) && compareDeep(classification, o.classification, true) 1097 && compareDeep(subtype, o.subtype, true) && compareDeep(source, o.source, true); 1098 } 1099 1100 @Override 1101 public boolean equalsShallow(Base other_) { 1102 if (!super.equalsShallow(other_)) 1103 return false; 1104 if (!(other_ instanceof SubstanceReferenceInformationClassificationComponent)) 1105 return false; 1106 SubstanceReferenceInformationClassificationComponent o = (SubstanceReferenceInformationClassificationComponent) other_; 1107 return true; 1108 } 1109 1110 public boolean isEmpty() { 1111 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(domain, classification, subtype, source); 1112 } 1113 1114 public String fhirType() { 1115 return "SubstanceReferenceInformation.classification"; 1116 1117 } 1118 1119 } 1120 1121 @Block() 1122 public static class SubstanceReferenceInformationTargetComponent extends BackboneElement 1123 implements IBaseBackboneElement { 1124 /** 1125 * Todo. 1126 */ 1127 @Child(name = "target", type = { Identifier.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 1128 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1129 protected Identifier target; 1130 1131 /** 1132 * Todo. 1133 */ 1134 @Child(name = "type", type = { 1135 CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 1136 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1137 protected CodeableConcept type; 1138 1139 /** 1140 * Todo. 1141 */ 1142 @Child(name = "interaction", type = { 1143 CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 1144 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1145 protected CodeableConcept interaction; 1146 1147 /** 1148 * Todo. 1149 */ 1150 @Child(name = "organism", type = { 1151 CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = true) 1152 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1153 protected CodeableConcept organism; 1154 1155 /** 1156 * Todo. 1157 */ 1158 @Child(name = "organismType", type = { 1159 CodeableConcept.class }, order = 5, min = 0, max = 1, modifier = false, summary = true) 1160 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1161 protected CodeableConcept organismType; 1162 1163 /** 1164 * Todo. 1165 */ 1166 @Child(name = "amount", type = { Quantity.class, Range.class, 1167 StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 1168 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1169 protected Type amount; 1170 1171 /** 1172 * Todo. 1173 */ 1174 @Child(name = "amountType", type = { 1175 CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = true) 1176 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1177 protected CodeableConcept amountType; 1178 1179 /** 1180 * Todo. 1181 */ 1182 @Child(name = "source", type = { 1183 DocumentReference.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1184 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1185 protected List<Reference> source; 1186 /** 1187 * The actual objects that are the target of the reference (Todo.) 1188 */ 1189 protected List<DocumentReference> sourceTarget; 1190 1191 private static final long serialVersionUID = -1682270197L; 1192 1193 /** 1194 * Constructor 1195 */ 1196 public SubstanceReferenceInformationTargetComponent() { 1197 super(); 1198 } 1199 1200 /** 1201 * @return {@link #target} (Todo.) 1202 */ 1203 public Identifier getTarget() { 1204 if (this.target == null) 1205 if (Configuration.errorOnAutoCreate()) 1206 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.target"); 1207 else if (Configuration.doAutoCreate()) 1208 this.target = new Identifier(); // cc 1209 return this.target; 1210 } 1211 1212 public boolean hasTarget() { 1213 return this.target != null && !this.target.isEmpty(); 1214 } 1215 1216 /** 1217 * @param value {@link #target} (Todo.) 1218 */ 1219 public SubstanceReferenceInformationTargetComponent setTarget(Identifier value) { 1220 this.target = value; 1221 return this; 1222 } 1223 1224 /** 1225 * @return {@link #type} (Todo.) 1226 */ 1227 public CodeableConcept getType() { 1228 if (this.type == null) 1229 if (Configuration.errorOnAutoCreate()) 1230 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.type"); 1231 else if (Configuration.doAutoCreate()) 1232 this.type = new CodeableConcept(); // cc 1233 return this.type; 1234 } 1235 1236 public boolean hasType() { 1237 return this.type != null && !this.type.isEmpty(); 1238 } 1239 1240 /** 1241 * @param value {@link #type} (Todo.) 1242 */ 1243 public SubstanceReferenceInformationTargetComponent setType(CodeableConcept value) { 1244 this.type = value; 1245 return this; 1246 } 1247 1248 /** 1249 * @return {@link #interaction} (Todo.) 1250 */ 1251 public CodeableConcept getInteraction() { 1252 if (this.interaction == null) 1253 if (Configuration.errorOnAutoCreate()) 1254 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.interaction"); 1255 else if (Configuration.doAutoCreate()) 1256 this.interaction = new CodeableConcept(); // cc 1257 return this.interaction; 1258 } 1259 1260 public boolean hasInteraction() { 1261 return this.interaction != null && !this.interaction.isEmpty(); 1262 } 1263 1264 /** 1265 * @param value {@link #interaction} (Todo.) 1266 */ 1267 public SubstanceReferenceInformationTargetComponent setInteraction(CodeableConcept value) { 1268 this.interaction = value; 1269 return this; 1270 } 1271 1272 /** 1273 * @return {@link #organism} (Todo.) 1274 */ 1275 public CodeableConcept getOrganism() { 1276 if (this.organism == null) 1277 if (Configuration.errorOnAutoCreate()) 1278 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.organism"); 1279 else if (Configuration.doAutoCreate()) 1280 this.organism = new CodeableConcept(); // cc 1281 return this.organism; 1282 } 1283 1284 public boolean hasOrganism() { 1285 return this.organism != null && !this.organism.isEmpty(); 1286 } 1287 1288 /** 1289 * @param value {@link #organism} (Todo.) 1290 */ 1291 public SubstanceReferenceInformationTargetComponent setOrganism(CodeableConcept value) { 1292 this.organism = value; 1293 return this; 1294 } 1295 1296 /** 1297 * @return {@link #organismType} (Todo.) 1298 */ 1299 public CodeableConcept getOrganismType() { 1300 if (this.organismType == null) 1301 if (Configuration.errorOnAutoCreate()) 1302 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.organismType"); 1303 else if (Configuration.doAutoCreate()) 1304 this.organismType = new CodeableConcept(); // cc 1305 return this.organismType; 1306 } 1307 1308 public boolean hasOrganismType() { 1309 return this.organismType != null && !this.organismType.isEmpty(); 1310 } 1311 1312 /** 1313 * @param value {@link #organismType} (Todo.) 1314 */ 1315 public SubstanceReferenceInformationTargetComponent setOrganismType(CodeableConcept value) { 1316 this.organismType = value; 1317 return this; 1318 } 1319 1320 /** 1321 * @return {@link #amount} (Todo.) 1322 */ 1323 public Type getAmount() { 1324 return this.amount; 1325 } 1326 1327 /** 1328 * @return {@link #amount} (Todo.) 1329 */ 1330 public Quantity getAmountQuantity() throws FHIRException { 1331 if (this.amount == null) 1332 this.amount = new Quantity(); 1333 if (!(this.amount instanceof Quantity)) 1334 throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.amount.getClass().getName() 1335 + " was encountered"); 1336 return (Quantity) this.amount; 1337 } 1338 1339 public boolean hasAmountQuantity() { 1340 return this != null && this.amount instanceof Quantity; 1341 } 1342 1343 /** 1344 * @return {@link #amount} (Todo.) 1345 */ 1346 public Range getAmountRange() throws FHIRException { 1347 if (this.amount == null) 1348 this.amount = new Range(); 1349 if (!(this.amount instanceof Range)) 1350 throw new FHIRException( 1351 "Type mismatch: the type Range was expected, but " + this.amount.getClass().getName() + " was encountered"); 1352 return (Range) this.amount; 1353 } 1354 1355 public boolean hasAmountRange() { 1356 return this != null && this.amount instanceof Range; 1357 } 1358 1359 /** 1360 * @return {@link #amount} (Todo.) 1361 */ 1362 public StringType getAmountStringType() throws FHIRException { 1363 if (this.amount == null) 1364 this.amount = new StringType(); 1365 if (!(this.amount instanceof StringType)) 1366 throw new FHIRException("Type mismatch: the type StringType was expected, but " 1367 + this.amount.getClass().getName() + " was encountered"); 1368 return (StringType) this.amount; 1369 } 1370 1371 public boolean hasAmountStringType() { 1372 return this != null && this.amount instanceof StringType; 1373 } 1374 1375 public boolean hasAmount() { 1376 return this.amount != null && !this.amount.isEmpty(); 1377 } 1378 1379 /** 1380 * @param value {@link #amount} (Todo.) 1381 */ 1382 public SubstanceReferenceInformationTargetComponent setAmount(Type value) { 1383 if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof StringType)) 1384 throw new Error("Not the right type for SubstanceReferenceInformation.target.amount[x]: " + value.fhirType()); 1385 this.amount = value; 1386 return this; 1387 } 1388 1389 /** 1390 * @return {@link #amountType} (Todo.) 1391 */ 1392 public CodeableConcept getAmountType() { 1393 if (this.amountType == null) 1394 if (Configuration.errorOnAutoCreate()) 1395 throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.amountType"); 1396 else if (Configuration.doAutoCreate()) 1397 this.amountType = new CodeableConcept(); // cc 1398 return this.amountType; 1399 } 1400 1401 public boolean hasAmountType() { 1402 return this.amountType != null && !this.amountType.isEmpty(); 1403 } 1404 1405 /** 1406 * @param value {@link #amountType} (Todo.) 1407 */ 1408 public SubstanceReferenceInformationTargetComponent setAmountType(CodeableConcept value) { 1409 this.amountType = value; 1410 return this; 1411 } 1412 1413 /** 1414 * @return {@link #source} (Todo.) 1415 */ 1416 public List<Reference> getSource() { 1417 if (this.source == null) 1418 this.source = new ArrayList<Reference>(); 1419 return this.source; 1420 } 1421 1422 /** 1423 * @return Returns a reference to <code>this</code> for easy method chaining 1424 */ 1425 public SubstanceReferenceInformationTargetComponent setSource(List<Reference> theSource) { 1426 this.source = theSource; 1427 return this; 1428 } 1429 1430 public boolean hasSource() { 1431 if (this.source == null) 1432 return false; 1433 for (Reference item : this.source) 1434 if (!item.isEmpty()) 1435 return true; 1436 return false; 1437 } 1438 1439 public Reference addSource() { // 3 1440 Reference t = new Reference(); 1441 if (this.source == null) 1442 this.source = new ArrayList<Reference>(); 1443 this.source.add(t); 1444 return t; 1445 } 1446 1447 public SubstanceReferenceInformationTargetComponent addSource(Reference t) { // 3 1448 if (t == null) 1449 return this; 1450 if (this.source == null) 1451 this.source = new ArrayList<Reference>(); 1452 this.source.add(t); 1453 return this; 1454 } 1455 1456 /** 1457 * @return The first repetition of repeating field {@link #source}, creating it 1458 * if it does not already exist 1459 */ 1460 public Reference getSourceFirstRep() { 1461 if (getSource().isEmpty()) { 1462 addSource(); 1463 } 1464 return getSource().get(0); 1465 } 1466 1467 /** 1468 * @deprecated Use Reference#setResource(IBaseResource) instead 1469 */ 1470 @Deprecated 1471 public List<DocumentReference> getSourceTarget() { 1472 if (this.sourceTarget == null) 1473 this.sourceTarget = new ArrayList<DocumentReference>(); 1474 return this.sourceTarget; 1475 } 1476 1477 /** 1478 * @deprecated Use Reference#setResource(IBaseResource) instead 1479 */ 1480 @Deprecated 1481 public DocumentReference addSourceTarget() { 1482 DocumentReference r = new DocumentReference(); 1483 if (this.sourceTarget == null) 1484 this.sourceTarget = new ArrayList<DocumentReference>(); 1485 this.sourceTarget.add(r); 1486 return r; 1487 } 1488 1489 protected void listChildren(List<Property> children) { 1490 super.listChildren(children); 1491 children.add(new Property("target", "Identifier", "Todo.", 0, 1, target)); 1492 children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type)); 1493 children.add(new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction)); 1494 children.add(new Property("organism", "CodeableConcept", "Todo.", 0, 1, organism)); 1495 children.add(new Property("organismType", "CodeableConcept", "Todo.", 0, 1, organismType)); 1496 children.add(new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount)); 1497 children.add(new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType)); 1498 children 1499 .add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source)); 1500 } 1501 1502 @Override 1503 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1504 switch (_hash) { 1505 case -880905839: 1506 /* target */ return new Property("target", "Identifier", "Todo.", 0, 1, target); 1507 case 3575610: 1508 /* type */ return new Property("type", "CodeableConcept", "Todo.", 0, 1, type); 1509 case 1844104722: 1510 /* interaction */ return new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction); 1511 case 1316389074: 1512 /* organism */ return new Property("organism", "CodeableConcept", "Todo.", 0, 1, organism); 1513 case 988662572: 1514 /* organismType */ return new Property("organismType", "CodeableConcept", "Todo.", 0, 1, organismType); 1515 case 646780200: 1516 /* amount[x] */ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1517 case -1413853096: 1518 /* amount */ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1519 case 1664303363: 1520 /* amountQuantity */ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1521 case -1223462971: 1522 /* amountRange */ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1523 case 773651081: 1524 /* amountString */ return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount); 1525 case -1424857166: 1526 /* amountType */ return new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType); 1527 case -896505829: 1528 /* source */ return new Property("source", "Reference(DocumentReference)", "Todo.", 0, 1529 java.lang.Integer.MAX_VALUE, source); 1530 default: 1531 return super.getNamedProperty(_hash, _name, _checkValid); 1532 } 1533 1534 } 1535 1536 @Override 1537 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1538 switch (hash) { 1539 case -880905839: 1540 /* target */ return this.target == null ? new Base[0] : new Base[] { this.target }; // Identifier 1541 case 3575610: 1542 /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept 1543 case 1844104722: 1544 /* interaction */ return this.interaction == null ? new Base[0] : new Base[] { this.interaction }; // CodeableConcept 1545 case 1316389074: 1546 /* organism */ return this.organism == null ? new Base[0] : new Base[] { this.organism }; // CodeableConcept 1547 case 988662572: 1548 /* organismType */ return this.organismType == null ? new Base[0] : new Base[] { this.organismType }; // CodeableConcept 1549 case -1413853096: 1550 /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Type 1551 case -1424857166: 1552 /* amountType */ return this.amountType == null ? new Base[0] : new Base[] { this.amountType }; // CodeableConcept 1553 case -896505829: 1554 /* source */ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference 1555 default: 1556 return super.getProperty(hash, name, checkValid); 1557 } 1558 1559 } 1560 1561 @Override 1562 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1563 switch (hash) { 1564 case -880905839: // target 1565 this.target = castToIdentifier(value); // Identifier 1566 return value; 1567 case 3575610: // type 1568 this.type = castToCodeableConcept(value); // CodeableConcept 1569 return value; 1570 case 1844104722: // interaction 1571 this.interaction = castToCodeableConcept(value); // CodeableConcept 1572 return value; 1573 case 1316389074: // organism 1574 this.organism = castToCodeableConcept(value); // CodeableConcept 1575 return value; 1576 case 988662572: // organismType 1577 this.organismType = castToCodeableConcept(value); // CodeableConcept 1578 return value; 1579 case -1413853096: // amount 1580 this.amount = castToType(value); // Type 1581 return value; 1582 case -1424857166: // amountType 1583 this.amountType = castToCodeableConcept(value); // CodeableConcept 1584 return value; 1585 case -896505829: // source 1586 this.getSource().add(castToReference(value)); // Reference 1587 return value; 1588 default: 1589 return super.setProperty(hash, name, value); 1590 } 1591 1592 } 1593 1594 @Override 1595 public Base setProperty(String name, Base value) throws FHIRException { 1596 if (name.equals("target")) { 1597 this.target = castToIdentifier(value); // Identifier 1598 } else if (name.equals("type")) { 1599 this.type = castToCodeableConcept(value); // CodeableConcept 1600 } else if (name.equals("interaction")) { 1601 this.interaction = castToCodeableConcept(value); // CodeableConcept 1602 } else if (name.equals("organism")) { 1603 this.organism = castToCodeableConcept(value); // CodeableConcept 1604 } else if (name.equals("organismType")) { 1605 this.organismType = castToCodeableConcept(value); // CodeableConcept 1606 } else if (name.equals("amount[x]")) { 1607 this.amount = castToType(value); // Type 1608 } else if (name.equals("amountType")) { 1609 this.amountType = castToCodeableConcept(value); // CodeableConcept 1610 } else if (name.equals("source")) { 1611 this.getSource().add(castToReference(value)); 1612 } else 1613 return super.setProperty(name, value); 1614 return value; 1615 } 1616 1617 @Override 1618 public Base makeProperty(int hash, String name) throws FHIRException { 1619 switch (hash) { 1620 case -880905839: 1621 return getTarget(); 1622 case 3575610: 1623 return getType(); 1624 case 1844104722: 1625 return getInteraction(); 1626 case 1316389074: 1627 return getOrganism(); 1628 case 988662572: 1629 return getOrganismType(); 1630 case 646780200: 1631 return getAmount(); 1632 case -1413853096: 1633 return getAmount(); 1634 case -1424857166: 1635 return getAmountType(); 1636 case -896505829: 1637 return addSource(); 1638 default: 1639 return super.makeProperty(hash, name); 1640 } 1641 1642 } 1643 1644 @Override 1645 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1646 switch (hash) { 1647 case -880905839: 1648 /* target */ return new String[] { "Identifier" }; 1649 case 3575610: 1650 /* type */ return new String[] { "CodeableConcept" }; 1651 case 1844104722: 1652 /* interaction */ return new String[] { "CodeableConcept" }; 1653 case 1316389074: 1654 /* organism */ return new String[] { "CodeableConcept" }; 1655 case 988662572: 1656 /* organismType */ return new String[] { "CodeableConcept" }; 1657 case -1413853096: 1658 /* amount */ return new String[] { "Quantity", "Range", "string" }; 1659 case -1424857166: 1660 /* amountType */ return new String[] { "CodeableConcept" }; 1661 case -896505829: 1662 /* source */ return new String[] { "Reference" }; 1663 default: 1664 return super.getTypesForProperty(hash, name); 1665 } 1666 1667 } 1668 1669 @Override 1670 public Base addChild(String name) throws FHIRException { 1671 if (name.equals("target")) { 1672 this.target = new Identifier(); 1673 return this.target; 1674 } else if (name.equals("type")) { 1675 this.type = new CodeableConcept(); 1676 return this.type; 1677 } else if (name.equals("interaction")) { 1678 this.interaction = new CodeableConcept(); 1679 return this.interaction; 1680 } else if (name.equals("organism")) { 1681 this.organism = new CodeableConcept(); 1682 return this.organism; 1683 } else if (name.equals("organismType")) { 1684 this.organismType = new CodeableConcept(); 1685 return this.organismType; 1686 } else if (name.equals("amountQuantity")) { 1687 this.amount = new Quantity(); 1688 return this.amount; 1689 } else if (name.equals("amountRange")) { 1690 this.amount = new Range(); 1691 return this.amount; 1692 } else if (name.equals("amountString")) { 1693 this.amount = new StringType(); 1694 return this.amount; 1695 } else if (name.equals("amountType")) { 1696 this.amountType = new CodeableConcept(); 1697 return this.amountType; 1698 } else if (name.equals("source")) { 1699 return addSource(); 1700 } else 1701 return super.addChild(name); 1702 } 1703 1704 public SubstanceReferenceInformationTargetComponent copy() { 1705 SubstanceReferenceInformationTargetComponent dst = new SubstanceReferenceInformationTargetComponent(); 1706 copyValues(dst); 1707 return dst; 1708 } 1709 1710 public void copyValues(SubstanceReferenceInformationTargetComponent dst) { 1711 super.copyValues(dst); 1712 dst.target = target == null ? null : target.copy(); 1713 dst.type = type == null ? null : type.copy(); 1714 dst.interaction = interaction == null ? null : interaction.copy(); 1715 dst.organism = organism == null ? null : organism.copy(); 1716 dst.organismType = organismType == null ? null : organismType.copy(); 1717 dst.amount = amount == null ? null : amount.copy(); 1718 dst.amountType = amountType == null ? null : amountType.copy(); 1719 if (source != null) { 1720 dst.source = new ArrayList<Reference>(); 1721 for (Reference i : source) 1722 dst.source.add(i.copy()); 1723 } 1724 ; 1725 } 1726 1727 @Override 1728 public boolean equalsDeep(Base other_) { 1729 if (!super.equalsDeep(other_)) 1730 return false; 1731 if (!(other_ instanceof SubstanceReferenceInformationTargetComponent)) 1732 return false; 1733 SubstanceReferenceInformationTargetComponent o = (SubstanceReferenceInformationTargetComponent) other_; 1734 return compareDeep(target, o.target, true) && compareDeep(type, o.type, true) 1735 && compareDeep(interaction, o.interaction, true) && compareDeep(organism, o.organism, true) 1736 && compareDeep(organismType, o.organismType, true) && compareDeep(amount, o.amount, true) 1737 && compareDeep(amountType, o.amountType, true) && compareDeep(source, o.source, true); 1738 } 1739 1740 @Override 1741 public boolean equalsShallow(Base other_) { 1742 if (!super.equalsShallow(other_)) 1743 return false; 1744 if (!(other_ instanceof SubstanceReferenceInformationTargetComponent)) 1745 return false; 1746 SubstanceReferenceInformationTargetComponent o = (SubstanceReferenceInformationTargetComponent) other_; 1747 return true; 1748 } 1749 1750 public boolean isEmpty() { 1751 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(target, type, interaction, organism, organismType, 1752 amount, amountType, source); 1753 } 1754 1755 public String fhirType() { 1756 return "SubstanceReferenceInformation.target"; 1757 1758 } 1759 1760 } 1761 1762 /** 1763 * Todo. 1764 */ 1765 @Child(name = "comment", type = { StringType.class }, order = 0, min = 0, max = 1, modifier = false, summary = true) 1766 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1767 protected StringType comment; 1768 1769 /** 1770 * Todo. 1771 */ 1772 @Child(name = "gene", type = {}, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1773 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1774 protected List<SubstanceReferenceInformationGeneComponent> gene; 1775 1776 /** 1777 * Todo. 1778 */ 1779 @Child(name = "geneElement", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1780 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1781 protected List<SubstanceReferenceInformationGeneElementComponent> geneElement; 1782 1783 /** 1784 * Todo. 1785 */ 1786 @Child(name = "classification", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1787 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1788 protected List<SubstanceReferenceInformationClassificationComponent> classification; 1789 1790 /** 1791 * Todo. 1792 */ 1793 @Child(name = "target", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 1794 @Description(shortDefinition = "Todo", formalDefinition = "Todo.") 1795 protected List<SubstanceReferenceInformationTargetComponent> target; 1796 1797 private static final long serialVersionUID = 890303332L; 1798 1799 /** 1800 * Constructor 1801 */ 1802 public SubstanceReferenceInformation() { 1803 super(); 1804 } 1805 1806 /** 1807 * @return {@link #comment} (Todo.). This is the underlying object with id, 1808 * value and extensions. The accessor "getComment" gives direct access 1809 * to the value 1810 */ 1811 public StringType getCommentElement() { 1812 if (this.comment == null) 1813 if (Configuration.errorOnAutoCreate()) 1814 throw new Error("Attempt to auto-create SubstanceReferenceInformation.comment"); 1815 else if (Configuration.doAutoCreate()) 1816 this.comment = new StringType(); // bb 1817 return this.comment; 1818 } 1819 1820 public boolean hasCommentElement() { 1821 return this.comment != null && !this.comment.isEmpty(); 1822 } 1823 1824 public boolean hasComment() { 1825 return this.comment != null && !this.comment.isEmpty(); 1826 } 1827 1828 /** 1829 * @param value {@link #comment} (Todo.). This is the underlying object with id, 1830 * value and extensions. The accessor "getComment" gives direct 1831 * access to the value 1832 */ 1833 public SubstanceReferenceInformation setCommentElement(StringType value) { 1834 this.comment = value; 1835 return this; 1836 } 1837 1838 /** 1839 * @return Todo. 1840 */ 1841 public String getComment() { 1842 return this.comment == null ? null : this.comment.getValue(); 1843 } 1844 1845 /** 1846 * @param value Todo. 1847 */ 1848 public SubstanceReferenceInformation setComment(String value) { 1849 if (Utilities.noString(value)) 1850 this.comment = null; 1851 else { 1852 if (this.comment == null) 1853 this.comment = new StringType(); 1854 this.comment.setValue(value); 1855 } 1856 return this; 1857 } 1858 1859 /** 1860 * @return {@link #gene} (Todo.) 1861 */ 1862 public List<SubstanceReferenceInformationGeneComponent> getGene() { 1863 if (this.gene == null) 1864 this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>(); 1865 return this.gene; 1866 } 1867 1868 /** 1869 * @return Returns a reference to <code>this</code> for easy method chaining 1870 */ 1871 public SubstanceReferenceInformation setGene(List<SubstanceReferenceInformationGeneComponent> theGene) { 1872 this.gene = theGene; 1873 return this; 1874 } 1875 1876 public boolean hasGene() { 1877 if (this.gene == null) 1878 return false; 1879 for (SubstanceReferenceInformationGeneComponent item : this.gene) 1880 if (!item.isEmpty()) 1881 return true; 1882 return false; 1883 } 1884 1885 public SubstanceReferenceInformationGeneComponent addGene() { // 3 1886 SubstanceReferenceInformationGeneComponent t = new SubstanceReferenceInformationGeneComponent(); 1887 if (this.gene == null) 1888 this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>(); 1889 this.gene.add(t); 1890 return t; 1891 } 1892 1893 public SubstanceReferenceInformation addGene(SubstanceReferenceInformationGeneComponent t) { // 3 1894 if (t == null) 1895 return this; 1896 if (this.gene == null) 1897 this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>(); 1898 this.gene.add(t); 1899 return this; 1900 } 1901 1902 /** 1903 * @return The first repetition of repeating field {@link #gene}, creating it if 1904 * it does not already exist 1905 */ 1906 public SubstanceReferenceInformationGeneComponent getGeneFirstRep() { 1907 if (getGene().isEmpty()) { 1908 addGene(); 1909 } 1910 return getGene().get(0); 1911 } 1912 1913 /** 1914 * @return {@link #geneElement} (Todo.) 1915 */ 1916 public List<SubstanceReferenceInformationGeneElementComponent> getGeneElement() { 1917 if (this.geneElement == null) 1918 this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>(); 1919 return this.geneElement; 1920 } 1921 1922 /** 1923 * @return Returns a reference to <code>this</code> for easy method chaining 1924 */ 1925 public SubstanceReferenceInformation setGeneElement( 1926 List<SubstanceReferenceInformationGeneElementComponent> theGeneElement) { 1927 this.geneElement = theGeneElement; 1928 return this; 1929 } 1930 1931 public boolean hasGeneElement() { 1932 if (this.geneElement == null) 1933 return false; 1934 for (SubstanceReferenceInformationGeneElementComponent item : this.geneElement) 1935 if (!item.isEmpty()) 1936 return true; 1937 return false; 1938 } 1939 1940 public SubstanceReferenceInformationGeneElementComponent addGeneElement() { // 3 1941 SubstanceReferenceInformationGeneElementComponent t = new SubstanceReferenceInformationGeneElementComponent(); 1942 if (this.geneElement == null) 1943 this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>(); 1944 this.geneElement.add(t); 1945 return t; 1946 } 1947 1948 public SubstanceReferenceInformation addGeneElement(SubstanceReferenceInformationGeneElementComponent t) { // 3 1949 if (t == null) 1950 return this; 1951 if (this.geneElement == null) 1952 this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>(); 1953 this.geneElement.add(t); 1954 return this; 1955 } 1956 1957 /** 1958 * @return The first repetition of repeating field {@link #geneElement}, 1959 * creating it if it does not already exist 1960 */ 1961 public SubstanceReferenceInformationGeneElementComponent getGeneElementFirstRep() { 1962 if (getGeneElement().isEmpty()) { 1963 addGeneElement(); 1964 } 1965 return getGeneElement().get(0); 1966 } 1967 1968 /** 1969 * @return {@link #classification} (Todo.) 1970 */ 1971 public List<SubstanceReferenceInformationClassificationComponent> getClassification() { 1972 if (this.classification == null) 1973 this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>(); 1974 return this.classification; 1975 } 1976 1977 /** 1978 * @return Returns a reference to <code>this</code> for easy method chaining 1979 */ 1980 public SubstanceReferenceInformation setClassification( 1981 List<SubstanceReferenceInformationClassificationComponent> theClassification) { 1982 this.classification = theClassification; 1983 return this; 1984 } 1985 1986 public boolean hasClassification() { 1987 if (this.classification == null) 1988 return false; 1989 for (SubstanceReferenceInformationClassificationComponent item : this.classification) 1990 if (!item.isEmpty()) 1991 return true; 1992 return false; 1993 } 1994 1995 public SubstanceReferenceInformationClassificationComponent addClassification() { // 3 1996 SubstanceReferenceInformationClassificationComponent t = new SubstanceReferenceInformationClassificationComponent(); 1997 if (this.classification == null) 1998 this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>(); 1999 this.classification.add(t); 2000 return t; 2001 } 2002 2003 public SubstanceReferenceInformation addClassification(SubstanceReferenceInformationClassificationComponent t) { // 3 2004 if (t == null) 2005 return this; 2006 if (this.classification == null) 2007 this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>(); 2008 this.classification.add(t); 2009 return this; 2010 } 2011 2012 /** 2013 * @return The first repetition of repeating field {@link #classification}, 2014 * creating it if it does not already exist 2015 */ 2016 public SubstanceReferenceInformationClassificationComponent getClassificationFirstRep() { 2017 if (getClassification().isEmpty()) { 2018 addClassification(); 2019 } 2020 return getClassification().get(0); 2021 } 2022 2023 /** 2024 * @return {@link #target} (Todo.) 2025 */ 2026 public List<SubstanceReferenceInformationTargetComponent> getTarget() { 2027 if (this.target == null) 2028 this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>(); 2029 return this.target; 2030 } 2031 2032 /** 2033 * @return Returns a reference to <code>this</code> for easy method chaining 2034 */ 2035 public SubstanceReferenceInformation setTarget(List<SubstanceReferenceInformationTargetComponent> theTarget) { 2036 this.target = theTarget; 2037 return this; 2038 } 2039 2040 public boolean hasTarget() { 2041 if (this.target == null) 2042 return false; 2043 for (SubstanceReferenceInformationTargetComponent item : this.target) 2044 if (!item.isEmpty()) 2045 return true; 2046 return false; 2047 } 2048 2049 public SubstanceReferenceInformationTargetComponent addTarget() { // 3 2050 SubstanceReferenceInformationTargetComponent t = new SubstanceReferenceInformationTargetComponent(); 2051 if (this.target == null) 2052 this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>(); 2053 this.target.add(t); 2054 return t; 2055 } 2056 2057 public SubstanceReferenceInformation addTarget(SubstanceReferenceInformationTargetComponent t) { // 3 2058 if (t == null) 2059 return this; 2060 if (this.target == null) 2061 this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>(); 2062 this.target.add(t); 2063 return this; 2064 } 2065 2066 /** 2067 * @return The first repetition of repeating field {@link #target}, creating it 2068 * if it does not already exist 2069 */ 2070 public SubstanceReferenceInformationTargetComponent getTargetFirstRep() { 2071 if (getTarget().isEmpty()) { 2072 addTarget(); 2073 } 2074 return getTarget().get(0); 2075 } 2076 2077 protected void listChildren(List<Property> children) { 2078 super.listChildren(children); 2079 children.add(new Property("comment", "string", "Todo.", 0, 1, comment)); 2080 children.add(new Property("gene", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, gene)); 2081 children.add(new Property("geneElement", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, geneElement)); 2082 children.add(new Property("classification", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, classification)); 2083 children.add(new Property("target", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, target)); 2084 } 2085 2086 @Override 2087 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2088 switch (_hash) { 2089 case 950398559: 2090 /* comment */ return new Property("comment", "string", "Todo.", 0, 1, comment); 2091 case 3169045: 2092 /* gene */ return new Property("gene", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, gene); 2093 case -94918105: 2094 /* geneElement */ return new Property("geneElement", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, geneElement); 2095 case 382350310: 2096 /* classification */ return new Property("classification", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, 2097 classification); 2098 case -880905839: 2099 /* target */ return new Property("target", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, target); 2100 default: 2101 return super.getNamedProperty(_hash, _name, _checkValid); 2102 } 2103 2104 } 2105 2106 @Override 2107 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2108 switch (hash) { 2109 case 950398559: 2110 /* comment */ return this.comment == null ? new Base[0] : new Base[] { this.comment }; // StringType 2111 case 3169045: 2112 /* gene */ return this.gene == null ? new Base[0] : this.gene.toArray(new Base[this.gene.size()]); // SubstanceReferenceInformationGeneComponent 2113 case -94918105: 2114 /* geneElement */ return this.geneElement == null ? new Base[0] 2115 : this.geneElement.toArray(new Base[this.geneElement.size()]); // SubstanceReferenceInformationGeneElementComponent 2116 case 382350310: 2117 /* classification */ return this.classification == null ? new Base[0] 2118 : this.classification.toArray(new Base[this.classification.size()]); // SubstanceReferenceInformationClassificationComponent 2119 case -880905839: 2120 /* target */ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // SubstanceReferenceInformationTargetComponent 2121 default: 2122 return super.getProperty(hash, name, checkValid); 2123 } 2124 2125 } 2126 2127 @Override 2128 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2129 switch (hash) { 2130 case 950398559: // comment 2131 this.comment = castToString(value); // StringType 2132 return value; 2133 case 3169045: // gene 2134 this.getGene().add((SubstanceReferenceInformationGeneComponent) value); // SubstanceReferenceInformationGeneComponent 2135 return value; 2136 case -94918105: // geneElement 2137 this.getGeneElement().add((SubstanceReferenceInformationGeneElementComponent) value); // SubstanceReferenceInformationGeneElementComponent 2138 return value; 2139 case 382350310: // classification 2140 this.getClassification().add((SubstanceReferenceInformationClassificationComponent) value); // SubstanceReferenceInformationClassificationComponent 2141 return value; 2142 case -880905839: // target 2143 this.getTarget().add((SubstanceReferenceInformationTargetComponent) value); // SubstanceReferenceInformationTargetComponent 2144 return value; 2145 default: 2146 return super.setProperty(hash, name, value); 2147 } 2148 2149 } 2150 2151 @Override 2152 public Base setProperty(String name, Base value) throws FHIRException { 2153 if (name.equals("comment")) { 2154 this.comment = castToString(value); // StringType 2155 } else if (name.equals("gene")) { 2156 this.getGene().add((SubstanceReferenceInformationGeneComponent) value); 2157 } else if (name.equals("geneElement")) { 2158 this.getGeneElement().add((SubstanceReferenceInformationGeneElementComponent) value); 2159 } else if (name.equals("classification")) { 2160 this.getClassification().add((SubstanceReferenceInformationClassificationComponent) value); 2161 } else if (name.equals("target")) { 2162 this.getTarget().add((SubstanceReferenceInformationTargetComponent) value); 2163 } else 2164 return super.setProperty(name, value); 2165 return value; 2166 } 2167 2168 @Override 2169 public Base makeProperty(int hash, String name) throws FHIRException { 2170 switch (hash) { 2171 case 950398559: 2172 return getCommentElement(); 2173 case 3169045: 2174 return addGene(); 2175 case -94918105: 2176 return addGeneElement(); 2177 case 382350310: 2178 return addClassification(); 2179 case -880905839: 2180 return addTarget(); 2181 default: 2182 return super.makeProperty(hash, name); 2183 } 2184 2185 } 2186 2187 @Override 2188 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2189 switch (hash) { 2190 case 950398559: 2191 /* comment */ return new String[] { "string" }; 2192 case 3169045: 2193 /* gene */ return new String[] {}; 2194 case -94918105: 2195 /* geneElement */ return new String[] {}; 2196 case 382350310: 2197 /* classification */ return new String[] {}; 2198 case -880905839: 2199 /* target */ return new String[] {}; 2200 default: 2201 return super.getTypesForProperty(hash, name); 2202 } 2203 2204 } 2205 2206 @Override 2207 public Base addChild(String name) throws FHIRException { 2208 if (name.equals("comment")) { 2209 throw new FHIRException("Cannot call addChild on a singleton property SubstanceReferenceInformation.comment"); 2210 } else if (name.equals("gene")) { 2211 return addGene(); 2212 } else if (name.equals("geneElement")) { 2213 return addGeneElement(); 2214 } else if (name.equals("classification")) { 2215 return addClassification(); 2216 } else if (name.equals("target")) { 2217 return addTarget(); 2218 } else 2219 return super.addChild(name); 2220 } 2221 2222 public String fhirType() { 2223 return "SubstanceReferenceInformation"; 2224 2225 } 2226 2227 public SubstanceReferenceInformation copy() { 2228 SubstanceReferenceInformation dst = new SubstanceReferenceInformation(); 2229 copyValues(dst); 2230 return dst; 2231 } 2232 2233 public void copyValues(SubstanceReferenceInformation dst) { 2234 super.copyValues(dst); 2235 dst.comment = comment == null ? null : comment.copy(); 2236 if (gene != null) { 2237 dst.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>(); 2238 for (SubstanceReferenceInformationGeneComponent i : gene) 2239 dst.gene.add(i.copy()); 2240 } 2241 ; 2242 if (geneElement != null) { 2243 dst.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>(); 2244 for (SubstanceReferenceInformationGeneElementComponent i : geneElement) 2245 dst.geneElement.add(i.copy()); 2246 } 2247 ; 2248 if (classification != null) { 2249 dst.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>(); 2250 for (SubstanceReferenceInformationClassificationComponent i : classification) 2251 dst.classification.add(i.copy()); 2252 } 2253 ; 2254 if (target != null) { 2255 dst.target = new ArrayList<SubstanceReferenceInformationTargetComponent>(); 2256 for (SubstanceReferenceInformationTargetComponent i : target) 2257 dst.target.add(i.copy()); 2258 } 2259 ; 2260 } 2261 2262 protected SubstanceReferenceInformation typedCopy() { 2263 return copy(); 2264 } 2265 2266 @Override 2267 public boolean equalsDeep(Base other_) { 2268 if (!super.equalsDeep(other_)) 2269 return false; 2270 if (!(other_ instanceof SubstanceReferenceInformation)) 2271 return false; 2272 SubstanceReferenceInformation o = (SubstanceReferenceInformation) other_; 2273 return compareDeep(comment, o.comment, true) && compareDeep(gene, o.gene, true) 2274 && compareDeep(geneElement, o.geneElement, true) && compareDeep(classification, o.classification, true) 2275 && compareDeep(target, o.target, true); 2276 } 2277 2278 @Override 2279 public boolean equalsShallow(Base other_) { 2280 if (!super.equalsShallow(other_)) 2281 return false; 2282 if (!(other_ instanceof SubstanceReferenceInformation)) 2283 return false; 2284 SubstanceReferenceInformation o = (SubstanceReferenceInformation) other_; 2285 return compareValues(comment, o.comment, true); 2286 } 2287 2288 public boolean isEmpty() { 2289 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(comment, gene, geneElement, classification, target); 2290 } 2291 2292 @Override 2293 public ResourceType getResourceType() { 2294 return ResourceType.SubstanceReferenceInformation; 2295 } 2296 2297}