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 * 
050 */
051@DatatypeDef(name="WebTemplateInputListItem")
052public class WebTemplateInputListItem extends LogicalBase implements ICompositeType {
053
054    /**
055     * 
056     */
057    @Child(name = "value", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=false)
058    @Description(shortDefinition="at-code of the specified item", formalDefinition="" )
059    protected CodeType value;
060
061    /**
062     * 
063     */
064    @Child(name = "label", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
065    @Description(shortDefinition="label of the item in the default language", formalDefinition="" )
066    protected StringType label;
067
068    /**
069     * 
070     */
071    @Child(name = "ordinal", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
072    @Description(shortDefinition="todo", formalDefinition="" )
073    protected StringType ordinal;
074
075    /**
076     * 
077     */
078    @Child(name = "localizedLabels", type = {TranslatedString.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
079    @Description(shortDefinition="labels in all specified languages", formalDefinition="" )
080    protected List<TranslatedString> localizedLabelsList;
081
082    /**
083     * 
084     */
085    @Child(name = "localizedDescriptions", type = {TranslatedString.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
086    @Description(shortDefinition="todo", formalDefinition="" )
087    protected List<TranslatedString> localizedDescriptionsList;
088
089    /**
090     * 
091     */
092    @Child(name = "currentStates", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=false)
093    @Description(shortDefinition="todo", formalDefinition="" )
094    protected StringType currentStates;
095
096    /**
097     * 
098     */
099    @Child(name = "range", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
100    @Description(shortDefinition="todo", formalDefinition="" )
101    protected StringType range;
102
103    /**
104     * 
105     */
106    @Child(name = "precision", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
107    @Description(shortDefinition="todo", formalDefinition="" )
108    protected StringType precision;
109
110    /**
111     * 
112     */
113    @Child(name = "termBindings", type = {WebTemplateTermBinding.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
114    @Description(shortDefinition="todo", formalDefinition="" )
115    protected List<WebTemplateTermBinding> termBindingsList;
116
117    private static final long serialVersionUID = 598072749L;
118
119  /**
120   * Constructor
121   */
122    public WebTemplateInputListItem() {
123      super();
124    }
125
126  /**
127   * Constructor
128   */
129    public WebTemplateInputListItem(String value) {
130      super();
131      this.setValue(value);
132    }
133
134    /**
135     * @return {@link #value} (). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
136     */
137    public CodeType getValueElement() { 
138      if (this.value == null)
139        if (Configuration.errorOnAutoCreate())
140          throw new Error("Attempt to auto-create WebTemplateInputListItem.value");
141        else if (Configuration.doAutoCreate())
142          this.value = new CodeType(); // bb
143      return this.value;
144    }
145
146    public boolean hasValueElement() { 
147      return this.value != null && !this.value.isEmpty();
148    }
149
150    public boolean hasValue() { 
151      return this.value != null && !this.value.isEmpty();
152    }
153
154    /**
155     * @param value {@link #value} (). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
156     */
157    public WebTemplateInputListItem setValueElement(CodeType value) { 
158      this.value = value;
159      return this;
160    }
161
162    /**
163     * @return 
164     */
165    public String getValue() { 
166      return this.value == null ? null : this.value.getValue();
167    }
168
169    /**
170     * @param value 
171     */
172    public WebTemplateInputListItem setValue(String value) { 
173        if (this.value == null)
174          this.value = new CodeType();
175        this.value.setValue(value);
176      return this;
177    }
178
179    /**
180     * @return {@link #label} (). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
181     */
182    public StringType getLabelElement() { 
183      if (this.label == null)
184        if (Configuration.errorOnAutoCreate())
185          throw new Error("Attempt to auto-create WebTemplateInputListItem.label");
186        else if (Configuration.doAutoCreate())
187          this.label = new StringType(); // bb
188      return this.label;
189    }
190
191    public boolean hasLabelElement() { 
192      return this.label != null && !this.label.isEmpty();
193    }
194
195    public boolean hasLabel() { 
196      return this.label != null && !this.label.isEmpty();
197    }
198
199    /**
200     * @param value {@link #label} (). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
201     */
202    public WebTemplateInputListItem setLabelElement(StringType value) { 
203      this.label = value;
204      return this;
205    }
206
207    /**
208     * @return 
209     */
210    public String getLabel() { 
211      return this.label == null ? null : this.label.getValue();
212    }
213
214    /**
215     * @param value 
216     */
217    public WebTemplateInputListItem setLabel(String value) { 
218      if (Utilities.noString(value))
219        this.label = null;
220      else {
221        if (this.label == null)
222          this.label = new StringType();
223        this.label.setValue(value);
224      }
225      return this;
226    }
227
228    /**
229     * @return {@link #ordinal} (). This is the underlying object with id, value and extensions. The accessor "getOrdinal" gives direct access to the value
230     */
231    public StringType getOrdinalElement() { 
232      if (this.ordinal == null)
233        if (Configuration.errorOnAutoCreate())
234          throw new Error("Attempt to auto-create WebTemplateInputListItem.ordinal");
235        else if (Configuration.doAutoCreate())
236          this.ordinal = new StringType(); // bb
237      return this.ordinal;
238    }
239
240    public boolean hasOrdinalElement() { 
241      return this.ordinal != null && !this.ordinal.isEmpty();
242    }
243
244    public boolean hasOrdinal() { 
245      return this.ordinal != null && !this.ordinal.isEmpty();
246    }
247
248    /**
249     * @param value {@link #ordinal} (). This is the underlying object with id, value and extensions. The accessor "getOrdinal" gives direct access to the value
250     */
251    public WebTemplateInputListItem setOrdinalElement(StringType value) { 
252      this.ordinal = value;
253      return this;
254    }
255
256    /**
257     * @return 
258     */
259    public String getOrdinal() { 
260      return this.ordinal == null ? null : this.ordinal.getValue();
261    }
262
263    /**
264     * @param value 
265     */
266    public WebTemplateInputListItem setOrdinal(String value) { 
267      if (Utilities.noString(value))
268        this.ordinal = null;
269      else {
270        if (this.ordinal == null)
271          this.ordinal = new StringType();
272        this.ordinal.setValue(value);
273      }
274      return this;
275    }
276
277    /**
278     * @return {@link #localizedLabels} ()
279     */
280    public List<TranslatedString> getLocalizedLabelsList() { 
281      if (this.localizedLabelsList == null)
282        this.localizedLabelsList = new ArrayList<TranslatedString>();
283      return this.localizedLabelsList;
284    }
285
286    /**
287     * @return Returns a reference to <code>this</code> for easy method chaining
288     */
289    public WebTemplateInputListItem setLocalizedLabelsList(List<TranslatedString> theLocalizedLabels) { 
290      this.localizedLabelsList = theLocalizedLabels;
291      return this;
292    }
293
294    public boolean hasLocalizedLabels() { 
295      if (this.localizedLabelsList == null)
296        return false;
297      for (TranslatedString item : this.localizedLabelsList)
298        if (!item.isEmpty())
299          return true;
300      return false;
301    }
302
303    public TranslatedString addLocalizedLabels() { //3a
304      TranslatedString t = new TranslatedString();
305      if (this.localizedLabelsList == null)
306        this.localizedLabelsList = new ArrayList<TranslatedString>();
307      this.localizedLabelsList.add(t);
308      return t;
309    }
310
311    public WebTemplateInputListItem addLocalizedLabels(TranslatedString t) { //3b
312      if (t == null)
313        return this;
314      if (this.localizedLabelsList == null)
315        this.localizedLabelsList = new ArrayList<TranslatedString>();
316      this.localizedLabelsList.add(t);
317      return this;
318    }
319
320    /**
321     * @return The first repetition of repeating field {@link #localizedLabels}, creating it if it does not already exist {3}
322     */
323    public TranslatedString getLocalizedLabelsFirstRep() { 
324      if (getLocalizedLabelsList().isEmpty()) {
325        addLocalizedLabels();
326      }
327      return getLocalizedLabelsList().get(0);
328    }
329
330    /**
331     * @return {@link #localizedDescriptions} ()
332     */
333    public List<TranslatedString> getLocalizedDescriptionsList() { 
334      if (this.localizedDescriptionsList == null)
335        this.localizedDescriptionsList = new ArrayList<TranslatedString>();
336      return this.localizedDescriptionsList;
337    }
338
339    /**
340     * @return Returns a reference to <code>this</code> for easy method chaining
341     */
342    public WebTemplateInputListItem setLocalizedDescriptionsList(List<TranslatedString> theLocalizedDescriptions) { 
343      this.localizedDescriptionsList = theLocalizedDescriptions;
344      return this;
345    }
346
347    public boolean hasLocalizedDescriptions() { 
348      if (this.localizedDescriptionsList == null)
349        return false;
350      for (TranslatedString item : this.localizedDescriptionsList)
351        if (!item.isEmpty())
352          return true;
353      return false;
354    }
355
356    public TranslatedString addLocalizedDescriptions() { //3a
357      TranslatedString t = new TranslatedString();
358      if (this.localizedDescriptionsList == null)
359        this.localizedDescriptionsList = new ArrayList<TranslatedString>();
360      this.localizedDescriptionsList.add(t);
361      return t;
362    }
363
364    public WebTemplateInputListItem addLocalizedDescriptions(TranslatedString t) { //3b
365      if (t == null)
366        return this;
367      if (this.localizedDescriptionsList == null)
368        this.localizedDescriptionsList = new ArrayList<TranslatedString>();
369      this.localizedDescriptionsList.add(t);
370      return this;
371    }
372
373    /**
374     * @return The first repetition of repeating field {@link #localizedDescriptions}, creating it if it does not already exist {3}
375     */
376    public TranslatedString getLocalizedDescriptionsFirstRep() { 
377      if (getLocalizedDescriptionsList().isEmpty()) {
378        addLocalizedDescriptions();
379      }
380      return getLocalizedDescriptionsList().get(0);
381    }
382
383    /**
384     * @return {@link #currentStates} (). This is the underlying object with id, value and extensions. The accessor "getCurrentStates" gives direct access to the value
385     */
386    public StringType getCurrentStatesElement() { 
387      if (this.currentStates == null)
388        if (Configuration.errorOnAutoCreate())
389          throw new Error("Attempt to auto-create WebTemplateInputListItem.currentStates");
390        else if (Configuration.doAutoCreate())
391          this.currentStates = new StringType(); // bb
392      return this.currentStates;
393    }
394
395    public boolean hasCurrentStatesElement() { 
396      return this.currentStates != null && !this.currentStates.isEmpty();
397    }
398
399    public boolean hasCurrentStates() { 
400      return this.currentStates != null && !this.currentStates.isEmpty();
401    }
402
403    /**
404     * @param value {@link #currentStates} (). This is the underlying object with id, value and extensions. The accessor "getCurrentStates" gives direct access to the value
405     */
406    public WebTemplateInputListItem setCurrentStatesElement(StringType value) { 
407      this.currentStates = value;
408      return this;
409    }
410
411    /**
412     * @return 
413     */
414    public String getCurrentStates() { 
415      return this.currentStates == null ? null : this.currentStates.getValue();
416    }
417
418    /**
419     * @param value 
420     */
421    public WebTemplateInputListItem setCurrentStates(String value) { 
422      if (Utilities.noString(value))
423        this.currentStates = null;
424      else {
425        if (this.currentStates == null)
426          this.currentStates = new StringType();
427        this.currentStates.setValue(value);
428      }
429      return this;
430    }
431
432    /**
433     * @return {@link #range} (). This is the underlying object with id, value and extensions. The accessor "getRange" gives direct access to the value
434     */
435    public StringType getRangeElement() { 
436      if (this.range == null)
437        if (Configuration.errorOnAutoCreate())
438          throw new Error("Attempt to auto-create WebTemplateInputListItem.range");
439        else if (Configuration.doAutoCreate())
440          this.range = new StringType(); // bb
441      return this.range;
442    }
443
444    public boolean hasRangeElement() { 
445      return this.range != null && !this.range.isEmpty();
446    }
447
448    public boolean hasRange() { 
449      return this.range != null && !this.range.isEmpty();
450    }
451
452    /**
453     * @param value {@link #range} (). This is the underlying object with id, value and extensions. The accessor "getRange" gives direct access to the value
454     */
455    public WebTemplateInputListItem setRangeElement(StringType value) { 
456      this.range = value;
457      return this;
458    }
459
460    /**
461     * @return 
462     */
463    public String getRange() { 
464      return this.range == null ? null : this.range.getValue();
465    }
466
467    /**
468     * @param value 
469     */
470    public WebTemplateInputListItem setRange(String value) { 
471      if (Utilities.noString(value))
472        this.range = null;
473      else {
474        if (this.range == null)
475          this.range = new StringType();
476        this.range.setValue(value);
477      }
478      return this;
479    }
480
481    /**
482     * @return {@link #precision} (). This is the underlying object with id, value and extensions. The accessor "getPrecision" gives direct access to the value
483     */
484    public StringType getPrecisionElement() { 
485      if (this.precision == null)
486        if (Configuration.errorOnAutoCreate())
487          throw new Error("Attempt to auto-create WebTemplateInputListItem.precision");
488        else if (Configuration.doAutoCreate())
489          this.precision = new StringType(); // bb
490      return this.precision;
491    }
492
493    public boolean hasPrecisionElement() { 
494      return this.precision != null && !this.precision.isEmpty();
495    }
496
497    public boolean hasPrecision() { 
498      return this.precision != null && !this.precision.isEmpty();
499    }
500
501    /**
502     * @param value {@link #precision} (). This is the underlying object with id, value and extensions. The accessor "getPrecision" gives direct access to the value
503     */
504    public WebTemplateInputListItem setPrecisionElement(StringType value) { 
505      this.precision = value;
506      return this;
507    }
508
509    /**
510     * @return 
511     */
512    public String getPrecision() { 
513      return this.precision == null ? null : this.precision.getValue();
514    }
515
516    /**
517     * @param value 
518     */
519    public WebTemplateInputListItem setPrecision(String value) { 
520      if (Utilities.noString(value))
521        this.precision = null;
522      else {
523        if (this.precision == null)
524          this.precision = new StringType();
525        this.precision.setValue(value);
526      }
527      return this;
528    }
529
530    /**
531     * @return {@link #termBindings} ()
532     */
533    public List<WebTemplateTermBinding> getTermBindingsList() { 
534      if (this.termBindingsList == null)
535        this.termBindingsList = new ArrayList<WebTemplateTermBinding>();
536      return this.termBindingsList;
537    }
538
539    /**
540     * @return Returns a reference to <code>this</code> for easy method chaining
541     */
542    public WebTemplateInputListItem setTermBindingsList(List<WebTemplateTermBinding> theTermBindings) { 
543      this.termBindingsList = theTermBindings;
544      return this;
545    }
546
547    public boolean hasTermBindings() { 
548      if (this.termBindingsList == null)
549        return false;
550      for (WebTemplateTermBinding item : this.termBindingsList)
551        if (!item.isEmpty())
552          return true;
553      return false;
554    }
555
556    public WebTemplateTermBinding addTermBindings() { //3a
557      WebTemplateTermBinding t = new WebTemplateTermBinding();
558      if (this.termBindingsList == null)
559        this.termBindingsList = new ArrayList<WebTemplateTermBinding>();
560      this.termBindingsList.add(t);
561      return t;
562    }
563
564    public WebTemplateInputListItem addTermBindings(WebTemplateTermBinding t) { //3b
565      if (t == null)
566        return this;
567      if (this.termBindingsList == null)
568        this.termBindingsList = new ArrayList<WebTemplateTermBinding>();
569      this.termBindingsList.add(t);
570      return this;
571    }
572
573    /**
574     * @return The first repetition of repeating field {@link #termBindings}, creating it if it does not already exist {3}
575     */
576    public WebTemplateTermBinding getTermBindingsFirstRep() { 
577      if (getTermBindingsList().isEmpty()) {
578        addTermBindings();
579      }
580      return getTermBindingsList().get(0);
581    }
582
583      protected void listChildren(List<Property> children) {
584        super.listChildren(children);
585        children.add(new Property("value", "code", "", 0, 1, value));
586        children.add(new Property("label", "string", "", 0, 1, label));
587        children.add(new Property("ordinal", "string", "", 0, 1, ordinal));
588        children.add(new Property("localizedLabels", "http://openehr.org/fhir/StructureDefinition/TranslatedString", "", 0, java.lang.Integer.MAX_VALUE, localizedLabelsList));
589        children.add(new Property("localizedDescriptions", "http://openehr.org/fhir/StructureDefinition/TranslatedString", "", 0, java.lang.Integer.MAX_VALUE, localizedDescriptionsList));
590        children.add(new Property("currentStates", "string", "", 0, 1, currentStates));
591        children.add(new Property("range", "string", "", 0, 1, range));
592        children.add(new Property("precision", "string", "", 0, 1, precision));
593        children.add(new Property("termBindings", "http://openehr.org/fhir/StructureDefinition/WebTemplateTermBinding", "", 0, java.lang.Integer.MAX_VALUE, termBindingsList));
594      }
595
596      @Override
597      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
598        switch (_hash) {
599        case 111972721: /*value*/  return new Property("value", "code", "", 0, 1, value);
600        case 102727412: /*label*/  return new Property("label", "string", "", 0, 1, label);
601        case -1206994319: /*ordinal*/  return new Property("ordinal", "string", "", 0, 1, ordinal);
602        case -689354918: /*localizedLabels*/  return new Property("localizedLabels", "http://openehr.org/fhir/StructureDefinition/TranslatedString", "", 0, java.lang.Integer.MAX_VALUE, localizedLabelsList);
603        case 31568658: /*localizedDescriptions*/  return new Property("localizedDescriptions", "http://openehr.org/fhir/StructureDefinition/TranslatedString", "", 0, java.lang.Integer.MAX_VALUE, localizedDescriptionsList);
604        case -2052146981: /*currentStates*/  return new Property("currentStates", "string", "", 0, 1, currentStates);
605        case 108280125: /*range*/  return new Property("range", "string", "", 0, 1, range);
606        case -1376177026: /*precision*/  return new Property("precision", "string", "", 0, 1, precision);
607        case 1618255642: /*termBindings*/  return new Property("termBindings", "http://openehr.org/fhir/StructureDefinition/WebTemplateTermBinding", "", 0, java.lang.Integer.MAX_VALUE, termBindingsList);
608        default: return super.getNamedProperty(_hash, _name, _checkValid);
609        }
610
611      }
612
613      @Override
614      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
615        switch (hash) {
616        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // CodeType
617        case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
618        case -1206994319: /*ordinal*/ return this.ordinal == null ? new Base[0] : new Base[] {this.ordinal}; // StringType
619        case -689354918: /*localizedLabels*/ return this.localizedLabelsList == null ? new Base[0] : this.localizedLabelsList.toArray(new Base[this.localizedLabelsList.size()]); // TranslatedString
620        case 31568658: /*localizedDescriptions*/ return this.localizedDescriptionsList == null ? new Base[0] : this.localizedDescriptionsList.toArray(new Base[this.localizedDescriptionsList.size()]); // TranslatedString
621        case -2052146981: /*currentStates*/ return this.currentStates == null ? new Base[0] : new Base[] {this.currentStates}; // StringType
622        case 108280125: /*range*/ return this.range == null ? new Base[0] : new Base[] {this.range}; // StringType
623        case -1376177026: /*precision*/ return this.precision == null ? new Base[0] : new Base[] {this.precision}; // StringType
624        case 1618255642: /*termBindings*/ return this.termBindingsList == null ? new Base[0] : this.termBindingsList.toArray(new Base[this.termBindingsList.size()]); // WebTemplateTermBinding
625        default: return super.getProperty(hash, name, checkValid);
626        }
627
628      }
629
630      @Override
631      public Base setProperty(int hash, String name, Base value) throws FHIRException {
632        switch (hash) {
633        case 111972721: // value
634          this.value = TypeConvertor.castToCode(value); // CodeType
635          return value;
636        case 102727412: // label
637          this.label = TypeConvertor.castToString(value); // StringType
638          return value;
639        case -1206994319: // ordinal
640          this.ordinal = TypeConvertor.castToString(value); // StringType
641          return value;
642        case -689354918: // localizedLabels
643          this.getLocalizedLabelsList().add((TranslatedString) value); // TranslatedString
644          return value;
645        case 31568658: // localizedDescriptions
646          this.getLocalizedDescriptionsList().add((TranslatedString) value); // TranslatedString
647          return value;
648        case -2052146981: // currentStates
649          this.currentStates = TypeConvertor.castToString(value); // StringType
650          return value;
651        case 108280125: // range
652          this.range = TypeConvertor.castToString(value); // StringType
653          return value;
654        case -1376177026: // precision
655          this.precision = TypeConvertor.castToString(value); // StringType
656          return value;
657        case 1618255642: // termBindings
658          this.getTermBindingsList().add((WebTemplateTermBinding) value); // WebTemplateTermBinding
659          return value;
660        default: return super.setProperty(hash, name, value);
661        }
662
663      }
664
665      @Override
666      public Base setProperty(String name, Base value) throws FHIRException {
667        if (name.equals("value")) {
668          this.value = TypeConvertor.castToCode(value); // CodeType
669        } else if (name.equals("label")) {
670          this.label = TypeConvertor.castToString(value); // StringType
671        } else if (name.equals("ordinal")) {
672          this.ordinal = TypeConvertor.castToString(value); // StringType
673        } else if (name.equals("localizedLabels")) {
674          this.getLocalizedLabelsList().add((TranslatedString) value); // TranslatedString
675        } else if (name.equals("localizedDescriptions")) {
676          this.getLocalizedDescriptionsList().add((TranslatedString) value); // TranslatedString
677        } else if (name.equals("currentStates")) {
678          this.currentStates = TypeConvertor.castToString(value); // StringType
679        } else if (name.equals("range")) {
680          this.range = TypeConvertor.castToString(value); // StringType
681        } else if (name.equals("precision")) {
682          this.precision = TypeConvertor.castToString(value); // StringType
683        } else if (name.equals("termBindings")) {
684          this.getTermBindingsList().add((WebTemplateTermBinding) value); // WebTemplateTermBinding
685        } else
686          return super.setProperty(name, value);
687        return value;
688      }
689
690      @Override
691      public Base makeProperty(int hash, String name) throws FHIRException {
692        switch (hash) {
693        case 111972721:  return getValueElement();
694        case 102727412:  return getLabelElement();
695        case -1206994319:  return getOrdinalElement();
696        case -689354918:  return addLocalizedLabels(); 
697        case 31568658:  return addLocalizedDescriptions(); 
698        case -2052146981:  return getCurrentStatesElement();
699        case 108280125:  return getRangeElement();
700        case -1376177026:  return getPrecisionElement();
701        case 1618255642:  return addTermBindings(); 
702        default: return super.makeProperty(hash, name);
703        }
704
705      }
706
707      @Override
708      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
709        switch (hash) {
710        case 111972721: /*value*/ return new String[] {"code"};
711        case 102727412: /*label*/ return new String[] {"string"};
712        case -1206994319: /*ordinal*/ return new String[] {"string"};
713        case -689354918: /*localizedLabels*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/TranslatedString"};
714        case 31568658: /*localizedDescriptions*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/TranslatedString"};
715        case -2052146981: /*currentStates*/ return new String[] {"string"};
716        case 108280125: /*range*/ return new String[] {"string"};
717        case -1376177026: /*precision*/ return new String[] {"string"};
718        case 1618255642: /*termBindings*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/WebTemplateTermBinding"};
719        default: return super.getTypesForProperty(hash, name);
720        }
721
722      }
723
724      @Override
725      public Base addChild(String name) throws FHIRException {
726        if (name.equals("value")) {
727          throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputListItem.value");
728        }
729        else if (name.equals("label")) {
730          throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputListItem.label");
731        }
732        else if (name.equals("ordinal")) {
733          throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputListItem.ordinal");
734        }
735        else if (name.equals("localizedLabels")) {
736          return addLocalizedLabels();
737        }
738        else if (name.equals("localizedDescriptions")) {
739          return addLocalizedDescriptions();
740        }
741        else if (name.equals("currentStates")) {
742          throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputListItem.currentStates");
743        }
744        else if (name.equals("range")) {
745          throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputListItem.range");
746        }
747        else if (name.equals("precision")) {
748          throw new FHIRException("Cannot call addChild on a singleton property WebTemplateInputListItem.precision");
749        }
750        else if (name.equals("termBindings")) {
751          return addTermBindings();
752        }
753        else
754          return super.addChild(name);
755      }
756
757  public String fhirType() {
758    return "WebTemplateInputListItem";
759
760  }
761
762      public WebTemplateInputListItem copy() {
763        WebTemplateInputListItem dst = new WebTemplateInputListItem();
764        copyValues(dst);
765        return dst;
766      }
767
768      public void copyValues(WebTemplateInputListItem dst) {
769        super.copyValues(dst);
770        dst.value = value == null ? null : value.copy();
771        dst.label = label == null ? null : label.copy();
772        dst.ordinal = ordinal == null ? null : ordinal.copy();
773        if (localizedLabelsList != null) {
774          dst.localizedLabelsList = new ArrayList<TranslatedString>();
775          for (TranslatedString i : localizedLabelsList)
776            dst.localizedLabelsList.add(i.copy());
777        };
778        if (localizedDescriptionsList != null) {
779          dst.localizedDescriptionsList = new ArrayList<TranslatedString>();
780          for (TranslatedString i : localizedDescriptionsList)
781            dst.localizedDescriptionsList.add(i.copy());
782        };
783        dst.currentStates = currentStates == null ? null : currentStates.copy();
784        dst.range = range == null ? null : range.copy();
785        dst.precision = precision == null ? null : precision.copy();
786        if (termBindingsList != null) {
787          dst.termBindingsList = new ArrayList<WebTemplateTermBinding>();
788          for (WebTemplateTermBinding i : termBindingsList)
789            dst.termBindingsList.add(i.copy());
790        };
791      }
792
793      protected WebTemplateInputListItem typedCopy() {
794        return copy();
795      }
796
797      @Override
798      public boolean equalsDeep(Base other_) {
799        if (!super.equalsDeep(other_))
800          return false;
801        if (!(other_ instanceof WebTemplateInputListItem))
802          return false;
803        WebTemplateInputListItem o = (WebTemplateInputListItem) other_;
804        return compareDeep(value, o.value, true) && compareDeep(label, o.label, true) && compareDeep(ordinal, o.ordinal, true)
805           && compareDeep(localizedLabelsList, o.localizedLabelsList, true) && compareDeep(localizedDescriptionsList, o.localizedDescriptionsList, true)
806           && compareDeep(currentStates, o.currentStates, true) && compareDeep(range, o.range, true) && compareDeep(precision, o.precision, true)
807           && compareDeep(termBindingsList, o.termBindingsList, true);
808      }
809
810      @Override
811      public boolean equalsShallow(Base other_) {
812        if (!super.equalsShallow(other_))
813          return false;
814        if (!(other_ instanceof WebTemplateInputListItem))
815          return false;
816        WebTemplateInputListItem o = (WebTemplateInputListItem) other_;
817        return compareValues(value, o.value, true) && compareValues(label, o.label, true) && compareValues(ordinal, o.ordinal, true)
818           && compareValues(currentStates, o.currentStates, true) && compareValues(range, o.range, true) && compareValues(precision, o.precision, true)
819          ;
820      }
821
822      public boolean isEmpty() {
823        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, label, ordinal, localizedLabelsList
824          , localizedDescriptionsList, currentStates, range, precision, termBindingsList);
825      }
826
827
828}
829