001package org.hl7.fhir.r4b.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 Fri, Dec 31, 2021 05:58+1100 for FHIR v4.3.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.r4b.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, 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 MarkdownType getValueMarkdownType() throws FHIRException { 
302      if (this.value == null)
303        this.value = new MarkdownType();
304      if (!(this.value instanceof MarkdownType))
305        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.value.getClass().getName()+" was encountered");
306      return (MarkdownType) this.value;
307    }
308
309    public boolean hasValueMarkdownType() { 
310      return this != null && this.value instanceof MarkdownType;
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 OidType getValueOidType() throws FHIRException { 
317      if (this.value == null)
318        this.value = new OidType();
319      if (!(this.value instanceof OidType))
320        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.value.getClass().getName()+" was encountered");
321      return (OidType) this.value;
322    }
323
324    public boolean hasValueOidType() { 
325      return this != null && this.value instanceof OidType;
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 PositiveIntType getValuePositiveIntType() throws FHIRException { 
332      if (this.value == null)
333        this.value = new PositiveIntType();
334      if (!(this.value instanceof PositiveIntType))
335        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.value.getClass().getName()+" was encountered");
336      return (PositiveIntType) this.value;
337    }
338
339    public boolean hasValuePositiveIntType() { 
340      return this != null && this.value instanceof PositiveIntType;
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 StringType getValueStringType() throws FHIRException { 
347      if (this.value == null)
348        this.value = new StringType();
349      if (!(this.value instanceof StringType))
350        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
351      return (StringType) this.value;
352    }
353
354    public boolean hasValueStringType() { 
355      return this != null && this.value instanceof StringType;
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 TimeType getValueTimeType() throws FHIRException { 
362      if (this.value == null)
363        this.value = new TimeType();
364      if (!(this.value instanceof TimeType))
365        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
366      return (TimeType) this.value;
367    }
368
369    public boolean hasValueTimeType() { 
370      return this != null && this.value instanceof TimeType;
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 UnsignedIntType getValueUnsignedIntType() throws FHIRException { 
377      if (this.value == null)
378        this.value = new UnsignedIntType();
379      if (!(this.value instanceof UnsignedIntType))
380        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.value.getClass().getName()+" was encountered");
381      return (UnsignedIntType) this.value;
382    }
383
384    public boolean hasValueUnsignedIntType() { 
385      return this != null && this.value instanceof UnsignedIntType;
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 UriType getValueUriType() throws FHIRException { 
392      if (this.value == null)
393        this.value = new UriType();
394      if (!(this.value instanceof UriType))
395        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
396      return (UriType) this.value;
397    }
398
399    public boolean hasValueUriType() { 
400      return this != null && this.value instanceof UriType;
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 UrlType getValueUrlType() throws FHIRException { 
407      if (this.value == null)
408        this.value = new UrlType();
409      if (!(this.value instanceof UrlType))
410        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.value.getClass().getName()+" was encountered");
411      return (UrlType) this.value;
412    }
413
414    public boolean hasValueUrlType() { 
415      return this != null && this.value instanceof UrlType;
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 UuidType getValueUuidType() throws FHIRException { 
422      if (this.value == null)
423        this.value = new UuidType();
424      if (!(this.value instanceof UuidType))
425        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.value.getClass().getName()+" was encountered");
426      return (UuidType) this.value;
427    }
428
429    public boolean hasValueUuidType() { 
430      return this != null && this.value instanceof UuidType;
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 Address getValueAddress() throws FHIRException { 
437      if (this.value == null)
438        this.value = new Address();
439      if (!(this.value instanceof Address))
440        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.value.getClass().getName()+" was encountered");
441      return (Address) this.value;
442    }
443
444    public boolean hasValueAddress() { 
445      return this != null && this.value instanceof Address;
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 Age getValueAge() throws FHIRException { 
452      if (this.value == null)
453        this.value = new Age();
454      if (!(this.value instanceof Age))
455        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.value.getClass().getName()+" was encountered");
456      return (Age) this.value;
457    }
458
459    public boolean hasValueAge() { 
460      return this != null && this.value instanceof Age;
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 Annotation getValueAnnotation() throws FHIRException { 
467      if (this.value == null)
468        this.value = new Annotation();
469      if (!(this.value instanceof Annotation))
470        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.value.getClass().getName()+" was encountered");
471      return (Annotation) this.value;
472    }
473
474    public boolean hasValueAnnotation() { 
475      return this != null && this.value instanceof Annotation;
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 Attachment getValueAttachment() throws FHIRException { 
482      if (this.value == null)
483        this.value = new Attachment();
484      if (!(this.value instanceof Attachment))
485        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
486      return (Attachment) this.value;
487    }
488
489    public boolean hasValueAttachment() { 
490      return this != null && this.value instanceof Attachment;
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 CodeableConcept getValueCodeableConcept() throws FHIRException { 
497      if (this.value == null)
498        this.value = new CodeableConcept();
499      if (!(this.value instanceof CodeableConcept))
500        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
501      return (CodeableConcept) this.value;
502    }
503
504    public boolean hasValueCodeableConcept() { 
505      return this != null && this.value instanceof CodeableConcept;
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 CodeableReference getValueCodeableReference() throws FHIRException { 
512      if (this.value == null)
513        this.value = new CodeableReference();
514      if (!(this.value instanceof CodeableReference))
515        throw new FHIRException("Type mismatch: the type CodeableReference was expected, but "+this.value.getClass().getName()+" was encountered");
516      return (CodeableReference) this.value;
517    }
518
519    public boolean hasValueCodeableReference() { 
520      return this != null && this.value instanceof CodeableReference;
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 Coding getValueCoding() throws FHIRException { 
527      if (this.value == null)
528        this.value = new Coding();
529      if (!(this.value instanceof Coding))
530        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
531      return (Coding) this.value;
532    }
533
534    public boolean hasValueCoding() { 
535      return this != null && this.value instanceof Coding;
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 ContactPoint getValueContactPoint() throws FHIRException { 
542      if (this.value == null)
543        this.value = new ContactPoint();
544      if (!(this.value instanceof ContactPoint))
545        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.value.getClass().getName()+" was encountered");
546      return (ContactPoint) this.value;
547    }
548
549    public boolean hasValueContactPoint() { 
550      return this != null && this.value instanceof ContactPoint;
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 Count getValueCount() throws FHIRException { 
557      if (this.value == null)
558        this.value = new Count();
559      if (!(this.value instanceof Count))
560        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.value.getClass().getName()+" was encountered");
561      return (Count) this.value;
562    }
563
564    public boolean hasValueCount() { 
565      return this != null && this.value instanceof Count;
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 Distance getValueDistance() throws FHIRException { 
572      if (this.value == null)
573        this.value = new Distance();
574      if (!(this.value instanceof Distance))
575        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.value.getClass().getName()+" was encountered");
576      return (Distance) this.value;
577    }
578
579    public boolean hasValueDistance() { 
580      return this != null && this.value instanceof Distance;
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 Duration getValueDuration() throws FHIRException { 
587      if (this.value == null)
588        this.value = new Duration();
589      if (!(this.value instanceof Duration))
590        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
591      return (Duration) this.value;
592    }
593
594    public boolean hasValueDuration() { 
595      return this != null && this.value instanceof Duration;
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 HumanName getValueHumanName() throws FHIRException { 
602      if (this.value == null)
603        this.value = new HumanName();
604      if (!(this.value instanceof HumanName))
605        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.value.getClass().getName()+" was encountered");
606      return (HumanName) this.value;
607    }
608
609    public boolean hasValueHumanName() { 
610      return this != null && this.value instanceof HumanName;
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 Identifier getValueIdentifier() throws FHIRException { 
617      if (this.value == null)
618        this.value = new Identifier();
619      if (!(this.value instanceof Identifier))
620        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.value.getClass().getName()+" was encountered");
621      return (Identifier) this.value;
622    }
623
624    public boolean hasValueIdentifier() { 
625      return this != null && this.value instanceof Identifier;
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 Money getValueMoney() throws FHIRException { 
632      if (this.value == null)
633        this.value = new Money();
634      if (!(this.value instanceof Money))
635        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.value.getClass().getName()+" was encountered");
636      return (Money) this.value;
637    }
638
639    public boolean hasValueMoney() { 
640      return this != null && this.value instanceof Money;
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 Period getValuePeriod() throws FHIRException { 
647      if (this.value == null)
648        this.value = new Period();
649      if (!(this.value instanceof Period))
650        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
651      return (Period) this.value;
652    }
653
654    public boolean hasValuePeriod() { 
655      return this != null && this.value instanceof Period;
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 Quantity getValueQuantity() throws FHIRException { 
662      if (this.value == null)
663        this.value = new Quantity();
664      if (!(this.value instanceof Quantity))
665        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
666      return (Quantity) this.value;
667    }
668
669    public boolean hasValueQuantity() { 
670      return this != null && this.value instanceof Quantity;
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 Range getValueRange() throws FHIRException { 
677      if (this.value == null)
678        this.value = new Range();
679      if (!(this.value instanceof Range))
680        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
681      return (Range) this.value;
682    }
683
684    public boolean hasValueRange() { 
685      return this != null && this.value instanceof Range;
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 Ratio getValueRatio() throws FHIRException { 
692      if (this.value == null)
693        this.value = new Ratio();
694      if (!(this.value instanceof Ratio))
695        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
696      return (Ratio) this.value;
697    }
698
699    public boolean hasValueRatio() { 
700      return this != null && this.value instanceof Ratio;
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 RatioRange getValueRatioRange() throws FHIRException { 
707      if (this.value == null)
708        this.value = new RatioRange();
709      if (!(this.value instanceof RatioRange))
710        throw new FHIRException("Type mismatch: the type RatioRange was expected, but "+this.value.getClass().getName()+" was encountered");
711      return (RatioRange) this.value;
712    }
713
714    public boolean hasValueRatioRange() { 
715      return this != null && this.value instanceof RatioRange;
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 Reference getValueReference() throws FHIRException { 
722      if (this.value == null)
723        this.value = new Reference();
724      if (!(this.value instanceof Reference))
725        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
726      return (Reference) this.value;
727    }
728
729    public boolean hasValueReference() { 
730      return this != null && this.value instanceof Reference;
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 SampledData getValueSampledData() throws FHIRException { 
737      if (this.value == null)
738        this.value = new SampledData();
739      if (!(this.value instanceof SampledData))
740        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered");
741      return (SampledData) this.value;
742    }
743
744    public boolean hasValueSampledData() { 
745      return this != null && this.value instanceof SampledData;
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 Signature getValueSignature() throws FHIRException { 
752      if (this.value == null)
753        this.value = new Signature();
754      if (!(this.value instanceof Signature))
755        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.value.getClass().getName()+" was encountered");
756      return (Signature) this.value;
757    }
758
759    public boolean hasValueSignature() { 
760      return this != null && this.value instanceof Signature;
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 Timing getValueTiming() throws FHIRException { 
767      if (this.value == null)
768        this.value = new Timing();
769      if (!(this.value instanceof Timing))
770        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.value.getClass().getName()+" was encountered");
771      return (Timing) this.value;
772    }
773
774    public boolean hasValueTiming() { 
775      return this != null && this.value instanceof Timing;
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 ContactDetail getValueContactDetail() throws FHIRException { 
782      if (this.value == null)
783        this.value = new ContactDetail();
784      if (!(this.value instanceof ContactDetail))
785        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.value.getClass().getName()+" was encountered");
786      return (ContactDetail) this.value;
787    }
788
789    public boolean hasValueContactDetail() { 
790      return this != null && this.value instanceof ContactDetail;
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 Contributor getValueContributor() throws FHIRException { 
797      if (this.value == null)
798        this.value = new Contributor();
799      if (!(this.value instanceof Contributor))
800        throw new FHIRException("Type mismatch: the type Contributor was expected, but "+this.value.getClass().getName()+" was encountered");
801      return (Contributor) this.value;
802    }
803
804    public boolean hasValueContributor() { 
805      return this != null && this.value instanceof Contributor;
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 DataRequirement getValueDataRequirement() throws FHIRException { 
812      if (this.value == null)
813        this.value = new DataRequirement();
814      if (!(this.value instanceof DataRequirement))
815        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.value.getClass().getName()+" was encountered");
816      return (DataRequirement) this.value;
817    }
818
819    public boolean hasValueDataRequirement() { 
820      return this != null && this.value instanceof DataRequirement;
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 Expression getValueExpression() throws FHIRException { 
827      if (this.value == null)
828        this.value = new Expression();
829      if (!(this.value instanceof Expression))
830        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.value.getClass().getName()+" was encountered");
831      return (Expression) this.value;
832    }
833
834    public boolean hasValueExpression() { 
835      return this != null && this.value instanceof Expression;
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 ParameterDefinition getValueParameterDefinition() throws FHIRException { 
842      if (this.value == null)
843        this.value = new ParameterDefinition();
844      if (!(this.value instanceof ParameterDefinition))
845        throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
846      return (ParameterDefinition) this.value;
847    }
848
849    public boolean hasValueParameterDefinition() { 
850      return this != null && this.value instanceof ParameterDefinition;
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 RelatedArtifact getValueRelatedArtifact() throws FHIRException { 
857      if (this.value == null)
858        this.value = new RelatedArtifact();
859      if (!(this.value instanceof RelatedArtifact))
860        throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.value.getClass().getName()+" was encountered");
861      return (RelatedArtifact) this.value;
862    }
863
864    public boolean hasValueRelatedArtifact() { 
865      return this != null && this.value instanceof RelatedArtifact;
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 TriggerDefinition getValueTriggerDefinition() throws FHIRException { 
872      if (this.value == null)
873        this.value = new TriggerDefinition();
874      if (!(this.value instanceof TriggerDefinition))
875        throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
876      return (TriggerDefinition) this.value;
877    }
878
879    public boolean hasValueTriggerDefinition() { 
880      return this != null && this.value instanceof TriggerDefinition;
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 UsageContext getValueUsageContext() throws FHIRException { 
887      if (this.value == null)
888        this.value = new UsageContext();
889      if (!(this.value instanceof UsageContext))
890        throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.value.getClass().getName()+" was encountered");
891      return (UsageContext) this.value;
892    }
893
894    public boolean hasValueUsageContext() { 
895      return this != null && this.value instanceof UsageContext;
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 Dosage getValueDosage() throws FHIRException { 
902      if (this.value == null)
903        this.value = new Dosage();
904      if (!(this.value instanceof Dosage))
905        throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.value.getClass().getName()+" was encountered");
906      return (Dosage) this.value;
907    }
908
909    public boolean hasValueDosage() { 
910      return this != null && this.value instanceof Dosage;
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 Meta getValueMeta() throws FHIRException { 
917      if (this.value == null)
918        this.value = new Meta();
919      if (!(this.value instanceof Meta))
920        throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.value.getClass().getName()+" was encountered");
921      return (Meta) this.value;
922    }
923
924    public boolean hasValueMeta() { 
925      return this != null && this.value instanceof Meta;
926    }
927
928    public boolean hasValue() { 
929      return this.value != null && !this.value.isEmpty();
930    }
931
932    /**
933     * @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).)
934     */
935    public Extension setValue(DataType value) { 
936      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 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))
937        throw new Error("Not the right type for Extension.value[x]: "+value.fhirType());
938      this.value = value;
939      return this;
940    }
941
942      protected void listChildren(List<Property> children) {
943        super.listChildren(children);
944        children.add(new Property("url", "uri", "Source of the definition for the extension code - a logical name or a URL.", 0, 1, url));
945        children.add(new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|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));
946      }
947
948      @Override
949      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
950        switch (_hash) {
951        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);
952        case -1410166417: /*value[x]*/  return new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|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);
953        case 111972721: /*value*/  return new Property("value[x]", "base64Binary|boolean|canonical|code|date|dateTime|decimal|id|instant|integer|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);
954        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);
955        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);
956        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);
957        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);
958        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);
959        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);
960        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);
961        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);
962        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);
963        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);
964        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);
965        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);
966        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);
967        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);
968        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);
969        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);
970        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);
971        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);
972        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);
973        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);
974        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);
975        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);
976        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);
977        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);
978        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);
979        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);
980        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);
981        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);
982        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);
983        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);
984        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);
985        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);
986        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);
987        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);
988        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);
989        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);
990        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);
991        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);
992        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);
993        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);
994        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);
995        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);
996        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);
997        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);
998        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);
999        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);
1000        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);
1001        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);
1002        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);
1003        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);
1004        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);
1005        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);
1006        default: return super.getNamedProperty(_hash, _name, _checkValid);
1007        }
1008
1009      }
1010
1011      @Override
1012      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1013        switch (hash) {
1014        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
1015        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1016        default: return super.getProperty(hash, name, checkValid);
1017        }
1018
1019      }
1020
1021      @Override
1022      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1023        switch (hash) {
1024        case 116079: // url
1025          this.url = TypeConvertor.castToUri(value); // UriType
1026          return value;
1027        case 111972721: // value
1028          this.value = TypeConvertor.castToType(value); // DataType
1029          return value;
1030        default: return super.setProperty(hash, name, value);
1031        }
1032
1033      }
1034
1035      @Override
1036      public Base setProperty(String name, Base value) throws FHIRException {
1037        if (name.equals("url")) {
1038          this.url = TypeConvertor.castToUri(value); // UriType
1039        } else if (name.equals("value[x]")) {
1040          this.value = TypeConvertor.castToType(value); // DataType
1041        } else
1042          return super.setProperty(name, value);
1043        return value;
1044      }
1045
1046      @Override
1047      public Base makeProperty(int hash, String name) throws FHIRException {
1048        switch (hash) {
1049        case 116079:  return getUrlElement();
1050        case -1410166417:  return getValue();
1051        case 111972721:  return getValue();
1052        default: return super.makeProperty(hash, name);
1053        }
1054
1055      }
1056
1057      @Override
1058      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1059        switch (hash) {
1060        case 116079: /*url*/ return new String[] {"uri"};
1061        case 111972721: /*value*/ return new String[] {"base64Binary", "boolean", "canonical", "code", "date", "dateTime", "decimal", "id", "instant", "integer", "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"};
1062        default: return super.getTypesForProperty(hash, name);
1063        }
1064
1065      }
1066
1067      @Override
1068      public Base addChild(String name) throws FHIRException {
1069        if (name.equals("url")) {
1070          throw new FHIRException("Cannot call addChild on a primitive type Extension.url");
1071        }
1072        else if (name.equals("valueBase64Binary")) {
1073          this.value = new Base64BinaryType();
1074          return this.value;
1075        }
1076        else if (name.equals("valueBoolean")) {
1077          this.value = new BooleanType();
1078          return this.value;
1079        }
1080        else if (name.equals("valueCanonical")) {
1081          this.value = new CanonicalType();
1082          return this.value;
1083        }
1084        else if (name.equals("valueCode")) {
1085          this.value = new CodeType();
1086          return this.value;
1087        }
1088        else if (name.equals("valueDate")) {
1089          this.value = new DateType();
1090          return this.value;
1091        }
1092        else if (name.equals("valueDateTime")) {
1093          this.value = new DateTimeType();
1094          return this.value;
1095        }
1096        else if (name.equals("valueDecimal")) {
1097          this.value = new DecimalType();
1098          return this.value;
1099        }
1100        else if (name.equals("valueId")) {
1101          this.value = new IdType();
1102          return this.value;
1103        }
1104        else if (name.equals("valueInstant")) {
1105          this.value = new InstantType();
1106          return this.value;
1107        }
1108        else if (name.equals("valueInteger")) {
1109          this.value = new IntegerType();
1110          return this.value;
1111        }
1112        else if (name.equals("valueMarkdown")) {
1113          this.value = new MarkdownType();
1114          return this.value;
1115        }
1116        else if (name.equals("valueOid")) {
1117          this.value = new OidType();
1118          return this.value;
1119        }
1120        else if (name.equals("valuePositiveInt")) {
1121          this.value = new PositiveIntType();
1122          return this.value;
1123        }
1124        else if (name.equals("valueString")) {
1125          this.value = new StringType();
1126          return this.value;
1127        }
1128        else if (name.equals("valueTime")) {
1129          this.value = new TimeType();
1130          return this.value;
1131        }
1132        else if (name.equals("valueUnsignedInt")) {
1133          this.value = new UnsignedIntType();
1134          return this.value;
1135        }
1136        else if (name.equals("valueUri")) {
1137          this.value = new UriType();
1138          return this.value;
1139        }
1140        else if (name.equals("valueUrl")) {
1141          this.value = new UrlType();
1142          return this.value;
1143        }
1144        else if (name.equals("valueUuid")) {
1145          this.value = new UuidType();
1146          return this.value;
1147        }
1148        else if (name.equals("valueAddress")) {
1149          this.value = new Address();
1150          return this.value;
1151        }
1152        else if (name.equals("valueAge")) {
1153          this.value = new Age();
1154          return this.value;
1155        }
1156        else if (name.equals("valueAnnotation")) {
1157          this.value = new Annotation();
1158          return this.value;
1159        }
1160        else if (name.equals("valueAttachment")) {
1161          this.value = new Attachment();
1162          return this.value;
1163        }
1164        else if (name.equals("valueCodeableConcept")) {
1165          this.value = new CodeableConcept();
1166          return this.value;
1167        }
1168        else if (name.equals("valueCodeableReference")) {
1169          this.value = new CodeableReference();
1170          return this.value;
1171        }
1172        else if (name.equals("valueCoding")) {
1173          this.value = new Coding();
1174          return this.value;
1175        }
1176        else if (name.equals("valueContactPoint")) {
1177          this.value = new ContactPoint();
1178          return this.value;
1179        }
1180        else if (name.equals("valueCount")) {
1181          this.value = new Count();
1182          return this.value;
1183        }
1184        else if (name.equals("valueDistance")) {
1185          this.value = new Distance();
1186          return this.value;
1187        }
1188        else if (name.equals("valueDuration")) {
1189          this.value = new Duration();
1190          return this.value;
1191        }
1192        else if (name.equals("valueHumanName")) {
1193          this.value = new HumanName();
1194          return this.value;
1195        }
1196        else if (name.equals("valueIdentifier")) {
1197          this.value = new Identifier();
1198          return this.value;
1199        }
1200        else if (name.equals("valueMoney")) {
1201          this.value = new Money();
1202          return this.value;
1203        }
1204        else if (name.equals("valuePeriod")) {
1205          this.value = new Period();
1206          return this.value;
1207        }
1208        else if (name.equals("valueQuantity")) {
1209          this.value = new Quantity();
1210          return this.value;
1211        }
1212        else if (name.equals("valueRange")) {
1213          this.value = new Range();
1214          return this.value;
1215        }
1216        else if (name.equals("valueRatio")) {
1217          this.value = new Ratio();
1218          return this.value;
1219        }
1220        else if (name.equals("valueRatioRange")) {
1221          this.value = new RatioRange();
1222          return this.value;
1223        }
1224        else if (name.equals("valueReference")) {
1225          this.value = new Reference();
1226          return this.value;
1227        }
1228        else if (name.equals("valueSampledData")) {
1229          this.value = new SampledData();
1230          return this.value;
1231        }
1232        else if (name.equals("valueSignature")) {
1233          this.value = new Signature();
1234          return this.value;
1235        }
1236        else if (name.equals("valueTiming")) {
1237          this.value = new Timing();
1238          return this.value;
1239        }
1240        else if (name.equals("valueContactDetail")) {
1241          this.value = new ContactDetail();
1242          return this.value;
1243        }
1244        else if (name.equals("valueContributor")) {
1245          this.value = new Contributor();
1246          return this.value;
1247        }
1248        else if (name.equals("valueDataRequirement")) {
1249          this.value = new DataRequirement();
1250          return this.value;
1251        }
1252        else if (name.equals("valueExpression")) {
1253          this.value = new Expression();
1254          return this.value;
1255        }
1256        else if (name.equals("valueParameterDefinition")) {
1257          this.value = new ParameterDefinition();
1258          return this.value;
1259        }
1260        else if (name.equals("valueRelatedArtifact")) {
1261          this.value = new RelatedArtifact();
1262          return this.value;
1263        }
1264        else if (name.equals("valueTriggerDefinition")) {
1265          this.value = new TriggerDefinition();
1266          return this.value;
1267        }
1268        else if (name.equals("valueUsageContext")) {
1269          this.value = new UsageContext();
1270          return this.value;
1271        }
1272        else if (name.equals("valueDosage")) {
1273          this.value = new Dosage();
1274          return this.value;
1275        }
1276        else if (name.equals("valueMeta")) {
1277          this.value = new Meta();
1278          return this.value;
1279        }
1280        else
1281          return super.addChild(name);
1282      }
1283
1284  public String fhirType() {
1285    return "Extension";
1286
1287  }
1288
1289      public Extension copy() {
1290        Extension dst = new Extension();
1291        copyValues(dst);
1292        return dst;
1293      }
1294
1295      public void copyValues(Extension dst) {
1296        super.copyValues(dst);
1297        dst.url = url == null ? null : url.copy();
1298        dst.value = value == null ? null : value.copy();
1299      }
1300
1301      protected Extension typedCopy() {
1302        return copy();
1303      }
1304
1305      @Override
1306      public boolean equalsDeep(Base other_) {
1307        if (!super.equalsDeep(other_))
1308          return false;
1309        if (!(other_ instanceof Extension))
1310          return false;
1311        Extension o = (Extension) other_;
1312        return compareDeep(url, o.url, true) && compareDeep(value, o.value, true);
1313      }
1314
1315      @Override
1316      public boolean equalsShallow(Base other_) {
1317        if (!super.equalsShallow(other_))
1318          return false;
1319        if (!(other_ instanceof Extension))
1320          return false;
1321        Extension o = (Extension) other_;
1322        return compareValues(url, o.url, true);
1323      }
1324
1325      public boolean isEmpty() {
1326        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(url, value);
1327      }
1328
1329
1330}
1331