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