001package org.hl7.fhir.r5.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.r5 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023/* 024 Copyright (c) 2011+, HL7, Inc. 025 All rights reserved. 026 027 Redistribution and use in source and binary forms, with or without modification, 028 are permitted provided that the following conditions are met: 029 030 * Redistributions of source code must retain the above copyright notice, this 031 list of conditions and the following disclaimer. 032 * Redistributions in binary form must reproduce the above copyright notice, 033 this list of conditions and the following disclaimer in the documentation 034 and/or other materials provided with the distribution. 035 * Neither the name of HL7 nor the names of its contributors may be used to 036 endorse or promote products derived from this software without specific 037 prior written permission. 038 039 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 040 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 041 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 042 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 043 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 044 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 045 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 046 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 047 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 048 POSSIBILITY OF SUCH DAMAGE. 049 050*/ 051 052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0 053import java.util.ArrayList; 054import java.util.Date; 055import java.util.List; 056import org.hl7.fhir.exceptions.FHIRException; 057import org.hl7.fhir.instance.model.api.ICompositeType; 058 059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement; 060import org.hl7.fhir.utilities.Utilities; 061import org.hl7.fhir.r5.model.Enumerations.*; 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 * An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers. 069 */ 070@DatatypeDef(name="Identifier") 071public class Identifier extends Type implements ICompositeType { 072 073 public enum IdentifierUse { 074 /** 075 * The identifier recommended for display and use in real-world interactions. 076 */ 077 USUAL, 078 /** 079 * The identifier considered to be most trusted for the identification of this item. Sometimes also known as "primary" and "main". The determination of "official" is subjective and implementation guides often provide additional guidelines for use. 080 */ 081 OFFICIAL, 082 /** 083 * A temporary identifier. 084 */ 085 TEMP, 086 /** 087 * An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context. 088 */ 089 SECONDARY, 090 /** 091 * The identifier id no longer considered valid, but may be relevant for search purposes. E.g. Changes to identifier schemes, account merges, etc. 092 */ 093 OLD, 094 /** 095 * added to help the parsers with the generic types 096 */ 097 NULL; 098 public static IdentifierUse fromCode(String codeString) throws FHIRException { 099 if (codeString == null || "".equals(codeString)) 100 return null; 101 if ("usual".equals(codeString)) 102 return USUAL; 103 if ("official".equals(codeString)) 104 return OFFICIAL; 105 if ("temp".equals(codeString)) 106 return TEMP; 107 if ("secondary".equals(codeString)) 108 return SECONDARY; 109 if ("old".equals(codeString)) 110 return OLD; 111 if (Configuration.isAcceptInvalidEnums()) 112 return null; 113 else 114 throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'"); 115 } 116 public String toCode() { 117 switch (this) { 118 case USUAL: return "usual"; 119 case OFFICIAL: return "official"; 120 case TEMP: return "temp"; 121 case SECONDARY: return "secondary"; 122 case OLD: return "old"; 123 default: return "?"; 124 } 125 } 126 public String getSystem() { 127 switch (this) { 128 case USUAL: return "http://hl7.org/fhir/identifier-use"; 129 case OFFICIAL: return "http://hl7.org/fhir/identifier-use"; 130 case TEMP: return "http://hl7.org/fhir/identifier-use"; 131 case SECONDARY: return "http://hl7.org/fhir/identifier-use"; 132 case OLD: return "http://hl7.org/fhir/identifier-use"; 133 default: return "?"; 134 } 135 } 136 public String getDefinition() { 137 switch (this) { 138 case USUAL: return "The identifier recommended for display and use in real-world interactions."; 139 case OFFICIAL: return "The identifier considered to be most trusted for the identification of this item. Sometimes also known as \"primary\" and \"main\". The determination of \"official\" is subjective and implementation guides often provide additional guidelines for use."; 140 case TEMP: return "A temporary identifier."; 141 case SECONDARY: return "An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context."; 142 case OLD: return "The identifier id no longer considered valid, but may be relevant for search purposes. E.g. Changes to identifier schemes, account merges, etc."; 143 default: return "?"; 144 } 145 } 146 public String getDisplay() { 147 switch (this) { 148 case USUAL: return "Usual"; 149 case OFFICIAL: return "Official"; 150 case TEMP: return "Temp"; 151 case SECONDARY: return "Secondary"; 152 case OLD: return "Old"; 153 default: return "?"; 154 } 155 } 156 } 157 158 public static class IdentifierUseEnumFactory implements EnumFactory<IdentifierUse> { 159 public IdentifierUse fromCode(String codeString) throws IllegalArgumentException { 160 if (codeString == null || "".equals(codeString)) 161 if (codeString == null || "".equals(codeString)) 162 return null; 163 if ("usual".equals(codeString)) 164 return IdentifierUse.USUAL; 165 if ("official".equals(codeString)) 166 return IdentifierUse.OFFICIAL; 167 if ("temp".equals(codeString)) 168 return IdentifierUse.TEMP; 169 if ("secondary".equals(codeString)) 170 return IdentifierUse.SECONDARY; 171 if ("old".equals(codeString)) 172 return IdentifierUse.OLD; 173 throw new IllegalArgumentException("Unknown IdentifierUse code '"+codeString+"'"); 174 } 175 public Enumeration<IdentifierUse> fromType(Base code) throws FHIRException { 176 if (code == null) 177 return null; 178 if (code.isEmpty()) 179 return new Enumeration<IdentifierUse>(this); 180 String codeString = ((PrimitiveType) code).asStringValue(); 181 if (codeString == null || "".equals(codeString)) 182 return null; 183 if ("usual".equals(codeString)) 184 return new Enumeration<IdentifierUse>(this, IdentifierUse.USUAL); 185 if ("official".equals(codeString)) 186 return new Enumeration<IdentifierUse>(this, IdentifierUse.OFFICIAL); 187 if ("temp".equals(codeString)) 188 return new Enumeration<IdentifierUse>(this, IdentifierUse.TEMP); 189 if ("secondary".equals(codeString)) 190 return new Enumeration<IdentifierUse>(this, IdentifierUse.SECONDARY); 191 if ("old".equals(codeString)) 192 return new Enumeration<IdentifierUse>(this, IdentifierUse.OLD); 193 throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'"); 194 } 195 public String toCode(IdentifierUse code) { 196 if (code == IdentifierUse.USUAL) 197 return "usual"; 198 if (code == IdentifierUse.OFFICIAL) 199 return "official"; 200 if (code == IdentifierUse.TEMP) 201 return "temp"; 202 if (code == IdentifierUse.SECONDARY) 203 return "secondary"; 204 if (code == IdentifierUse.OLD) 205 return "old"; 206 return "?"; 207 } 208 public String toSystem(IdentifierUse code) { 209 return code.getSystem(); 210 } 211 } 212 213 /** 214 * The purpose of this identifier. 215 */ 216 @Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true) 217 @Description(shortDefinition="usual | official | temp | secondary | old (If known)", formalDefinition="The purpose of this identifier." ) 218 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/identifier-use") 219 protected Enumeration<IdentifierUse> use; 220 221 /** 222 * A coded type for the identifier that can be used to determine which identifier to use for a specific purpose. 223 */ 224 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 225 @Description(shortDefinition="Description of identifier", formalDefinition="A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." ) 226 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/identifier-type") 227 protected CodeableConcept type; 228 229 /** 230 * Establishes the namespace for the value - that is, a URL that describes a set values that are unique. 231 */ 232 @Child(name = "system", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true) 233 @Description(shortDefinition="The namespace for the identifier value", formalDefinition="Establishes the namespace for the value - that is, a URL that describes a set values that are unique." ) 234 protected UriType system; 235 236 /** 237 * The portion of the identifier typically relevant to the user and which is unique within the context of the system. 238 */ 239 @Child(name = "value", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 240 @Description(shortDefinition="The value that is unique", formalDefinition="The portion of the identifier typically relevant to the user and which is unique within the context of the system." ) 241 protected StringType value; 242 243 /** 244 * Time period during which identifier is/was valid for use. 245 */ 246 @Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true) 247 @Description(shortDefinition="Time period when id is/was valid for use", formalDefinition="Time period during which identifier is/was valid for use." ) 248 protected Period period; 249 250 /** 251 * Organization that issued/manages the identifier. 252 */ 253 @Child(name = "assigner", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true) 254 @Description(shortDefinition="Organization that issued id (may be just text)", formalDefinition="Organization that issued/manages the identifier." ) 255 protected Reference assigner; 256 257 private static final long serialVersionUID = 2098433371L; 258 259 /** 260 * Constructor 261 */ 262 public Identifier() { 263 super(); 264 } 265 266 /** 267 * @return {@link #use} (The purpose of this identifier.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 268 */ 269 public Enumeration<IdentifierUse> getUseElement() { 270 if (this.use == null) 271 if (Configuration.errorOnAutoCreate()) 272 throw new Error("Attempt to auto-create Identifier.use"); 273 else if (Configuration.doAutoCreate()) 274 this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); // bb 275 return this.use; 276 } 277 278 public boolean hasUseElement() { 279 return this.use != null && !this.use.isEmpty(); 280 } 281 282 public boolean hasUse() { 283 return this.use != null && !this.use.isEmpty(); 284 } 285 286 /** 287 * @param value {@link #use} (The purpose of this identifier.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 288 */ 289 public Identifier setUseElement(Enumeration<IdentifierUse> value) { 290 this.use = value; 291 return this; 292 } 293 294 /** 295 * @return The purpose of this identifier. 296 */ 297 public IdentifierUse getUse() { 298 return this.use == null ? null : this.use.getValue(); 299 } 300 301 /** 302 * @param value The purpose of this identifier. 303 */ 304 public Identifier setUse(IdentifierUse value) { 305 if (value == null) 306 this.use = null; 307 else { 308 if (this.use == null) 309 this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); 310 this.use.setValue(value); 311 } 312 return this; 313 } 314 315 /** 316 * @return {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.) 317 */ 318 public CodeableConcept getType() { 319 if (this.type == null) 320 if (Configuration.errorOnAutoCreate()) 321 throw new Error("Attempt to auto-create Identifier.type"); 322 else if (Configuration.doAutoCreate()) 323 this.type = new CodeableConcept(); // cc 324 return this.type; 325 } 326 327 public boolean hasType() { 328 return this.type != null && !this.type.isEmpty(); 329 } 330 331 /** 332 * @param value {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.) 333 */ 334 public Identifier setType(CodeableConcept value) { 335 this.type = value; 336 return this; 337 } 338 339 /** 340 * @return {@link #system} (Establishes the namespace for the value - that is, a URL that describes a set values that are unique.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 341 */ 342 public UriType getSystemElement() { 343 if (this.system == null) 344 if (Configuration.errorOnAutoCreate()) 345 throw new Error("Attempt to auto-create Identifier.system"); 346 else if (Configuration.doAutoCreate()) 347 this.system = new UriType(); // bb 348 return this.system; 349 } 350 351 public boolean hasSystemElement() { 352 return this.system != null && !this.system.isEmpty(); 353 } 354 355 public boolean hasSystem() { 356 return this.system != null && !this.system.isEmpty(); 357 } 358 359 /** 360 * @param value {@link #system} (Establishes the namespace for the value - that is, a URL that describes a set values that are unique.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 361 */ 362 public Identifier setSystemElement(UriType value) { 363 this.system = value; 364 return this; 365 } 366 367 /** 368 * @return Establishes the namespace for the value - that is, a URL that describes a set values that are unique. 369 */ 370 public String getSystem() { 371 return this.system == null ? null : this.system.getValue(); 372 } 373 374 /** 375 * @param value Establishes the namespace for the value - that is, a URL that describes a set values that are unique. 376 */ 377 public Identifier setSystem(String value) { 378 if (Utilities.noString(value)) 379 this.system = null; 380 else { 381 if (this.system == null) 382 this.system = new UriType(); 383 this.system.setValue(value); 384 } 385 return this; 386 } 387 388 /** 389 * @return {@link #value} (The portion of the identifier typically relevant to the user and which is unique within the context of the system.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 390 */ 391 public StringType getValueElement() { 392 if (this.value == null) 393 if (Configuration.errorOnAutoCreate()) 394 throw new Error("Attempt to auto-create Identifier.value"); 395 else if (Configuration.doAutoCreate()) 396 this.value = new StringType(); // bb 397 return this.value; 398 } 399 400 public boolean hasValueElement() { 401 return this.value != null && !this.value.isEmpty(); 402 } 403 404 public boolean hasValue() { 405 return this.value != null && !this.value.isEmpty(); 406 } 407 408 /** 409 * @param value {@link #value} (The portion of the identifier typically relevant to the user and which is unique within the context of the system.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 410 */ 411 public Identifier setValueElement(StringType value) { 412 this.value = value; 413 return this; 414 } 415 416 /** 417 * @return The portion of the identifier typically relevant to the user and which is unique within the context of the system. 418 */ 419 public String getValue() { 420 return this.value == null ? null : this.value.getValue(); 421 } 422 423 /** 424 * @param value The portion of the identifier typically relevant to the user and which is unique within the context of the system. 425 */ 426 public Identifier setValue(String value) { 427 if (Utilities.noString(value)) 428 this.value = null; 429 else { 430 if (this.value == null) 431 this.value = new StringType(); 432 this.value.setValue(value); 433 } 434 return this; 435 } 436 437 /** 438 * @return {@link #period} (Time period during which identifier is/was valid for use.) 439 */ 440 public Period getPeriod() { 441 if (this.period == null) 442 if (Configuration.errorOnAutoCreate()) 443 throw new Error("Attempt to auto-create Identifier.period"); 444 else if (Configuration.doAutoCreate()) 445 this.period = new Period(); // cc 446 return this.period; 447 } 448 449 public boolean hasPeriod() { 450 return this.period != null && !this.period.isEmpty(); 451 } 452 453 /** 454 * @param value {@link #period} (Time period during which identifier is/was valid for use.) 455 */ 456 public Identifier setPeriod(Period value) { 457 this.period = value; 458 return this; 459 } 460 461 /** 462 * @return {@link #assigner} (Organization that issued/manages the identifier.) 463 */ 464 public Reference getAssigner() { 465 if (this.assigner == null) 466 if (Configuration.errorOnAutoCreate()) 467 throw new Error("Attempt to auto-create Identifier.assigner"); 468 else if (Configuration.doAutoCreate()) 469 this.assigner = new Reference(); // cc 470 return this.assigner; 471 } 472 473 public boolean hasAssigner() { 474 return this.assigner != null && !this.assigner.isEmpty(); 475 } 476 477 /** 478 * @param value {@link #assigner} (Organization that issued/manages the identifier.) 479 */ 480 public Identifier setAssigner(Reference value) { 481 this.assigner = value; 482 return this; 483 } 484 485 protected void listChildren(List<Property> children) { 486 super.listChildren(children); 487 children.add(new Property("use", "code", "The purpose of this identifier.", 0, 1, use)); 488 children.add(new Property("type", "CodeableConcept", "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.", 0, 1, type)); 489 children.add(new Property("system", "uri", "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.", 0, 1, system)); 490 children.add(new Property("value", "string", "The portion of the identifier typically relevant to the user and which is unique within the context of the system.", 0, 1, value)); 491 children.add(new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period)); 492 children.add(new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner)); 493 } 494 495 @Override 496 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 497 switch (_hash) { 498 case 116103: /*use*/ return new Property("use", "code", "The purpose of this identifier.", 0, 1, use); 499 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.", 0, 1, type); 500 case -887328209: /*system*/ return new Property("system", "uri", "Establishes the namespace for the value - that is, a URL that describes a set values that are unique.", 0, 1, system); 501 case 111972721: /*value*/ return new Property("value", "string", "The portion of the identifier typically relevant to the user and which is unique within the context of the system.", 0, 1, value); 502 case -991726143: /*period*/ return new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, 1, period); 503 case -369881636: /*assigner*/ return new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, 1, assigner); 504 default: return super.getNamedProperty(_hash, _name, _checkValid); 505 } 506 507 } 508 509 @Override 510 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 511 switch (hash) { 512 case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<IdentifierUse> 513 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 514 case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType 515 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType 516 case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period 517 case -369881636: /*assigner*/ return this.assigner == null ? new Base[0] : new Base[] {this.assigner}; // Reference 518 default: return super.getProperty(hash, name, checkValid); 519 } 520 521 } 522 523 @Override 524 public Base setProperty(int hash, String name, Base value) throws FHIRException { 525 switch (hash) { 526 case 116103: // use 527 value = new IdentifierUseEnumFactory().fromType(castToCode(value)); 528 this.use = (Enumeration) value; // Enumeration<IdentifierUse> 529 return value; 530 case 3575610: // type 531 this.type = castToCodeableConcept(value); // CodeableConcept 532 return value; 533 case -887328209: // system 534 this.system = castToUri(value); // UriType 535 return value; 536 case 111972721: // value 537 this.value = castToString(value); // StringType 538 return value; 539 case -991726143: // period 540 this.period = castToPeriod(value); // Period 541 return value; 542 case -369881636: // assigner 543 this.assigner = castToReference(value); // Reference 544 return value; 545 default: return super.setProperty(hash, name, value); 546 } 547 548 } 549 550 @Override 551 public Base setProperty(String name, Base value) throws FHIRException { 552 if (name.equals("use")) { 553 value = new IdentifierUseEnumFactory().fromType(castToCode(value)); 554 this.use = (Enumeration) value; // Enumeration<IdentifierUse> 555 } else if (name.equals("type")) { 556 this.type = castToCodeableConcept(value); // CodeableConcept 557 } else if (name.equals("system")) { 558 this.system = castToUri(value); // UriType 559 } else if (name.equals("value")) { 560 this.value = castToString(value); // StringType 561 } else if (name.equals("period")) { 562 this.period = castToPeriod(value); // Period 563 } else if (name.equals("assigner")) { 564 this.assigner = castToReference(value); // Reference 565 } else 566 return super.setProperty(name, value); 567 return value; 568 } 569 570 @Override 571 public Base makeProperty(int hash, String name) throws FHIRException { 572 switch (hash) { 573 case 116103: return getUseElement(); 574 case 3575610: return getType(); 575 case -887328209: return getSystemElement(); 576 case 111972721: return getValueElement(); 577 case -991726143: return getPeriod(); 578 case -369881636: return getAssigner(); 579 default: return super.makeProperty(hash, name); 580 } 581 582 } 583 584 @Override 585 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 586 switch (hash) { 587 case 116103: /*use*/ return new String[] {"code"}; 588 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 589 case -887328209: /*system*/ return new String[] {"uri"}; 590 case 111972721: /*value*/ return new String[] {"string"}; 591 case -991726143: /*period*/ return new String[] {"Period"}; 592 case -369881636: /*assigner*/ return new String[] {"Reference"}; 593 default: return super.getTypesForProperty(hash, name); 594 } 595 596 } 597 598 @Override 599 public Base addChild(String name) throws FHIRException { 600 if (name.equals("use")) { 601 throw new FHIRException("Cannot call addChild on a primitive type Identifier.use"); 602 } 603 else if (name.equals("type")) { 604 this.type = new CodeableConcept(); 605 return this.type; 606 } 607 else if (name.equals("system")) { 608 throw new FHIRException("Cannot call addChild on a primitive type Identifier.system"); 609 } 610 else if (name.equals("value")) { 611 throw new FHIRException("Cannot call addChild on a primitive type Identifier.value"); 612 } 613 else if (name.equals("period")) { 614 this.period = new Period(); 615 return this.period; 616 } 617 else if (name.equals("assigner")) { 618 this.assigner = new Reference(); 619 return this.assigner; 620 } 621 else 622 return super.addChild(name); 623 } 624 625 public String fhirType() { 626 return "Identifier"; 627 628 } 629 630 public Identifier copy() { 631 Identifier dst = new Identifier(); 632 copyValues(dst); 633 return dst; 634 } 635 636 public void copyValues(Identifier dst) { 637 super.copyValues(dst); 638 dst.use = use == null ? null : use.copy(); 639 dst.type = type == null ? null : type.copy(); 640 dst.system = system == null ? null : system.copy(); 641 dst.value = value == null ? null : value.copy(); 642 dst.period = period == null ? null : period.copy(); 643 dst.assigner = assigner == null ? null : assigner.copy(); 644 } 645 646 protected Identifier typedCopy() { 647 return copy(); 648 } 649 650 @Override 651 public boolean equalsDeep(Base other_) { 652 if (!super.equalsDeep(other_)) 653 return false; 654 if (!(other_ instanceof Identifier)) 655 return false; 656 Identifier o = (Identifier) other_; 657 return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(system, o.system, true) 658 && compareDeep(value, o.value, true) && compareDeep(period, o.period, true) && compareDeep(assigner, o.assigner, true) 659 ; 660 } 661 662 @Override 663 public boolean equalsShallow(Base other_) { 664 if (!super.equalsShallow(other_)) 665 return false; 666 if (!(other_ instanceof Identifier)) 667 return false; 668 Identifier o = (Identifier) other_; 669 return compareValues(use, o.use, true) && compareValues(system, o.system, true) && compareValues(value, o.value, true) 670 ; 671 } 672 673 public boolean isEmpty() { 674 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(use, type, system, value 675 , period, assigner); 676 } 677 678 679} 680