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.List; 037 038import ca.uhn.fhir.model.api.annotation.Child; 039import ca.uhn.fhir.model.api.annotation.DatatypeDef; 040import ca.uhn.fhir.model.api.annotation.Description; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import org.hl7.fhir.exceptions.FHIRException; 043import org.hl7.fhir.utilities.Utilities; 044/** 045 * Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, etc. 046 */ 047@DatatypeDef(name="ContactPoint") 048public class ContactPoint extends Type implements ICompositeType { 049 050 public enum ContactPointSystem { 051 /** 052 * The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required. 053 */ 054 PHONE, 055 /** 056 * The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required. 057 */ 058 FAX, 059 /** 060 * The value is an email address. 061 */ 062 EMAIL, 063 /** 064 * The value is a pager number. These may be local pager numbers that are only usable on a particular pager system. 065 */ 066 PAGER, 067 /** 068 * A contact that is not a phone, fax, or email address. The format of the value SHOULD be a URL. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses. If this is not a URL, then it will require human interpretation. 069 */ 070 OTHER, 071 /** 072 * added to help the parsers 073 */ 074 NULL; 075 public static ContactPointSystem fromCode(String codeString) throws FHIRException { 076 if (codeString == null || "".equals(codeString)) 077 return null; 078 if ("phone".equals(codeString)) 079 return PHONE; 080 if ("fax".equals(codeString)) 081 return FAX; 082 if ("email".equals(codeString)) 083 return EMAIL; 084 if ("pager".equals(codeString)) 085 return PAGER; 086 if ("other".equals(codeString)) 087 return OTHER; 088 throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'"); 089 } 090 public String toCode() { 091 switch (this) { 092 case PHONE: return "phone"; 093 case FAX: return "fax"; 094 case EMAIL: return "email"; 095 case PAGER: return "pager"; 096 case OTHER: return "other"; 097 default: return "?"; 098 } 099 } 100 public String getSystem() { 101 switch (this) { 102 case PHONE: return "http://hl7.org/fhir/contact-point-system"; 103 case FAX: return "http://hl7.org/fhir/contact-point-system"; 104 case EMAIL: return "http://hl7.org/fhir/contact-point-system"; 105 case PAGER: return "http://hl7.org/fhir/contact-point-system"; 106 case OTHER: return "http://hl7.org/fhir/contact-point-system"; 107 default: return "?"; 108 } 109 } 110 public String getDefinition() { 111 switch (this) { 112 case PHONE: return "The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required."; 113 case FAX: return "The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required."; 114 case EMAIL: return "The value is an email address."; 115 case PAGER: return "The value is a pager number. These may be local pager numbers that are only usable on a particular pager system."; 116 case OTHER: return "A contact that is not a phone, fax, or email address. The format of the value SHOULD be a URL. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses. If this is not a URL, then it will require human interpretation."; 117 default: return "?"; 118 } 119 } 120 public String getDisplay() { 121 switch (this) { 122 case PHONE: return "Phone"; 123 case FAX: return "Fax"; 124 case EMAIL: return "Email"; 125 case PAGER: return "Pager"; 126 case OTHER: return "URL"; 127 default: return "?"; 128 } 129 } 130 } 131 132 public static class ContactPointSystemEnumFactory implements EnumFactory<ContactPointSystem> { 133 public ContactPointSystem fromCode(String codeString) throws IllegalArgumentException { 134 if (codeString == null || "".equals(codeString)) 135 if (codeString == null || "".equals(codeString)) 136 return null; 137 if ("phone".equals(codeString)) 138 return ContactPointSystem.PHONE; 139 if ("fax".equals(codeString)) 140 return ContactPointSystem.FAX; 141 if ("email".equals(codeString)) 142 return ContactPointSystem.EMAIL; 143 if ("pager".equals(codeString)) 144 return ContactPointSystem.PAGER; 145 if ("other".equals(codeString)) 146 return ContactPointSystem.OTHER; 147 throw new IllegalArgumentException("Unknown ContactPointSystem code '"+codeString+"'"); 148 } 149 public Enumeration<ContactPointSystem> fromType(Base code) throws FHIRException { 150 if (code == null || code.isEmpty()) 151 return null; 152 String codeString = ((PrimitiveType) code).asStringValue(); 153 if (codeString == null || "".equals(codeString)) 154 return null; 155 if ("phone".equals(codeString)) 156 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PHONE); 157 if ("fax".equals(codeString)) 158 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.FAX); 159 if ("email".equals(codeString)) 160 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.EMAIL); 161 if ("pager".equals(codeString)) 162 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PAGER); 163 if ("other".equals(codeString)) 164 return new Enumeration<ContactPointSystem>(this, ContactPointSystem.OTHER); 165 throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'"); 166 } 167 public String toCode(ContactPointSystem code) { 168 if (code == ContactPointSystem.PHONE) 169 return "phone"; 170 if (code == ContactPointSystem.FAX) 171 return "fax"; 172 if (code == ContactPointSystem.EMAIL) 173 return "email"; 174 if (code == ContactPointSystem.PAGER) 175 return "pager"; 176 if (code == ContactPointSystem.OTHER) 177 return "other"; 178 return "?"; 179 } 180 } 181 182 public enum ContactPointUse { 183 /** 184 * A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available. 185 */ 186 HOME, 187 /** 188 * An office contact point. First choice for business related contacts during business hours. 189 */ 190 WORK, 191 /** 192 * A temporary contact point. The period can provide more detailed information. 193 */ 194 TEMP, 195 /** 196 * This contact point is no longer in use (or was never correct, but retained for records). 197 */ 198 OLD, 199 /** 200 * A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business. 201 */ 202 MOBILE, 203 /** 204 * added to help the parsers 205 */ 206 NULL; 207 public static ContactPointUse 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 ("mobile".equals(codeString)) 219 return MOBILE; 220 throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'"); 221 } 222 public String toCode() { 223 switch (this) { 224 case HOME: return "home"; 225 case WORK: return "work"; 226 case TEMP: return "temp"; 227 case OLD: return "old"; 228 case MOBILE: return "mobile"; 229 default: return "?"; 230 } 231 } 232 public String getSystem() { 233 switch (this) { 234 case HOME: return "http://hl7.org/fhir/contact-point-use"; 235 case WORK: return "http://hl7.org/fhir/contact-point-use"; 236 case TEMP: return "http://hl7.org/fhir/contact-point-use"; 237 case OLD: return "http://hl7.org/fhir/contact-point-use"; 238 case MOBILE: return "http://hl7.org/fhir/contact-point-use"; 239 default: return "?"; 240 } 241 } 242 public String getDefinition() { 243 switch (this) { 244 case HOME: return "A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available."; 245 case WORK: return "An office contact point. First choice for business related contacts during business hours."; 246 case TEMP: return "A temporary contact point. The period can provide more detailed information."; 247 case OLD: return "This contact point is no longer in use (or was never correct, but retained for records)."; 248 case MOBILE: return "A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business."; 249 default: return "?"; 250 } 251 } 252 public String getDisplay() { 253 switch (this) { 254 case HOME: return "Home"; 255 case WORK: return "Work"; 256 case TEMP: return "Temp"; 257 case OLD: return "Old"; 258 case MOBILE: return "Mobile"; 259 default: return "?"; 260 } 261 } 262 } 263 264 public static class ContactPointUseEnumFactory implements EnumFactory<ContactPointUse> { 265 public ContactPointUse fromCode(String codeString) throws IllegalArgumentException { 266 if (codeString == null || "".equals(codeString)) 267 if (codeString == null || "".equals(codeString)) 268 return null; 269 if ("home".equals(codeString)) 270 return ContactPointUse.HOME; 271 if ("work".equals(codeString)) 272 return ContactPointUse.WORK; 273 if ("temp".equals(codeString)) 274 return ContactPointUse.TEMP; 275 if ("old".equals(codeString)) 276 return ContactPointUse.OLD; 277 if ("mobile".equals(codeString)) 278 return ContactPointUse.MOBILE; 279 throw new IllegalArgumentException("Unknown ContactPointUse code '"+codeString+"'"); 280 } 281 public Enumeration<ContactPointUse> fromType(Base code) throws FHIRException { 282 if (code == null || code.isEmpty()) 283 return null; 284 String codeString = ((PrimitiveType) code).asStringValue(); 285 if (codeString == null || "".equals(codeString)) 286 return null; 287 if ("home".equals(codeString)) 288 return new Enumeration<ContactPointUse>(this, ContactPointUse.HOME); 289 if ("work".equals(codeString)) 290 return new Enumeration<ContactPointUse>(this, ContactPointUse.WORK); 291 if ("temp".equals(codeString)) 292 return new Enumeration<ContactPointUse>(this, ContactPointUse.TEMP); 293 if ("old".equals(codeString)) 294 return new Enumeration<ContactPointUse>(this, ContactPointUse.OLD); 295 if ("mobile".equals(codeString)) 296 return new Enumeration<ContactPointUse>(this, ContactPointUse.MOBILE); 297 throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'"); 298 } 299 public String toCode(ContactPointUse code) { 300 if (code == ContactPointUse.HOME) 301 return "home"; 302 if (code == ContactPointUse.WORK) 303 return "work"; 304 if (code == ContactPointUse.TEMP) 305 return "temp"; 306 if (code == ContactPointUse.OLD) 307 return "old"; 308 if (code == ContactPointUse.MOBILE) 309 return "mobile"; 310 return "?"; 311 } 312 } 313 314 /** 315 * Telecommunications form for contact point - what communications system is required to make use of the contact. 316 */ 317 @Child(name = "system", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true) 318 @Description(shortDefinition="phone | fax | email | pager | other", formalDefinition="Telecommunications form for contact point - what communications system is required to make use of the contact." ) 319 protected Enumeration<ContactPointSystem> system; 320 321 /** 322 * The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address). 323 */ 324 @Child(name = "value", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 325 @Description(shortDefinition="The actual contact point details", formalDefinition="The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address)." ) 326 protected StringType value; 327 328 /** 329 * Identifies the purpose for the contact point. 330 */ 331 @Child(name = "use", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true) 332 @Description(shortDefinition="home | work | temp | old | mobile - purpose of this contact point", formalDefinition="Identifies the purpose for the contact point." ) 333 protected Enumeration<ContactPointUse> use; 334 335 /** 336 * Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 337 */ 338 @Child(name = "rank", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true) 339 @Description(shortDefinition="Specify preferred order of use (1 = highest)", formalDefinition="Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values." ) 340 protected PositiveIntType rank; 341 342 /** 343 * Time period when the contact point was/is in use. 344 */ 345 @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true) 346 @Description(shortDefinition="Time period when the contact point was/is in use", formalDefinition="Time period when the contact point was/is in use." ) 347 protected Period period; 348 349 private static final long serialVersionUID = 1509610874L; 350 351 /* 352 * Constructor 353 */ 354 public ContactPoint() { 355 super(); 356 } 357 358 /** 359 * @return {@link #system} (Telecommunications form for contact point - what communications system is required to make use of the contact.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 360 */ 361 public Enumeration<ContactPointSystem> getSystemElement() { 362 if (this.system == null) 363 if (Configuration.errorOnAutoCreate()) 364 throw new Error("Attempt to auto-create ContactPoint.system"); 365 else if (Configuration.doAutoCreate()) 366 this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory()); // bb 367 return this.system; 368 } 369 370 public boolean hasSystemElement() { 371 return this.system != null && !this.system.isEmpty(); 372 } 373 374 public boolean hasSystem() { 375 return this.system != null && !this.system.isEmpty(); 376 } 377 378 /** 379 * @param value {@link #system} (Telecommunications form for contact point - what communications system is required to make use of the contact.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 380 */ 381 public ContactPoint setSystemElement(Enumeration<ContactPointSystem> value) { 382 this.system = value; 383 return this; 384 } 385 386 /** 387 * @return Telecommunications form for contact point - what communications system is required to make use of the contact. 388 */ 389 public ContactPointSystem getSystem() { 390 return this.system == null ? null : this.system.getValue(); 391 } 392 393 /** 394 * @param value Telecommunications form for contact point - what communications system is required to make use of the contact. 395 */ 396 public ContactPoint setSystem(ContactPointSystem value) { 397 if (value == null) 398 this.system = null; 399 else { 400 if (this.system == null) 401 this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory()); 402 this.system.setValue(value); 403 } 404 return this; 405 } 406 407 /** 408 * @return {@link #value} (The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 409 */ 410 public StringType getValueElement() { 411 if (this.value == null) 412 if (Configuration.errorOnAutoCreate()) 413 throw new Error("Attempt to auto-create ContactPoint.value"); 414 else if (Configuration.doAutoCreate()) 415 this.value = new StringType(); // bb 416 return this.value; 417 } 418 419 public boolean hasValueElement() { 420 return this.value != null && !this.value.isEmpty(); 421 } 422 423 public boolean hasValue() { 424 return this.value != null && !this.value.isEmpty(); 425 } 426 427 /** 428 * @param value {@link #value} (The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 429 */ 430 public ContactPoint setValueElement(StringType value) { 431 this.value = value; 432 return this; 433 } 434 435 /** 436 * @return The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address). 437 */ 438 public String getValue() { 439 return this.value == null ? null : this.value.getValue(); 440 } 441 442 /** 443 * @param value The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address). 444 */ 445 public ContactPoint setValue(String value) { 446 if (Utilities.noString(value)) 447 this.value = null; 448 else { 449 if (this.value == null) 450 this.value = new StringType(); 451 this.value.setValue(value); 452 } 453 return this; 454 } 455 456 /** 457 * @return {@link #use} (Identifies the purpose for the contact point.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 458 */ 459 public Enumeration<ContactPointUse> getUseElement() { 460 if (this.use == null) 461 if (Configuration.errorOnAutoCreate()) 462 throw new Error("Attempt to auto-create ContactPoint.use"); 463 else if (Configuration.doAutoCreate()) 464 this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory()); // bb 465 return this.use; 466 } 467 468 public boolean hasUseElement() { 469 return this.use != null && !this.use.isEmpty(); 470 } 471 472 public boolean hasUse() { 473 return this.use != null && !this.use.isEmpty(); 474 } 475 476 /** 477 * @param value {@link #use} (Identifies the purpose for the contact point.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 478 */ 479 public ContactPoint setUseElement(Enumeration<ContactPointUse> value) { 480 this.use = value; 481 return this; 482 } 483 484 /** 485 * @return Identifies the purpose for the contact point. 486 */ 487 public ContactPointUse getUse() { 488 return this.use == null ? null : this.use.getValue(); 489 } 490 491 /** 492 * @param value Identifies the purpose for the contact point. 493 */ 494 public ContactPoint setUse(ContactPointUse value) { 495 if (value == null) 496 this.use = null; 497 else { 498 if (this.use == null) 499 this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory()); 500 this.use.setValue(value); 501 } 502 return this; 503 } 504 505 /** 506 * @return {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value 507 */ 508 public PositiveIntType getRankElement() { 509 if (this.rank == null) 510 if (Configuration.errorOnAutoCreate()) 511 throw new Error("Attempt to auto-create ContactPoint.rank"); 512 else if (Configuration.doAutoCreate()) 513 this.rank = new PositiveIntType(); // bb 514 return this.rank; 515 } 516 517 public boolean hasRankElement() { 518 return this.rank != null && !this.rank.isEmpty(); 519 } 520 521 public boolean hasRank() { 522 return this.rank != null && !this.rank.isEmpty(); 523 } 524 525 /** 526 * @param value {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value 527 */ 528 public ContactPoint setRankElement(PositiveIntType value) { 529 this.rank = value; 530 return this; 531 } 532 533 /** 534 * @return Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 535 */ 536 public int getRank() { 537 return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue(); 538 } 539 540 /** 541 * @param value Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values. 542 */ 543 public ContactPoint setRank(int value) { 544 if (this.rank == null) 545 this.rank = new PositiveIntType(); 546 this.rank.setValue(value); 547 return this; 548 } 549 550 /** 551 * @return {@link #period} (Time period when the contact point was/is in use.) 552 */ 553 public Period getPeriod() { 554 if (this.period == null) 555 if (Configuration.errorOnAutoCreate()) 556 throw new Error("Attempt to auto-create ContactPoint.period"); 557 else if (Configuration.doAutoCreate()) 558 this.period = new Period(); // cc 559 return this.period; 560 } 561 562 public boolean hasPeriod() { 563 return this.period != null && !this.period.isEmpty(); 564 } 565 566 /** 567 * @param value {@link #period} (Time period when the contact point was/is in use.) 568 */ 569 public ContactPoint setPeriod(Period value) { 570 this.period = value; 571 return this; 572 } 573 574 protected void listChildren(List<Property> childrenList) { 575 super.listChildren(childrenList); 576 childrenList.add(new Property("system", "code", "Telecommunications form for contact point - what communications system is required to make use of the contact.", 0, java.lang.Integer.MAX_VALUE, system)); 577 childrenList.add(new Property("value", "string", "The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).", 0, java.lang.Integer.MAX_VALUE, value)); 578 childrenList.add(new Property("use", "code", "Identifies the purpose for the contact point.", 0, java.lang.Integer.MAX_VALUE, use)); 579 childrenList.add(new Property("rank", "positiveInt", "Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.", 0, java.lang.Integer.MAX_VALUE, rank)); 580 childrenList.add(new Property("period", "Period", "Time period when the contact point was/is in use.", 0, java.lang.Integer.MAX_VALUE, period)); 581 } 582 583 @Override 584 public void setProperty(String name, Base value) throws FHIRException { 585 if (name.equals("system")) 586 this.system = new ContactPointSystemEnumFactory().fromType(value); // Enumeration<ContactPointSystem> 587 else if (name.equals("value")) 588 this.value = castToString(value); // StringType 589 else if (name.equals("use")) 590 this.use = new ContactPointUseEnumFactory().fromType(value); // Enumeration<ContactPointUse> 591 else if (name.equals("rank")) 592 this.rank = castToPositiveInt(value); // PositiveIntType 593 else if (name.equals("period")) 594 this.period = castToPeriod(value); // Period 595 else 596 super.setProperty(name, value); 597 } 598 599 @Override 600 public Base addChild(String name) throws FHIRException { 601 if (name.equals("system")) { 602 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.system"); 603 } 604 else if (name.equals("value")) { 605 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.value"); 606 } 607 else if (name.equals("use")) { 608 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.use"); 609 } 610 else if (name.equals("rank")) { 611 throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.rank"); 612 } 613 else if (name.equals("period")) { 614 this.period = new Period(); 615 return this.period; 616 } 617 else 618 return super.addChild(name); 619 } 620 621 public String fhirType() { 622 return "ContactPoint"; 623 624 } 625 626 public ContactPoint copy() { 627 ContactPoint dst = new ContactPoint(); 628 copyValues(dst); 629 dst.system = system == null ? null : system.copy(); 630 dst.value = value == null ? null : value.copy(); 631 dst.use = use == null ? null : use.copy(); 632 dst.rank = rank == null ? null : rank.copy(); 633 dst.period = period == null ? null : period.copy(); 634 return dst; 635 } 636 637 protected ContactPoint typedCopy() { 638 return copy(); 639 } 640 641 @Override 642 public boolean equalsDeep(Base other) { 643 if (!super.equalsDeep(other)) 644 return false; 645 if (!(other instanceof ContactPoint)) 646 return false; 647 ContactPoint o = (ContactPoint) other; 648 return compareDeep(system, o.system, true) && compareDeep(value, o.value, true) && compareDeep(use, o.use, true) 649 && compareDeep(rank, o.rank, true) && compareDeep(period, o.period, true); 650 } 651 652 @Override 653 public boolean equalsShallow(Base other) { 654 if (!super.equalsShallow(other)) 655 return false; 656 if (!(other instanceof ContactPoint)) 657 return false; 658 ContactPoint o = (ContactPoint) other; 659 return compareValues(system, o.system, true) && compareValues(value, o.value, true) && compareValues(use, o.use, true) 660 && compareValues(rank, o.rank, true); 661 } 662 663 public boolean isEmpty() { 664 return super.isEmpty() && (system == null || system.isEmpty()) && (value == null || value.isEmpty()) 665 && (use == null || use.isEmpty()) && (rank == null || rank.isEmpty()) && (period == null || period.isEmpty()) 666 ; 667 } 668 669 670}