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