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