001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import org.hl7.fhir.utilities.Utilities;
058import org.hl7.fhir.r5.model.Enumerations.*;
059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
060import org.hl7.fhir.exceptions.FHIRException;
061import org.hl7.fhir.instance.model.api.ICompositeType;
062import ca.uhn.fhir.model.api.annotation.Child;
063import ca.uhn.fhir.model.api.annotation.ChildOrder;
064import ca.uhn.fhir.model.api.annotation.DatatypeDef;
065import ca.uhn.fhir.model.api.annotation.Description;
066import ca.uhn.fhir.model.api.annotation.Block;
067
068import org.hl7.fhir.instance.model.api.IBaseExtension;
069import  org.hl7.fhir.instance.model.api.IBaseDatatype;
070import  org.hl7.fhir.instance.model.api.IBaseHasExtensions;
071/**
072 * Base StructureDefinition for Extension Type: Optional Extension Element - found in all resources.
073 */
074@DatatypeDef(name="Extension")
075public class Extension extends BaseExtension implements IBaseExtension<Extension, DataType>, IBaseHasExtensions {
076
077    /**
078     * Source of the definition for the extension code - a logical name or a URL.
079     */
080    @Child(name = "url", type = {UriType.class}, order=0, min=1, max=1, modifier=false, summary=false)
081    @Description(shortDefinition="identifies the meaning of the extension", formalDefinition="Source of the definition for the extension code - a logical name or a URL." )
082    protected UriType url;
083
084    /**
085     * Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).
086     */
087    @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, Coding.class, ContactPoint.class, Count.class, Distance.class, Duration.class, HumanName.class, Identifier.class, Money.class, Period.class, Quantity.class, Range.class, Ratio.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)
088    @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)." )
089    protected DataType value;
090
091    private static final long serialVersionUID = 465890108L;
092
093  /**
094   * Constructor
095   */
096    public Extension() {
097      super();
098    }
099
100  /**
101   * Constructor
102   */
103    public Extension(String url) {
104      super();
105      this.setUrl(url);
106    }
107
108    /**
109     * Constructor
110     */
111    public Extension(String theUrl, IBaseDatatype theValue) {
112      setUrl(theUrl);
113      setValue(theValue);
114    }
115
116    /**
117     * @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
118     */
119    public UriType getUrlElement() { 
120      if (this.url == null)
121        if (Configuration.errorOnAutoCreate())
122          throw new Error("Attempt to auto-create Extension.url");
123        else if (Configuration.doAutoCreate())
124          this.url = new UriType(); // bb
125      return this.url;
126    }
127
128    public boolean hasUrlElement() { 
129      return this.url != null && !this.url.isEmpty();
130    }
131
132    public boolean hasUrl() { 
133      return this.url != null && !this.url.isEmpty();
134    }
135
136    /**
137     * @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
138     */
139    public Extension setUrlElement(UriType value) { 
140      this.url = value;
141      return this;
142    }
143
144    /**
145     * @return Source of the definition for the extension code - a logical name or a URL.
146     */
147    public String getUrl() { 
148      return this.url == null ? null : this.url.getValue();
149    }
150
151    /**
152     * @param value Source of the definition for the extension code - a logical name or a URL.
153     */
154    public Extension setUrl(String value) { 
155        if (this.url == null)
156          this.url = new UriType();
157        this.url.setValue(value);
158      return this;
159    }
160
161    /**
162     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
163     */
164    public DataType getValue() { 
165      return this.value;
166    }
167
168    /**
169     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
170     */
171    public Base64BinaryType getValueBase64BinaryType() throws FHIRException { 
172      if (this.value == null)
173        this.value = new Base64BinaryType();
174      if (!(this.value instanceof Base64BinaryType))
175        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.value.getClass().getName()+" was encountered");
176      return (Base64BinaryType) this.value;
177    }
178
179    public boolean hasValueBase64BinaryType() { 
180      return this != null && this.value instanceof Base64BinaryType;
181    }
182
183    /**
184     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
185     */
186    public BooleanType getValueBooleanType() throws FHIRException { 
187      if (this.value == null)
188        this.value = new BooleanType();
189      if (!(this.value instanceof BooleanType))
190        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
191      return (BooleanType) this.value;
192    }
193
194    public boolean hasValueBooleanType() { 
195      return this != null && this.value instanceof BooleanType;
196    }
197
198    /**
199     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
200     */
201    public CanonicalType getValueCanonicalType() throws FHIRException { 
202      if (this.value == null)
203        this.value = new CanonicalType();
204      if (!(this.value instanceof CanonicalType))
205        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.value.getClass().getName()+" was encountered");
206      return (CanonicalType) this.value;
207    }
208
209    public boolean hasValueCanonicalType() { 
210      return this != null && this.value instanceof CanonicalType;
211    }
212
213    /**
214     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
215     */
216    public CodeType getValueCodeType() throws FHIRException { 
217      if (this.value == null)
218        this.value = new CodeType();
219      if (!(this.value instanceof CodeType))
220        throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.value.getClass().getName()+" was encountered");
221      return (CodeType) this.value;
222    }
223
224    public boolean hasValueCodeType() { 
225      return this != null && this.value instanceof CodeType;
226    }
227
228    /**
229     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
230     */
231    public DateType getValueDateType() throws FHIRException { 
232      if (this.value == null)
233        this.value = new DateType();
234      if (!(this.value instanceof DateType))
235        throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
236      return (DateType) this.value;
237    }
238
239    public boolean hasValueDateType() { 
240      return this != null && this.value instanceof DateType;
241    }
242
243    /**
244     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
245     */
246    public DateTimeType getValueDateTimeType() throws FHIRException { 
247      if (this.value == null)
248        this.value = new DateTimeType();
249      if (!(this.value instanceof DateTimeType))
250        throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
251      return (DateTimeType) this.value;
252    }
253
254    public boolean hasValueDateTimeType() { 
255      return this != null && this.value instanceof DateTimeType;
256    }
257
258    /**
259     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
260     */
261    public DecimalType getValueDecimalType() throws FHIRException { 
262      if (this.value == null)
263        this.value = new DecimalType();
264      if (!(this.value instanceof DecimalType))
265        throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
266      return (DecimalType) this.value;
267    }
268
269    public boolean hasValueDecimalType() { 
270      return this != null && this.value instanceof DecimalType;
271    }
272
273    /**
274     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
275     */
276    public IdType getValueIdType() throws FHIRException { 
277      if (this.value == null)
278        this.value = new IdType();
279      if (!(this.value instanceof IdType))
280        throw new FHIRException("Type mismatch: the type IdType was expected, but "+this.value.getClass().getName()+" was encountered");
281      return (IdType) this.value;
282    }
283
284    public boolean hasValueIdType() { 
285      return this != null && this.value instanceof IdType;
286    }
287
288    /**
289     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
290     */
291    public InstantType getValueInstantType() throws FHIRException { 
292      if (this.value == null)
293        this.value = new InstantType();
294      if (!(this.value instanceof InstantType))
295        throw new FHIRException("Type mismatch: the type InstantType was expected, but "+this.value.getClass().getName()+" was encountered");
296      return (InstantType) this.value;
297    }
298
299    public boolean hasValueInstantType() { 
300      return this != null && this.value instanceof InstantType;
301    }
302
303    /**
304     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
305     */
306    public IntegerType getValueIntegerType() throws FHIRException { 
307      if (this.value == null)
308        this.value = new IntegerType();
309      if (!(this.value instanceof IntegerType))
310        throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
311      return (IntegerType) this.value;
312    }
313
314    public boolean hasValueIntegerType() { 
315      return this != null && this.value instanceof IntegerType;
316    }
317
318    /**
319     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
320     */
321    public Integer64Type getValueInteger64Type() throws FHIRException { 
322      if (this.value == null)
323        this.value = new Integer64Type();
324      if (!(this.value instanceof Integer64Type))
325        throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.value.getClass().getName()+" was encountered");
326      return (Integer64Type) this.value;
327    }
328
329    public boolean hasValueInteger64Type() { 
330      return this != null && this.value instanceof Integer64Type;
331    }
332
333    /**
334     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
335     */
336    public MarkdownType getValueMarkdownType() throws FHIRException { 
337      if (this.value == null)
338        this.value = new MarkdownType();
339      if (!(this.value instanceof MarkdownType))
340        throw new FHIRException("Type mismatch: the type MarkdownType was expected, but "+this.value.getClass().getName()+" was encountered");
341      return (MarkdownType) this.value;
342    }
343
344    public boolean hasValueMarkdownType() { 
345      return this != null && this.value instanceof MarkdownType;
346    }
347
348    /**
349     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
350     */
351    public OidType getValueOidType() throws FHIRException { 
352      if (this.value == null)
353        this.value = new OidType();
354      if (!(this.value instanceof OidType))
355        throw new FHIRException("Type mismatch: the type OidType was expected, but "+this.value.getClass().getName()+" was encountered");
356      return (OidType) this.value;
357    }
358
359    public boolean hasValueOidType() { 
360      return this != null && this.value instanceof OidType;
361    }
362
363    /**
364     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
365     */
366    public PositiveIntType getValuePositiveIntType() throws FHIRException { 
367      if (this.value == null)
368        this.value = new PositiveIntType();
369      if (!(this.value instanceof PositiveIntType))
370        throw new FHIRException("Type mismatch: the type PositiveIntType was expected, but "+this.value.getClass().getName()+" was encountered");
371      return (PositiveIntType) this.value;
372    }
373
374    public boolean hasValuePositiveIntType() { 
375      return this != null && this.value instanceof PositiveIntType;
376    }
377
378    /**
379     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
380     */
381    public StringType getValueStringType() throws FHIRException { 
382      if (this.value == null)
383        this.value = new StringType();
384      if (!(this.value instanceof StringType))
385        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
386      return (StringType) this.value;
387    }
388
389    public boolean hasValueStringType() { 
390      return this != null && this.value instanceof StringType;
391    }
392
393    /**
394     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
395     */
396    public TimeType getValueTimeType() throws FHIRException { 
397      if (this.value == null)
398        this.value = new TimeType();
399      if (!(this.value instanceof TimeType))
400        throw new FHIRException("Type mismatch: the type TimeType was expected, but "+this.value.getClass().getName()+" was encountered");
401      return (TimeType) this.value;
402    }
403
404    public boolean hasValueTimeType() { 
405      return this != null && this.value instanceof TimeType;
406    }
407
408    /**
409     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
410     */
411    public UnsignedIntType getValueUnsignedIntType() throws FHIRException { 
412      if (this.value == null)
413        this.value = new UnsignedIntType();
414      if (!(this.value instanceof UnsignedIntType))
415        throw new FHIRException("Type mismatch: the type UnsignedIntType was expected, but "+this.value.getClass().getName()+" was encountered");
416      return (UnsignedIntType) this.value;
417    }
418
419    public boolean hasValueUnsignedIntType() { 
420      return this != null && this.value instanceof UnsignedIntType;
421    }
422
423    /**
424     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
425     */
426    public UriType getValueUriType() throws FHIRException { 
427      if (this.value == null)
428        this.value = new UriType();
429      if (!(this.value instanceof UriType))
430        throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
431      return (UriType) this.value;
432    }
433
434    public boolean hasValueUriType() { 
435      return this != null && this.value instanceof UriType;
436    }
437
438    /**
439     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
440     */
441    public UrlType getValueUrlType() throws FHIRException { 
442      if (this.value == null)
443        this.value = new UrlType();
444      if (!(this.value instanceof UrlType))
445        throw new FHIRException("Type mismatch: the type UrlType was expected, but "+this.value.getClass().getName()+" was encountered");
446      return (UrlType) this.value;
447    }
448
449    public boolean hasValueUrlType() { 
450      return this != null && this.value instanceof UrlType;
451    }
452
453    /**
454     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
455     */
456    public UuidType getValueUuidType() throws FHIRException { 
457      if (this.value == null)
458        this.value = new UuidType();
459      if (!(this.value instanceof UuidType))
460        throw new FHIRException("Type mismatch: the type UuidType was expected, but "+this.value.getClass().getName()+" was encountered");
461      return (UuidType) this.value;
462    }
463
464    public boolean hasValueUuidType() { 
465      return this != null && this.value instanceof UuidType;
466    }
467
468    /**
469     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
470     */
471    public Address getValueAddress() throws FHIRException { 
472      if (this.value == null)
473        this.value = new Address();
474      if (!(this.value instanceof Address))
475        throw new FHIRException("Type mismatch: the type Address was expected, but "+this.value.getClass().getName()+" was encountered");
476      return (Address) this.value;
477    }
478
479    public boolean hasValueAddress() { 
480      return this != null && this.value instanceof Address;
481    }
482
483    /**
484     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
485     */
486    public Age getValueAge() throws FHIRException { 
487      if (this.value == null)
488        this.value = new Age();
489      if (!(this.value instanceof Age))
490        throw new FHIRException("Type mismatch: the type Age was expected, but "+this.value.getClass().getName()+" was encountered");
491      return (Age) this.value;
492    }
493
494    public boolean hasValueAge() { 
495      return this != null && this.value instanceof Age;
496    }
497
498    /**
499     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
500     */
501    public Annotation getValueAnnotation() throws FHIRException { 
502      if (this.value == null)
503        this.value = new Annotation();
504      if (!(this.value instanceof Annotation))
505        throw new FHIRException("Type mismatch: the type Annotation was expected, but "+this.value.getClass().getName()+" was encountered");
506      return (Annotation) this.value;
507    }
508
509    public boolean hasValueAnnotation() { 
510      return this != null && this.value instanceof Annotation;
511    }
512
513    /**
514     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
515     */
516    public Attachment getValueAttachment() throws FHIRException { 
517      if (this.value == null)
518        this.value = new Attachment();
519      if (!(this.value instanceof Attachment))
520        throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
521      return (Attachment) this.value;
522    }
523
524    public boolean hasValueAttachment() { 
525      return this != null && this.value instanceof Attachment;
526    }
527
528    /**
529     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
530     */
531    public CodeableConcept getValueCodeableConcept() throws FHIRException { 
532      if (this.value == null)
533        this.value = new CodeableConcept();
534      if (!(this.value instanceof CodeableConcept))
535        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
536      return (CodeableConcept) this.value;
537    }
538
539    public boolean hasValueCodeableConcept() { 
540      return this != null && this.value instanceof CodeableConcept;
541    }
542
543    /**
544     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
545     */
546    public Coding getValueCoding() throws FHIRException { 
547      if (this.value == null)
548        this.value = new Coding();
549      if (!(this.value instanceof Coding))
550        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.value.getClass().getName()+" was encountered");
551      return (Coding) this.value;
552    }
553
554    public boolean hasValueCoding() { 
555      return this != null && this.value instanceof Coding;
556    }
557
558    /**
559     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
560     */
561    public ContactPoint getValueContactPoint() throws FHIRException { 
562      if (this.value == null)
563        this.value = new ContactPoint();
564      if (!(this.value instanceof ContactPoint))
565        throw new FHIRException("Type mismatch: the type ContactPoint was expected, but "+this.value.getClass().getName()+" was encountered");
566      return (ContactPoint) this.value;
567    }
568
569    public boolean hasValueContactPoint() { 
570      return this != null && this.value instanceof ContactPoint;
571    }
572
573    /**
574     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
575     */
576    public Count getValueCount() throws FHIRException { 
577      if (this.value == null)
578        this.value = new Count();
579      if (!(this.value instanceof Count))
580        throw new FHIRException("Type mismatch: the type Count was expected, but "+this.value.getClass().getName()+" was encountered");
581      return (Count) this.value;
582    }
583
584    public boolean hasValueCount() { 
585      return this != null && this.value instanceof Count;
586    }
587
588    /**
589     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
590     */
591    public Distance getValueDistance() throws FHIRException { 
592      if (this.value == null)
593        this.value = new Distance();
594      if (!(this.value instanceof Distance))
595        throw new FHIRException("Type mismatch: the type Distance was expected, but "+this.value.getClass().getName()+" was encountered");
596      return (Distance) this.value;
597    }
598
599    public boolean hasValueDistance() { 
600      return this != null && this.value instanceof Distance;
601    }
602
603    /**
604     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
605     */
606    public Duration getValueDuration() throws FHIRException { 
607      if (this.value == null)
608        this.value = new Duration();
609      if (!(this.value instanceof Duration))
610        throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
611      return (Duration) this.value;
612    }
613
614    public boolean hasValueDuration() { 
615      return this != null && this.value instanceof Duration;
616    }
617
618    /**
619     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
620     */
621    public HumanName getValueHumanName() throws FHIRException { 
622      if (this.value == null)
623        this.value = new HumanName();
624      if (!(this.value instanceof HumanName))
625        throw new FHIRException("Type mismatch: the type HumanName was expected, but "+this.value.getClass().getName()+" was encountered");
626      return (HumanName) this.value;
627    }
628
629    public boolean hasValueHumanName() { 
630      return this != null && this.value instanceof HumanName;
631    }
632
633    /**
634     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
635     */
636    public Identifier getValueIdentifier() throws FHIRException { 
637      if (this.value == null)
638        this.value = new Identifier();
639      if (!(this.value instanceof Identifier))
640        throw new FHIRException("Type mismatch: the type Identifier was expected, but "+this.value.getClass().getName()+" was encountered");
641      return (Identifier) this.value;
642    }
643
644    public boolean hasValueIdentifier() { 
645      return this != null && this.value instanceof Identifier;
646    }
647
648    /**
649     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
650     */
651    public Money getValueMoney() throws FHIRException { 
652      if (this.value == null)
653        this.value = new Money();
654      if (!(this.value instanceof Money))
655        throw new FHIRException("Type mismatch: the type Money was expected, but "+this.value.getClass().getName()+" was encountered");
656      return (Money) this.value;
657    }
658
659    public boolean hasValueMoney() { 
660      return this != null && this.value instanceof Money;
661    }
662
663    /**
664     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
665     */
666    public Period getValuePeriod() throws FHIRException { 
667      if (this.value == null)
668        this.value = new Period();
669      if (!(this.value instanceof Period))
670        throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
671      return (Period) this.value;
672    }
673
674    public boolean hasValuePeriod() { 
675      return this != null && this.value instanceof Period;
676    }
677
678    /**
679     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
680     */
681    public Quantity getValueQuantity() throws FHIRException { 
682      if (this.value == null)
683        this.value = new Quantity();
684      if (!(this.value instanceof Quantity))
685        throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
686      return (Quantity) this.value;
687    }
688
689    public boolean hasValueQuantity() { 
690      return this != null && this.value instanceof Quantity;
691    }
692
693    /**
694     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
695     */
696    public Range getValueRange() throws FHIRException { 
697      if (this.value == null)
698        this.value = new Range();
699      if (!(this.value instanceof Range))
700        throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
701      return (Range) this.value;
702    }
703
704    public boolean hasValueRange() { 
705      return this != null && this.value instanceof Range;
706    }
707
708    /**
709     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
710     */
711    public Ratio getValueRatio() throws FHIRException { 
712      if (this.value == null)
713        this.value = new Ratio();
714      if (!(this.value instanceof Ratio))
715        throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.value.getClass().getName()+" was encountered");
716      return (Ratio) this.value;
717    }
718
719    public boolean hasValueRatio() { 
720      return this != null && this.value instanceof Ratio;
721    }
722
723    /**
724     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
725     */
726    public Reference getValueReference() throws FHIRException { 
727      if (this.value == null)
728        this.value = new Reference();
729      if (!(this.value instanceof Reference))
730        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.value.getClass().getName()+" was encountered");
731      return (Reference) this.value;
732    }
733
734    public boolean hasValueReference() { 
735      return this != null && this.value instanceof Reference;
736    }
737
738    /**
739     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
740     */
741    public SampledData getValueSampledData() throws FHIRException { 
742      if (this.value == null)
743        this.value = new SampledData();
744      if (!(this.value instanceof SampledData))
745        throw new FHIRException("Type mismatch: the type SampledData was expected, but "+this.value.getClass().getName()+" was encountered");
746      return (SampledData) this.value;
747    }
748
749    public boolean hasValueSampledData() { 
750      return this != null && this.value instanceof SampledData;
751    }
752
753    /**
754     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
755     */
756    public Signature getValueSignature() throws FHIRException { 
757      if (this.value == null)
758        this.value = new Signature();
759      if (!(this.value instanceof Signature))
760        throw new FHIRException("Type mismatch: the type Signature was expected, but "+this.value.getClass().getName()+" was encountered");
761      return (Signature) this.value;
762    }
763
764    public boolean hasValueSignature() { 
765      return this != null && this.value instanceof Signature;
766    }
767
768    /**
769     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
770     */
771    public Timing getValueTiming() throws FHIRException { 
772      if (this.value == null)
773        this.value = new Timing();
774      if (!(this.value instanceof Timing))
775        throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.value.getClass().getName()+" was encountered");
776      return (Timing) this.value;
777    }
778
779    public boolean hasValueTiming() { 
780      return this != null && this.value instanceof Timing;
781    }
782
783    /**
784     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
785     */
786    public ContactDetail getValueContactDetail() throws FHIRException { 
787      if (this.value == null)
788        this.value = new ContactDetail();
789      if (!(this.value instanceof ContactDetail))
790        throw new FHIRException("Type mismatch: the type ContactDetail was expected, but "+this.value.getClass().getName()+" was encountered");
791      return (ContactDetail) this.value;
792    }
793
794    public boolean hasValueContactDetail() { 
795      return this != null && this.value instanceof ContactDetail;
796    }
797
798    /**
799     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
800     */
801    public Contributor getValueContributor() throws FHIRException { 
802      if (this.value == null)
803        this.value = new Contributor();
804      if (!(this.value instanceof Contributor))
805        throw new FHIRException("Type mismatch: the type Contributor was expected, but "+this.value.getClass().getName()+" was encountered");
806      return (Contributor) this.value;
807    }
808
809    public boolean hasValueContributor() { 
810      return this != null && this.value instanceof Contributor;
811    }
812
813    /**
814     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
815     */
816    public DataRequirement getValueDataRequirement() throws FHIRException { 
817      if (this.value == null)
818        this.value = new DataRequirement();
819      if (!(this.value instanceof DataRequirement))
820        throw new FHIRException("Type mismatch: the type DataRequirement was expected, but "+this.value.getClass().getName()+" was encountered");
821      return (DataRequirement) this.value;
822    }
823
824    public boolean hasValueDataRequirement() { 
825      return this != null && this.value instanceof DataRequirement;
826    }
827
828    /**
829     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
830     */
831    public Expression getValueExpression() throws FHIRException { 
832      if (this.value == null)
833        this.value = new Expression();
834      if (!(this.value instanceof Expression))
835        throw new FHIRException("Type mismatch: the type Expression was expected, but "+this.value.getClass().getName()+" was encountered");
836      return (Expression) this.value;
837    }
838
839    public boolean hasValueExpression() { 
840      return this != null && this.value instanceof Expression;
841    }
842
843    /**
844     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
845     */
846    public ParameterDefinition getValueParameterDefinition() throws FHIRException { 
847      if (this.value == null)
848        this.value = new ParameterDefinition();
849      if (!(this.value instanceof ParameterDefinition))
850        throw new FHIRException("Type mismatch: the type ParameterDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
851      return (ParameterDefinition) this.value;
852    }
853
854    public boolean hasValueParameterDefinition() { 
855      return this != null && this.value instanceof ParameterDefinition;
856    }
857
858    /**
859     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
860     */
861    public RelatedArtifact getValueRelatedArtifact() throws FHIRException { 
862      if (this.value == null)
863        this.value = new RelatedArtifact();
864      if (!(this.value instanceof RelatedArtifact))
865        throw new FHIRException("Type mismatch: the type RelatedArtifact was expected, but "+this.value.getClass().getName()+" was encountered");
866      return (RelatedArtifact) this.value;
867    }
868
869    public boolean hasValueRelatedArtifact() { 
870      return this != null && this.value instanceof RelatedArtifact;
871    }
872
873    /**
874     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
875     */
876    public TriggerDefinition getValueTriggerDefinition() throws FHIRException { 
877      if (this.value == null)
878        this.value = new TriggerDefinition();
879      if (!(this.value instanceof TriggerDefinition))
880        throw new FHIRException("Type mismatch: the type TriggerDefinition was expected, but "+this.value.getClass().getName()+" was encountered");
881      return (TriggerDefinition) this.value;
882    }
883
884    public boolean hasValueTriggerDefinition() { 
885      return this != null && this.value instanceof TriggerDefinition;
886    }
887
888    /**
889     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
890     */
891    public UsageContext getValueUsageContext() throws FHIRException { 
892      if (this.value == null)
893        this.value = new UsageContext();
894      if (!(this.value instanceof UsageContext))
895        throw new FHIRException("Type mismatch: the type UsageContext was expected, but "+this.value.getClass().getName()+" was encountered");
896      return (UsageContext) this.value;
897    }
898
899    public boolean hasValueUsageContext() { 
900      return this != null && this.value instanceof UsageContext;
901    }
902
903    /**
904     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
905     */
906    public Dosage getValueDosage() throws FHIRException { 
907      if (this.value == null)
908        this.value = new Dosage();
909      if (!(this.value instanceof Dosage))
910        throw new FHIRException("Type mismatch: the type Dosage was expected, but "+this.value.getClass().getName()+" was encountered");
911      return (Dosage) this.value;
912    }
913
914    public boolean hasValueDosage() { 
915      return this != null && this.value instanceof Dosage;
916    }
917
918    /**
919     * @return {@link #value} (Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).)
920     */
921    public Meta getValueMeta() throws FHIRException { 
922      if (this.value == null)
923        this.value = new Meta();
924      if (!(this.value instanceof Meta))
925        throw new FHIRException("Type mismatch: the type Meta was expected, but "+this.value.getClass().getName()+" was encountered");
926      return (Meta) this.value;
927    }
928
929    public boolean hasValueMeta() { 
930      return this != null && this.value instanceof Meta;
931    }
932
933    public boolean hasValue() { 
934      return this.value != null && !this.value.isEmpty();
935    }
936
937    /**
938     * @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).)
939     */
940    public Extension setValue(DataType value) { 
941      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 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 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))
942        throw new Error("Not the right type for Extension.value[x]: "+value.fhirType());
943      this.value = value;
944      return this;
945    }
946
947      protected void listChildren(List<Property> children) {
948        super.listChildren(children);
949        children.add(new Property("url", "uri", "Source of the definition for the extension code - a logical name or a URL.", 0, 1, url));
950        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|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|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));
951      }
952
953      @Override
954      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
955        switch (_hash) {
956        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);
957        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|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|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);
958        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|Coding|ContactPoint|Count|Distance|Duration|HumanName|Identifier|Money|Period|Quantity|Range|Ratio|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);
959        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);
960        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);
961        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);
962        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);
963        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);
964        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);
965        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);
966        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);
967        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);
968        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);
969        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);
970        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);
971        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);
972        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);
973        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);
974        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);
975        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);
976        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);
977        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);
978        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);
979        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);
980        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);
981        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);
982        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);
983        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);
984        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);
985        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);
986        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);
987        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);
988        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);
989        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);
990        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);
991        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);
992        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);
993        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);
994        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);
995        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);
996        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);
997        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);
998        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);
999        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);
1000        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);
1001        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);
1002        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);
1003        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);
1004        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);
1005        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);
1006        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);
1007        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);
1008        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);
1009        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);
1010        default: return super.getNamedProperty(_hash, _name, _checkValid);
1011        }
1012
1013      }
1014
1015      @Override
1016      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1017        switch (hash) {
1018        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
1019        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1020        default: return super.getProperty(hash, name, checkValid);
1021        }
1022
1023      }
1024
1025      @Override
1026      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1027        switch (hash) {
1028        case 116079: // url
1029          this.url = TypeConvertor.castToUri(value); // UriType
1030          return value;
1031        case 111972721: // value
1032          this.value = TypeConvertor.castToType(value); // DataType
1033          return value;
1034        default: return super.setProperty(hash, name, value);
1035        }
1036
1037      }
1038
1039      @Override
1040      public Base setProperty(String name, Base value) throws FHIRException {
1041        if (name.equals("url")) {
1042          this.url = TypeConvertor.castToUri(value); // UriType
1043        } else if (name.equals("value[x]")) {
1044          this.value = TypeConvertor.castToType(value); // DataType
1045        } else
1046          return super.setProperty(name, value);
1047        return value;
1048      }
1049
1050      @Override
1051      public Base makeProperty(int hash, String name) throws FHIRException {
1052        switch (hash) {
1053        case 116079:  return getUrlElement();
1054        case -1410166417:  return getValue();
1055        case 111972721:  return getValue();
1056        default: return super.makeProperty(hash, name);
1057        }
1058
1059      }
1060
1061      @Override
1062      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1063        switch (hash) {
1064        case 116079: /*url*/ return new String[] {"uri"};
1065        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", "Coding", "ContactPoint", "Count", "Distance", "Duration", "HumanName", "Identifier", "Money", "Period", "Quantity", "Range", "Ratio", "Reference", "SampledData", "Signature", "Timing", "ContactDetail", "Contributor", "DataRequirement", "Expression", "ParameterDefinition", "RelatedArtifact", "TriggerDefinition", "UsageContext", "Dosage", "Meta"};
1066        default: return super.getTypesForProperty(hash, name);
1067        }
1068
1069      }
1070
1071      @Override
1072      public Base addChild(String name) throws FHIRException {
1073        if (name.equals("url")) {
1074          throw new FHIRException("Cannot call addChild on a primitive type Extension.url");
1075        }
1076        else if (name.equals("valueBase64Binary")) {
1077          this.value = new Base64BinaryType();
1078          return this.value;
1079        }
1080        else if (name.equals("valueBoolean")) {
1081          this.value = new BooleanType();
1082          return this.value;
1083        }
1084        else if (name.equals("valueCanonical")) {
1085          this.value = new CanonicalType();
1086          return this.value;
1087        }
1088        else if (name.equals("valueCode")) {
1089          this.value = new CodeType();
1090          return this.value;
1091        }
1092        else if (name.equals("valueDate")) {
1093          this.value = new DateType();
1094          return this.value;
1095        }
1096        else if (name.equals("valueDateTime")) {
1097          this.value = new DateTimeType();
1098          return this.value;
1099        }
1100        else if (name.equals("valueDecimal")) {
1101          this.value = new DecimalType();
1102          return this.value;
1103        }
1104        else if (name.equals("valueId")) {
1105          this.value = new IdType();
1106          return this.value;
1107        }
1108        else if (name.equals("valueInstant")) {
1109          this.value = new InstantType();
1110          return this.value;
1111        }
1112        else if (name.equals("valueInteger")) {
1113          this.value = new IntegerType();
1114          return this.value;
1115        }
1116        else if (name.equals("valueInteger64")) {
1117          this.value = new Integer64Type();
1118          return this.value;
1119        }
1120        else if (name.equals("valueMarkdown")) {
1121          this.value = new MarkdownType();
1122          return this.value;
1123        }
1124        else if (name.equals("valueOid")) {
1125          this.value = new OidType();
1126          return this.value;
1127        }
1128        else if (name.equals("valuePositiveInt")) {
1129          this.value = new PositiveIntType();
1130          return this.value;
1131        }
1132        else if (name.equals("valueString")) {
1133          this.value = new StringType();
1134          return this.value;
1135        }
1136        else if (name.equals("valueTime")) {
1137          this.value = new TimeType();
1138          return this.value;
1139        }
1140        else if (name.equals("valueUnsignedInt")) {
1141          this.value = new UnsignedIntType();
1142          return this.value;
1143        }
1144        else if (name.equals("valueUri")) {
1145          this.value = new UriType();
1146          return this.value;
1147        }
1148        else if (name.equals("valueUrl")) {
1149          this.value = new UrlType();
1150          return this.value;
1151        }
1152        else if (name.equals("valueUuid")) {
1153          this.value = new UuidType();
1154          return this.value;
1155        }
1156        else if (name.equals("valueAddress")) {
1157          this.value = new Address();
1158          return this.value;
1159        }
1160        else if (name.equals("valueAge")) {
1161          this.value = new Age();
1162          return this.value;
1163        }
1164        else if (name.equals("valueAnnotation")) {
1165          this.value = new Annotation();
1166          return this.value;
1167        }
1168        else if (name.equals("valueAttachment")) {
1169          this.value = new Attachment();
1170          return this.value;
1171        }
1172        else if (name.equals("valueCodeableConcept")) {
1173          this.value = new CodeableConcept();
1174          return this.value;
1175        }
1176        else if (name.equals("valueCoding")) {
1177          this.value = new Coding();
1178          return this.value;
1179        }
1180        else if (name.equals("valueContactPoint")) {
1181          this.value = new ContactPoint();
1182          return this.value;
1183        }
1184        else if (name.equals("valueCount")) {
1185          this.value = new Count();
1186          return this.value;
1187        }
1188        else if (name.equals("valueDistance")) {
1189          this.value = new Distance();
1190          return this.value;
1191        }
1192        else if (name.equals("valueDuration")) {
1193          this.value = new Duration();
1194          return this.value;
1195        }
1196        else if (name.equals("valueHumanName")) {
1197          this.value = new HumanName();
1198          return this.value;
1199        }
1200        else if (name.equals("valueIdentifier")) {
1201          this.value = new Identifier();
1202          return this.value;
1203        }
1204        else if (name.equals("valueMoney")) {
1205          this.value = new Money();
1206          return this.value;
1207        }
1208        else if (name.equals("valuePeriod")) {
1209          this.value = new Period();
1210          return this.value;
1211        }
1212        else if (name.equals("valueQuantity")) {
1213          this.value = new Quantity();
1214          return this.value;
1215        }
1216        else if (name.equals("valueRange")) {
1217          this.value = new Range();
1218          return this.value;
1219        }
1220        else if (name.equals("valueRatio")) {
1221          this.value = new Ratio();
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