001package org.hl7.fhir.dstu2.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, 016 this list of conditions and the following disclaimer in the documentation 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 031 POSSIBILITY OF SUCH DAMAGE. 032 033*/ 034 035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 036import java.util.ArrayList; 037import java.util.List; 038 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.DatatypeDef; 041import ca.uhn.fhir.model.api.annotation.Description; 042import org.hl7.fhir.instance.model.api.ICompositeType; 043import org.hl7.fhir.exceptions.FHIRException; 044import org.hl7.fhir.utilities.Utilities; 045/** 046 * A human's name with the ability to identify parts and usage. 047 */ 048@DatatypeDef(name="HumanName") 049public class HumanName extends Type implements ICompositeType { 050 051 public enum NameUse { 052 /** 053 * Known as/conventional/the one you normally use 054 */ 055 USUAL, 056 /** 057 * The formal name as registered in an official (government) registry, but which name might not be commonly used. May be called "legal name". 058 */ 059 OFFICIAL, 060 /** 061 * 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. 062 */ 063 TEMP, 064 /** 065 * A name that is used to address the person in an informal manner, but is not part of their formal or usual name 066 */ 067 NICKNAME, 068 /** 069 * Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons) 070 */ 071 ANONYMOUS, 072 /** 073 * This name is no longer in use (or was never correct, but retained for records) 074 */ 075 OLD, 076 /** 077 * 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. 078 */ 079 MAIDEN, 080 /** 081 * added to help the parsers 082 */ 083 NULL; 084 public static NameUse fromCode(String codeString) throws FHIRException { 085 if (codeString == null || "".equals(codeString)) 086 return null; 087 if ("usual".equals(codeString)) 088 return USUAL; 089 if ("official".equals(codeString)) 090 return OFFICIAL; 091 if ("temp".equals(codeString)) 092 return TEMP; 093 if ("nickname".equals(codeString)) 094 return NICKNAME; 095 if ("anonymous".equals(codeString)) 096 return ANONYMOUS; 097 if ("old".equals(codeString)) 098 return OLD; 099 if ("maiden".equals(codeString)) 100 return MAIDEN; 101 throw new FHIRException("Unknown NameUse code '"+codeString+"'"); 102 } 103 public String toCode() { 104 switch (this) { 105 case USUAL: return "usual"; 106 case OFFICIAL: return "official"; 107 case TEMP: return "temp"; 108 case NICKNAME: return "nickname"; 109 case ANONYMOUS: return "anonymous"; 110 case OLD: return "old"; 111 case MAIDEN: return "maiden"; 112 case NULL: return null; 113 default: return "?"; 114 } 115 } 116 public String getSystem() { 117 switch (this) { 118 case USUAL: return "http://hl7.org/fhir/name-use"; 119 case OFFICIAL: return "http://hl7.org/fhir/name-use"; 120 case TEMP: return "http://hl7.org/fhir/name-use"; 121 case NICKNAME: return "http://hl7.org/fhir/name-use"; 122 case ANONYMOUS: return "http://hl7.org/fhir/name-use"; 123 case OLD: return "http://hl7.org/fhir/name-use"; 124 case MAIDEN: return "http://hl7.org/fhir/name-use"; 125 case NULL: return null; 126 default: return "?"; 127 } 128 } 129 public String getDefinition() { 130 switch (this) { 131 case USUAL: return "Known as/conventional/the one you normally use"; 132 case OFFICIAL: return "The formal name as registered in an official (government) registry, but which name might not be commonly used. May be called \"legal name\"."; 133 case TEMP: 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."; 134 case NICKNAME: return "A name that is used to address the person in an informal manner, but is not part of their formal or usual name"; 135 case ANONYMOUS: return "Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)"; 136 case OLD: return "This name is no longer in use (or was never correct, but retained for records)"; 137 case MAIDEN: 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."; 138 case NULL: return null; 139 default: return "?"; 140 } 141 } 142 public String getDisplay() { 143 switch (this) { 144 case USUAL: return "Usual"; 145 case OFFICIAL: return "Official"; 146 case TEMP: return "Temp"; 147 case NICKNAME: return "Nickname"; 148 case ANONYMOUS: return "Anonymous"; 149 case OLD: return "Old"; 150 case MAIDEN: return "Maiden"; 151 case NULL: return null; 152 default: return "?"; 153 } 154 } 155 } 156 157 public static class NameUseEnumFactory implements EnumFactory<NameUse> { 158 public NameUse fromCode(String codeString) throws IllegalArgumentException { 159 if (codeString == null || "".equals(codeString)) 160 if (codeString == null || "".equals(codeString)) 161 return null; 162 if ("usual".equals(codeString)) 163 return NameUse.USUAL; 164 if ("official".equals(codeString)) 165 return NameUse.OFFICIAL; 166 if ("temp".equals(codeString)) 167 return NameUse.TEMP; 168 if ("nickname".equals(codeString)) 169 return NameUse.NICKNAME; 170 if ("anonymous".equals(codeString)) 171 return NameUse.ANONYMOUS; 172 if ("old".equals(codeString)) 173 return NameUse.OLD; 174 if ("maiden".equals(codeString)) 175 return NameUse.MAIDEN; 176 throw new IllegalArgumentException("Unknown NameUse code '"+codeString+"'"); 177 } 178 public Enumeration<NameUse> fromType(Base code) throws FHIRException { 179 if (code == null || code.isEmpty()) 180 return null; 181 String codeString = ((PrimitiveType) code).asStringValue(); 182 if (codeString == null || "".equals(codeString)) 183 return null; 184 if ("usual".equals(codeString)) 185 return new Enumeration<NameUse>(this, NameUse.USUAL); 186 if ("official".equals(codeString)) 187 return new Enumeration<NameUse>(this, NameUse.OFFICIAL); 188 if ("temp".equals(codeString)) 189 return new Enumeration<NameUse>(this, NameUse.TEMP); 190 if ("nickname".equals(codeString)) 191 return new Enumeration<NameUse>(this, NameUse.NICKNAME); 192 if ("anonymous".equals(codeString)) 193 return new Enumeration<NameUse>(this, NameUse.ANONYMOUS); 194 if ("old".equals(codeString)) 195 return new Enumeration<NameUse>(this, NameUse.OLD); 196 if ("maiden".equals(codeString)) 197 return new Enumeration<NameUse>(this, NameUse.MAIDEN); 198 throw new FHIRException("Unknown NameUse code '"+codeString+"'"); 199 } 200 public String toCode(NameUse code) { 201 if (code == NameUse.USUAL) 202 return "usual"; 203 if (code == NameUse.OFFICIAL) 204 return "official"; 205 if (code == NameUse.TEMP) 206 return "temp"; 207 if (code == NameUse.NICKNAME) 208 return "nickname"; 209 if (code == NameUse.ANONYMOUS) 210 return "anonymous"; 211 if (code == NameUse.OLD) 212 return "old"; 213 if (code == NameUse.MAIDEN) 214 return "maiden"; 215 return "?"; 216 } 217 } 218 219 /** 220 * Identifies the purpose for this name. 221 */ 222 @Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true) 223 @Description(shortDefinition="usual | official | temp | nickname | anonymous | old | maiden", formalDefinition="Identifies the purpose for this name." ) 224 protected Enumeration<NameUse> use; 225 226 /** 227 * A full text representation of the name. 228 */ 229 @Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 230 @Description(shortDefinition="Text representation of the full name", formalDefinition="A full text representation of the name." ) 231 protected StringType text; 232 233 /** 234 * 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. 235 */ 236 @Child(name = "family", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 237 @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." ) 238 protected List<StringType> family; 239 240 /** 241 * Given name. 242 */ 243 @Child(name = "given", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 244 @Description(shortDefinition="Given names (not always 'first'). Includes middle names", formalDefinition="Given name." ) 245 protected List<StringType> given; 246 247 /** 248 * 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. 249 */ 250 @Child(name = "prefix", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 251 @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." ) 252 protected List<StringType> prefix; 253 254 /** 255 * 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. 256 */ 257 @Child(name = "suffix", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 258 @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." ) 259 protected List<StringType> suffix; 260 261 /** 262 * Indicates the period of time when this name was valid for the named person. 263 */ 264 @Child(name = "period", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true) 265 @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." ) 266 protected Period period; 267 268 private static final long serialVersionUID = -210174642L; 269 270 /* 271 * Constructor 272 */ 273 public HumanName() { 274 super(); 275 } 276 277 /** 278 * @return {@link #use} (Identifies the purpose for this name.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 279 */ 280 public Enumeration<NameUse> getUseElement() { 281 if (this.use == null) 282 if (Configuration.errorOnAutoCreate()) 283 throw new Error("Attempt to auto-create HumanName.use"); 284 else if (Configuration.doAutoCreate()) 285 this.use = new Enumeration<NameUse>(new NameUseEnumFactory()); // bb 286 return this.use; 287 } 288 289 public boolean hasUseElement() { 290 return this.use != null && !this.use.isEmpty(); 291 } 292 293 public boolean hasUse() { 294 return this.use != null && !this.use.isEmpty(); 295 } 296 297 /** 298 * @param value {@link #use} (Identifies the purpose for this name.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 299 */ 300 public HumanName setUseElement(Enumeration<NameUse> value) { 301 this.use = value; 302 return this; 303 } 304 305 /** 306 * @return Identifies the purpose for this name. 307 */ 308 public NameUse getUse() { 309 return this.use == null ? null : this.use.getValue(); 310 } 311 312 /** 313 * @param value Identifies the purpose for this name. 314 */ 315 public HumanName setUse(NameUse value) { 316 if (value == null) 317 this.use = null; 318 else { 319 if (this.use == null) 320 this.use = new Enumeration<NameUse>(new NameUseEnumFactory()); 321 this.use.setValue(value); 322 } 323 return this; 324 } 325 326 /** 327 * @return {@link #text} (A full text representation of the name.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 328 */ 329 public StringType getTextElement() { 330 if (this.text == null) 331 if (Configuration.errorOnAutoCreate()) 332 throw new Error("Attempt to auto-create HumanName.text"); 333 else if (Configuration.doAutoCreate()) 334 this.text = new StringType(); // bb 335 return this.text; 336 } 337 338 public boolean hasTextElement() { 339 return this.text != null && !this.text.isEmpty(); 340 } 341 342 public boolean hasText() { 343 return this.text != null && !this.text.isEmpty(); 344 } 345 346 /** 347 * @param value {@link #text} (A full text representation of the name.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 348 */ 349 public HumanName setTextElement(StringType value) { 350 this.text = value; 351 return this; 352 } 353 354 /** 355 * @return A full text representation of the name. 356 */ 357 public String getText() { 358 return this.text == null ? null : this.text.getValue(); 359 } 360 361 /** 362 * @param value A full text representation of the name. 363 */ 364 public HumanName setText(String value) { 365 if (Utilities.noString(value)) 366 this.text = null; 367 else { 368 if (this.text == null) 369 this.text = new StringType(); 370 this.text.setValue(value); 371 } 372 return this; 373 } 374 375 /** 376 * @return {@link #family} (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.) 377 */ 378 public List<StringType> getFamily() { 379 if (this.family == null) 380 this.family = new ArrayList<StringType>(); 381 return this.family; 382 } 383 384 public boolean hasFamily() { 385 if (this.family == null) 386 return false; 387 for (StringType item : this.family) 388 if (!item.isEmpty()) 389 return true; 390 return false; 391 } 392 393 /** 394 * @return {@link #family} (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.) 395 */ 396 // syntactic sugar 397 public StringType addFamilyElement() {//2 398 StringType t = new StringType(); 399 if (this.family == null) 400 this.family = new ArrayList<StringType>(); 401 this.family.add(t); 402 return t; 403 } 404 405 /** 406 * @param value {@link #family} (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.) 407 */ 408 public HumanName addFamily(String value) { //1 409 StringType t = new StringType(); 410 t.setValue(value); 411 if (this.family == null) 412 this.family = new ArrayList<StringType>(); 413 this.family.add(t); 414 return this; 415 } 416 417 /** 418 * @param value {@link #family} (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.) 419 */ 420 public boolean hasFamily(String value) { 421 if (this.family == null) 422 return false; 423 for (StringType v : this.family) 424 if (v.equals(value)) // string 425 return true; 426 return false; 427 } 428 429 /** 430 * @return {@link #given} (Given name.) 431 */ 432 public List<StringType> getGiven() { 433 if (this.given == null) 434 this.given = new ArrayList<StringType>(); 435 return this.given; 436 } 437 438 public boolean hasGiven() { 439 if (this.given == null) 440 return false; 441 for (StringType item : this.given) 442 if (!item.isEmpty()) 443 return true; 444 return false; 445 } 446 447 /** 448 * @return {@link #given} (Given name.) 449 */ 450 // syntactic sugar 451 public StringType addGivenElement() {//2 452 StringType t = new StringType(); 453 if (this.given == null) 454 this.given = new ArrayList<StringType>(); 455 this.given.add(t); 456 return t; 457 } 458 459 /** 460 * @param value {@link #given} (Given name.) 461 */ 462 public HumanName addGiven(String value) { //1 463 StringType t = new StringType(); 464 t.setValue(value); 465 if (this.given == null) 466 this.given = new ArrayList<StringType>(); 467 this.given.add(t); 468 return this; 469 } 470 471 /** 472 * @param value {@link #given} (Given name.) 473 */ 474 public boolean hasGiven(String value) { 475 if (this.given == null) 476 return false; 477 for (StringType v : this.given) 478 if (v.equals(value)) // string 479 return true; 480 return false; 481 } 482 483 /** 484 * @return {@link #prefix} (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.) 485 */ 486 public List<StringType> getPrefix() { 487 if (this.prefix == null) 488 this.prefix = new ArrayList<StringType>(); 489 return this.prefix; 490 } 491 492 public boolean hasPrefix() { 493 if (this.prefix == null) 494 return false; 495 for (StringType item : this.prefix) 496 if (!item.isEmpty()) 497 return true; 498 return false; 499 } 500 501 /** 502 * @return {@link #prefix} (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.) 503 */ 504 // syntactic sugar 505 public StringType addPrefixElement() {//2 506 StringType t = new StringType(); 507 if (this.prefix == null) 508 this.prefix = new ArrayList<StringType>(); 509 this.prefix.add(t); 510 return t; 511 } 512 513 /** 514 * @param value {@link #prefix} (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.) 515 */ 516 public HumanName addPrefix(String value) { //1 517 StringType t = new StringType(); 518 t.setValue(value); 519 if (this.prefix == null) 520 this.prefix = new ArrayList<StringType>(); 521 this.prefix.add(t); 522 return this; 523 } 524 525 /** 526 * @param value {@link #prefix} (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.) 527 */ 528 public boolean hasPrefix(String value) { 529 if (this.prefix == null) 530 return false; 531 for (StringType v : this.prefix) 532 if (v.equals(value)) // string 533 return true; 534 return false; 535 } 536 537 /** 538 * @return {@link #suffix} (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.) 539 */ 540 public List<StringType> getSuffix() { 541 if (this.suffix == null) 542 this.suffix = new ArrayList<StringType>(); 543 return this.suffix; 544 } 545 546 public boolean hasSuffix() { 547 if (this.suffix == null) 548 return false; 549 for (StringType item : this.suffix) 550 if (!item.isEmpty()) 551 return true; 552 return false; 553 } 554 555 /** 556 * @return {@link #suffix} (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.) 557 */ 558 // syntactic sugar 559 public StringType addSuffixElement() {//2 560 StringType t = new StringType(); 561 if (this.suffix == null) 562 this.suffix = new ArrayList<StringType>(); 563 this.suffix.add(t); 564 return t; 565 } 566 567 /** 568 * @param value {@link #suffix} (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.) 569 */ 570 public HumanName addSuffix(String value) { //1 571 StringType t = new StringType(); 572 t.setValue(value); 573 if (this.suffix == null) 574 this.suffix = new ArrayList<StringType>(); 575 this.suffix.add(t); 576 return this; 577 } 578 579 /** 580 * @param value {@link #suffix} (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.) 581 */ 582 public boolean hasSuffix(String value) { 583 if (this.suffix == null) 584 return false; 585 for (StringType v : this.suffix) 586 if (v.equals(value)) // string 587 return true; 588 return false; 589 } 590 591 /** 592 * @return {@link #period} (Indicates the period of time when this name was valid for the named person.) 593 */ 594 public Period getPeriod() { 595 if (this.period == null) 596 if (Configuration.errorOnAutoCreate()) 597 throw new Error("Attempt to auto-create HumanName.period"); 598 else if (Configuration.doAutoCreate()) 599 this.period = new Period(); // cc 600 return this.period; 601 } 602 603 public boolean hasPeriod() { 604 return this.period != null && !this.period.isEmpty(); 605 } 606 607 /** 608 * @param value {@link #period} (Indicates the period of time when this name was valid for the named person.) 609 */ 610 public HumanName setPeriod(Period value) { 611 this.period = value; 612 return this; 613 } 614 615 protected void listChildren(List<Property> childrenList) { 616 super.listChildren(childrenList); 617 childrenList.add(new Property("use", "code", "Identifies the purpose for this name.", 0, java.lang.Integer.MAX_VALUE, use)); 618 childrenList.add(new Property("text", "string", "A full text representation of the name.", 0, java.lang.Integer.MAX_VALUE, text)); 619 childrenList.add(new Property("family", "string", "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.", 0, java.lang.Integer.MAX_VALUE, family)); 620 childrenList.add(new Property("given", "string", "Given name.", 0, java.lang.Integer.MAX_VALUE, given)); 621 childrenList.add(new Property("prefix", "string", "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.", 0, java.lang.Integer.MAX_VALUE, prefix)); 622 childrenList.add(new Property("suffix", "string", "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.", 0, java.lang.Integer.MAX_VALUE, suffix)); 623 childrenList.add(new Property("period", "Period", "Indicates the period of time when this name was valid for the named person.", 0, java.lang.Integer.MAX_VALUE, period)); 624 } 625 626 @Override 627 public void setProperty(String name, Base value) throws FHIRException { 628 if (name.equals("use")) 629 this.use = new NameUseEnumFactory().fromType(value); // Enumeration<NameUse> 630 else if (name.equals("text")) 631 this.text = castToString(value); // StringType 632 else if (name.equals("family")) 633 this.getFamily().add(castToString(value)); 634 else if (name.equals("given")) 635 this.getGiven().add(castToString(value)); 636 else if (name.equals("prefix")) 637 this.getPrefix().add(castToString(value)); 638 else if (name.equals("suffix")) 639 this.getSuffix().add(castToString(value)); 640 else if (name.equals("period")) 641 this.period = castToPeriod(value); // Period 642 else 643 super.setProperty(name, value); 644 } 645 646 @Override 647 public Base addChild(String name) throws FHIRException { 648 if (name.equals("use")) { 649 throw new FHIRException("Cannot call addChild on a primitive type HumanName.use"); 650 } 651 else if (name.equals("text")) { 652 throw new FHIRException("Cannot call addChild on a primitive type HumanName.text"); 653 } 654 else if (name.equals("family")) { 655 throw new FHIRException("Cannot call addChild on a primitive type HumanName.family"); 656 } 657 else if (name.equals("given")) { 658 throw new FHIRException("Cannot call addChild on a primitive type HumanName.given"); 659 } 660 else if (name.equals("prefix")) { 661 throw new FHIRException("Cannot call addChild on a primitive type HumanName.prefix"); 662 } 663 else if (name.equals("suffix")) { 664 throw new FHIRException("Cannot call addChild on a primitive type HumanName.suffix"); 665 } 666 else if (name.equals("period")) { 667 this.period = new Period(); 668 return this.period; 669 } 670 else 671 return super.addChild(name); 672 } 673 674 public String fhirType() { 675 return "HumanName"; 676 677 } 678 679 public HumanName copy() { 680 HumanName dst = new HumanName(); 681 copyValues(dst); 682 dst.use = use == null ? null : use.copy(); 683 dst.text = text == null ? null : text.copy(); 684 if (family != null) { 685 dst.family = new ArrayList<StringType>(); 686 for (StringType i : family) 687 dst.family.add(i.copy()); 688 }; 689 if (given != null) { 690 dst.given = new ArrayList<StringType>(); 691 for (StringType i : given) 692 dst.given.add(i.copy()); 693 }; 694 if (prefix != null) { 695 dst.prefix = new ArrayList<StringType>(); 696 for (StringType i : prefix) 697 dst.prefix.add(i.copy()); 698 }; 699 if (suffix != null) { 700 dst.suffix = new ArrayList<StringType>(); 701 for (StringType i : suffix) 702 dst.suffix.add(i.copy()); 703 }; 704 dst.period = period == null ? null : period.copy(); 705 return dst; 706 } 707 708 protected HumanName typedCopy() { 709 return copy(); 710 } 711 712 @Override 713 public boolean equalsDeep(Base other) { 714 if (!super.equalsDeep(other)) 715 return false; 716 if (!(other instanceof HumanName)) 717 return false; 718 HumanName o = (HumanName) other; 719 return compareDeep(use, o.use, true) && compareDeep(text, o.text, true) && compareDeep(family, o.family, true) 720 && compareDeep(given, o.given, true) && compareDeep(prefix, o.prefix, true) && compareDeep(suffix, o.suffix, true) 721 && compareDeep(period, o.period, true); 722 } 723 724 @Override 725 public boolean equalsShallow(Base other) { 726 if (!super.equalsShallow(other)) 727 return false; 728 if (!(other instanceof HumanName)) 729 return false; 730 HumanName o = (HumanName) other; 731 return compareValues(use, o.use, true) && compareValues(text, o.text, true) && compareValues(family, o.family, true) 732 && compareValues(given, o.given, true) && compareValues(prefix, o.prefix, true) && compareValues(suffix, o.suffix, true) 733 ; 734 } 735 736 public boolean isEmpty() { 737 return super.isEmpty() && (use == null || use.isEmpty()) && (text == null || text.isEmpty()) 738 && (family == null || family.isEmpty()) && (given == null || given.isEmpty()) && (prefix == null || prefix.isEmpty()) 739 && (suffix == null || suffix.isEmpty()) && (period == null || period.isEmpty()); 740 } 741 742 743}