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