![](/hapi-fhir/images/logos/raccoon-forwards.png)
001package org.hl7.fhir.dstu3.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 Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x 036import java.util.ArrayList; 037import java.util.List; 038 039import org.hl7.fhir.exceptions.FHIRException; 040import org.hl7.fhir.instance.model.api.ICompositeType; 041import org.hl7.fhir.utilities.Utilities; 042 043import ca.uhn.fhir.model.api.annotation.Child; 044import ca.uhn.fhir.model.api.annotation.DatatypeDef; 045import ca.uhn.fhir.model.api.annotation.Description; 046/** 047 * An address expressed using postal conventions (as opposed to GPS or other location definition formats). This data type may be used to convey addresses for use in delivering mail as well as for visiting locations which might not be valid for mail delivery. There are a variety of postal address formats defined around the world. 048 */ 049@DatatypeDef(name="Address") 050public class Address extends Type implements ICompositeType { 051 052 public enum AddressUse { 053 /** 054 * A communication address at a home. 055 */ 056 HOME, 057 /** 058 * An office address. First choice for business related contacts during business hours. 059 */ 060 WORK, 061 /** 062 * A temporary address. The period can provide more detailed information. 063 */ 064 TEMP, 065 /** 066 * This address is no longer in use (or was never correct, but retained for records). 067 */ 068 OLD, 069 /** 070 * added to help the parsers with the generic types 071 */ 072 NULL; 073 public static AddressUse fromCode(String codeString) throws FHIRException { 074 if (codeString == null || "".equals(codeString)) 075 return null; 076 if ("home".equals(codeString)) 077 return HOME; 078 if ("work".equals(codeString)) 079 return WORK; 080 if ("temp".equals(codeString)) 081 return TEMP; 082 if ("old".equals(codeString)) 083 return OLD; 084 if (Configuration.isAcceptInvalidEnums()) 085 return null; 086 else 087 throw new FHIRException("Unknown AddressUse code '"+codeString+"'"); 088 } 089 public String toCode() { 090 switch (this) { 091 case HOME: return "home"; 092 case WORK: return "work"; 093 case TEMP: return "temp"; 094 case OLD: return "old"; 095 case NULL: return null; 096 default: return "?"; 097 } 098 } 099 public String getSystem() { 100 switch (this) { 101 case HOME: return "http://hl7.org/fhir/address-use"; 102 case WORK: return "http://hl7.org/fhir/address-use"; 103 case TEMP: return "http://hl7.org/fhir/address-use"; 104 case OLD: return "http://hl7.org/fhir/address-use"; 105 case NULL: return null; 106 default: return "?"; 107 } 108 } 109 public String getDefinition() { 110 switch (this) { 111 case HOME: return "A communication address at a home."; 112 case WORK: return "An office address. First choice for business related contacts during business hours."; 113 case TEMP: return "A temporary address. The period can provide more detailed information."; 114 case OLD: return "This address is no longer in use (or was never correct, but retained for records)."; 115 case NULL: return null; 116 default: return "?"; 117 } 118 } 119 public String getDisplay() { 120 switch (this) { 121 case HOME: return "Home"; 122 case WORK: return "Work"; 123 case TEMP: return "Temporary"; 124 case OLD: return "Old / Incorrect"; 125 case NULL: return null; 126 default: return "?"; 127 } 128 } 129 } 130 131 public static class AddressUseEnumFactory implements EnumFactory<AddressUse> { 132 public AddressUse fromCode(String codeString) throws IllegalArgumentException { 133 if (codeString == null || "".equals(codeString)) 134 if (codeString == null || "".equals(codeString)) 135 return null; 136 if ("home".equals(codeString)) 137 return AddressUse.HOME; 138 if ("work".equals(codeString)) 139 return AddressUse.WORK; 140 if ("temp".equals(codeString)) 141 return AddressUse.TEMP; 142 if ("old".equals(codeString)) 143 return AddressUse.OLD; 144 throw new IllegalArgumentException("Unknown AddressUse code '"+codeString+"'"); 145 } 146 public Enumeration<AddressUse> fromType(PrimitiveType<?> code) throws FHIRException { 147 if (code == null) 148 return null; 149 if (code.isEmpty()) 150 return new Enumeration<AddressUse>(this); 151 String codeString = code.asStringValue(); 152 if (codeString == null || "".equals(codeString)) 153 return null; 154 if ("home".equals(codeString)) 155 return new Enumeration<AddressUse>(this, AddressUse.HOME); 156 if ("work".equals(codeString)) 157 return new Enumeration<AddressUse>(this, AddressUse.WORK); 158 if ("temp".equals(codeString)) 159 return new Enumeration<AddressUse>(this, AddressUse.TEMP); 160 if ("old".equals(codeString)) 161 return new Enumeration<AddressUse>(this, AddressUse.OLD); 162 throw new FHIRException("Unknown AddressUse code '"+codeString+"'"); 163 } 164 public String toCode(AddressUse code) { 165 if (code == AddressUse.HOME) 166 return "home"; 167 if (code == AddressUse.WORK) 168 return "work"; 169 if (code == AddressUse.TEMP) 170 return "temp"; 171 if (code == AddressUse.OLD) 172 return "old"; 173 return "?"; 174 } 175 public String toSystem(AddressUse code) { 176 return code.getSystem(); 177 } 178 } 179 180 public enum AddressType { 181 /** 182 * Mailing addresses - PO Boxes and care-of addresses. 183 */ 184 POSTAL, 185 /** 186 * A physical address that can be visited. 187 */ 188 PHYSICAL, 189 /** 190 * An address that is both physical and postal. 191 */ 192 BOTH, 193 /** 194 * added to help the parsers with the generic types 195 */ 196 NULL; 197 public static AddressType fromCode(String codeString) throws FHIRException { 198 if (codeString == null || "".equals(codeString)) 199 return null; 200 if ("postal".equals(codeString)) 201 return POSTAL; 202 if ("physical".equals(codeString)) 203 return PHYSICAL; 204 if ("both".equals(codeString)) 205 return BOTH; 206 if (Configuration.isAcceptInvalidEnums()) 207 return null; 208 else 209 throw new FHIRException("Unknown AddressType code '"+codeString+"'"); 210 } 211 public String toCode() { 212 switch (this) { 213 case POSTAL: return "postal"; 214 case PHYSICAL: return "physical"; 215 case BOTH: return "both"; 216 case NULL: return null; 217 default: return "?"; 218 } 219 } 220 public String getSystem() { 221 switch (this) { 222 case POSTAL: return "http://hl7.org/fhir/address-type"; 223 case PHYSICAL: return "http://hl7.org/fhir/address-type"; 224 case BOTH: return "http://hl7.org/fhir/address-type"; 225 case NULL: return null; 226 default: return "?"; 227 } 228 } 229 public String getDefinition() { 230 switch (this) { 231 case POSTAL: return "Mailing addresses - PO Boxes and care-of addresses."; 232 case PHYSICAL: return "A physical address that can be visited."; 233 case BOTH: return "An address that is both physical and postal."; 234 case NULL: return null; 235 default: return "?"; 236 } 237 } 238 public String getDisplay() { 239 switch (this) { 240 case POSTAL: return "Postal"; 241 case PHYSICAL: return "Physical"; 242 case BOTH: return "Postal & Physical"; 243 case NULL: return null; 244 default: return "?"; 245 } 246 } 247 } 248 249 public static class AddressTypeEnumFactory implements EnumFactory<AddressType> { 250 public AddressType fromCode(String codeString) throws IllegalArgumentException { 251 if (codeString == null || "".equals(codeString)) 252 if (codeString == null || "".equals(codeString)) 253 return null; 254 if ("postal".equals(codeString)) 255 return AddressType.POSTAL; 256 if ("physical".equals(codeString)) 257 return AddressType.PHYSICAL; 258 if ("both".equals(codeString)) 259 return AddressType.BOTH; 260 throw new IllegalArgumentException("Unknown AddressType code '"+codeString+"'"); 261 } 262 public Enumeration<AddressType> fromType(PrimitiveType<?> code) throws FHIRException { 263 if (code == null) 264 return null; 265 if (code.isEmpty()) 266 return new Enumeration<AddressType>(this); 267 String codeString = code.asStringValue(); 268 if (codeString == null || "".equals(codeString)) 269 return null; 270 if ("postal".equals(codeString)) 271 return new Enumeration<AddressType>(this, AddressType.POSTAL); 272 if ("physical".equals(codeString)) 273 return new Enumeration<AddressType>(this, AddressType.PHYSICAL); 274 if ("both".equals(codeString)) 275 return new Enumeration<AddressType>(this, AddressType.BOTH); 276 throw new FHIRException("Unknown AddressType code '"+codeString+"'"); 277 } 278 public String toCode(AddressType code) { 279 if (code == AddressType.POSTAL) 280 return "postal"; 281 if (code == AddressType.PHYSICAL) 282 return "physical"; 283 if (code == AddressType.BOTH) 284 return "both"; 285 return "?"; 286 } 287 public String toSystem(AddressType code) { 288 return code.getSystem(); 289 } 290 } 291 292 /** 293 * The purpose of this address. 294 */ 295 @Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true) 296 @Description(shortDefinition="home | work | temp | old - purpose of this address", formalDefinition="The purpose of this address." ) 297 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/address-use") 298 protected Enumeration<AddressUse> use; 299 300 /** 301 * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both. 302 */ 303 @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 304 @Description(shortDefinition="postal | physical | both", formalDefinition="Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both." ) 305 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/address-type") 306 protected Enumeration<AddressType> type; 307 308 /** 309 * A full text representation of the address. 310 */ 311 @Child(name = "text", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 312 @Description(shortDefinition="Text representation of the address", formalDefinition="A full text representation of the address." ) 313 protected StringType text; 314 315 /** 316 * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information. 317 */ 318 @Child(name = "line", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 319 @Description(shortDefinition="Street name, number, direction & P.O. Box etc.", formalDefinition="This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information." ) 320 protected List<StringType> line; 321 322 /** 323 * The name of the city, town, village or other community or delivery center. 324 */ 325 @Child(name = "city", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true) 326 @Description(shortDefinition="Name of city, town etc.", formalDefinition="The name of the city, town, village or other community or delivery center." ) 327 protected StringType city; 328 329 /** 330 * The name of the administrative area (county). 331 */ 332 @Child(name = "district", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true) 333 @Description(shortDefinition="District name (aka county)", formalDefinition="The name of the administrative area (county)." ) 334 protected StringType district; 335 336 /** 337 * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes). 338 */ 339 @Child(name = "state", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true) 340 @Description(shortDefinition="Sub-unit of country (abbreviations ok)", formalDefinition="Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes)." ) 341 protected StringType state; 342 343 /** 344 * A postal code designating a region defined by the postal service. 345 */ 346 @Child(name = "postalCode", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true) 347 @Description(shortDefinition="Postal code for area", formalDefinition="A postal code designating a region defined by the postal service." ) 348 protected StringType postalCode; 349 350 /** 351 * Country - a nation as commonly understood or generally accepted. 352 */ 353 @Child(name = "country", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true) 354 @Description(shortDefinition="Country (e.g. can be ISO 3166 2 or 3 letter code)", formalDefinition="Country - a nation as commonly understood or generally accepted." ) 355 protected StringType country; 356 357 /** 358 * Time period when address was/is in use. 359 */ 360 @Child(name = "period", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true) 361 @Description(shortDefinition="Time period when address was/is in use", formalDefinition="Time period when address was/is in use." ) 362 protected Period period; 363 364 private static final long serialVersionUID = 561490318L; 365 366 /** 367 * Constructor 368 */ 369 public Address() { 370 super(); 371 } 372 373 /** 374 * @return {@link #use} (The purpose of this address.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 375 */ 376 public Enumeration<AddressUse> getUseElement() { 377 if (this.use == null) 378 if (Configuration.errorOnAutoCreate()) 379 throw new Error("Attempt to auto-create Address.use"); 380 else if (Configuration.doAutoCreate()) 381 this.use = new Enumeration<AddressUse>(new AddressUseEnumFactory()); // bb 382 return this.use; 383 } 384 385 public boolean hasUseElement() { 386 return this.use != null && !this.use.isEmpty(); 387 } 388 389 public boolean hasUse() { 390 return this.use != null && !this.use.isEmpty(); 391 } 392 393 /** 394 * @param value {@link #use} (The purpose of this address.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 395 */ 396 public Address setUseElement(Enumeration<AddressUse> value) { 397 this.use = value; 398 return this; 399 } 400 401 /** 402 * @return The purpose of this address. 403 */ 404 public AddressUse getUse() { 405 return this.use == null ? null : this.use.getValue(); 406 } 407 408 /** 409 * @param value The purpose of this address. 410 */ 411 public Address setUse(AddressUse value) { 412 if (value == null) 413 this.use = null; 414 else { 415 if (this.use == null) 416 this.use = new Enumeration<AddressUse>(new AddressUseEnumFactory()); 417 this.use.setValue(value); 418 } 419 return this; 420 } 421 422 /** 423 * @return {@link #type} (Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 424 */ 425 public Enumeration<AddressType> getTypeElement() { 426 if (this.type == null) 427 if (Configuration.errorOnAutoCreate()) 428 throw new Error("Attempt to auto-create Address.type"); 429 else if (Configuration.doAutoCreate()) 430 this.type = new Enumeration<AddressType>(new AddressTypeEnumFactory()); // bb 431 return this.type; 432 } 433 434 public boolean hasTypeElement() { 435 return this.type != null && !this.type.isEmpty(); 436 } 437 438 public boolean hasType() { 439 return this.type != null && !this.type.isEmpty(); 440 } 441 442 /** 443 * @param value {@link #type} (Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 444 */ 445 public Address setTypeElement(Enumeration<AddressType> value) { 446 this.type = value; 447 return this; 448 } 449 450 /** 451 * @return Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both. 452 */ 453 public AddressType getType() { 454 return this.type == null ? null : this.type.getValue(); 455 } 456 457 /** 458 * @param value Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both. 459 */ 460 public Address setType(AddressType value) { 461 if (value == null) 462 this.type = null; 463 else { 464 if (this.type == null) 465 this.type = new Enumeration<AddressType>(new AddressTypeEnumFactory()); 466 this.type.setValue(value); 467 } 468 return this; 469 } 470 471 /** 472 * @return {@link #text} (A full text representation of the address.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 473 */ 474 public StringType getTextElement() { 475 if (this.text == null) 476 if (Configuration.errorOnAutoCreate()) 477 throw new Error("Attempt to auto-create Address.text"); 478 else if (Configuration.doAutoCreate()) 479 this.text = new StringType(); // bb 480 return this.text; 481 } 482 483 public boolean hasTextElement() { 484 return this.text != null && !this.text.isEmpty(); 485 } 486 487 public boolean hasText() { 488 return this.text != null && !this.text.isEmpty(); 489 } 490 491 /** 492 * @param value {@link #text} (A full text representation of the address.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value 493 */ 494 public Address setTextElement(StringType value) { 495 this.text = value; 496 return this; 497 } 498 499 /** 500 * @return A full text representation of the address. 501 */ 502 public String getText() { 503 return this.text == null ? null : this.text.getValue(); 504 } 505 506 /** 507 * @param value A full text representation of the address. 508 */ 509 public Address setText(String value) { 510 if (Utilities.noString(value)) 511 this.text = null; 512 else { 513 if (this.text == null) 514 this.text = new StringType(); 515 this.text.setValue(value); 516 } 517 return this; 518 } 519 520 /** 521 * @return {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.) 522 */ 523 public List<StringType> getLine() { 524 if (this.line == null) 525 this.line = new ArrayList<StringType>(); 526 return this.line; 527 } 528 529 /** 530 * @return Returns a reference to <code>this</code> for easy method chaining 531 */ 532 public Address setLine(List<StringType> theLine) { 533 this.line = theLine; 534 return this; 535 } 536 537 public boolean hasLine() { 538 if (this.line == null) 539 return false; 540 for (StringType item : this.line) 541 if (!item.isEmpty()) 542 return true; 543 return false; 544 } 545 546 /** 547 * @return {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.) 548 */ 549 public StringType addLineElement() {//2 550 StringType t = new StringType(); 551 if (this.line == null) 552 this.line = new ArrayList<StringType>(); 553 this.line.add(t); 554 return t; 555 } 556 557 /** 558 * @param value {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.) 559 */ 560 public Address addLine(String value) { //1 561 StringType t = new StringType(); 562 t.setValue(value); 563 if (this.line == null) 564 this.line = new ArrayList<StringType>(); 565 this.line.add(t); 566 return this; 567 } 568 569 /** 570 * @param value {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.) 571 */ 572 public boolean hasLine(String value) { 573 if (this.line == null) 574 return false; 575 for (StringType v : this.line) 576 if (v.getValue().equals(value)) // string 577 return true; 578 return false; 579 } 580 581 /** 582 * @return {@link #city} (The name of the city, town, village or other community or delivery center.). This is the underlying object with id, value and extensions. The accessor "getCity" gives direct access to the value 583 */ 584 public StringType getCityElement() { 585 if (this.city == null) 586 if (Configuration.errorOnAutoCreate()) 587 throw new Error("Attempt to auto-create Address.city"); 588 else if (Configuration.doAutoCreate()) 589 this.city = new StringType(); // bb 590 return this.city; 591 } 592 593 public boolean hasCityElement() { 594 return this.city != null && !this.city.isEmpty(); 595 } 596 597 public boolean hasCity() { 598 return this.city != null && !this.city.isEmpty(); 599 } 600 601 /** 602 * @param value {@link #city} (The name of the city, town, village or other community or delivery center.). This is the underlying object with id, value and extensions. The accessor "getCity" gives direct access to the value 603 */ 604 public Address setCityElement(StringType value) { 605 this.city = value; 606 return this; 607 } 608 609 /** 610 * @return The name of the city, town, village or other community or delivery center. 611 */ 612 public String getCity() { 613 return this.city == null ? null : this.city.getValue(); 614 } 615 616 /** 617 * @param value The name of the city, town, village or other community or delivery center. 618 */ 619 public Address setCity(String value) { 620 if (Utilities.noString(value)) 621 this.city = null; 622 else { 623 if (this.city == null) 624 this.city = new StringType(); 625 this.city.setValue(value); 626 } 627 return this; 628 } 629 630 /** 631 * @return {@link #district} (The name of the administrative area (county).). This is the underlying object with id, value and extensions. The accessor "getDistrict" gives direct access to the value 632 */ 633 public StringType getDistrictElement() { 634 if (this.district == null) 635 if (Configuration.errorOnAutoCreate()) 636 throw new Error("Attempt to auto-create Address.district"); 637 else if (Configuration.doAutoCreate()) 638 this.district = new StringType(); // bb 639 return this.district; 640 } 641 642 public boolean hasDistrictElement() { 643 return this.district != null && !this.district.isEmpty(); 644 } 645 646 public boolean hasDistrict() { 647 return this.district != null && !this.district.isEmpty(); 648 } 649 650 /** 651 * @param value {@link #district} (The name of the administrative area (county).). This is the underlying object with id, value and extensions. The accessor "getDistrict" gives direct access to the value 652 */ 653 public Address setDistrictElement(StringType value) { 654 this.district = value; 655 return this; 656 } 657 658 /** 659 * @return The name of the administrative area (county). 660 */ 661 public String getDistrict() { 662 return this.district == null ? null : this.district.getValue(); 663 } 664 665 /** 666 * @param value The name of the administrative area (county). 667 */ 668 public Address setDistrict(String value) { 669 if (Utilities.noString(value)) 670 this.district = null; 671 else { 672 if (this.district == null) 673 this.district = new StringType(); 674 this.district.setValue(value); 675 } 676 return this; 677 } 678 679 /** 680 * @return {@link #state} (Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value 681 */ 682 public StringType getStateElement() { 683 if (this.state == null) 684 if (Configuration.errorOnAutoCreate()) 685 throw new Error("Attempt to auto-create Address.state"); 686 else if (Configuration.doAutoCreate()) 687 this.state = new StringType(); // bb 688 return this.state; 689 } 690 691 public boolean hasStateElement() { 692 return this.state != null && !this.state.isEmpty(); 693 } 694 695 public boolean hasState() { 696 return this.state != null && !this.state.isEmpty(); 697 } 698 699 /** 700 * @param value {@link #state} (Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value 701 */ 702 public Address setStateElement(StringType value) { 703 this.state = value; 704 return this; 705 } 706 707 /** 708 * @return Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes). 709 */ 710 public String getState() { 711 return this.state == null ? null : this.state.getValue(); 712 } 713 714 /** 715 * @param value Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes). 716 */ 717 public Address setState(String value) { 718 if (Utilities.noString(value)) 719 this.state = null; 720 else { 721 if (this.state == null) 722 this.state = new StringType(); 723 this.state.setValue(value); 724 } 725 return this; 726 } 727 728 /** 729 * @return {@link #postalCode} (A postal code designating a region defined by the postal service.). This is the underlying object with id, value and extensions. The accessor "getPostalCode" gives direct access to the value 730 */ 731 public StringType getPostalCodeElement() { 732 if (this.postalCode == null) 733 if (Configuration.errorOnAutoCreate()) 734 throw new Error("Attempt to auto-create Address.postalCode"); 735 else if (Configuration.doAutoCreate()) 736 this.postalCode = new StringType(); // bb 737 return this.postalCode; 738 } 739 740 public boolean hasPostalCodeElement() { 741 return this.postalCode != null && !this.postalCode.isEmpty(); 742 } 743 744 public boolean hasPostalCode() { 745 return this.postalCode != null && !this.postalCode.isEmpty(); 746 } 747 748 /** 749 * @param value {@link #postalCode} (A postal code designating a region defined by the postal service.). This is the underlying object with id, value and extensions. The accessor "getPostalCode" gives direct access to the value 750 */ 751 public Address setPostalCodeElement(StringType value) { 752 this.postalCode = value; 753 return this; 754 } 755 756 /** 757 * @return A postal code designating a region defined by the postal service. 758 */ 759 public String getPostalCode() { 760 return this.postalCode == null ? null : this.postalCode.getValue(); 761 } 762 763 /** 764 * @param value A postal code designating a region defined by the postal service. 765 */ 766 public Address setPostalCode(String value) { 767 if (Utilities.noString(value)) 768 this.postalCode = null; 769 else { 770 if (this.postalCode == null) 771 this.postalCode = new StringType(); 772 this.postalCode.setValue(value); 773 } 774 return this; 775 } 776 777 /** 778 * @return {@link #country} (Country - a nation as commonly understood or generally accepted.). This is the underlying object with id, value and extensions. The accessor "getCountry" gives direct access to the value 779 */ 780 public StringType getCountryElement() { 781 if (this.country == null) 782 if (Configuration.errorOnAutoCreate()) 783 throw new Error("Attempt to auto-create Address.country"); 784 else if (Configuration.doAutoCreate()) 785 this.country = new StringType(); // bb 786 return this.country; 787 } 788 789 public boolean hasCountryElement() { 790 return this.country != null && !this.country.isEmpty(); 791 } 792 793 public boolean hasCountry() { 794 return this.country != null && !this.country.isEmpty(); 795 } 796 797 /** 798 * @param value {@link #country} (Country - a nation as commonly understood or generally accepted.). This is the underlying object with id, value and extensions. The accessor "getCountry" gives direct access to the value 799 */ 800 public Address setCountryElement(StringType value) { 801 this.country = value; 802 return this; 803 } 804 805 /** 806 * @return Country - a nation as commonly understood or generally accepted. 807 */ 808 public String getCountry() { 809 return this.country == null ? null : this.country.getValue(); 810 } 811 812 /** 813 * @param value Country - a nation as commonly understood or generally accepted. 814 */ 815 public Address setCountry(String value) { 816 if (Utilities.noString(value)) 817 this.country = null; 818 else { 819 if (this.country == null) 820 this.country = new StringType(); 821 this.country.setValue(value); 822 } 823 return this; 824 } 825 826 /** 827 * @return {@link #period} (Time period when address was/is in use.) 828 */ 829 public Period getPeriod() { 830 if (this.period == null) 831 if (Configuration.errorOnAutoCreate()) 832 throw new Error("Attempt to auto-create Address.period"); 833 else if (Configuration.doAutoCreate()) 834 this.period = new Period(); // cc 835 return this.period; 836 } 837 838 public boolean hasPeriod() { 839 return this.period != null && !this.period.isEmpty(); 840 } 841 842 /** 843 * @param value {@link #period} (Time period when address was/is in use.) 844 */ 845 public Address setPeriod(Period value) { 846 this.period = value; 847 return this; 848 } 849 850 protected void listChildren(List<Property> children) { 851 super.listChildren(children); 852 children.add(new Property("use", "code", "The purpose of this address.", 0, 1, use)); 853 children.add(new Property("type", "code", "Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.", 0, 1, type)); 854 children.add(new Property("text", "string", "A full text representation of the address.", 0, 1, text)); 855 children.add(new Property("line", "string", "This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.", 0, java.lang.Integer.MAX_VALUE, line)); 856 children.add(new Property("city", "string", "The name of the city, town, village or other community or delivery center.", 0, 1, city)); 857 children.add(new Property("district", "string", "The name of the administrative area (county).", 0, 1, district)); 858 children.add(new Property("state", "string", "Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).", 0, 1, state)); 859 children.add(new Property("postalCode", "string", "A postal code designating a region defined by the postal service.", 0, 1, postalCode)); 860 children.add(new Property("country", "string", "Country - a nation as commonly understood or generally accepted.", 0, 1, country)); 861 children.add(new Property("period", "Period", "Time period when address was/is in use.", 0, 1, period)); 862 } 863 864 @Override 865 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 866 switch (_hash) { 867 case 116103: /*use*/ return new Property("use", "code", "The purpose of this address.", 0, 1, use); 868 case 3575610: /*type*/ return new Property("type", "code", "Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.", 0, 1, type); 869 case 3556653: /*text*/ return new Property("text", "string", "A full text representation of the address.", 0, 1, text); 870 case 3321844: /*line*/ return new Property("line", "string", "This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.", 0, java.lang.Integer.MAX_VALUE, line); 871 case 3053931: /*city*/ return new Property("city", "string", "The name of the city, town, village or other community or delivery center.", 0, 1, city); 872 case 288961422: /*district*/ return new Property("district", "string", "The name of the administrative area (county).", 0, 1, district); 873 case 109757585: /*state*/ return new Property("state", "string", "Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).", 0, 1, state); 874 case 2011152728: /*postalCode*/ return new Property("postalCode", "string", "A postal code designating a region defined by the postal service.", 0, 1, postalCode); 875 case 957831062: /*country*/ return new Property("country", "string", "Country - a nation as commonly understood or generally accepted.", 0, 1, country); 876 case -991726143: /*period*/ return new Property("period", "Period", "Time period when address was/is in use.", 0, 1, period); 877 default: return super.getNamedProperty(_hash, _name, _checkValid); 878 } 879 880 } 881 882 @Override 883 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 884 switch (hash) { 885 case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<AddressUse> 886 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<AddressType> 887 case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType 888 case 3321844: /*line*/ return this.line == null ? new Base[0] : this.line.toArray(new Base[this.line.size()]); // StringType 889 case 3053931: /*city*/ return this.city == null ? new Base[0] : new Base[] {this.city}; // StringType 890 case 288961422: /*district*/ return this.district == null ? new Base[0] : new Base[] {this.district}; // StringType 891 case 109757585: /*state*/ return this.state == null ? new Base[0] : new Base[] {this.state}; // StringType 892 case 2011152728: /*postalCode*/ return this.postalCode == null ? new Base[0] : new Base[] {this.postalCode}; // StringType 893 case 957831062: /*country*/ return this.country == null ? new Base[0] : new Base[] {this.country}; // StringType 894 case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period 895 default: return super.getProperty(hash, name, checkValid); 896 } 897 898 } 899 900 @Override 901 public Base setProperty(int hash, String name, Base value) throws FHIRException { 902 switch (hash) { 903 case 116103: // use 904 value = new AddressUseEnumFactory().fromType(castToCode(value)); 905 this.use = (Enumeration) value; // Enumeration<AddressUse> 906 return value; 907 case 3575610: // type 908 value = new AddressTypeEnumFactory().fromType(castToCode(value)); 909 this.type = (Enumeration) value; // Enumeration<AddressType> 910 return value; 911 case 3556653: // text 912 this.text = castToString(value); // StringType 913 return value; 914 case 3321844: // line 915 this.getLine().add(castToString(value)); // StringType 916 return value; 917 case 3053931: // city 918 this.city = castToString(value); // StringType 919 return value; 920 case 288961422: // district 921 this.district = castToString(value); // StringType 922 return value; 923 case 109757585: // state 924 this.state = castToString(value); // StringType 925 return value; 926 case 2011152728: // postalCode 927 this.postalCode = castToString(value); // StringType 928 return value; 929 case 957831062: // country 930 this.country = castToString(value); // StringType 931 return value; 932 case -991726143: // period 933 this.period = castToPeriod(value); // Period 934 return value; 935 default: return super.setProperty(hash, name, value); 936 } 937 938 } 939 940 @Override 941 public Base setProperty(String name, Base value) throws FHIRException { 942 if (name.equals("use")) { 943 value = new AddressUseEnumFactory().fromType(castToCode(value)); 944 this.use = (Enumeration) value; // Enumeration<AddressUse> 945 } else if (name.equals("type")) { 946 value = new AddressTypeEnumFactory().fromType(castToCode(value)); 947 this.type = (Enumeration) value; // Enumeration<AddressType> 948 } else if (name.equals("text")) { 949 this.text = castToString(value); // StringType 950 } else if (name.equals("line")) { 951 this.getLine().add(castToString(value)); 952 } else if (name.equals("city")) { 953 this.city = castToString(value); // StringType 954 } else if (name.equals("district")) { 955 this.district = castToString(value); // StringType 956 } else if (name.equals("state")) { 957 this.state = castToString(value); // StringType 958 } else if (name.equals("postalCode")) { 959 this.postalCode = castToString(value); // StringType 960 } else if (name.equals("country")) { 961 this.country = castToString(value); // StringType 962 } else if (name.equals("period")) { 963 this.period = castToPeriod(value); // Period 964 } else 965 return super.setProperty(name, value); 966 return value; 967 } 968 969 @Override 970 public Base makeProperty(int hash, String name) throws FHIRException { 971 switch (hash) { 972 case 116103: return getUseElement(); 973 case 3575610: return getTypeElement(); 974 case 3556653: return getTextElement(); 975 case 3321844: return addLineElement(); 976 case 3053931: return getCityElement(); 977 case 288961422: return getDistrictElement(); 978 case 109757585: return getStateElement(); 979 case 2011152728: return getPostalCodeElement(); 980 case 957831062: return getCountryElement(); 981 case -991726143: return getPeriod(); 982 default: return super.makeProperty(hash, name); 983 } 984 985 } 986 987 @Override 988 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 989 switch (hash) { 990 case 116103: /*use*/ return new String[] {"code"}; 991 case 3575610: /*type*/ return new String[] {"code"}; 992 case 3556653: /*text*/ return new String[] {"string"}; 993 case 3321844: /*line*/ return new String[] {"string"}; 994 case 3053931: /*city*/ return new String[] {"string"}; 995 case 288961422: /*district*/ return new String[] {"string"}; 996 case 109757585: /*state*/ return new String[] {"string"}; 997 case 2011152728: /*postalCode*/ return new String[] {"string"}; 998 case 957831062: /*country*/ return new String[] {"string"}; 999 case -991726143: /*period*/ return new String[] {"Period"}; 1000 default: return super.getTypesForProperty(hash, name); 1001 } 1002 1003 } 1004 1005 @Override 1006 public Base addChild(String name) throws FHIRException { 1007 if (name.equals("use")) { 1008 throw new FHIRException("Cannot call addChild on a singleton property Address.use"); 1009 } 1010 else if (name.equals("type")) { 1011 throw new FHIRException("Cannot call addChild on a singleton property Address.type"); 1012 } 1013 else if (name.equals("text")) { 1014 throw new FHIRException("Cannot call addChild on a singleton property Address.text"); 1015 } 1016 else if (name.equals("line")) { 1017 throw new FHIRException("Cannot call addChild on a singleton property Address.line"); 1018 } 1019 else if (name.equals("city")) { 1020 throw new FHIRException("Cannot call addChild on a singleton property Address.city"); 1021 } 1022 else if (name.equals("district")) { 1023 throw new FHIRException("Cannot call addChild on a singleton property Address.district"); 1024 } 1025 else if (name.equals("state")) { 1026 throw new FHIRException("Cannot call addChild on a singleton property Address.state"); 1027 } 1028 else if (name.equals("postalCode")) { 1029 throw new FHIRException("Cannot call addChild on a singleton property Address.postalCode"); 1030 } 1031 else if (name.equals("country")) { 1032 throw new FHIRException("Cannot call addChild on a singleton property Address.country"); 1033 } 1034 else if (name.equals("period")) { 1035 this.period = new Period(); 1036 return this.period; 1037 } 1038 else 1039 return super.addChild(name); 1040 } 1041 1042 public String fhirType() { 1043 return "Address"; 1044 1045 } 1046 1047 public Address copy() { 1048 Address dst = new Address(); 1049 copyValues(dst); 1050 dst.use = use == null ? null : use.copy(); 1051 dst.type = type == null ? null : type.copy(); 1052 dst.text = text == null ? null : text.copy(); 1053 if (line != null) { 1054 dst.line = new ArrayList<StringType>(); 1055 for (StringType i : line) 1056 dst.line.add(i.copy()); 1057 }; 1058 dst.city = city == null ? null : city.copy(); 1059 dst.district = district == null ? null : district.copy(); 1060 dst.state = state == null ? null : state.copy(); 1061 dst.postalCode = postalCode == null ? null : postalCode.copy(); 1062 dst.country = country == null ? null : country.copy(); 1063 dst.period = period == null ? null : period.copy(); 1064 return dst; 1065 } 1066 1067 protected Address typedCopy() { 1068 return copy(); 1069 } 1070 1071 @Override 1072 public boolean equalsDeep(Base other_) { 1073 if (!super.equalsDeep(other_)) 1074 return false; 1075 if (!(other_ instanceof Address)) 1076 return false; 1077 Address o = (Address) other_; 1078 return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true) 1079 && compareDeep(line, o.line, true) && compareDeep(city, o.city, true) && compareDeep(district, o.district, true) 1080 && compareDeep(state, o.state, true) && compareDeep(postalCode, o.postalCode, true) && compareDeep(country, o.country, true) 1081 && compareDeep(period, o.period, true); 1082 } 1083 1084 @Override 1085 public boolean equalsShallow(Base other_) { 1086 if (!super.equalsShallow(other_)) 1087 return false; 1088 if (!(other_ instanceof Address)) 1089 return false; 1090 Address o = (Address) other_; 1091 return compareValues(use, o.use, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true) 1092 && compareValues(line, o.line, true) && compareValues(city, o.city, true) && compareValues(district, o.district, true) 1093 && compareValues(state, o.state, true) && compareValues(postalCode, o.postalCode, true) && compareValues(country, o.country, true) 1094 ; 1095 } 1096 1097 public boolean isEmpty() { 1098 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, type, text, line 1099 , city, district, state, postalCode, country, period); 1100 } 1101 1102 1103}