001package org.hl7.fhir.r5.model;
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 Tue, Dec 28, 2021 07:16+1100 for FHIR v5.0.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
040import org.hl7.fhir.exceptions.FHIRException;
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
048import org.hl7.fhir.instance.model.api.IBaseExtension;
049import  org.hl7.fhir.instance.model.api.IBaseDatatype;
050import  org.hl7.fhir.instance.model.api.IBaseHasExtensions;
051/**
052 * Base StructureDefinition for Extension Type: Optional Extension Element - found in all resources.
053 */
054@DatatypeDef(name="Extension")
055public class Extension extends BaseExtension implements IBaseExtension<Extension, DataType>, IBaseHasExtensions {
056
057    /**
058     * Source of the definition for the extension code - a logical name or a URL.
059     */
060    @Child(name = "url", type = {UriType.class}, order=0, min=1, max=1, modifier=false, summary=false)
061    @Description(shortDefinition="identifies the meaning of the extension", formalDefinition="Source of the definition for the extension code - a logical name or a URL." )
062    protected UriType url;
063
064    /**
065     * Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).
066     */
067    @Child(name = "value", type = {Base64BinaryType.class, BooleanType.class, CanonicalType.class, CodeType.class, DateType.class, DateTimeType.class, DecimalType.class, IdType.class, InstantType.class, IntegerType.class, Integer64Type.class, MarkdownType.class, OidType.class, PositiveIntType.class, StringType.class, TimeType.class, UnsignedIntType.class, UriType.class, UrlType.class, UuidType.class, Address.class, Age.class, Annotation.class, Attachment.class, CodeableConcept.class, CodeableReference.class, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.class, RatioRange.class, Reference.class, SampledData.class, Signature.class, Timing.class, ContactDetail.class, Contributor.class, DataRequirement.class, Expression.class, ParameterDefinition.class, RelatedArtifact.class, TriggerDefinition.class, UsageContext.class, Dosage.class, Meta.class}, order=1, min=0, max=1, modifier=false, summary=false)
068    @Description(shortDefinition="Value of extension", formalDefinition="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list)." )
069    protected DataType value;
070
071    private static final long serialVersionUID = 465890108L;
072
073  /**
074   * Constructor
075   */
076    public Extension() {
077      super();
078    }
079
080  /**
081   * Constructor
082   */
083    public Extension(String url) {
084      super();
085      this.setUrl(url);
086    }
087
088    /**
089     * Constructor
090     */
091    public Extension(String theUrl, IBaseDatatype theValue) {
092      setUrl(theUrl);
093      setValue(theValue);
094    }
095
096    /**
097     * @return {@link #url} (Source of the definition for the extension code - a logical name or a URL.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
098     */
099    public UriType getUrlElement() { 
100      if (this.url == null)
101        if (Configuration.errorOnAutoCreate())
102          throw new Error("Attempt to auto-create Extension.url");
103        else if (Configuration.doAutoCreate())
104          this.url = new UriType(); // bb
105      return this.url;
106    }
107
108    public boolean hasUrlElement() { 
109      return this.url != null && !this.url.isEmpty();
110    }
111
112    public boolean hasUrl() { 
113      return this.url != null && !this.url.isEmpty();
114    }
115
116    /**
117     * @param value {@link #url} (Source of the definition for the extension code - a logical name or a URL.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
118     */
119    public Extension setUrlElement(UriType value) { 
120      this.url = value;
121      return this;
122    }
123
124    /**
125     * @return Source of the definition for the extension code - a logical name or a URL.
126     */
127    public String getUrl() { 
128      return this.url == null ? null : this.url.getValue();
129    }
130
131    /**
132     * @param value Source of the definition for the extension code - a logical name or a URL.
133     */
134    public Extension setUrl(String value) { 
135        if (this.url == null)
136          this.url = new UriType();
137        this.url.setValue(value);
138      return this;
139    }
140
141    /**
142     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
143     */
144    public DataType getValue() { 
145      return this.value;
146    }
147
148    /**
149     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
150     */
151    public Base64BinaryType getValueBase64BinaryType() throws FHIRException { 
152      if (this.value == null)
153        this.value = new Base64BinaryType();
154      if (!(this.value instanceof Base64BinaryType))
155        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.value.getClass().getName()+" was encountered");
156      return (Base64BinaryType) this.value;
157    }
158
159    public boolean hasValueBase64BinaryType() { 
160      return this != null && this.value instanceof Base64BinaryType;
161    }
162
163    /**
164     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
165     */
166    public BooleanType getValueBooleanType() throws FHIRException { 
167      if (this.value == null)
168        this.value = new BooleanType();
169      if (!(this.value instanceof BooleanType))
170        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
171      return (BooleanType) this.value;
172    }
173
174    public boolean hasValueBooleanType() { 
175      return this != null && this.value instanceof BooleanType;
176    }
177
178    /**
179     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
180     */
181    public CanonicalType getValueCanonicalType() throws FHIRException { 
182      if (this.value == null)
183        this.value = new CanonicalType();
184      if (!(this.value instanceof CanonicalType))
185        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.value.getClass().getName()+" was encountered");
186      return (CanonicalType) this.value;
187    }
188
189    public boolean hasValueCanonicalType() { 
190      return this != null && this.value instanceof CanonicalType;
191    }
192
193    /**
194     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
195     */
196    public CodeType getValueCodeType() throws FHIRException { 
197      if (this.value == null)
198        this.value = new CodeType();
199      if (!(this.value instanceof CodeType))
200        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.value.getClass().getName()+" was encountered");
201      return (CodeType) this.value;
202    }
203
204    public boolean hasValueCodeType() { 
205      return this != null && this.value instanceof CodeType;
206    }
207
208    /**
209     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
210     */
211    public DateType getValueDateType() throws FHIRException { 
212      if (this.value == null)
213        this.value = new DateType();
214      if (!(this.value instanceof DateType))
215        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
216      return (DateType) this.value;
217    }
218
219    public boolean hasValueDateType() { 
220      return this != null && this.value instanceof DateType;
221    }
222
223    /**
224     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
225     */
226    public DateTimeType getValueDateTimeType() throws FHIRException { 
227      if (this.value == null)
228        this.value = new DateTimeType();
229      if (!(this.value instanceof DateTimeType))
230        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
231      return (DateTimeType) this.value;
232    }
233
234    public boolean hasValueDateTimeType() { 
235      return this != null && this.value instanceof DateTimeType;
236    }
237
238    /**
239     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
240     */
241    public DecimalType getValueDecimalType() throws FHIRException { 
242      if (this.value == null)
243        this.value = new DecimalType();
244      if (!(this.value instanceof DecimalType))
245        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
246      return (DecimalType) this.value;
247    }
248
249    public boolean hasValueDecimalType() { 
250      return this != null && this.value instanceof DecimalType;
251    }
252
253    /**
254     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
255     */
256    public IdType getValueIdType() throws FHIRException { 
257      if (this.value == null)
258        this.value = new IdType();
259      if (!(this.value instanceof IdType))
260        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.value.getClass().getName()+" was encountered");
261      return (IdType) this.value;
262    }
263
264    public boolean hasValueIdType() { 
265      return this != null && this.value instanceof IdType;
266    }
267
268    /**
269     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
270     */
271    public InstantType getValueInstantType() throws FHIRException { 
272      if (this.value == null)
273        this.value = new InstantType();
274      if (!(this.value instanceof InstantType))
275        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.value.getClass().getName()+" was encountered");
276      return (InstantType) this.value;
277    }
278
279    public boolean hasValueInstantType() { 
280      return this != null && this.value instanceof InstantType;
281    }
282
283    /**
284     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
285     */
286    public IntegerType getValueIntegerType() throws FHIRException { 
287      if (this.value == null)
288        this.value = new IntegerType();
289      if (!(this.value instanceof IntegerType))
290        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
291      return (IntegerType) this.value;
292    }
293
294    public boolean hasValueIntegerType() { 
295      return this != null && this.value instanceof IntegerType;
296    }
297
298    /**
299     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
300     */
301    public Integer64Type getValueInteger64Type() throws FHIRException { 
302      if (this.value == null)
303        this.value = new Integer64Type();
304      if (!(this.value instanceof Integer64Type))
305        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.value.getClass().getName()+" was encountered");
306      return (Integer64Type) this.value;
307    }
308
309    public boolean hasValueInteger64Type() { 
310      return this != null && this.value instanceof Integer64Type;
311    }
312
313    /**
314     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
315     */
316    public MarkdownType getValueMarkdownType() throws FHIRException { 
317      if (this.value == null)
318        this.value = new MarkdownType();
319      if (!(this.value instanceof MarkdownType))
320        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.value.getClass().getName()+" was encountered");
321      return (MarkdownType) this.value;
322    }
323
324    public boolean hasValueMarkdownType() { 
325      return this != null && this.value instanceof MarkdownType;
326    }
327
328    /**
329     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
330     */
331    public OidType getValueOidType() throws FHIRException { 
332      if (this.value == null)
333        this.value = new OidType();
334      if (!(this.value instanceof OidType))
335        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.value.getClass().getName()+" was encountered");
336      return (OidType) this.value;
337    }
338
339    public boolean hasValueOidType() { 
340      return this != null && this.value instanceof OidType;
341    }
342
343    /**
344     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
345     */
346    public PositiveIntType getValuePositiveIntType() throws FHIRException { 
347      if (this.value == null)
348        this.value = new PositiveIntType();
349      if (!(this.value instanceof PositiveIntType))
350        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.value.getClass().getName()+" was encountered");
351      return (PositiveIntType) this.value;
352    }
353
354    public boolean hasValuePositiveIntType() { 
355      return this != null && this.value instanceof PositiveIntType;
356    }
357
358    /**
359     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
360     */
361    public StringType getValueStringType() throws FHIRException { 
362      if (this.value == null)
363        this.value = new StringType();
364      if (!(this.value instanceof StringType))
365        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
366      return (StringType) this.value;
367    }
368
369    public boolean hasValueStringType() { 
370      return this != null && this.value instanceof StringType;
371    }
372
373    /**
374     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
375     */
376    public TimeType getValueTimeType() throws FHIRException { 
377      if (this.value == null)
378        this.value = new TimeType();
379      if (!(this.value instanceof TimeType))
380        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
381      return (TimeType) this.value;
382    }
383
384    public boolean hasValueTimeType() { 
385      return this != null && this.value instanceof TimeType;
386    }
387
388    /**
389     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
390     */
391    public UnsignedIntType getValueUnsignedIntType() throws FHIRException { 
392      if (this.value == null)
393        this.value = new UnsignedIntType();
394      if (!(this.value instanceof UnsignedIntType))
395        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.value.getClass().getName()+" was encountered");
396      return (UnsignedIntType) this.value;
397    }
398
399    public boolean hasValueUnsignedIntType() { 
400      return this != null && this.value instanceof UnsignedIntType;
401    }
402
403    /**
404     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
405     */
406    public UriType getValueUriType() throws FHIRException { 
407      if (this.value == null)
408        this.value = new UriType();
409      if (!(this.value instanceof UriType))
410        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
411      return (UriType) this.value;
412    }
413
414    public boolean hasValueUriType() { 
415      return this != null && this.value instanceof UriType;
416    }
417
418    /**
419     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
420     */
421    public UrlType getValueUrlType() throws FHIRException { 
422      if (this.value == null)
423        this.value = new UrlType();
424      if (!(this.value instanceof UrlType))
425        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.value.getClass().getName()+" was encountered");
426      return (UrlType) this.value;
427    }
428
429    public boolean hasValueUrlType() { 
430      return this != null && this.value instanceof UrlType;
431    }
432
433    /**
434     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
435     */
436    public UuidType getValueUuidType() throws FHIRException { 
437      if (this.value == null)
438        this.value = new UuidType();
439      if (!(this.value instanceof UuidType))
440        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.value.getClass().getName()+" was encountered");
441      return (UuidType) this.value;
442    }
443
444    public boolean hasValueUuidType() { 
445      return this != null && this.value instanceof UuidType;
446    }
447
448    /**
449     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
450     */
451    public Address getValueAddress() throws FHIRException { 
452      if (this.value == null)
453        this.value = new Address();
454      if (!(this.value instanceof Address))
455        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.value.getClass().getName()+" was encountered");
456      return (Address) this.value;
457    }
458
459    public boolean hasValueAddress() { 
460      return this != null && this.value instanceof Address;
461    }
462
463    /**
464     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
465     */
466    public Age getValueAge() throws FHIRException { 
467      if (this.value == null)
468        this.value = new Age();
469      if (!(this.value instanceof Age))
470        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.value.getClass().getName()+" was encountered");
471      return (Age) this.value;
472    }
473
474    public boolean hasValueAge() { 
475      return this != null && this.value instanceof Age;
476    }
477
478    /**
479     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
480     */
481    public Annotation getValueAnnotation() throws FHIRException { 
482      if (this.value == null)
483        this.value = new Annotation();
484      if (!(this.value instanceof Annotation))
485        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.value.getClass().getName()+" was encountered");
486      return (Annotation) this.value;
487    }
488
489    public boolean hasValueAnnotation() { 
490      return this != null && this.value instanceof Annotation;
491    }
492
493    /**
494     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
495     */
496    public Attachment getValueAttachment() throws FHIRException { 
497      if (this.value == null)
498        this.value = new Attachment();
499      if (!(this.value instanceof Attachment))
500        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
501      return (Attachment) this.value;
502    }
503
504    public boolean hasValueAttachment() { 
505      return this != null && this.value instanceof Attachment;
506    }
507
508    /**
509     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
510     */
511    public CodeableConcept getValueCodeableConcept() throws FHIRException { 
512      if (this.value == null)
513        this.value = new CodeableConcept();
514      if (!(this.value instanceof CodeableConcept))
515        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
516      return (CodeableConcept) this.value;
517    }
518
519    public boolean hasValueCodeableConcept() { 
520      return this != null && this.value instanceof CodeableConcept;
521    }
522
523    /**
524     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
525     */
526    public CodeableReference getValueCodeableReference() throws FHIRException { 
527      if (this.value == null)
528        this.value = new CodeableReference();
529      if (!(this.value instanceof CodeableReference))
530        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.value.getClass().getName()+" was encountered");
531      return (CodeableReference) this.value;
532    }
533
534    public boolean hasValueCodeableReference() { 
535      return this != null && this.value instanceof CodeableReference;
536    }
537
538    /**
539     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
540     */
541    public Coding getValueCoding() throws FHIRException { 
542      if (this.value == null)
543        this.value = new Coding();
544      if (!(this.value instanceof Coding))
545        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
546      return (Coding) this.value;
547    }
548
549    public boolean hasValueCoding() { 
550      return this != null && this.value instanceof Coding;
551    }
552
553    /**
554     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
555     */
556    public ContactPoint getValueContactPoint() throws FHIRException { 
557      if (this.value == null)
558        this.value = new ContactPoint();
559      if (!(this.value instanceof ContactPoint))
560        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.value.getClass().getName()+" was encountered");
561      return (ContactPoint) this.value;
562    }
563
564    public boolean hasValueContactPoint() { 
565      return this != null && this.value instanceof ContactPoint;
566    }
567
568    /**
569     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
570     */
571    public Count getValueCount() throws FHIRException { 
572      if (this.value == null)
573        this.value = new Count();
574      if (!(this.value instanceof Count))
575        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.value.getClass().getName()+" was encountered");
576      return (Count) this.value;
577    }
578
579    public boolean hasValueCount() { 
580      return this != null && this.value instanceof Count;
581    }
582
583    /**
584     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
585     */
586    public Distance getValueDistance() throws FHIRException { 
587      if (this.value == null)
588        this.value = new Distance();
589      if (!(this.value instanceof Distance))
590        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.value.getClass().getName()+" was encountered");
591      return (Distance) this.value;
592    }
593
594    public boolean hasValueDistance() { 
595      return this != null && this.value instanceof Distance;
596    }
597
598    /**
599     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
600     */
601    public Duration getValueDuration() throws FHIRException { 
602      if (this.value == null)
603        this.value = new Duration();
604      if (!(this.value instanceof Duration))
605        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
606      return (Duration) this.value;
607    }
608
609    public boolean hasValueDuration() { 
610      return this != null && this.value instanceof Duration;
611    }
612
613    /**
614     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
615     */
616    public HumanName getValueHumanName() throws FHIRException { 
617      if (this.value == null)
618        this.value = new HumanName();
619      if (!(this.value instanceof HumanName))
620        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.value.getClass().getName()+" was encountered");
621      return (HumanName) this.value;
622    }
623
624    public boolean hasValueHumanName() { 
625      return this != null && this.value instanceof HumanName;
626    }
627
628    /**
629     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
630     */
631    public Identifier getValueIdentifier() throws FHIRException { 
632      if (this.value == null)
633        this.value = new Identifier();
634      if (!(this.value instanceof Identifier))
635        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.value.getClass().getName()+" was encountered");
636      return (Identifier) this.value;
637    }
638
639    public boolean hasValueIdentifier() { 
640      return this != null && this.value instanceof Identifier;
641    }
642
643    /**
644     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
645     */
646    public Money getValueMoney() throws FHIRException { 
647      if (this.value == null)
648        this.value = new Money();
649      if (!(this.value instanceof Money))
650        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.value.getClass().getName()+" was encountered");
651      return (Money) this.value;
652    }
653
654    public boolean hasValueMoney() { 
655      return this != null && this.value instanceof Money;
656    }
657
658    /**
659     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
660     */
661    public Period getValuePeriod() throws FHIRException { 
662      if (this.value == null)
663        this.value = new Period();
664      if (!(this.value instanceof Period))
665        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
666      return (Period) this.value;
667    }
668
669    public boolean hasValuePeriod() { 
670      return this != null && this.value instanceof Period;
671    }
672
673    /**
674     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
675     */
676    public Quantity getValueQuantity() throws FHIRException { 
677      if (this.value == null)
678        this.value = new Quantity();
679      if (!(this.value instanceof Quantity))
680        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
681      return (Quantity) this.value;
682    }
683
684    public boolean hasValueQuantity() { 
685      return this != null && this.value instanceof Quantity;
686    }
687
688    /**
689     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
690     */
691    public Range getValueRange() throws FHIRException { 
692      if (this.value == null)
693        this.value = new Range();
694      if (!(this.value instanceof Range))
695        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
696      return (Range) this.value;
697    }
698
699    public boolean hasValueRange() { 
700      return this != null && this.value instanceof Range;
701    }
702
703    /**
704     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
705     */
706    public Ratio getValueRatio() throws FHIRException { 
707      if (this.value == null)
708        this.value = new Ratio();
709      if (!(this.value instanceof Ratio))
710        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
711      return (Ratio) this.value;
712    }
713
714    public boolean hasValueRatio() { 
715      return this != null && this.value instanceof Ratio;
716    }
717
718    /**
719     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
720     */
721    public RatioRange getValueRatioRange() throws FHIRException { 
722      if (this.value == null)
723        this.value = new RatioRange();
724      if (!(this.value instanceof RatioRange))
725        throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.value.getClass().getName()+" was encountered");
726      return (RatioRange) this.value;
727    }
728
729    public boolean hasValueRatioRange() { 
730      return this != null && this.value instanceof RatioRange;
731    }
732
733    /**
734     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
735     */
736    public Reference getValueReference() throws FHIRException { 
737      if (this.value == null)
738        this.value = new Reference();
739      if (!(this.value instanceof Reference))
740        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
741      return (Reference) this.value;
742    }
743
744    public boolean hasValueReference() { 
745      return this != null && this.value instanceof Reference;
746    }
747
748    /**
749     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
750     */
751    public SampledData getValueSampledData() throws FHIRException { 
752      if (this.value == null)
753        this.value = new SampledData();
754      if (!(this.value instanceof SampledData))
755        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered");
756      return (SampledData) this.value;
757    }
758
759    public boolean hasValueSampledData() { 
760      return this != null && this.value instanceof SampledData;
761    }
762
763    /**
764     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
765     */
766    public Signature getValueSignature() throws FHIRException { 
767      if (this.value == null)
768        this.value = new Signature();
769      if (!(this.value instanceof Signature))
770        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.value.getClass().getName()+" was encountered");
771      return (Signature) this.value;
772    }
773
774    public boolean hasValueSignature() { 
775      return this != null && this.value instanceof Signature;
776    }
777
778    /**
779     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
780     */
781    public Timing getValueTiming() throws FHIRException { 
782      if (this.value == null)
783        this.value = new Timing();
784      if (!(this.value instanceof Timing))
785        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.value.getClass().getName()+" was encountered");
786      return (Timing) this.value;
787    }
788
789    public boolean hasValueTiming() { 
790      return this != null && this.value instanceof Timing;
791    }
792
793    /**
794     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
795     */
796    public ContactDetail getValueContactDetail() throws FHIRException { 
797      if (this.value == null)
798        this.value = new ContactDetail();
799      if (!(this.value instanceof ContactDetail))
800        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.value.getClass().getName()+" was encountered");
801      return (ContactDetail) this.value;
802    }
803
804    public boolean hasValueContactDetail() { 
805      return this != null && this.value instanceof ContactDetail;
806    }
807
808    /**
809     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
810     */
811    public Contributor getValueContributor() throws FHIRException { 
812      if (this.value == null)
813        this.value = new Contributor();
814      if (!(this.value instanceof Contributor))
815        throw new FHIRException("Type mismatch: the type Contributor was expected, but "+this.value.getClass().getName()+" was encountered");
816      return (Contributor) this.value;
817    }
818
819    public boolean hasValueContributor() { 
820      return this != null && this.value instanceof Contributor;
821    }
822
823    /**
824     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
825     */
826    public DataRequirement getValueDataRequirement() throws FHIRException { 
827      if (this.value == null)
828        this.value = new DataRequirement();
829      if (!(this.value instanceof DataRequirement))
830        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.value.getClass().getName()+" was encountered");
831      return (DataRequirement) this.value;
832    }
833
834    public boolean hasValueDataRequirement() { 
835      return this != null && this.value instanceof DataRequirement;
836    }
837
838    /**
839     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
840     */
841    public Expression getValueExpression() throws FHIRException { 
842      if (this.value == null)
843        this.value = new Expression();
844      if (!(this.value instanceof Expression))
845        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.value.getClass().getName()+" was encountered");
846      return (Expression) this.value;
847    }
848
849    public boolean hasValueExpression() { 
850      return this != null && this.value instanceof Expression;
851    }
852
853    /**
854     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
855     */
856    public ParameterDefinition getValueParameterDefinition() throws FHIRException { 
857      if (this.value == null)
858        this.value = new ParameterDefinition();
859      if (!(this.value instanceof ParameterDefinition))
860        throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
861      return (ParameterDefinition) this.value;
862    }
863
864    public boolean hasValueParameterDefinition() { 
865      return this != null && this.value instanceof ParameterDefinition;
866    }
867
868    /**
869     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
870     */
871    public RelatedArtifact getValueRelatedArtifact() throws FHIRException { 
872      if (this.value == null)
873        this.value = new RelatedArtifact();
874      if (!(this.value instanceof RelatedArtifact))
875        throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.value.getClass().getName()+" was encountered");
876      return (RelatedArtifact) this.value;
877    }
878
879    public boolean hasValueRelatedArtifact() { 
880      return this != null && this.value instanceof RelatedArtifact;
881    }
882
883    /**
884     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
885     */
886    public TriggerDefinition getValueTriggerDefinition() throws FHIRException { 
887      if (this.value == null)
888        this.value = new TriggerDefinition();
889      if (!(this.value instanceof TriggerDefinition))
890        throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
891      return (TriggerDefinition) this.value;
892    }
893
894    public boolean hasValueTriggerDefinition() { 
895      return this != null && this.value instanceof TriggerDefinition;
896    }
897
898    /**
899     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
900     */
901    public UsageContext getValueUsageContext() throws FHIRException { 
902      if (this.value == null)
903        this.value = new UsageContext();
904      if (!(this.value instanceof UsageContext))
905        throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.value.getClass().getName()+" was encountered");
906      return (UsageContext) this.value;
907    }
908
909    public boolean hasValueUsageContext() { 
910      return this != null && this.value instanceof UsageContext;
911    }
912
913    /**
914     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
915     */
916    public Dosage getValueDosage() throws FHIRException { 
917      if (this.value == null)
918        this.value = new Dosage();
919      if (!(this.value instanceof Dosage))
920        throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.value.getClass().getName()+" was encountered");
921      return (Dosage) this.value;
922    }
923
924    public boolean hasValueDosage() { 
925      return this != null && this.value instanceof Dosage;
926    }
927
928    /**
929     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
930     */
931    public Meta getValueMeta() throws FHIRException { 
932      if (this.value == null)
933        this.value = new Meta();
934      if (!(this.value instanceof Meta))
935        throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.value.getClass().getName()+" was encountered");
936      return (Meta) this.value;
937    }
938
939    public boolean hasValueMeta() { 
940      return this != null && this.value instanceof Meta;
941    }
942
943    public boolean hasValue() { 
944      return this.value != null && !this.value.isEmpty();
945    }
946
947    /**
948     * @param value {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
949     */
950    public Extension setValue(DataType value) { 
951      if (value != null && !(value instanceof Base64BinaryType || value instanceof BooleanType || value instanceof CanonicalType || value instanceof CodeType || value instanceof DateType || value instanceof DateTimeType || value instanceof DecimalType || value instanceof IdType || value instanceof InstantType || value instanceof IntegerType || value instanceof Integer64Type || value instanceof MarkdownType || value instanceof OidType || value instanceof PositiveIntType || value instanceof StringType || value instanceof TimeType || value instanceof UnsignedIntType || value instanceof UriType || value instanceof UrlType || value instanceof UuidType || value instanceof Address || value instanceof Age || value instanceof Annotation || value instanceof Attachment || value instanceof CodeableConcept || value instanceof CodeableReference || value instanceof Coding || value instanceof ContactPoint || value instanceof Count || value instanceof Distance || value instanceof Duration || value instanceof HumanName || value instanceof Identifier || value instanceof Money || value instanceof Period || value instanceof Quantity || value instanceof Range || value instanceof Ratio || value instanceof RatioRange || value instanceof Reference || value instanceof SampledData || value instanceof Signature || value instanceof Timing || value instanceof ContactDetail || value instanceof Contributor || value instanceof DataRequirement || value instanceof Expression || value instanceof ParameterDefinition || value instanceof RelatedArtifact || value instanceof TriggerDefinition || value instanceof UsageContext || value instanceof Dosage || value instanceof Meta))
952        throw new Error("Not the right type for Extension.value[x]: "+value.fhirType());
953      this.value = value;
954      return this;
955    }
956
957      protected void listChildren(List<Property> children) {
958        super.listChildren(children);
959        children.add(new Property("url", "uri", "Source of the definition for the extension code - a logical name or a URL.", 0, 1, url));
960        children.add(new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|Contributor|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Dosage|Meta", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value));
961      }
962
963      @Override
964      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
965        switch (_hash) {
966        case 116079: /*url*/  return new Property("url", "uri", "Source of the definition for the extension code - a logical name or a URL.", 0, 1, url);
967        case -1410166417: /*value[x]*/  return new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|Contributor|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Dosage|Meta", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
968        case 111972721: /*value*/  return new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|integer64|markdown|oid|positiveInt|string|time|unsignedInt|uri|url|uuid|Address|Age|Annotation|Attachment|CodeableConcept|CodeableReference|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|RatioRange|Reference|SampledData|Signature|Timing|ContactDetail|Contributor|DataRequirement|Expression|ParameterDefinition|RelatedArtifact|TriggerDefinition|UsageContext|Dosage|Meta", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
969        case -1535024575: /*valueBase64Binary*/  return new Property("value[x]", "base64Binary", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
970        case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
971        case -786218365: /*valueCanonical*/  return new Property("value[x]", "canonical", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
972        case -766209282: /*valueCode*/  return new Property("value[x]", "code", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
973        case -766192449: /*valueDate*/  return new Property("value[x]", "date", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
974        case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
975        case -2083993440: /*valueDecimal*/  return new Property("value[x]", "decimal", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
976        case 231604844: /*valueId*/  return new Property("value[x]", "id", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
977        case -1668687056: /*valueInstant*/  return new Property("value[x]", "instant", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
978        case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
979        case -1122120181: /*valueInteger64*/  return new Property("value[x]", "integer64", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
980        case -497880704: /*valueMarkdown*/  return new Property("value[x]", "markdown", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
981        case -1410178407: /*valueOid*/  return new Property("value[x]", "oid", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
982        case -1249932027: /*valuePositiveInt*/  return new Property("value[x]", "positiveInt", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
983        case -1424603934: /*valueString*/  return new Property("value[x]", "string", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
984        case -765708322: /*valueTime*/  return new Property("value[x]", "time", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
985        case 26529417: /*valueUnsignedInt*/  return new Property("value[x]", "unsignedInt", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
986        case -1410172357: /*valueUri*/  return new Property("value[x]", "uri", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
987        case -1410172354: /*valueUrl*/  return new Property("value[x]", "url", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
988        case -765667124: /*valueUuid*/  return new Property("value[x]", "uuid", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
989        case -478981821: /*valueAddress*/  return new Property("value[x]", "Address", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
990        case -1410191922: /*valueAge*/  return new Property("value[x]", "Age", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
991        case -67108992: /*valueAnnotation*/  return new Property("value[x]", "Annotation", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
992        case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
993        case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
994        case -257955629: /*valueCodeableReference*/  return new Property("value[x]", "CodeableReference", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
995        case -1887705029: /*valueCoding*/  return new Property("value[x]", "Coding", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
996        case 944904545: /*valueContactPoint*/  return new Property("value[x]", "ContactPoint", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
997        case 2017332766: /*valueCount*/  return new Property("value[x]", "Count", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
998        case -456359802: /*valueDistance*/  return new Property("value[x]", "Distance", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
999        case 1558135333: /*valueDuration*/  return new Property("value[x]", "Duration", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1000        case -2026205465: /*valueHumanName*/  return new Property("value[x]", "HumanName", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1001        case -130498310: /*valueIdentifier*/  return new Property("value[x]", "Identifier", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1002        case 2026560975: /*valueMoney*/  return new Property("value[x]", "Money", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1003        case -1524344174: /*valuePeriod*/  return new Property("value[x]", "Period", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1004        case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1005        case 2030761548: /*valueRange*/  return new Property("value[x]", "Range", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1006        case 2030767386: /*valueRatio*/  return new Property("value[x]", "Ratio", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1007        case -706454461: /*valueRatioRange*/  return new Property("value[x]", "RatioRange", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1008        case 1755241690: /*valueReference*/  return new Property("value[x]", "Reference", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1009        case -962229101: /*valueSampledData*/  return new Property("value[x]", "SampledData", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1010        case -540985785: /*valueSignature*/  return new Property("value[x]", "Signature", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1011        case -1406282469: /*valueTiming*/  return new Property("value[x]", "Timing", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1012        case -1125200224: /*valueContactDetail*/  return new Property("value[x]", "ContactDetail", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1013        case 1281021610: /*valueContributor*/  return new Property("value[x]", "Contributor", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1014        case 1710554248: /*valueDataRequirement*/  return new Property("value[x]", "DataRequirement", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1015        case -307517719: /*valueExpression*/  return new Property("value[x]", "Expression", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1016        case 1387478187: /*valueParameterDefinition*/  return new Property("value[x]", "ParameterDefinition", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1017        case 1748214124: /*valueRelatedArtifact*/  return new Property("value[x]", "RelatedArtifact", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1018        case 976830394: /*valueTriggerDefinition*/  return new Property("value[x]", "TriggerDefinition", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1019        case 588000479: /*valueUsageContext*/  return new Property("value[x]", "UsageContext", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1020        case -1858636920: /*valueDosage*/  return new Property("value[x]", "Dosage", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1021        case -765920490: /*valueMeta*/  return new Property("value[x]", "Meta", "Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", 0, 1, value);
1022        default: return super.getNamedProperty(_hash, _name, _checkValid);
1023        }
1024
1025      }
1026
1027      @Override
1028      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1029        switch (hash) {
1030        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
1031        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1032        default: return super.getProperty(hash, name, checkValid);
1033        }
1034
1035      }
1036
1037      @Override
1038      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1039        switch (hash) {
1040        case 116079: // url
1041          this.url = TypeConvertor.castToUri(value); // UriType
1042          return value;
1043        case 111972721: // value
1044          this.value = TypeConvertor.castToType(value); // DataType
1045          return value;
1046        default: return super.setProperty(hash, name, value);
1047        }
1048
1049      }
1050
1051      @Override
1052      public Base setProperty(String name, Base value) throws FHIRException {
1053        if (name.equals("url")) {
1054          this.url = TypeConvertor.castToUri(value); // UriType
1055        } else if (name.equals("value[x]")) {
1056          this.value = TypeConvertor.castToType(value); // DataType
1057        } else
1058          return super.setProperty(name, value);
1059        return value;
1060      }
1061
1062      @Override
1063      public Base makeProperty(int hash, String name) throws FHIRException {
1064        switch (hash) {
1065        case 116079:  return getUrlElement();
1066        case -1410166417:  return getValue();
1067        case 111972721:  return getValue();
1068        default: return super.makeProperty(hash, name);
1069        }
1070
1071      }
1072
1073      @Override
1074      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1075        switch (hash) {
1076        case 116079: /*url*/ return new String[] {"uri"};
1077        case 111972721: /*value*/ return new String[] {"base64Binary", "boolean", "canonical", "code", "date", "dateTime", "decimal", "id", "instant", "integer", "integer64", "markdown", "oid", "positiveInt", "string", "time", "unsignedInt", "uri", "url", "uuid", "Address", "Age", "Annotation", "Attachment", "CodeableConcept", "CodeableReference", "Coding", "ContactPoint", "Count", "Distance", "Duration", "HumanName", "Identifier", "Money", "Period", "Quantity", "Range", "Ratio", "RatioRange", "Reference", "SampledData", "Signature", "Timing", "ContactDetail", "Contributor", "DataRequirement", "Expression", "ParameterDefinition", "RelatedArtifact", "TriggerDefinition", "UsageContext", "Dosage", "Meta"};
1078        default: return super.getTypesForProperty(hash, name);
1079        }
1080
1081      }
1082
1083      @Override
1084      public Base addChild(String name) throws FHIRException {
1085        if (name.equals("url")) {
1086          throw new FHIRException("Cannot call addChild on a primitive type Extension.url");
1087        }
1088        else if (name.equals("valueBase64Binary")) {
1089          this.value = new Base64BinaryType();
1090          return this.value;
1091        }
1092        else if (name.equals("valueBoolean")) {
1093          this.value = new BooleanType();
1094          return this.value;
1095        }
1096        else if (name.equals("valueCanonical")) {
1097          this.value = new CanonicalType();
1098          return this.value;
1099        }
1100        else if (name.equals("valueCode")) {
1101          this.value = new CodeType();
1102          return this.value;
1103        }
1104        else if (name.equals("valueDate")) {
1105          this.value = new DateType();
1106          return this.value;
1107        }
1108        else if (name.equals("valueDateTime")) {
1109          this.value = new DateTimeType();
1110          return this.value;
1111        }
1112        else if (name.equals("valueDecimal")) {
1113          this.value = new DecimalType();
1114          return this.value;
1115        }
1116        else if (name.equals("valueId")) {
1117          this.value = new IdType();
1118          return this.value;
1119        }
1120        else if (name.equals("valueInstant")) {
1121          this.value = new InstantType();
1122          return this.value;
1123        }
1124        else if (name.equals("valueInteger")) {
1125          this.value = new IntegerType();
1126          return this.value;
1127        }
1128        else if (name.equals("valueInteger64")) {
1129          this.value = new Integer64Type();
1130          return this.value;
1131        }
1132        else if (name.equals("valueMarkdown")) {
1133          this.value = new MarkdownType();
1134          return this.value;
1135        }
1136        else if (name.equals("valueOid")) {
1137          this.value = new OidType();
1138          return this.value;
1139        }
1140        else if (name.equals("valuePositiveInt")) {
1141          this.value = new PositiveIntType();
1142          return this.value;
1143        }
1144        else if (name.equals("valueString")) {
1145          this.value = new StringType();
1146          return this.value;
1147        }
1148        else if (name.equals("valueTime")) {
1149          this.value = new TimeType();
1150          return this.value;
1151        }
1152        else if (name.equals("valueUnsignedInt")) {
1153          this.value = new UnsignedIntType();
1154          return this.value;
1155        }
1156        else if (name.equals("valueUri")) {
1157          this.value = new UriType();
1158          return this.value;
1159        }
1160        else if (name.equals("valueUrl")) {
1161          this.value = new UrlType();
1162          return this.value;
1163        }
1164        else if (name.equals("valueUuid")) {
1165          this.value = new UuidType();
1166          return this.value;
1167        }
1168        else if (name.equals("valueAddress")) {
1169          this.value = new Address();
1170          return this.value;
1171        }
1172        else if (name.equals("valueAge")) {
1173          this.value = new Age();
1174          return this.value;
1175        }
1176        else if (name.equals("valueAnnotation")) {
1177          this.value = new Annotation();
1178          return this.value;
1179        }
1180        else if (name.equals("valueAttachment")) {
1181          this.value = new Attachment();
1182          return this.value;
1183        }
1184        else if (name.equals("valueCodeableConcept")) {
1185          this.value = new CodeableConcept();
1186          return this.value;
1187        }
1188        else if (name.equals("valueCodeableReference")) {
1189          this.value = new CodeableReference();
1190          return this.value;
1191        }
1192        else if (name.equals("valueCoding")) {
1193          this.value = new Coding();
1194          return this.value;
1195        }
1196        else if (name.equals("valueContactPoint")) {
1197          this.value = new ContactPoint();
1198          return this.value;
1199        }
1200        else if (name.equals("valueCount")) {
1201          this.value = new Count();
1202          return this.value;
1203        }
1204        else if (name.equals("valueDistance")) {
1205          this.value = new Distance();
1206          return this.value;
1207        }
1208        else if (name.equals("valueDuration")) {
1209          this.value = new Duration();
1210          return this.value;
1211        }
1212        else if (name.equals("valueHumanName")) {
1213          this.value = new HumanName();
1214          return this.value;
1215        }
1216        else if (name.equals("valueIdentifier")) {
1217          this.value = new Identifier();
1218          return this.value;
1219        }
1220        else if (name.equals("valueMoney")) {
1221          this.value = new Money();
1222          return this.value;
1223        }
1224        else if (name.equals("valuePeriod")) {
1225          this.value = new Period();
1226          return this.value;
1227        }
1228        else if (name.equals("valueQuantity")) {
1229          this.value = new Quantity();
1230          return this.value;
1231        }
1232        else if (name.equals("valueRange")) {
1233          this.value = new Range();
1234          return this.value;
1235        }
1236        else if (name.equals("valueRatio")) {
1237          this.value = new Ratio();
1238          return this.value;
1239        }
1240        else if (name.equals("valueRatioRange")) {
1241          this.value = new RatioRange();
1242          return this.value;
1243        }
1244        else if (name.equals("valueReference")) {
1245          this.value = new Reference();
1246          return this.value;
1247        }
1248        else if (name.equals("valueSampledData")) {
1249          this.value = new SampledData();
1250          return this.value;
1251        }
1252        else if (name.equals("valueSignature")) {
1253          this.value = new Signature();
1254          return this.value;
1255        }
1256        else if (name.equals("valueTiming")) {
1257          this.value = new Timing();
1258          return this.value;
1259        }
1260        else if (name.equals("valueContactDetail")) {
1261          this.value = new ContactDetail();
1262          return this.value;
1263        }
1264        else if (name.equals("valueContributor")) {
1265          this.value = new Contributor();
1266          return this.value;
1267        }
1268        else if (name.equals("valueDataRequirement")) {
1269          this.value = new DataRequirement();
1270          return this.value;
1271        }
1272        else if (name.equals("valueExpression")) {
1273          this.value = new Expression();
1274          return this.value;
1275        }
1276        else if (name.equals("valueParameterDefinition")) {
1277          this.value = new ParameterDefinition();
1278          return this.value;
1279        }
1280        else if (name.equals("valueRelatedArtifact")) {
1281          this.value = new RelatedArtifact();
1282          return this.value;
1283        }
1284        else if (name.equals("valueTriggerDefinition")) {
1285          this.value = new TriggerDefinition();
1286          return this.value;
1287        }
1288        else if (name.equals("valueUsageContext")) {
1289          this.value = new UsageContext();
1290          return this.value;
1291        }
1292        else if (name.equals("valueDosage")) {
1293          this.value = new Dosage();
1294          return this.value;
1295        }
1296        else if (name.equals("valueMeta")) {
1297          this.value = new Meta();
1298          return this.value;
1299        }
1300        else
1301          return super.addChild(name);
1302      }
1303
1304  public String fhirType() {
1305    return "Extension";
1306
1307  }
1308
1309      public Extension copy() {
1310        Extension dst = new Extension();
1311        copyValues(dst);
1312        return dst;
1313      }
1314
1315      public void copyValues(Extension dst) {
1316        super.copyValues(dst);
1317        dst.url = url == null ? null : url.copy();
1318        dst.value = value == null ? null : value.copy();
1319      }
1320
1321      protected Extension typedCopy() {
1322        return copy();
1323      }
1324
1325      @Override
1326      public boolean equalsDeep(Base other_) {
1327        if (!super.equalsDeep(other_))
1328          return false;
1329        if (!(other_ instanceof Extension))
1330          return false;
1331        Extension o = (Extension) other_;
1332        return compareDeep(url, o.url, true) && compareDeep(value, o.value, true);
1333      }
1334
1335      @Override
1336      public boolean equalsShallow(Base other_) {
1337        if (!super.equalsShallow(other_))
1338          return false;
1339        if (!(other_ instanceof Extension))
1340          return false;
1341        Extension o = (Extension) other_;
1342        return compareValues(url, o.url, true);
1343      }
1344
1345      public boolean isEmpty() {
1346        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, value);
1347      }
1348
1349
1350}
1351