001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r4.model.Enumerations.*;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.
050 */
051@DatatypeDef(name="ParameterDefinition")
052public class ParameterDefinition extends Type implements ICompositeType {
053
054    public enum ParameterUse {
055        /**
056         * This is an input parameter.
057         */
058        IN, 
059        /**
060         * This is an output parameter.
061         */
062        OUT, 
063        /**
064         * added to help the parsers with the generic types
065         */
066        NULL;
067        public static ParameterUse fromCode(String codeString) throws FHIRException {
068            if (codeString == null || "".equals(codeString))
069                return null;
070        if ("in".equals(codeString))
071          return IN;
072        if ("out".equals(codeString))
073          return OUT;
074        if (Configuration.isAcceptInvalidEnums())
075          return null;
076        else
077          throw new FHIRException("Unknown ParameterUse code '"+codeString+"'");
078        }
079        public String toCode() {
080          switch (this) {
081            case IN: return "in";
082            case OUT: return "out";
083            case NULL: return null;
084            default: return "?";
085          }
086        }
087        public String getSystem() {
088          switch (this) {
089            case IN: return "http://hl7.org/fhir/operation-parameter-use";
090            case OUT: return "http://hl7.org/fhir/operation-parameter-use";
091            case NULL: return null;
092            default: return "?";
093          }
094        }
095        public String getDefinition() {
096          switch (this) {
097            case IN: return "This is an input parameter.";
098            case OUT: return "This is an output parameter.";
099            case NULL: return null;
100            default: return "?";
101          }
102        }
103        public String getDisplay() {
104          switch (this) {
105            case IN: return "In";
106            case OUT: return "Out";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111    }
112
113  public static class ParameterUseEnumFactory implements EnumFactory<ParameterUse> {
114    public ParameterUse fromCode(String codeString) throws IllegalArgumentException {
115      if (codeString == null || "".equals(codeString))
116            if (codeString == null || "".equals(codeString))
117                return null;
118        if ("in".equals(codeString))
119          return ParameterUse.IN;
120        if ("out".equals(codeString))
121          return ParameterUse.OUT;
122        throw new IllegalArgumentException("Unknown ParameterUse code '"+codeString+"'");
123        }
124        public Enumeration<ParameterUse> fromType(Base code) throws FHIRException {
125          if (code == null)
126            return null;
127          if (code.isEmpty())
128            return new Enumeration<ParameterUse>(this);
129          String codeString = ((PrimitiveType) code).asStringValue();
130          if (codeString == null || "".equals(codeString))
131            return null;
132        if ("in".equals(codeString))
133          return new Enumeration<ParameterUse>(this, ParameterUse.IN);
134        if ("out".equals(codeString))
135          return new Enumeration<ParameterUse>(this, ParameterUse.OUT);
136        throw new FHIRException("Unknown ParameterUse code '"+codeString+"'");
137        }
138    public String toCode(ParameterUse code) {
139      if (code == ParameterUse.IN)
140        return "in";
141      if (code == ParameterUse.OUT)
142        return "out";
143      return "?";
144      }
145    public String toSystem(ParameterUse code) {
146      return code.getSystem();
147      }
148    }
149
150    /**
151     * The name of the parameter used to allow access to the value of the parameter in evaluation contexts.
152     */
153    @Child(name = "name", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true)
154    @Description(shortDefinition="Name used to access the parameter value", formalDefinition="The name of the parameter used to allow access to the value of the parameter in evaluation contexts." )
155    protected CodeType name;
156
157    /**
158     * Whether the parameter is input or output for the module.
159     */
160    @Child(name = "use", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
161    @Description(shortDefinition="in | out", formalDefinition="Whether the parameter is input or output for the module." )
162    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/operation-parameter-use")
163    protected Enumeration<ParameterUse> use;
164
165    /**
166     * The minimum number of times this parameter SHALL appear in the request or response.
167     */
168    @Child(name = "min", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true)
169    @Description(shortDefinition="Minimum cardinality", formalDefinition="The minimum number of times this parameter SHALL appear in the request or response." )
170    protected IntegerType min;
171
172    /**
173     * The maximum number of times this element is permitted to appear in the request or response.
174     */
175    @Child(name = "max", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
176    @Description(shortDefinition="Maximum cardinality (a number of *)", formalDefinition="The maximum number of times this element is permitted to appear in the request or response." )
177    protected StringType max;
178
179    /**
180     * A brief discussion of what the parameter is for and how it is used by the module.
181     */
182    @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
183    @Description(shortDefinition="A brief description of the parameter", formalDefinition="A brief discussion of what the parameter is for and how it is used by the module." )
184    protected StringType documentation;
185
186    /**
187     * The type of the parameter.
188     */
189    @Child(name = "type", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=true)
190    @Description(shortDefinition="What type of value", formalDefinition="The type of the parameter." )
191    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-types")
192    protected CodeType type;
193
194    /**
195     * If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.
196     */
197    @Child(name = "profile", type = {CanonicalType.class}, order=6, min=0, max=1, modifier=false, summary=true)
198    @Description(shortDefinition="What profile the value is expected to be", formalDefinition="If specified, this indicates a profile that the input data must conform to, or that the output data will conform to." )
199    protected CanonicalType profile;
200
201    private static final long serialVersionUID = -1891730734L;
202
203  /**
204   * Constructor
205   */
206    public ParameterDefinition() {
207      super();
208    }
209
210  /**
211   * Constructor
212   */
213    public ParameterDefinition(Enumeration<ParameterUse> use, CodeType type) {
214      super();
215      this.use = use;
216      this.type = type;
217    }
218
219    /**
220     * @return {@link #name} (The name of the parameter used to allow access to the value of the parameter in evaluation contexts.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
221     */
222    public CodeType getNameElement() { 
223      if (this.name == null)
224        if (Configuration.errorOnAutoCreate())
225          throw new Error("Attempt to auto-create ParameterDefinition.name");
226        else if (Configuration.doAutoCreate())
227          this.name = new CodeType(); // bb
228      return this.name;
229    }
230
231    public boolean hasNameElement() { 
232      return this.name != null && !this.name.isEmpty();
233    }
234
235    public boolean hasName() { 
236      return this.name != null && !this.name.isEmpty();
237    }
238
239    /**
240     * @param value {@link #name} (The name of the parameter used to allow access to the value of the parameter in evaluation contexts.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
241     */
242    public ParameterDefinition setNameElement(CodeType value) { 
243      this.name = value;
244      return this;
245    }
246
247    /**
248     * @return The name of the parameter used to allow access to the value of the parameter in evaluation contexts.
249     */
250    public String getName() { 
251      return this.name == null ? null : this.name.getValue();
252    }
253
254    /**
255     * @param value The name of the parameter used to allow access to the value of the parameter in evaluation contexts.
256     */
257    public ParameterDefinition setName(String value) { 
258      if (Utilities.noString(value))
259        this.name = null;
260      else {
261        if (this.name == null)
262          this.name = new CodeType();
263        this.name.setValue(value);
264      }
265      return this;
266    }
267
268    /**
269     * @return {@link #use} (Whether the parameter is input or output for the module.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
270     */
271    public Enumeration<ParameterUse> getUseElement() { 
272      if (this.use == null)
273        if (Configuration.errorOnAutoCreate())
274          throw new Error("Attempt to auto-create ParameterDefinition.use");
275        else if (Configuration.doAutoCreate())
276          this.use = new Enumeration<ParameterUse>(new ParameterUseEnumFactory()); // bb
277      return this.use;
278    }
279
280    public boolean hasUseElement() { 
281      return this.use != null && !this.use.isEmpty();
282    }
283
284    public boolean hasUse() { 
285      return this.use != null && !this.use.isEmpty();
286    }
287
288    /**
289     * @param value {@link #use} (Whether the parameter is input or output for the module.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
290     */
291    public ParameterDefinition setUseElement(Enumeration<ParameterUse> value) { 
292      this.use = value;
293      return this;
294    }
295
296    /**
297     * @return Whether the parameter is input or output for the module.
298     */
299    public ParameterUse getUse() { 
300      return this.use == null ? null : this.use.getValue();
301    }
302
303    /**
304     * @param value Whether the parameter is input or output for the module.
305     */
306    public ParameterDefinition setUse(ParameterUse value) { 
307        if (this.use == null)
308          this.use = new Enumeration<ParameterUse>(new ParameterUseEnumFactory());
309        this.use.setValue(value);
310      return this;
311    }
312
313    /**
314     * @return {@link #min} (The minimum number of times this parameter SHALL appear in the request or response.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
315     */
316    public IntegerType getMinElement() { 
317      if (this.min == null)
318        if (Configuration.errorOnAutoCreate())
319          throw new Error("Attempt to auto-create ParameterDefinition.min");
320        else if (Configuration.doAutoCreate())
321          this.min = new IntegerType(); // bb
322      return this.min;
323    }
324
325    public boolean hasMinElement() { 
326      return this.min != null && !this.min.isEmpty();
327    }
328
329    public boolean hasMin() { 
330      return this.min != null && !this.min.isEmpty();
331    }
332
333    /**
334     * @param value {@link #min} (The minimum number of times this parameter SHALL appear in the request or response.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
335     */
336    public ParameterDefinition setMinElement(IntegerType value) { 
337      this.min = value;
338      return this;
339    }
340
341    /**
342     * @return The minimum number of times this parameter SHALL appear in the request or response.
343     */
344    public int getMin() { 
345      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
346    }
347
348    /**
349     * @param value The minimum number of times this parameter SHALL appear in the request or response.
350     */
351    public ParameterDefinition setMin(int value) { 
352        if (this.min == null)
353          this.min = new IntegerType();
354        this.min.setValue(value);
355      return this;
356    }
357
358    /**
359     * @return {@link #max} (The maximum number of times this element is permitted to appear in the request or response.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
360     */
361    public StringType getMaxElement() { 
362      if (this.max == null)
363        if (Configuration.errorOnAutoCreate())
364          throw new Error("Attempt to auto-create ParameterDefinition.max");
365        else if (Configuration.doAutoCreate())
366          this.max = new StringType(); // bb
367      return this.max;
368    }
369
370    public boolean hasMaxElement() { 
371      return this.max != null && !this.max.isEmpty();
372    }
373
374    public boolean hasMax() { 
375      return this.max != null && !this.max.isEmpty();
376    }
377
378    /**
379     * @param value {@link #max} (The maximum number of times this element is permitted to appear in the request or response.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
380     */
381    public ParameterDefinition setMaxElement(StringType value) { 
382      this.max = value;
383      return this;
384    }
385
386    /**
387     * @return The maximum number of times this element is permitted to appear in the request or response.
388     */
389    public String getMax() { 
390      return this.max == null ? null : this.max.getValue();
391    }
392
393    /**
394     * @param value The maximum number of times this element is permitted to appear in the request or response.
395     */
396    public ParameterDefinition setMax(String value) { 
397      if (Utilities.noString(value))
398        this.max = null;
399      else {
400        if (this.max == null)
401          this.max = new StringType();
402        this.max.setValue(value);
403      }
404      return this;
405    }
406
407    /**
408     * @return {@link #documentation} (A brief discussion of what the parameter is for and how it is used by the module.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
409     */
410    public StringType getDocumentationElement() { 
411      if (this.documentation == null)
412        if (Configuration.errorOnAutoCreate())
413          throw new Error("Attempt to auto-create ParameterDefinition.documentation");
414        else if (Configuration.doAutoCreate())
415          this.documentation = new StringType(); // bb
416      return this.documentation;
417    }
418
419    public boolean hasDocumentationElement() { 
420      return this.documentation != null && !this.documentation.isEmpty();
421    }
422
423    public boolean hasDocumentation() { 
424      return this.documentation != null && !this.documentation.isEmpty();
425    }
426
427    /**
428     * @param value {@link #documentation} (A brief discussion of what the parameter is for and how it is used by the module.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
429     */
430    public ParameterDefinition setDocumentationElement(StringType value) { 
431      this.documentation = value;
432      return this;
433    }
434
435    /**
436     * @return A brief discussion of what the parameter is for and how it is used by the module.
437     */
438    public String getDocumentation() { 
439      return this.documentation == null ? null : this.documentation.getValue();
440    }
441
442    /**
443     * @param value A brief discussion of what the parameter is for and how it is used by the module.
444     */
445    public ParameterDefinition setDocumentation(String value) { 
446      if (Utilities.noString(value))
447        this.documentation = null;
448      else {
449        if (this.documentation == null)
450          this.documentation = new StringType();
451        this.documentation.setValue(value);
452      }
453      return this;
454    }
455
456    /**
457     * @return {@link #type} (The type of the parameter.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
458     */
459    public CodeType getTypeElement() { 
460      if (this.type == null)
461        if (Configuration.errorOnAutoCreate())
462          throw new Error("Attempt to auto-create ParameterDefinition.type");
463        else if (Configuration.doAutoCreate())
464          this.type = new CodeType(); // bb
465      return this.type;
466    }
467
468    public boolean hasTypeElement() { 
469      return this.type != null && !this.type.isEmpty();
470    }
471
472    public boolean hasType() { 
473      return this.type != null && !this.type.isEmpty();
474    }
475
476    /**
477     * @param value {@link #type} (The type of the parameter.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
478     */
479    public ParameterDefinition setTypeElement(CodeType value) { 
480      this.type = value;
481      return this;
482    }
483
484    /**
485     * @return The type of the parameter.
486     */
487    public String getType() { 
488      return this.type == null ? null : this.type.getValue();
489    }
490
491    /**
492     * @param value The type of the parameter.
493     */
494    public ParameterDefinition setType(String value) { 
495        if (this.type == null)
496          this.type = new CodeType();
497        this.type.setValue(value);
498      return this;
499    }
500
501    /**
502     * @return {@link #profile} (If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value
503     */
504    public CanonicalType getProfileElement() { 
505      if (this.profile == null)
506        if (Configuration.errorOnAutoCreate())
507          throw new Error("Attempt to auto-create ParameterDefinition.profile");
508        else if (Configuration.doAutoCreate())
509          this.profile = new CanonicalType(); // bb
510      return this.profile;
511    }
512
513    public boolean hasProfileElement() { 
514      return this.profile != null && !this.profile.isEmpty();
515    }
516
517    public boolean hasProfile() { 
518      return this.profile != null && !this.profile.isEmpty();
519    }
520
521    /**
522     * @param value {@link #profile} (If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value
523     */
524    public ParameterDefinition setProfileElement(CanonicalType value) { 
525      this.profile = value;
526      return this;
527    }
528
529    /**
530     * @return If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.
531     */
532    public String getProfile() { 
533      return this.profile == null ? null : this.profile.getValue();
534    }
535
536    /**
537     * @param value If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.
538     */
539    public ParameterDefinition setProfile(String value) { 
540      if (Utilities.noString(value))
541        this.profile = null;
542      else {
543        if (this.profile == null)
544          this.profile = new CanonicalType();
545        this.profile.setValue(value);
546      }
547      return this;
548    }
549
550      protected void listChildren(List<Property> children) {
551        super.listChildren(children);
552        children.add(new Property("name", "code", "The name of the parameter used to allow access to the value of the parameter in evaluation contexts.", 0, 1, name));
553        children.add(new Property("use", "code", "Whether the parameter is input or output for the module.", 0, 1, use));
554        children.add(new Property("min", "integer", "The minimum number of times this parameter SHALL appear in the request or response.", 0, 1, min));
555        children.add(new Property("max", "string", "The maximum number of times this element is permitted to appear in the request or response.", 0, 1, max));
556        children.add(new Property("documentation", "string", "A brief discussion of what the parameter is for and how it is used by the module.", 0, 1, documentation));
557        children.add(new Property("type", "code", "The type of the parameter.", 0, 1, type));
558        children.add(new Property("profile", "canonical(StructureDefinition)", "If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.", 0, 1, profile));
559      }
560
561      @Override
562      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
563        switch (_hash) {
564        case 3373707: /*name*/  return new Property("name", "code", "The name of the parameter used to allow access to the value of the parameter in evaluation contexts.", 0, 1, name);
565        case 116103: /*use*/  return new Property("use", "code", "Whether the parameter is input or output for the module.", 0, 1, use);
566        case 108114: /*min*/  return new Property("min", "integer", "The minimum number of times this parameter SHALL appear in the request or response.", 0, 1, min);
567        case 107876: /*max*/  return new Property("max", "string", "The maximum number of times this element is permitted to appear in the request or response.", 0, 1, max);
568        case 1587405498: /*documentation*/  return new Property("documentation", "string", "A brief discussion of what the parameter is for and how it is used by the module.", 0, 1, documentation);
569        case 3575610: /*type*/  return new Property("type", "code", "The type of the parameter.", 0, 1, type);
570        case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition)", "If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.", 0, 1, profile);
571        default: return super.getNamedProperty(_hash, _name, _checkValid);
572        }
573
574      }
575
576      @Override
577      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
578        switch (hash) {
579        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // CodeType
580        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<ParameterUse>
581        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // IntegerType
582        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
583        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
584        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
585        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // CanonicalType
586        default: return super.getProperty(hash, name, checkValid);
587        }
588
589      }
590
591      @Override
592      public Base setProperty(int hash, String name, Base value) throws FHIRException {
593        switch (hash) {
594        case 3373707: // name
595          this.name = castToCode(value); // CodeType
596          return value;
597        case 116103: // use
598          value = new ParameterUseEnumFactory().fromType(castToCode(value));
599          this.use = (Enumeration) value; // Enumeration<ParameterUse>
600          return value;
601        case 108114: // min
602          this.min = castToInteger(value); // IntegerType
603          return value;
604        case 107876: // max
605          this.max = castToString(value); // StringType
606          return value;
607        case 1587405498: // documentation
608          this.documentation = castToString(value); // StringType
609          return value;
610        case 3575610: // type
611          this.type = castToCode(value); // CodeType
612          return value;
613        case -309425751: // profile
614          this.profile = castToCanonical(value); // CanonicalType
615          return value;
616        default: return super.setProperty(hash, name, value);
617        }
618
619      }
620
621      @Override
622      public Base setProperty(String name, Base value) throws FHIRException {
623        if (name.equals("name")) {
624          this.name = castToCode(value); // CodeType
625        } else if (name.equals("use")) {
626          value = new ParameterUseEnumFactory().fromType(castToCode(value));
627          this.use = (Enumeration) value; // Enumeration<ParameterUse>
628        } else if (name.equals("min")) {
629          this.min = castToInteger(value); // IntegerType
630        } else if (name.equals("max")) {
631          this.max = castToString(value); // StringType
632        } else if (name.equals("documentation")) {
633          this.documentation = castToString(value); // StringType
634        } else if (name.equals("type")) {
635          this.type = castToCode(value); // CodeType
636        } else if (name.equals("profile")) {
637          this.profile = castToCanonical(value); // CanonicalType
638        } else
639          return super.setProperty(name, value);
640        return value;
641      }
642
643      @Override
644      public Base makeProperty(int hash, String name) throws FHIRException {
645        switch (hash) {
646        case 3373707:  return getNameElement();
647        case 116103:  return getUseElement();
648        case 108114:  return getMinElement();
649        case 107876:  return getMaxElement();
650        case 1587405498:  return getDocumentationElement();
651        case 3575610:  return getTypeElement();
652        case -309425751:  return getProfileElement();
653        default: return super.makeProperty(hash, name);
654        }
655
656      }
657
658      @Override
659      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
660        switch (hash) {
661        case 3373707: /*name*/ return new String[] {"code"};
662        case 116103: /*use*/ return new String[] {"code"};
663        case 108114: /*min*/ return new String[] {"integer"};
664        case 107876: /*max*/ return new String[] {"string"};
665        case 1587405498: /*documentation*/ return new String[] {"string"};
666        case 3575610: /*type*/ return new String[] {"code"};
667        case -309425751: /*profile*/ return new String[] {"canonical"};
668        default: return super.getTypesForProperty(hash, name);
669        }
670
671      }
672
673      @Override
674      public Base addChild(String name) throws FHIRException {
675        if (name.equals("name")) {
676          throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.name");
677        }
678        else if (name.equals("use")) {
679          throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.use");
680        }
681        else if (name.equals("min")) {
682          throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.min");
683        }
684        else if (name.equals("max")) {
685          throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.max");
686        }
687        else if (name.equals("documentation")) {
688          throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.documentation");
689        }
690        else if (name.equals("type")) {
691          throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.type");
692        }
693        else if (name.equals("profile")) {
694          throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.profile");
695        }
696        else
697          return super.addChild(name);
698      }
699
700  public String fhirType() {
701    return "ParameterDefinition";
702
703  }
704
705      public ParameterDefinition copy() {
706        ParameterDefinition dst = new ParameterDefinition();
707        copyValues(dst);
708        return dst;
709      }
710
711      public void copyValues(ParameterDefinition dst) {
712        super.copyValues(dst);
713        dst.name = name == null ? null : name.copy();
714        dst.use = use == null ? null : use.copy();
715        dst.min = min == null ? null : min.copy();
716        dst.max = max == null ? null : max.copy();
717        dst.documentation = documentation == null ? null : documentation.copy();
718        dst.type = type == null ? null : type.copy();
719        dst.profile = profile == null ? null : profile.copy();
720      }
721
722      protected ParameterDefinition typedCopy() {
723        return copy();
724      }
725
726      @Override
727      public boolean equalsDeep(Base other_) {
728        if (!super.equalsDeep(other_))
729          return false;
730        if (!(other_ instanceof ParameterDefinition))
731          return false;
732        ParameterDefinition o = (ParameterDefinition) other_;
733        return compareDeep(name, o.name, true) && compareDeep(use, o.use, true) && compareDeep(min, o.min, true)
734           && compareDeep(max, o.max, true) && compareDeep(documentation, o.documentation, true) && compareDeep(type, o.type, true)
735           && compareDeep(profile, o.profile, true);
736      }
737
738      @Override
739      public boolean equalsShallow(Base other_) {
740        if (!super.equalsShallow(other_))
741          return false;
742        if (!(other_ instanceof ParameterDefinition))
743          return false;
744        ParameterDefinition o = (ParameterDefinition) other_;
745        return compareValues(name, o.name, true) && compareValues(use, o.use, true) && compareValues(min, o.min, true)
746           && compareValues(max, o.max, true) && compareValues(documentation, o.documentation, true) && compareValues(type, o.type, true)
747          ;
748      }
749
750      public boolean isEmpty() {
751        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, use, min, max, documentation
752          , type, profile);
753      }
754
755
756}