001package org.hl7.fhir.dstu2016may.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 033import java.util.Date; 034import java.util.List; 035 036import org.hl7.fhir.exceptions.FHIRException; 037import org.hl7.fhir.instance.model.api.ICompositeType; 038import org.hl7.fhir.utilities.Utilities; 039 040import ca.uhn.fhir.model.api.annotation.Child; 041import ca.uhn.fhir.model.api.annotation.DatatypeDef; 042import ca.uhn.fhir.model.api.annotation.Description; 043/** 044 * For referring to data content defined in other formats. 045 */ 046@DatatypeDef(name="Attachment") 047public class Attachment extends Type implements ICompositeType { 048 049 /** 050 * Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate. 051 */ 052 @Child(name = "contentType", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true) 053 @Description(shortDefinition="Mime type of the content, with charset etc.", formalDefinition="Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate." ) 054 protected CodeType contentType; 055 056 /** 057 * The human language of the content. The value can be any valid value according to BCP 47. 058 */ 059 @Child(name = "language", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true) 060 @Description(shortDefinition="Human language of the content (BCP-47)", formalDefinition="The human language of the content. The value can be any valid value according to BCP 47." ) 061 protected CodeType language; 062 063 /** 064 * The actual data of the attachment - a sequence of bytes. In XML, represented using base64. 065 */ 066 @Child(name = "data", type = {Base64BinaryType.class}, order=2, min=0, max=1, modifier=false, summary=false) 067 @Description(shortDefinition="Data inline, base64ed", formalDefinition="The actual data of the attachment - a sequence of bytes. In XML, represented using base64." ) 068 protected Base64BinaryType data; 069 070 /** 071 * An alternative location where the data can be accessed. 072 */ 073 @Child(name = "url", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=true) 074 @Description(shortDefinition="Uri where the data can be found", formalDefinition="An alternative location where the data can be accessed." ) 075 protected UriType url; 076 077 /** 078 * The number of bytes of data that make up this attachment. 079 */ 080 @Child(name = "size", type = {UnsignedIntType.class}, order=4, min=0, max=1, modifier=false, summary=true) 081 @Description(shortDefinition="Number of bytes of content (if url provided)", formalDefinition="The number of bytes of data that make up this attachment." ) 082 protected UnsignedIntType size; 083 084 /** 085 * The calculated hash of the data using SHA-1. Represented using base64. 086 */ 087 @Child(name = "hash", type = {Base64BinaryType.class}, order=5, min=0, max=1, modifier=false, summary=true) 088 @Description(shortDefinition="Hash of the data (sha-1, base64ed)", formalDefinition="The calculated hash of the data using SHA-1. Represented using base64." ) 089 protected Base64BinaryType hash; 090 091 /** 092 * A label or set of text to display in place of the data. 093 */ 094 @Child(name = "title", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true) 095 @Description(shortDefinition="Label to display in place of the data", formalDefinition="A label or set of text to display in place of the data." ) 096 protected StringType title; 097 098 /** 099 * The date that the attachment was first created. 100 */ 101 @Child(name = "creation", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true) 102 @Description(shortDefinition="Date attachment was first created", formalDefinition="The date that the attachment was first created." ) 103 protected DateTimeType creation; 104 105 private static final long serialVersionUID = 581007080L; 106 107 /** 108 * Constructor 109 */ 110 public Attachment() { 111 super(); 112 } 113 114 /** 115 * @return {@link #contentType} (Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value 116 */ 117 public CodeType getContentTypeElement() { 118 if (this.contentType == null) 119 if (Configuration.errorOnAutoCreate()) 120 throw new Error("Attempt to auto-create Attachment.contentType"); 121 else if (Configuration.doAutoCreate()) 122 this.contentType = new CodeType(); // bb 123 return this.contentType; 124 } 125 126 public boolean hasContentTypeElement() { 127 return this.contentType != null && !this.contentType.isEmpty(); 128 } 129 130 public boolean hasContentType() { 131 return this.contentType != null && !this.contentType.isEmpty(); 132 } 133 134 /** 135 * @param value {@link #contentType} (Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value 136 */ 137 public Attachment setContentTypeElement(CodeType value) { 138 this.contentType = value; 139 return this; 140 } 141 142 /** 143 * @return Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate. 144 */ 145 public String getContentType() { 146 return this.contentType == null ? null : this.contentType.getValue(); 147 } 148 149 /** 150 * @param value Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate. 151 */ 152 public Attachment setContentType(String value) { 153 if (Utilities.noString(value)) 154 this.contentType = null; 155 else { 156 if (this.contentType == null) 157 this.contentType = new CodeType(); 158 this.contentType.setValue(value); 159 } 160 return this; 161 } 162 163 /** 164 * @return {@link #language} (The human language of the content. The value can be any valid value according to BCP 47.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value 165 */ 166 public CodeType getLanguageElement() { 167 if (this.language == null) 168 if (Configuration.errorOnAutoCreate()) 169 throw new Error("Attempt to auto-create Attachment.language"); 170 else if (Configuration.doAutoCreate()) 171 this.language = new CodeType(); // bb 172 return this.language; 173 } 174 175 public boolean hasLanguageElement() { 176 return this.language != null && !this.language.isEmpty(); 177 } 178 179 public boolean hasLanguage() { 180 return this.language != null && !this.language.isEmpty(); 181 } 182 183 /** 184 * @param value {@link #language} (The human language of the content. The value can be any valid value according to BCP 47.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value 185 */ 186 public Attachment setLanguageElement(CodeType value) { 187 this.language = value; 188 return this; 189 } 190 191 /** 192 * @return The human language of the content. The value can be any valid value according to BCP 47. 193 */ 194 public String getLanguage() { 195 return this.language == null ? null : this.language.getValue(); 196 } 197 198 /** 199 * @param value The human language of the content. The value can be any valid value according to BCP 47. 200 */ 201 public Attachment setLanguage(String value) { 202 if (Utilities.noString(value)) 203 this.language = null; 204 else { 205 if (this.language == null) 206 this.language = new CodeType(); 207 this.language.setValue(value); 208 } 209 return this; 210 } 211 212 /** 213 * @return {@link #data} (The actual data of the attachment - a sequence of bytes. In XML, represented using base64.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value 214 */ 215 public Base64BinaryType getDataElement() { 216 if (this.data == null) 217 if (Configuration.errorOnAutoCreate()) 218 throw new Error("Attempt to auto-create Attachment.data"); 219 else if (Configuration.doAutoCreate()) 220 this.data = new Base64BinaryType(); // bb 221 return this.data; 222 } 223 224 public boolean hasDataElement() { 225 return this.data != null && !this.data.isEmpty(); 226 } 227 228 public boolean hasData() { 229 return this.data != null && !this.data.isEmpty(); 230 } 231 232 /** 233 * @param value {@link #data} (The actual data of the attachment - a sequence of bytes. In XML, represented using base64.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value 234 */ 235 public Attachment setDataElement(Base64BinaryType value) { 236 this.data = value; 237 return this; 238 } 239 240 /** 241 * @return The actual data of the attachment - a sequence of bytes. In XML, represented using base64. 242 */ 243 public byte[] getData() { 244 return this.data == null ? null : this.data.getValue(); 245 } 246 247 /** 248 * @param value The actual data of the attachment - a sequence of bytes. In XML, represented using base64. 249 */ 250 public Attachment setData(byte[] value) { 251 if (value == null) 252 this.data = null; 253 else { 254 if (this.data == null) 255 this.data = new Base64BinaryType(); 256 this.data.setValue(value); 257 } 258 return this; 259 } 260 261 /** 262 * @return {@link #url} (An alternative location where the data can be accessed.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value 263 */ 264 public UriType getUrlElement() { 265 if (this.url == null) 266 if (Configuration.errorOnAutoCreate()) 267 throw new Error("Attempt to auto-create Attachment.url"); 268 else if (Configuration.doAutoCreate()) 269 this.url = new UriType(); // bb 270 return this.url; 271 } 272 273 public boolean hasUrlElement() { 274 return this.url != null && !this.url.isEmpty(); 275 } 276 277 public boolean hasUrl() { 278 return this.url != null && !this.url.isEmpty(); 279 } 280 281 /** 282 * @param value {@link #url} (An alternative location where the data can be accessed.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value 283 */ 284 public Attachment setUrlElement(UriType value) { 285 this.url = value; 286 return this; 287 } 288 289 /** 290 * @return An alternative location where the data can be accessed. 291 */ 292 public String getUrl() { 293 return this.url == null ? null : this.url.getValue(); 294 } 295 296 /** 297 * @param value An alternative location where the data can be accessed. 298 */ 299 public Attachment setUrl(String value) { 300 if (Utilities.noString(value)) 301 this.url = null; 302 else { 303 if (this.url == null) 304 this.url = new UriType(); 305 this.url.setValue(value); 306 } 307 return this; 308 } 309 310 /** 311 * @return {@link #size} (The number of bytes of data that make up this attachment.). This is the underlying object with id, value and extensions. The accessor "getSize" gives direct access to the value 312 */ 313 public UnsignedIntType getSizeElement() { 314 if (this.size == null) 315 if (Configuration.errorOnAutoCreate()) 316 throw new Error("Attempt to auto-create Attachment.size"); 317 else if (Configuration.doAutoCreate()) 318 this.size = new UnsignedIntType(); // bb 319 return this.size; 320 } 321 322 public boolean hasSizeElement() { 323 return this.size != null && !this.size.isEmpty(); 324 } 325 326 public boolean hasSize() { 327 return this.size != null && !this.size.isEmpty(); 328 } 329 330 /** 331 * @param value {@link #size} (The number of bytes of data that make up this attachment.). This is the underlying object with id, value and extensions. The accessor "getSize" gives direct access to the value 332 */ 333 public Attachment setSizeElement(UnsignedIntType value) { 334 this.size = value; 335 return this; 336 } 337 338 /** 339 * @return The number of bytes of data that make up this attachment. 340 */ 341 public int getSize() { 342 return this.size == null || this.size.isEmpty() ? 0 : this.size.getValue(); 343 } 344 345 /** 346 * @param value The number of bytes of data that make up this attachment. 347 */ 348 public Attachment setSize(int value) { 349 if (this.size == null) 350 this.size = new UnsignedIntType(); 351 this.size.setValue(value); 352 return this; 353 } 354 355 /** 356 * @return {@link #hash} (The calculated hash of the data using SHA-1. Represented using base64.). This is the underlying object with id, value and extensions. The accessor "getHash" gives direct access to the value 357 */ 358 public Base64BinaryType getHashElement() { 359 if (this.hash == null) 360 if (Configuration.errorOnAutoCreate()) 361 throw new Error("Attempt to auto-create Attachment.hash"); 362 else if (Configuration.doAutoCreate()) 363 this.hash = new Base64BinaryType(); // bb 364 return this.hash; 365 } 366 367 public boolean hasHashElement() { 368 return this.hash != null && !this.hash.isEmpty(); 369 } 370 371 public boolean hasHash() { 372 return this.hash != null && !this.hash.isEmpty(); 373 } 374 375 /** 376 * @param value {@link #hash} (The calculated hash of the data using SHA-1. Represented using base64.). This is the underlying object with id, value and extensions. The accessor "getHash" gives direct access to the value 377 */ 378 public Attachment setHashElement(Base64BinaryType value) { 379 this.hash = value; 380 return this; 381 } 382 383 /** 384 * @return The calculated hash of the data using SHA-1. Represented using base64. 385 */ 386 public byte[] getHash() { 387 return this.hash == null ? null : this.hash.getValue(); 388 } 389 390 /** 391 * @param value The calculated hash of the data using SHA-1. Represented using base64. 392 */ 393 public Attachment setHash(byte[] value) { 394 if (value == null) 395 this.hash = null; 396 else { 397 if (this.hash == null) 398 this.hash = new Base64BinaryType(); 399 this.hash.setValue(value); 400 } 401 return this; 402 } 403 404 /** 405 * @return {@link #title} (A label or set of text to display in place of the data.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value 406 */ 407 public StringType getTitleElement() { 408 if (this.title == null) 409 if (Configuration.errorOnAutoCreate()) 410 throw new Error("Attempt to auto-create Attachment.title"); 411 else if (Configuration.doAutoCreate()) 412 this.title = new StringType(); // bb 413 return this.title; 414 } 415 416 public boolean hasTitleElement() { 417 return this.title != null && !this.title.isEmpty(); 418 } 419 420 public boolean hasTitle() { 421 return this.title != null && !this.title.isEmpty(); 422 } 423 424 /** 425 * @param value {@link #title} (A label or set of text to display in place of the data.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value 426 */ 427 public Attachment setTitleElement(StringType value) { 428 this.title = value; 429 return this; 430 } 431 432 /** 433 * @return A label or set of text to display in place of the data. 434 */ 435 public String getTitle() { 436 return this.title == null ? null : this.title.getValue(); 437 } 438 439 /** 440 * @param value A label or set of text to display in place of the data. 441 */ 442 public Attachment setTitle(String value) { 443 if (Utilities.noString(value)) 444 this.title = null; 445 else { 446 if (this.title == null) 447 this.title = new StringType(); 448 this.title.setValue(value); 449 } 450 return this; 451 } 452 453 /** 454 * @return {@link #creation} (The date that the attachment was first created.). This is the underlying object with id, value and extensions. The accessor "getCreation" gives direct access to the value 455 */ 456 public DateTimeType getCreationElement() { 457 if (this.creation == null) 458 if (Configuration.errorOnAutoCreate()) 459 throw new Error("Attempt to auto-create Attachment.creation"); 460 else if (Configuration.doAutoCreate()) 461 this.creation = new DateTimeType(); // bb 462 return this.creation; 463 } 464 465 public boolean hasCreationElement() { 466 return this.creation != null && !this.creation.isEmpty(); 467 } 468 469 public boolean hasCreation() { 470 return this.creation != null && !this.creation.isEmpty(); 471 } 472 473 /** 474 * @param value {@link #creation} (The date that the attachment was first created.). This is the underlying object with id, value and extensions. The accessor "getCreation" gives direct access to the value 475 */ 476 public Attachment setCreationElement(DateTimeType value) { 477 this.creation = value; 478 return this; 479 } 480 481 /** 482 * @return The date that the attachment was first created. 483 */ 484 public Date getCreation() { 485 return this.creation == null ? null : this.creation.getValue(); 486 } 487 488 /** 489 * @param value The date that the attachment was first created. 490 */ 491 public Attachment setCreation(Date value) { 492 if (value == null) 493 this.creation = null; 494 else { 495 if (this.creation == null) 496 this.creation = new DateTimeType(); 497 this.creation.setValue(value); 498 } 499 return this; 500 } 501 502 protected void listChildren(List<Property> childrenList) { 503 super.listChildren(childrenList); 504 childrenList.add(new Property("contentType", "code", "Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.", 0, java.lang.Integer.MAX_VALUE, contentType)); 505 childrenList.add(new Property("language", "code", "The human language of the content. The value can be any valid value according to BCP 47.", 0, java.lang.Integer.MAX_VALUE, language)); 506 childrenList.add(new Property("data", "base64Binary", "The actual data of the attachment - a sequence of bytes. In XML, represented using base64.", 0, java.lang.Integer.MAX_VALUE, data)); 507 childrenList.add(new Property("url", "uri", "An alternative location where the data can be accessed.", 0, java.lang.Integer.MAX_VALUE, url)); 508 childrenList.add(new Property("size", "unsignedInt", "The number of bytes of data that make up this attachment.", 0, java.lang.Integer.MAX_VALUE, size)); 509 childrenList.add(new Property("hash", "base64Binary", "The calculated hash of the data using SHA-1. Represented using base64.", 0, java.lang.Integer.MAX_VALUE, hash)); 510 childrenList.add(new Property("title", "string", "A label or set of text to display in place of the data.", 0, java.lang.Integer.MAX_VALUE, title)); 511 childrenList.add(new Property("creation", "dateTime", "The date that the attachment was first created.", 0, java.lang.Integer.MAX_VALUE, creation)); 512 } 513 514 @Override 515 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 516 switch (hash) { 517 case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType 518 case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType 519 case 3076010: /*data*/ return this.data == null ? new Base[0] : new Base[] {this.data}; // Base64BinaryType 520 case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType 521 case 3530753: /*size*/ return this.size == null ? new Base[0] : new Base[] {this.size}; // UnsignedIntType 522 case 3195150: /*hash*/ return this.hash == null ? new Base[0] : new Base[] {this.hash}; // Base64BinaryType 523 case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType 524 case 1820421855: /*creation*/ return this.creation == null ? new Base[0] : new Base[] {this.creation}; // DateTimeType 525 default: return super.getProperty(hash, name, checkValid); 526 } 527 528 } 529 530 @Override 531 public void setProperty(int hash, String name, Base value) throws FHIRException { 532 switch (hash) { 533 case -389131437: // contentType 534 this.contentType = castToCode(value); // CodeType 535 break; 536 case -1613589672: // language 537 this.language = castToCode(value); // CodeType 538 break; 539 case 3076010: // data 540 this.data = castToBase64Binary(value); // Base64BinaryType 541 break; 542 case 116079: // url 543 this.url = castToUri(value); // UriType 544 break; 545 case 3530753: // size 546 this.size = castToUnsignedInt(value); // UnsignedIntType 547 break; 548 case 3195150: // hash 549 this.hash = castToBase64Binary(value); // Base64BinaryType 550 break; 551 case 110371416: // title 552 this.title = castToString(value); // StringType 553 break; 554 case 1820421855: // creation 555 this.creation = castToDateTime(value); // DateTimeType 556 break; 557 default: super.setProperty(hash, name, value); 558 } 559 560 } 561 562 @Override 563 public void setProperty(String name, Base value) throws FHIRException { 564 if (name.equals("contentType")) 565 this.contentType = castToCode(value); // CodeType 566 else if (name.equals("language")) 567 this.language = castToCode(value); // CodeType 568 else if (name.equals("data")) 569 this.data = castToBase64Binary(value); // Base64BinaryType 570 else if (name.equals("url")) 571 this.url = castToUri(value); // UriType 572 else if (name.equals("size")) 573 this.size = castToUnsignedInt(value); // UnsignedIntType 574 else if (name.equals("hash")) 575 this.hash = castToBase64Binary(value); // Base64BinaryType 576 else if (name.equals("title")) 577 this.title = castToString(value); // StringType 578 else if (name.equals("creation")) 579 this.creation = castToDateTime(value); // DateTimeType 580 else 581 super.setProperty(name, value); 582 } 583 584 @Override 585 public Base makeProperty(int hash, String name) throws FHIRException { 586 switch (hash) { 587 case -389131437: throw new FHIRException("Cannot make property contentType as it is not a complex type"); // CodeType 588 case -1613589672: throw new FHIRException("Cannot make property language as it is not a complex type"); // CodeType 589 case 3076010: throw new FHIRException("Cannot make property data as it is not a complex type"); // Base64BinaryType 590 case 116079: throw new FHIRException("Cannot make property url as it is not a complex type"); // UriType 591 case 3530753: throw new FHIRException("Cannot make property size as it is not a complex type"); // UnsignedIntType 592 case 3195150: throw new FHIRException("Cannot make property hash as it is not a complex type"); // Base64BinaryType 593 case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType 594 case 1820421855: throw new FHIRException("Cannot make property creation as it is not a complex type"); // DateTimeType 595 default: return super.makeProperty(hash, name); 596 } 597 598 } 599 600 @Override 601 public Base addChild(String name) throws FHIRException { 602 if (name.equals("contentType")) { 603 throw new FHIRException("Cannot call addChild on a primitive type Attachment.contentType"); 604 } 605 else if (name.equals("language")) { 606 throw new FHIRException("Cannot call addChild on a primitive type Attachment.language"); 607 } 608 else if (name.equals("data")) { 609 throw new FHIRException("Cannot call addChild on a primitive type Attachment.data"); 610 } 611 else if (name.equals("url")) { 612 throw new FHIRException("Cannot call addChild on a primitive type Attachment.url"); 613 } 614 else if (name.equals("size")) { 615 throw new FHIRException("Cannot call addChild on a primitive type Attachment.size"); 616 } 617 else if (name.equals("hash")) { 618 throw new FHIRException("Cannot call addChild on a primitive type Attachment.hash"); 619 } 620 else if (name.equals("title")) { 621 throw new FHIRException("Cannot call addChild on a primitive type Attachment.title"); 622 } 623 else if (name.equals("creation")) { 624 throw new FHIRException("Cannot call addChild on a primitive type Attachment.creation"); 625 } 626 else 627 return super.addChild(name); 628 } 629 630 public String fhirType() { 631 return "Attachment"; 632 633 } 634 635 public Attachment copy() { 636 Attachment dst = new Attachment(); 637 copyValues(dst); 638 dst.contentType = contentType == null ? null : contentType.copy(); 639 dst.language = language == null ? null : language.copy(); 640 dst.data = data == null ? null : data.copy(); 641 dst.url = url == null ? null : url.copy(); 642 dst.size = size == null ? null : size.copy(); 643 dst.hash = hash == null ? null : hash.copy(); 644 dst.title = title == null ? null : title.copy(); 645 dst.creation = creation == null ? null : creation.copy(); 646 return dst; 647 } 648 649 protected Attachment typedCopy() { 650 return copy(); 651 } 652 653 @Override 654 public boolean equalsDeep(Base other) { 655 if (!super.equalsDeep(other)) 656 return false; 657 if (!(other instanceof Attachment)) 658 return false; 659 Attachment o = (Attachment) other; 660 return compareDeep(contentType, o.contentType, true) && compareDeep(language, o.language, true) 661 && compareDeep(data, o.data, true) && compareDeep(url, o.url, true) && compareDeep(size, o.size, true) 662 && compareDeep(hash, o.hash, true) && compareDeep(title, o.title, true) && compareDeep(creation, o.creation, true) 663 ; 664 } 665 666 @Override 667 public boolean equalsShallow(Base other) { 668 if (!super.equalsShallow(other)) 669 return false; 670 if (!(other instanceof Attachment)) 671 return false; 672 Attachment o = (Attachment) other; 673 return compareValues(contentType, o.contentType, true) && compareValues(language, o.language, true) 674 && compareValues(data, o.data, true) && compareValues(url, o.url, true) && compareValues(size, o.size, true) 675 && compareValues(hash, o.hash, true) && compareValues(title, o.title, true) && compareValues(creation, o.creation, true) 676 ; 677 } 678 679 public boolean isEmpty() { 680 return super.isEmpty() && (contentType == null || contentType.isEmpty()) && (language == null || language.isEmpty()) 681 && (data == null || data.isEmpty()) && (url == null || url.isEmpty()) && (size == null || size.isEmpty()) 682 && (hash == null || hash.isEmpty()) && (title == null || title.isEmpty()) && (creation == null || creation.isEmpty()) 683 ; 684 } 685 686 687} 688