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