001package org.hl7.fhir.r5.openehr;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.openehr.Enumerations.*;
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.r5.model.*;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048/**
049 * A text item, which may contain any amount of legal characters arranged as e.g. words, sentences etc (i.e. one DV_TEXT may be more than one word). Visual formatting and hyperlinks may be included via markdown.
050 */
051@DatatypeDef(name="DV_TEXT")
052public class DV_TEXT extends DATA_VALUE implements ICompositeType {
053
054    /**
055     * Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.
056     */
057    @Child(name = "value", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=false)
058    @Description(shortDefinition="Displayable rendition of the item, regardless of its underlying structure", formalDefinition="Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service." )
059    protected StringType value;
060
061    /**
062     * DEPRECATED: this field is deprecated; use markdown link/text in the value attribute, and 'markdown' as the value of the formatting field.
063     */
064    @Child(name = "hyperlink", type = {DV_URI.class}, order=1, min=0, max=1, modifier=false, summary=false)
065    @Description(shortDefinition="DEPRECATED: this field is deprecated; use markdown", formalDefinition="DEPRECATED: this field is deprecated; use markdown link/text in the value attribute, and 'markdown' as the value of the formatting field." )
066    protected DV_URI hyperlink;
067
068    /**
069     * If set, contains one of the following values:
070
071'plain': use for plain text, possibly containing newlines, but otherwise unformatted (same as Void);
072* 'plain_no_newlines': use for text containing no newlines or other formatting;
073* 'markdown': use for markdown formatted text, strongly recommended in the format of the CommonMark specification.
074
075DEPRECATED usage: contains a string of the form ```'name:value; name:value??'``` , e.g. ```'font-weight : bold; font-family : Arial; font-size : 12pt;'```. Values taken from W3C CSS2 properties lists for background and font
076     */
077    @Child(name = "formatting", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
078    @Description(shortDefinition="plain | plain_no_newlines | markdown", formalDefinition="If set, contains one of the following values:\n\n'plain': use for plain text, possibly containing newlines, but otherwise unformatted (same as Void);\n* 'plain_no_newlines': use for text containing no newlines or other formatting;\n* 'markdown': use for markdown formatted text, strongly recommended in the format of the CommonMark specification.\n\nDEPRECATED usage: contains a string of the form ```'name:value; name:value??'``` , e.g. ```'font-weight : bold; font-family : Arial; font-size : 12pt;'```. Values taken from W3C CSS2 properties lists for background and font" )
079    protected StringType formatting;
080
081    /**
082     * Terms from other terminologies most closely matching this term, typically used where the originator (e.g. pathology lab) of information uses a local terminology but also supplies one or more equivalents from well known terminologies (e.g. LOINC).
083     */
084    @Child(name = "mappings", type = {TERM_MAPPING.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
085    @Description(shortDefinition="Terms from other terminologies most closely matching this term", formalDefinition="Terms from other terminologies most closely matching this term, typically used where the originator (e.g. pathology lab) of information uses a local terminology but also supplies one or more equivalents from well known terminologies (e.g. LOINC)." )
086    protected List<TERM_MAPPING> mappingsList;
087
088    /**
089     * Optional indicator of the localised language in which the value is written. Coded from openEHR Code Set languages . Only used when either the text object is in a different language from the enclosing ENTRY, or else the text object is being used outside of an ENTRY or other enclosing structure which indicates the language.
090     */
091    @Child(name = "language", type = {CODE_PHRASE.class}, order=4, min=0, max=1, modifier=false, summary=false)
092    @Description(shortDefinition="Optional indicator of the localised language in which the value is written", formalDefinition="Optional indicator of the localised language in which the value is written. Coded from openEHR Code Set languages . Only used when either the text object is in a different language from the enclosing ENTRY, or else the text object is being used outside of an ENTRY or other enclosing structure which indicates the language." )
093    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-languages")
094    protected CODE_PHRASE language;
095
096    /**
097     * Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions.
098     */
099    @Child(name = "encoding", type = {CODE_PHRASE.class}, order=5, min=0, max=1, modifier=false, summary=false)
100    @Description(shortDefinition="Name of character encoding scheme in which this value is encoded", formalDefinition="Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions." )
101    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="https://specifications.openehr.org/fhir/valueset-character_sets")
102    protected CODE_PHRASE encoding;
103
104    private static final long serialVersionUID = 1126979256L;
105
106  /**
107   * Constructor
108   */
109    public DV_TEXT() {
110      super();
111    }
112
113  /**
114   * Constructor
115   */
116    public DV_TEXT(String value, TERM_MAPPING mappings) {
117      super();
118      this.setValue(value);
119      this.addMappings(mappings);
120    }
121
122    /**
123     * @return {@link #value} (Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
124     */
125    public StringType getValueElement() { 
126      if (this.value == null)
127        if (Configuration.errorOnAutoCreate())
128          throw new Error("Attempt to auto-create DV_TEXT.value");
129        else if (Configuration.doAutoCreate())
130          this.value = new StringType(); // bb
131      return this.value;
132    }
133
134    public boolean hasValueElement() { 
135      return this.value != null && !this.value.isEmpty();
136    }
137
138    public boolean hasValue() { 
139      return this.value != null && !this.value.isEmpty();
140    }
141
142    /**
143     * @param value {@link #value} (Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
144     */
145    public DV_TEXT setValueElement(StringType value) { 
146      this.value = value;
147      return this;
148    }
149
150    /**
151     * @return Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.
152     */
153    public String getValue() { 
154      return this.value == null ? null : this.value.getValue();
155    }
156
157    /**
158     * @param value Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.
159     */
160    public DV_TEXT setValue(String value) { 
161        if (this.value == null)
162          this.value = new StringType();
163        this.value.setValue(value);
164      return this;
165    }
166
167    /**
168     * @return {@link #hyperlink} (DEPRECATED: this field is deprecated; use markdown link/text in the value attribute, and 'markdown' as the value of the formatting field.)
169     */
170    public DV_URI getHyperlink() { 
171      if (this.hyperlink == null)
172        if (Configuration.errorOnAutoCreate())
173          throw new Error("Attempt to auto-create DV_TEXT.hyperlink");
174        else if (Configuration.doAutoCreate())
175          this.hyperlink = new DV_URI(); // cc
176      return this.hyperlink;
177    }
178
179    public boolean hasHyperlink() { 
180      return this.hyperlink != null && !this.hyperlink.isEmpty();
181    }
182
183    /**
184     * @param value {@link #hyperlink} (DEPRECATED: this field is deprecated; use markdown link/text in the value attribute, and 'markdown' as the value of the formatting field.)
185     */
186    public DV_TEXT setHyperlink(DV_URI value) { 
187      this.hyperlink = value;
188      return this;
189    }
190
191    /**
192     * @return {@link #formatting} (If set, contains one of the following values:
193
194'plain': use for plain text, possibly containing newlines, but otherwise unformatted (same as Void);
195* 'plain_no_newlines': use for text containing no newlines or other formatting;
196* 'markdown': use for markdown formatted text, strongly recommended in the format of the CommonMark specification.
197
198DEPRECATED usage: contains a string of the form ```'name:value; name:value??'``` , e.g. ```'font-weight : bold; font-family : Arial; font-size : 12pt;'```. Values taken from W3C CSS2 properties lists for background and font). This is the underlying object with id, value and extensions. The accessor "getFormatting" gives direct access to the value
199     */
200    public StringType getFormattingElement() { 
201      if (this.formatting == null)
202        if (Configuration.errorOnAutoCreate())
203          throw new Error("Attempt to auto-create DV_TEXT.formatting");
204        else if (Configuration.doAutoCreate())
205          this.formatting = new StringType(); // bb
206      return this.formatting;
207    }
208
209    public boolean hasFormattingElement() { 
210      return this.formatting != null && !this.formatting.isEmpty();
211    }
212
213    public boolean hasFormatting() { 
214      return this.formatting != null && !this.formatting.isEmpty();
215    }
216
217    /**
218     * @param value {@link #formatting} (If set, contains one of the following values:
219
220'plain': use for plain text, possibly containing newlines, but otherwise unformatted (same as Void);
221* 'plain_no_newlines': use for text containing no newlines or other formatting;
222* 'markdown': use for markdown formatted text, strongly recommended in the format of the CommonMark specification.
223
224DEPRECATED usage: contains a string of the form ```'name:value; name:value??'``` , e.g. ```'font-weight : bold; font-family : Arial; font-size : 12pt;'```. Values taken from W3C CSS2 properties lists for background and font). This is the underlying object with id, value and extensions. The accessor "getFormatting" gives direct access to the value
225     */
226    public DV_TEXT setFormattingElement(StringType value) { 
227      this.formatting = value;
228      return this;
229    }
230
231    /**
232     * @return If set, contains one of the following values:
233
234'plain': use for plain text, possibly containing newlines, but otherwise unformatted (same as Void);
235* 'plain_no_newlines': use for text containing no newlines or other formatting;
236* 'markdown': use for markdown formatted text, strongly recommended in the format of the CommonMark specification.
237
238DEPRECATED usage: contains a string of the form ```'name:value; name:value??'``` , e.g. ```'font-weight : bold; font-family : Arial; font-size : 12pt;'```. Values taken from W3C CSS2 properties lists for background and font
239     */
240    public String getFormatting() { 
241      return this.formatting == null ? null : this.formatting.getValue();
242    }
243
244    /**
245     * @param value If set, contains one of the following values:
246
247'plain': use for plain text, possibly containing newlines, but otherwise unformatted (same as Void);
248* 'plain_no_newlines': use for text containing no newlines or other formatting;
249* 'markdown': use for markdown formatted text, strongly recommended in the format of the CommonMark specification.
250
251DEPRECATED usage: contains a string of the form ```'name:value; name:value??'``` , e.g. ```'font-weight : bold; font-family : Arial; font-size : 12pt;'```. Values taken from W3C CSS2 properties lists for background and font
252     */
253    public DV_TEXT setFormatting(String value) { 
254      if (Utilities.noString(value))
255        this.formatting = null;
256      else {
257        if (this.formatting == null)
258          this.formatting = new StringType();
259        this.formatting.setValue(value);
260      }
261      return this;
262    }
263
264    /**
265     * @return {@link #mappings} (Terms from other terminologies most closely matching this term, typically used where the originator (e.g. pathology lab) of information uses a local terminology but also supplies one or more equivalents from well known terminologies (e.g. LOINC).)
266     */
267    public List<TERM_MAPPING> getMappingsList() { 
268      if (this.mappingsList == null)
269        this.mappingsList = new ArrayList<TERM_MAPPING>();
270      return this.mappingsList;
271    }
272
273    /**
274     * @return Returns a reference to <code>this</code> for easy method chaining
275     */
276    public DV_TEXT setMappingsList(List<TERM_MAPPING> theMappings) { 
277      this.mappingsList = theMappings;
278      return this;
279    }
280
281    public boolean hasMappings() { 
282      if (this.mappingsList == null)
283        return false;
284      for (TERM_MAPPING item : this.mappingsList)
285        if (!item.isEmpty())
286          return true;
287      return false;
288    }
289
290    public TERM_MAPPING addMappings() { //3a
291      TERM_MAPPING t = new TERM_MAPPING();
292      if (this.mappingsList == null)
293        this.mappingsList = new ArrayList<TERM_MAPPING>();
294      this.mappingsList.add(t);
295      return t;
296    }
297
298    public DV_TEXT addMappings(TERM_MAPPING t) { //3b
299      if (t == null)
300        return this;
301      if (this.mappingsList == null)
302        this.mappingsList = new ArrayList<TERM_MAPPING>();
303      this.mappingsList.add(t);
304      return this;
305    }
306
307    /**
308     * @return The first repetition of repeating field {@link #mappings}, creating it if it does not already exist {3}
309     */
310    public TERM_MAPPING getMappingsFirstRep() { 
311      if (getMappingsList().isEmpty()) {
312        addMappings();
313      }
314      return getMappingsList().get(0);
315    }
316
317    /**
318     * @return {@link #language} (Optional indicator of the localised language in which the value is written. Coded from openEHR Code Set languages . Only used when either the text object is in a different language from the enclosing ENTRY, or else the text object is being used outside of an ENTRY or other enclosing structure which indicates the language.)
319     */
320    public CODE_PHRASE getLanguage() { 
321      if (this.language == null)
322        if (Configuration.errorOnAutoCreate())
323          throw new Error("Attempt to auto-create DV_TEXT.language");
324        else if (Configuration.doAutoCreate())
325          this.language = new CODE_PHRASE(); // cc
326      return this.language;
327    }
328
329    public boolean hasLanguage() { 
330      return this.language != null && !this.language.isEmpty();
331    }
332
333    /**
334     * @param value {@link #language} (Optional indicator of the localised language in which the value is written. Coded from openEHR Code Set languages . Only used when either the text object is in a different language from the enclosing ENTRY, or else the text object is being used outside of an ENTRY or other enclosing structure which indicates the language.)
335     */
336    public DV_TEXT setLanguage(CODE_PHRASE value) { 
337      this.language = value;
338      return this;
339    }
340
341    /**
342     * @return {@link #encoding} (Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions.)
343     */
344    public CODE_PHRASE getEncoding() { 
345      if (this.encoding == null)
346        if (Configuration.errorOnAutoCreate())
347          throw new Error("Attempt to auto-create DV_TEXT.encoding");
348        else if (Configuration.doAutoCreate())
349          this.encoding = new CODE_PHRASE(); // cc
350      return this.encoding;
351    }
352
353    public boolean hasEncoding() { 
354      return this.encoding != null && !this.encoding.isEmpty();
355    }
356
357    /**
358     * @param value {@link #encoding} (Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions.)
359     */
360    public DV_TEXT setEncoding(CODE_PHRASE value) { 
361      this.encoding = value;
362      return this;
363    }
364
365      protected void listChildren(List<Property> children) {
366        super.listChildren(children);
367        children.add(new Property("value", "string", "Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.", 0, 1, value));
368        children.add(new Property("hyperlink", "http://openehr.org/fhir/StructureDefinition/DV-URI", "DEPRECATED: this field is deprecated; use markdown link/text in the value attribute, and 'markdown' as the value of the formatting field.", 0, 1, hyperlink));
369        children.add(new Property("formatting", "string", "If set, contains one of the following values:\n\n'plain': use for plain text, possibly containing newlines, but otherwise unformatted (same as Void);\n* 'plain_no_newlines': use for text containing no newlines or other formatting;\n* 'markdown': use for markdown formatted text, strongly recommended in the format of the CommonMark specification.\n\nDEPRECATED usage: contains a string of the form ```'name:value; name:value??'``` , e.g. ```'font-weight : bold; font-family : Arial; font-size : 12pt;'```. Values taken from W3C CSS2 properties lists for background and font", 0, 1, formatting));
370        children.add(new Property("mappings", "http://openehr.org/fhir/StructureDefinition/TERM-MAPPING", "Terms from other terminologies most closely matching this term, typically used where the originator (e.g. pathology lab) of information uses a local terminology but also supplies one or more equivalents from well known terminologies (e.g. LOINC).", 0, java.lang.Integer.MAX_VALUE, mappingsList));
371        children.add(new Property("language", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Optional indicator of the localised language in which the value is written. Coded from openEHR Code Set languages . Only used when either the text object is in a different language from the enclosing ENTRY, or else the text object is being used outside of an ENTRY or other enclosing structure which indicates the language.", 0, 1, language));
372        children.add(new Property("encoding", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions.", 0, 1, encoding));
373      }
374
375      @Override
376      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
377        switch (_hash) {
378        case 111972721: /*value*/  return new Property("value", "string", "Displayable rendition of the item, regardless of its underlying structure. For DV_CODED_TEXT, this is the rubric of the complete term as provided by the terminology service.", 0, 1, value);
379        case 751294566: /*hyperlink*/  return new Property("hyperlink", "http://openehr.org/fhir/StructureDefinition/DV-URI", "DEPRECATED: this field is deprecated; use markdown link/text in the value attribute, and 'markdown' as the value of the formatting field.", 0, 1, hyperlink);
380        case 324761445: /*formatting*/  return new Property("formatting", "string", "If set, contains one of the following values:\n\n'plain': use for plain text, possibly containing newlines, but otherwise unformatted (same as Void);\n* 'plain_no_newlines': use for text containing no newlines or other formatting;\n* 'markdown': use for markdown formatted text, strongly recommended in the format of the CommonMark specification.\n\nDEPRECATED usage: contains a string of the form ```'name:value; name:value??'``` , e.g. ```'font-weight : bold; font-family : Arial; font-size : 12pt;'```. Values taken from W3C CSS2 properties lists for background and font", 0, 1, formatting);
381        case 194445669: /*mappings*/  return new Property("mappings", "http://openehr.org/fhir/StructureDefinition/TERM-MAPPING", "Terms from other terminologies most closely matching this term, typically used where the originator (e.g. pathology lab) of information uses a local terminology but also supplies one or more equivalents from well known terminologies (e.g. LOINC).", 0, java.lang.Integer.MAX_VALUE, mappingsList);
382        case -1613589672: /*language*/  return new Property("language", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Optional indicator of the localised language in which the value is written. Coded from openEHR Code Set languages . Only used when either the text object is in a different language from the enclosing ENTRY, or else the text object is being used outside of an ENTRY or other enclosing structure which indicates the language.", 0, 1, language);
383        case 1711222099: /*encoding*/  return new Property("encoding", "http://openehr.org/fhir/StructureDefinition/CODE-PHRASE", "Name of character encoding scheme in which this value is encoded. Coded from openEHR Code Set character sets . Unicode is the default assumption in openEHR, with UTF-8 being the assumed encoding. This attribute allows for variations from these assumptions.", 0, 1, encoding);
384        default: return super.getNamedProperty(_hash, _name, _checkValid);
385        }
386
387      }
388
389      @Override
390      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
391        switch (hash) {
392        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
393        case 751294566: /*hyperlink*/ return this.hyperlink == null ? new Base[0] : new Base[] {this.hyperlink}; // DV_URI
394        case 324761445: /*formatting*/ return this.formatting == null ? new Base[0] : new Base[] {this.formatting}; // StringType
395        case 194445669: /*mappings*/ return this.mappingsList == null ? new Base[0] : this.mappingsList.toArray(new Base[this.mappingsList.size()]); // TERM_MAPPING
396        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CODE_PHRASE
397        case 1711222099: /*encoding*/ return this.encoding == null ? new Base[0] : new Base[] {this.encoding}; // CODE_PHRASE
398        default: return super.getProperty(hash, name, checkValid);
399        }
400
401      }
402
403      @Override
404      public Base setProperty(int hash, String name, Base value) throws FHIRException {
405        switch (hash) {
406        case 111972721: // value
407          this.value = TypeConvertor.castToString(value); // StringType
408          return value;
409        case 751294566: // hyperlink
410          this.hyperlink = (DV_URI) value; // DV_URI
411          return value;
412        case 324761445: // formatting
413          this.formatting = TypeConvertor.castToString(value); // StringType
414          return value;
415        case 194445669: // mappings
416          this.getMappingsList().add((TERM_MAPPING) value); // TERM_MAPPING
417          return value;
418        case -1613589672: // language
419          this.language = (CODE_PHRASE) value; // CODE_PHRASE
420          return value;
421        case 1711222099: // encoding
422          this.encoding = (CODE_PHRASE) value; // CODE_PHRASE
423          return value;
424        default: return super.setProperty(hash, name, value);
425        }
426
427      }
428
429      @Override
430      public Base setProperty(String name, Base value) throws FHIRException {
431        if (name.equals("value")) {
432          this.value = TypeConvertor.castToString(value); // StringType
433        } else if (name.equals("hyperlink")) {
434          this.hyperlink = (DV_URI) value; // DV_URI
435        } else if (name.equals("formatting")) {
436          this.formatting = TypeConvertor.castToString(value); // StringType
437        } else if (name.equals("mappings")) {
438          this.getMappingsList().add((TERM_MAPPING) value); // TERM_MAPPING
439        } else if (name.equals("language")) {
440          this.language = (CODE_PHRASE) value; // CODE_PHRASE
441        } else if (name.equals("encoding")) {
442          this.encoding = (CODE_PHRASE) value; // CODE_PHRASE
443        } else
444          return super.setProperty(name, value);
445        return value;
446      }
447
448      @Override
449      public Base makeProperty(int hash, String name) throws FHIRException {
450        switch (hash) {
451        case 111972721:  return getValueElement();
452        case 751294566:  return getHyperlink();
453        case 324761445:  return getFormattingElement();
454        case 194445669:  return addMappings(); 
455        case -1613589672:  return getLanguage();
456        case 1711222099:  return getEncoding();
457        default: return super.makeProperty(hash, name);
458        }
459
460      }
461
462      @Override
463      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
464        switch (hash) {
465        case 111972721: /*value*/ return new String[] {"string"};
466        case 751294566: /*hyperlink*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/DV-URI"};
467        case 324761445: /*formatting*/ return new String[] {"string"};
468        case 194445669: /*mappings*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/TERM-MAPPING"};
469        case -1613589672: /*language*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/CODE-PHRASE"};
470        case 1711222099: /*encoding*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/CODE-PHRASE"};
471        default: return super.getTypesForProperty(hash, name);
472        }
473
474      }
475
476      @Override
477      public Base addChild(String name) throws FHIRException {
478        if (name.equals("value")) {
479          throw new FHIRException("Cannot call addChild on a singleton property DV_TEXT.value");
480        }
481        else if (name.equals("hyperlink")) {
482          this.hyperlink = new DV_URI();
483          return this.hyperlink;
484        }
485        else if (name.equals("formatting")) {
486          throw new FHIRException("Cannot call addChild on a singleton property DV_TEXT.formatting");
487        }
488        else if (name.equals("mappings")) {
489          return addMappings();
490        }
491        else if (name.equals("language")) {
492          this.language = new CODE_PHRASE();
493          return this.language;
494        }
495        else if (name.equals("encoding")) {
496          this.encoding = new CODE_PHRASE();
497          return this.encoding;
498        }
499        else
500          return super.addChild(name);
501      }
502
503  public String fhirType() {
504    return "DV_TEXT";
505
506  }
507
508      public DV_TEXT copy() {
509        DV_TEXT dst = new DV_TEXT();
510        copyValues(dst);
511        return dst;
512      }
513
514      public void copyValues(DV_TEXT dst) {
515        super.copyValues(dst);
516        dst.value = value == null ? null : value.copy();
517        dst.hyperlink = hyperlink == null ? null : hyperlink.copy();
518        dst.formatting = formatting == null ? null : formatting.copy();
519        if (mappingsList != null) {
520          dst.mappingsList = new ArrayList<TERM_MAPPING>();
521          for (TERM_MAPPING i : mappingsList)
522            dst.mappingsList.add(i.copy());
523        };
524        dst.language = language == null ? null : language.copy();
525        dst.encoding = encoding == null ? null : encoding.copy();
526      }
527
528      protected DV_TEXT typedCopy() {
529        return copy();
530      }
531
532      @Override
533      public boolean equalsDeep(Base other_) {
534        if (!super.equalsDeep(other_))
535          return false;
536        if (!(other_ instanceof DV_TEXT))
537          return false;
538        DV_TEXT o = (DV_TEXT) other_;
539        return compareDeep(value, o.value, true) && compareDeep(hyperlink, o.hyperlink, true) && compareDeep(formatting, o.formatting, true)
540           && compareDeep(mappingsList, o.mappingsList, true) && compareDeep(language, o.language, true) && compareDeep(encoding, o.encoding, true)
541          ;
542      }
543
544      @Override
545      public boolean equalsShallow(Base other_) {
546        if (!super.equalsShallow(other_))
547          return false;
548        if (!(other_ instanceof DV_TEXT))
549          return false;
550        DV_TEXT o = (DV_TEXT) other_;
551        return compareValues(value, o.value, true) && compareValues(formatting, o.formatting, true);
552      }
553
554      public boolean isEmpty() {
555        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, hyperlink, formatting
556          , mappingsList, language, encoding);
557      }
558
559
560}
561