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