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