001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 033import java.util.ArrayList; 034import java.util.List; 035 036import ca.uhn.fhir.model.api.annotation.Child; 037import ca.uhn.fhir.model.api.annotation.DatatypeDef; 038import ca.uhn.fhir.model.api.annotation.Description; 039import org.hl7.fhir.instance.model.api.ICompositeType; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.utilities.Utilities; 042 043/** 044 * A human's name with the ability to identify parts and usage. 045 */ 046@DatatypeDef(name = "HumanName") 047public class HumanName extends Type implements ICompositeType { 048 049 public enum NameUse { 050 /** 051 * Known as/conventional/the one you normally use 052 */ 053 USUAL, 054 /** 055 * The formal name as registered in an official (government) registry, but which 056 * name might not be commonly used. May be called "legal name". 057 */ 058 OFFICIAL, 059 /** 060 * A temporary name. Name.period can provide more detailed information. This may 061 * also be used for temporary names assigned at birth or in emergency 062 * situations. 063 */ 064 TEMP, 065 /** 066 * A name that is used to address the person in an informal manner, but is not 067 * part of their formal or usual name 068 */ 069 NICKNAME, 070 /** 071 * Anonymous assigned name, alias, or pseudonym (used to protect a person's 072 * identity for privacy reasons) 073 */ 074 ANONYMOUS, 075 /** 076 * This name is no longer in use (or was never correct, but retained for 077 * records) 078 */ 079 OLD, 080 /** 081 * A name used prior to marriage. Marriage naming customs vary greatly around 082 * the world. This name use is for use by applications that collect and store 083 * "maiden" names. Though the concept of maiden name is often gender specific, 084 * the use of this term is not gender specific. The use of this term does not 085 * imply any particular history for a person's name, nor should the maiden name 086 * be determined algorithmically. 087 */ 088 MAIDEN, 089 /** 090 * added to help the parsers 091 */ 092 NULL; 093 094 public static NameUse fromCode(String codeString) throws FHIRException { 095 if (codeString == null || "".equals(codeString)) 096 return null; 097 if ("usual".equals(codeString)) 098 return USUAL; 099 if ("official".equals(codeString)) 100 return OFFICIAL; 101 if ("temp".equals(codeString)) 102 return TEMP; 103 if ("nickname".equals(codeString)) 104 return NICKNAME; 105 if ("anonymous".equals(codeString)) 106 return ANONYMOUS; 107 if ("old".equals(codeString)) 108 return OLD; 109 if ("maiden".equals(codeString)) 110 return MAIDEN; 111 throw new FHIRException("Unknown NameUse code '" + codeString + "'"); 112 } 113 114 public String toCode() { 115 switch (this) { 116 case USUAL: 117 return "usual"; 118 case OFFICIAL: 119 return "official"; 120 case TEMP: 121 return "temp"; 122 case NICKNAME: 123 return "nickname"; 124 case ANONYMOUS: 125 return "anonymous"; 126 case OLD: 127 return "old"; 128 case MAIDEN: 129 return "maiden"; 130 case NULL: 131 return null; 132 default: 133 return "?"; 134 } 135 } 136 137 public String getSystem() { 138 switch (this) { 139 case USUAL: 140 return "http://hl7.org/fhir/name-use"; 141 case OFFICIAL: 142 return "http://hl7.org/fhir/name-use"; 143 case TEMP: 144 return "http://hl7.org/fhir/name-use"; 145 case NICKNAME: 146 return "http://hl7.org/fhir/name-use"; 147 case ANONYMOUS: 148 return "http://hl7.org/fhir/name-use"; 149 case OLD: 150 return "http://hl7.org/fhir/name-use"; 151 case MAIDEN: 152 return "http://hl7.org/fhir/name-use"; 153 case NULL: 154 return null; 155 default: 156 return "?"; 157 } 158 } 159 160 public String getDefinition() { 161 switch (this) { 162 case USUAL: 163 return "Known as/conventional/the one you normally use"; 164 case OFFICIAL: 165 return "The formal name as registered in an official (government) registry, but which name might not be commonly used. May be called \"legal name\"."; 166 case TEMP: 167 return "A temporary name. Name.period can provide more detailed information. This may also be used for temporary names assigned at birth or in emergency situations."; 168 case NICKNAME: 169 return "A name that is used to address the person in an informal manner, but is not part of their formal or usual name"; 170 case ANONYMOUS: 171 return "Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)"; 172 case OLD: 173 return "This name is no longer in use (or was never correct, but retained for records)"; 174 case MAIDEN: 175 return "A name used prior to marriage. Marriage naming customs vary greatly around the world. This name use is for use by applications that collect and store \"maiden\" names. Though the concept of maiden name is often gender specific, the use of this term is not gender specific. The use of this term does not imply any particular history for a person's name, nor should the maiden name be determined algorithmically."; 176 case NULL: 177 return null; 178 default: 179 return "?"; 180 } 181 } 182 183 public String getDisplay() { 184 switch (this) { 185 case USUAL: 186 return "Usual"; 187 case OFFICIAL: 188 return "Official"; 189 case TEMP: 190 return "Temp"; 191 case NICKNAME: 192 return "Nickname"; 193 case ANONYMOUS: 194 return "Anonymous"; 195 case OLD: 196 return "Old"; 197 case MAIDEN: 198 return "Maiden"; 199 case NULL: 200 return null; 201 default: 202 return "?"; 203 } 204 } 205 } 206 207 public static class NameUseEnumFactory implements EnumFactory<NameUse> { 208 public NameUse fromCode(String codeString) throws IllegalArgumentException { 209 if (codeString == null || "".equals(codeString)) 210 if (codeString == null || "".equals(codeString)) 211 return null; 212 if ("usual".equals(codeString)) 213 return NameUse.USUAL; 214 if ("official".equals(codeString)) 215 return NameUse.OFFICIAL; 216 if ("temp".equals(codeString)) 217 return NameUse.TEMP; 218 if ("nickname".equals(codeString)) 219 return NameUse.NICKNAME; 220 if ("anonymous".equals(codeString)) 221 return NameUse.ANONYMOUS; 222 if ("old".equals(codeString)) 223 return NameUse.OLD; 224 if ("maiden".equals(codeString)) 225 return NameUse.MAIDEN; 226 throw new IllegalArgumentException("Unknown NameUse code '" + codeString + "'"); 227 } 228 229 public Enumeration<NameUse> fromType(Base code) throws FHIRException { 230 if (code == null || code.isEmpty()) 231 return null; 232 String codeString = ((PrimitiveType) code).asStringValue(); 233 if (codeString == null || "".equals(codeString)) 234 return null; 235 if ("usual".equals(codeString)) 236 return new Enumeration<NameUse>(this, NameUse.USUAL); 237 if ("official".equals(codeString)) 238 return new Enumeration<NameUse>(this, NameUse.OFFICIAL); 239 if ("temp".equals(codeString)) 240 return new Enumeration<NameUse>(this, NameUse.TEMP); 241 if ("nickname".equals(codeString)) 242 return new Enumeration<NameUse>(this, NameUse.NICKNAME); 243 if ("anonymous".equals(codeString)) 244 return new Enumeration<NameUse>(this, NameUse.ANONYMOUS); 245 if ("old".equals(codeString)) 246 return new Enumeration<NameUse>(this, NameUse.OLD); 247 if ("maiden".equals(codeString)) 248 return new Enumeration<NameUse>(this, NameUse.MAIDEN); 249 throw new FHIRException("Unknown NameUse code '" + codeString + "'"); 250 } 251 252 public String toCode(NameUse code) { 253 if (code == NameUse.USUAL) 254 return "usual"; 255 if (code == NameUse.OFFICIAL) 256 return "official"; 257 if (code == NameUse.TEMP) 258 return "temp"; 259 if (code == NameUse.NICKNAME) 260 return "nickname"; 261 if (code == NameUse.ANONYMOUS) 262 return "anonymous"; 263 if (code == NameUse.OLD) 264 return "old"; 265 if (code == NameUse.MAIDEN) 266 return "maiden"; 267 return "?"; 268 } 269 } 270 271 /** 272 * Identifies the purpose for this name. 273 */ 274 @Child(name = "use", type = { CodeType.class }, order = 0, min = 0, max = 1, modifier = true, summary = true) 275 @Description(shortDefinition = "usual | official | temp | nickname | anonymous | old | maiden", formalDefinition = "Identifies the purpose for this name.") 276 protected Enumeration<NameUse> use; 277 278 /** 279 * A full text representation of the name. 280 */ 281 @Child(name = "text", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true) 282 @Description(shortDefinition = "Text representation of the full name", formalDefinition = "A full text representation of the name.") 283 protected StringType text; 284 285 /** 286 * The part of a name that links to the genealogy. In some cultures (e.g. 287 * Eritrea) the family name of a son is the first name of his father. 288 */ 289 @Child(name = "family", type = { 290 StringType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 291 @Description(shortDefinition = "Family name (often called 'Surname')", formalDefinition = "The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.") 292 protected List<StringType> family; 293 294 /** 295 * Given name. 296 */ 297 @Child(name = "given", type = { 298 StringType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 299 @Description(shortDefinition = "Given names (not always 'first'). Includes middle names", formalDefinition = "Given name.") 300 protected List<StringType> given; 301 302 /** 303 * Part of the name that is acquired as a title due to academic, legal, 304 * employment or nobility status, etc. and that appears at the start of the 305 * name. 306 */ 307 @Child(name = "prefix", type = { 308 StringType.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 309 @Description(shortDefinition = "Parts that come before the name", formalDefinition = "Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.") 310 protected List<StringType> prefix; 311 312 /** 313 * Part of the name that is acquired as a title due to academic, legal, 314 * employment or nobility status, etc. and that appears at the end of the name. 315 */ 316 @Child(name = "suffix", type = { 317 StringType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) 318 @Description(shortDefinition = "Parts that come after the name", formalDefinition = "Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.") 319 protected List<StringType> suffix; 320 321 /** 322 * Indicates the period of time when this name was valid for the named person. 323 */ 324 @Child(name = "period", type = { Period.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 325 @Description(shortDefinition = "Time period when name was/is in use", formalDefinition = "Indicates the period of time when this name was valid for the named person.") 326 protected Period period; 327 328 private static final long serialVersionUID = -210174642L; 329 330 /* 331 * Constructor 332 */ 333 public HumanName() { 334 super(); 335 } 336 337 /** 338 * @return {@link #use} (Identifies the purpose for this name.). This is the 339 * underlying object with id, value and extensions. The accessor 340 * "getUse" gives direct access to the value 341 */ 342 public Enumeration<NameUse> getUseElement() { 343 if (this.use == null) 344 if (Configuration.errorOnAutoCreate()) 345 throw new Error("Attempt to auto-create HumanName.use"); 346 else if (Configuration.doAutoCreate()) 347 this.use = new Enumeration<NameUse>(new NameUseEnumFactory()); // bb 348 return this.use; 349 } 350 351 public boolean hasUseElement() { 352 return this.use != null && !this.use.isEmpty(); 353 } 354 355 public boolean hasUse() { 356 return this.use != null && !this.use.isEmpty(); 357 } 358 359 /** 360 * @param value {@link #use} (Identifies the purpose for this name.). This is 361 * the underlying object with id, value and extensions. The 362 * accessor "getUse" gives direct access to the value 363 */ 364 public HumanName setUseElement(Enumeration<NameUse> value) { 365 this.use = value; 366 return this; 367 } 368 369 /** 370 * @return Identifies the purpose for this name. 371 */ 372 public NameUse getUse() { 373 return this.use == null ? null : this.use.getValue(); 374 } 375 376 /** 377 * @param value Identifies the purpose for this name. 378 */ 379 public HumanName setUse(NameUse value) { 380 if (value == null) 381 this.use = null; 382 else { 383 if (this.use == null) 384 this.use = new Enumeration<NameUse>(new NameUseEnumFactory()); 385 this.use.setValue(value); 386 } 387 return this; 388 } 389 390 /** 391 * @return {@link #text} (A full text representation of the name.). This is the 392 * underlying object with id, value and extensions. The accessor 393 * "getText" gives direct access to the value 394 */ 395 public StringType getTextElement() { 396 if (this.text == null) 397 if (Configuration.errorOnAutoCreate()) 398 throw new Error("Attempt to auto-create HumanName.text"); 399 else if (Configuration.doAutoCreate()) 400 this.text = new StringType(); // bb 401 return this.text; 402 } 403 404 public boolean hasTextElement() { 405 return this.text != null && !this.text.isEmpty(); 406 } 407 408 public boolean hasText() { 409 return this.text != null && !this.text.isEmpty(); 410 } 411 412 /** 413 * @param value {@link #text} (A full text representation of the name.). This is 414 * the underlying object with id, value and extensions. The 415 * accessor "getText" gives direct access to the value 416 */ 417 public HumanName setTextElement(StringType value) { 418 this.text = value; 419 return this; 420 } 421 422 /** 423 * @return A full text representation of the name. 424 */ 425 public String getText() { 426 return this.text == null ? null : this.text.getValue(); 427 } 428 429 /** 430 * @param value A full text representation of the name. 431 */ 432 public HumanName setText(String value) { 433 if (Utilities.noString(value)) 434 this.text = null; 435 else { 436 if (this.text == null) 437 this.text = new StringType(); 438 this.text.setValue(value); 439 } 440 return this; 441 } 442 443 /** 444 * @return {@link #family} (The part of a name that links to the genealogy. In 445 * some cultures (e.g. Eritrea) the family name of a son is the first 446 * name of his father.) 447 */ 448 public List<StringType> getFamily() { 449 if (this.family == null) 450 this.family = new ArrayList<StringType>(); 451 return this.family; 452 } 453 454 public boolean hasFamily() { 455 if (this.family == null) 456 return false; 457 for (StringType item : this.family) 458 if (!item.isEmpty()) 459 return true; 460 return false; 461 } 462 463 /** 464 * @return {@link #family} (The part of a name that links to the genealogy. In 465 * some cultures (e.g. Eritrea) the family name of a son is the first 466 * name of his father.) 467 */ 468 // syntactic sugar 469 public StringType addFamilyElement() {// 2 470 StringType t = new StringType(); 471 if (this.family == null) 472 this.family = new ArrayList<StringType>(); 473 this.family.add(t); 474 return t; 475 } 476 477 /** 478 * @param value {@link #family} (The part of a name that links to the genealogy. 479 * In some cultures (e.g. Eritrea) the family name of a son is the 480 * first name of his father.) 481 */ 482 public HumanName addFamily(String value) { // 1 483 StringType t = new StringType(); 484 t.setValue(value); 485 if (this.family == null) 486 this.family = new ArrayList<StringType>(); 487 this.family.add(t); 488 return this; 489 } 490 491 /** 492 * @param value {@link #family} (The part of a name that links to the genealogy. 493 * In some cultures (e.g. Eritrea) the family name of a son is the 494 * first name of his father.) 495 */ 496 public boolean hasFamily(String value) { 497 if (this.family == null) 498 return false; 499 for (StringType v : this.family) 500 if (v.equals(value)) // string 501 return true; 502 return false; 503 } 504 505 /** 506 * @return {@link #given} (Given name.) 507 */ 508 public List<StringType> getGiven() { 509 if (this.given == null) 510 this.given = new ArrayList<StringType>(); 511 return this.given; 512 } 513 514 public boolean hasGiven() { 515 if (this.given == null) 516 return false; 517 for (StringType item : this.given) 518 if (!item.isEmpty()) 519 return true; 520 return false; 521 } 522 523 /** 524 * @return {@link #given} (Given name.) 525 */ 526 // syntactic sugar 527 public StringType addGivenElement() {// 2 528 StringType t = new StringType(); 529 if (this.given == null) 530 this.given = new ArrayList<StringType>(); 531 this.given.add(t); 532 return t; 533 } 534 535 /** 536 * @param value {@link #given} (Given name.) 537 */ 538 public HumanName addGiven(String value) { // 1 539 StringType t = new StringType(); 540 t.setValue(value); 541 if (this.given == null) 542 this.given = new ArrayList<StringType>(); 543 this.given.add(t); 544 return this; 545 } 546 547 /** 548 * @param value {@link #given} (Given name.) 549 */ 550 public boolean hasGiven(String value) { 551 if (this.given == null) 552 return false; 553 for (StringType v : this.given) 554 if (v.equals(value)) // string 555 return true; 556 return false; 557 } 558 559 /** 560 * @return {@link #prefix} (Part of the name that is acquired as a title due to 561 * academic, legal, employment or nobility status, etc. and that appears 562 * at the start of the name.) 563 */ 564 public List<StringType> getPrefix() { 565 if (this.prefix == null) 566 this.prefix = new ArrayList<StringType>(); 567 return this.prefix; 568 } 569 570 public boolean hasPrefix() { 571 if (this.prefix == null) 572 return false; 573 for (StringType item : this.prefix) 574 if (!item.isEmpty()) 575 return true; 576 return false; 577 } 578 579 /** 580 * @return {@link #prefix} (Part of the name that is acquired as a title due to 581 * academic, legal, employment or nobility status, etc. and that appears 582 * at the start of the name.) 583 */ 584 // syntactic sugar 585 public StringType addPrefixElement() {// 2 586 StringType t = new StringType(); 587 if (this.prefix == null) 588 this.prefix = new ArrayList<StringType>(); 589 this.prefix.add(t); 590 return t; 591 } 592 593 /** 594 * @param value {@link #prefix} (Part of the name that is acquired as a title 595 * due to academic, legal, employment or nobility status, etc. and 596 * that appears at the start of the name.) 597 */ 598 public HumanName addPrefix(String value) { // 1 599 StringType t = new StringType(); 600 t.setValue(value); 601 if (this.prefix == null) 602 this.prefix = new ArrayList<StringType>(); 603 this.prefix.add(t); 604 return this; 605 } 606 607 /** 608 * @param value {@link #prefix} (Part of the name that is acquired as a title 609 * due to academic, legal, employment or nobility status, etc. and 610 * that appears at the start of the name.) 611 */ 612 public boolean hasPrefix(String value) { 613 if (this.prefix == null) 614 return false; 615 for (StringType v : this.prefix) 616 if (v.equals(value)) // string 617 return true; 618 return false; 619 } 620 621 /** 622 * @return {@link #suffix} (Part of the name that is acquired as a title due to 623 * academic, legal, employment or nobility status, etc. and that appears 624 * at the end of the name.) 625 */ 626 public List<StringType> getSuffix() { 627 if (this.suffix == null) 628 this.suffix = new ArrayList<StringType>(); 629 return this.suffix; 630 } 631 632 public boolean hasSuffix() { 633 if (this.suffix == null) 634 return false; 635 for (StringType item : this.suffix) 636 if (!item.isEmpty()) 637 return true; 638 return false; 639 } 640 641 /** 642 * @return {@link #suffix} (Part of the name that is acquired as a title due to 643 * academic, legal, employment or nobility status, etc. and that appears 644 * at the end of the name.) 645 */ 646 // syntactic sugar 647 public StringType addSuffixElement() {// 2 648 StringType t = new StringType(); 649 if (this.suffix == null) 650 this.suffix = new ArrayList<StringType>(); 651 this.suffix.add(t); 652 return t; 653 } 654 655 /** 656 * @param value {@link #suffix} (Part of the name that is acquired as a title 657 * due to academic, legal, employment or nobility status, etc. and 658 * that appears at the end of the name.) 659 */ 660 public HumanName addSuffix(String value) { // 1 661 StringType t = new StringType(); 662 t.setValue(value); 663 if (this.suffix == null) 664 this.suffix = new ArrayList<StringType>(); 665 this.suffix.add(t); 666 return this; 667 } 668 669 /** 670 * @param value {@link #suffix} (Part of the name that is acquired as a title 671 * due to academic, legal, employment or nobility status, etc. and 672 * that appears at the end of the name.) 673 */ 674 public boolean hasSuffix(String value) { 675 if (this.suffix == null) 676 return false; 677 for (StringType v : this.suffix) 678 if (v.equals(value)) // string 679 return true; 680 return false; 681 } 682 683 /** 684 * @return {@link #period} (Indicates the period of time when this name was 685 * valid for the named person.) 686 */ 687 public Period getPeriod() { 688 if (this.period == null) 689 if (Configuration.errorOnAutoCreate()) 690 throw new Error("Attempt to auto-create HumanName.period"); 691 else if (Configuration.doAutoCreate()) 692 this.period = new Period(); // cc 693 return this.period; 694 } 695 696 public boolean hasPeriod() { 697 return this.period != null && !this.period.isEmpty(); 698 } 699 700 /** 701 * @param value {@link #period} (Indicates the period of time when this name was 702 * valid for the named person.) 703 */ 704 public HumanName setPeriod(Period value) { 705 this.period = value; 706 return this; 707 } 708 709 protected void listChildren(List<Property> childrenList) { 710 super.listChildren(childrenList); 711 childrenList 712 .add(new Property("use", "code", "Identifies the purpose for this name.", 0, java.lang.Integer.MAX_VALUE, use)); 713 childrenList.add(new Property("text", "string", "A full text representation of the name.", 0, 714 java.lang.Integer.MAX_VALUE, text)); 715 childrenList.add(new Property("family", "string", 716 "The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.", 717 0, java.lang.Integer.MAX_VALUE, family)); 718 childrenList.add(new Property("given", "string", "Given name.", 0, java.lang.Integer.MAX_VALUE, given)); 719 childrenList.add(new Property("prefix", "string", 720 "Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.", 721 0, java.lang.Integer.MAX_VALUE, prefix)); 722 childrenList.add(new Property("suffix", "string", 723 "Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.", 724 0, java.lang.Integer.MAX_VALUE, suffix)); 725 childrenList.add( 726 new Property("period", "Period", "Indicates the period of time when this name was valid for the named person.", 727 0, java.lang.Integer.MAX_VALUE, period)); 728 } 729 730 @Override 731 public void setProperty(String name, Base value) throws FHIRException { 732 if (name.equals("use")) 733 this.use = new NameUseEnumFactory().fromType(value); // Enumeration<NameUse> 734 else if (name.equals("text")) 735 this.text = castToString(value); // StringType 736 else if (name.equals("family")) 737 this.getFamily().add(castToString(value)); 738 else if (name.equals("given")) 739 this.getGiven().add(castToString(value)); 740 else if (name.equals("prefix")) 741 this.getPrefix().add(castToString(value)); 742 else if (name.equals("suffix")) 743 this.getSuffix().add(castToString(value)); 744 else if (name.equals("period")) 745 this.period = castToPeriod(value); // Period 746 else 747 super.setProperty(name, value); 748 } 749 750 @Override 751 public Base addChild(String name) throws FHIRException { 752 if (name.equals("use")) { 753 throw new FHIRException("Cannot call addChild on a singleton property HumanName.use"); 754 } else if (name.equals("text")) { 755 throw new FHIRException("Cannot call addChild on a singleton property HumanName.text"); 756 } else if (name.equals("family")) { 757 throw new FHIRException("Cannot call addChild on a singleton property HumanName.family"); 758 } else if (name.equals("given")) { 759 throw new FHIRException("Cannot call addChild on a singleton property HumanName.given"); 760 } else if (name.equals("prefix")) { 761 throw new FHIRException("Cannot call addChild on a singleton property HumanName.prefix"); 762 } else if (name.equals("suffix")) { 763 throw new FHIRException("Cannot call addChild on a singleton property HumanName.suffix"); 764 } else if (name.equals("period")) { 765 this.period = new Period(); 766 return this.period; 767 } else 768 return super.addChild(name); 769 } 770 771 public String fhirType() { 772 return "HumanName"; 773 774 } 775 776 public HumanName copy() { 777 HumanName dst = new HumanName(); 778 copyValues(dst); 779 dst.use = use == null ? null : use.copy(); 780 dst.text = text == null ? null : text.copy(); 781 if (family != null) { 782 dst.family = new ArrayList<StringType>(); 783 for (StringType i : family) 784 dst.family.add(i.copy()); 785 } 786 ; 787 if (given != null) { 788 dst.given = new ArrayList<StringType>(); 789 for (StringType i : given) 790 dst.given.add(i.copy()); 791 } 792 ; 793 if (prefix != null) { 794 dst.prefix = new ArrayList<StringType>(); 795 for (StringType i : prefix) 796 dst.prefix.add(i.copy()); 797 } 798 ; 799 if (suffix != null) { 800 dst.suffix = new ArrayList<StringType>(); 801 for (StringType i : suffix) 802 dst.suffix.add(i.copy()); 803 } 804 ; 805 dst.period = period == null ? null : period.copy(); 806 return dst; 807 } 808 809 protected HumanName typedCopy() { 810 return copy(); 811 } 812 813 @Override 814 public boolean equalsDeep(Base other) { 815 if (!super.equalsDeep(other)) 816 return false; 817 if (!(other instanceof HumanName)) 818 return false; 819 HumanName o = (HumanName) other; 820 return compareDeep(use, o.use, true) && compareDeep(text, o.text, true) && compareDeep(family, o.family, true) 821 && compareDeep(given, o.given, true) && compareDeep(prefix, o.prefix, true) 822 && compareDeep(suffix, o.suffix, true) && compareDeep(period, o.period, true); 823 } 824 825 @Override 826 public boolean equalsShallow(Base other) { 827 if (!super.equalsShallow(other)) 828 return false; 829 if (!(other instanceof HumanName)) 830 return false; 831 HumanName o = (HumanName) other; 832 return compareValues(use, o.use, true) && compareValues(text, o.text, true) && compareValues(family, o.family, true) 833 && compareValues(given, o.given, true) && compareValues(prefix, o.prefix, true) 834 && compareValues(suffix, o.suffix, true); 835 } 836 837 public boolean isEmpty() { 838 return super.isEmpty() && (use == null || use.isEmpty()) && (text == null || text.isEmpty()) 839 && (family == null || family.isEmpty()) && (given == null || given.isEmpty()) 840 && (prefix == null || prefix.isEmpty()) && (suffix == null || suffix.isEmpty()) 841 && (period == null || period.isEmpty()); 842 } 843 844}