001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
038import org.hl7.fhir.instance.model.api.IBaseParameters;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044
045/**
046 * This resource is a non-persisted resource used to pass information into and
047 * back from an [operation](operations.html). It has no other use, and there is
048 * no RESTful endpoint associated with it.
049 */
050@ResourceDef(name = "Parameters", profile = "http://hl7.org/fhir/StructureDefinition/Parameters")
051public class Parameters extends Resource implements IBaseParameters {
052
053  @Block()
054  public static class ParametersParameterComponent extends BackboneElement implements IBaseBackboneElement {
055    /**
056     * The name of the parameter (reference to the operation definition).
057     */
058    @Child(name = "name", type = { StringType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
059    @Description(shortDefinition = "Name from the definition", formalDefinition = "The name of the parameter (reference to the operation definition).")
060    protected StringType name;
061
062    /**
063     * If the parameter is a data type.
064     */
065    @Child(name = "value", type = {}, order = 2, min = 0, max = 1, modifier = false, summary = true)
066    @Description(shortDefinition = "If parameter is a data type", formalDefinition = "If the parameter is a data type.")
067    protected org.hl7.fhir.r4.model.Type value;
068
069    /**
070     * If the parameter is a whole resource.
071     */
072    @Child(name = "resource", type = { Resource.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
073    @Description(shortDefinition = "If parameter is a whole resource", formalDefinition = "If the parameter is a whole resource.")
074    protected Resource resource;
075
076    /**
077     * A named part of a multi-part parameter.
078     */
079    @Child(name = "part", type = {
080        ParametersParameterComponent.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
081    @Description(shortDefinition = "Named part of a multi-part parameter", formalDefinition = "A named part of a multi-part parameter.")
082    protected List<ParametersParameterComponent> part;
083
084    private static final long serialVersionUID = -1265707999L;
085
086    /**
087     * Constructor
088     */
089    public ParametersParameterComponent() {
090      super();
091    }
092
093    /**
094     * Constructor
095     */
096    public ParametersParameterComponent(StringType name) {
097      super();
098      this.name = name;
099    }
100
101    /**
102     * @return {@link #name} (The name of the parameter (reference to the operation
103     *         definition).). This is the underlying object with id, value and
104     *         extensions. The accessor "getName" gives direct access to the value
105     */
106    public StringType getNameElement() {
107      if (this.name == null)
108        if (Configuration.errorOnAutoCreate())
109          throw new Error("Attempt to auto-create ParametersParameterComponent.name");
110        else if (Configuration.doAutoCreate())
111          this.name = new StringType(); // bb
112      return this.name;
113    }
114
115    public boolean hasNameElement() {
116      return this.name != null && !this.name.isEmpty();
117    }
118
119    public boolean hasName() {
120      return this.name != null && !this.name.isEmpty();
121    }
122
123    /**
124     * @param value {@link #name} (The name of the parameter (reference to the
125     *              operation definition).). This is the underlying object with id,
126     *              value and extensions. The accessor "getName" gives direct access
127     *              to the value
128     */
129    public ParametersParameterComponent setNameElement(StringType value) {
130      this.name = value;
131      return this;
132    }
133
134    /**
135     * @return The name of the parameter (reference to the operation definition).
136     */
137    public String getName() {
138      return this.name == null ? null : this.name.getValue();
139    }
140
141    /**
142     * @param value The name of the parameter (reference to the operation
143     *              definition).
144     */
145    public ParametersParameterComponent setName(String value) {
146      if (this.name == null)
147        this.name = new StringType();
148      this.name.setValue(value);
149      return this;
150    }
151
152    /**
153     * @return {@link #value} (If the parameter is a data type.)
154     */
155    public org.hl7.fhir.r4.model.Type getValue() {
156      return this.value;
157    }
158
159    public boolean hasValue() {
160      return this.value != null && !this.value.isEmpty();
161    }
162
163    /**
164     * @param value {@link #value} (If the parameter is a data type.)
165     */
166    public ParametersParameterComponent setValue(org.hl7.fhir.r4.model.Type value) {
167      this.value = value;
168      return this;
169    }
170
171    /**
172     * @return {@link #resource} (If the parameter is a whole resource.)
173     */
174    public Resource getResource() {
175      return this.resource;
176    }
177
178    public boolean hasResource() {
179      return this.resource != null && !this.resource.isEmpty();
180    }
181
182    /**
183     * @param value {@link #resource} (If the parameter is a whole resource.)
184     */
185    public ParametersParameterComponent setResource(Resource value) {
186      this.resource = value;
187      return this;
188    }
189
190    /**
191     * @return {@link #part} (A named part of a multi-part parameter.)
192     */
193    public List<ParametersParameterComponent> getPart() {
194      if (this.part == null)
195        this.part = new ArrayList<ParametersParameterComponent>();
196      return this.part;
197    }
198
199    /**
200     * @return Returns a reference to <code>this</code> for easy method chaining
201     */
202    public ParametersParameterComponent setPart(List<ParametersParameterComponent> thePart) {
203      this.part = thePart;
204      return this;
205    }
206
207    public boolean hasPart() {
208      if (this.part == null)
209        return false;
210      for (ParametersParameterComponent item : this.part)
211        if (!item.isEmpty())
212          return true;
213      return false;
214    }
215
216    public ParametersParameterComponent addPart() { // 3
217      ParametersParameterComponent t = new ParametersParameterComponent();
218      if (this.part == null)
219        this.part = new ArrayList<ParametersParameterComponent>();
220      this.part.add(t);
221      return t;
222    }
223
224    public ParametersParameterComponent addPart(ParametersParameterComponent t) { // 3
225      if (t == null)
226        return this;
227      if (this.part == null)
228        this.part = new ArrayList<ParametersParameterComponent>();
229      this.part.add(t);
230      return this;
231    }
232
233    /**
234     * @return The first repetition of repeating field {@link #part}, creating it if
235     *         it does not already exist
236     */
237    public ParametersParameterComponent getPartFirstRep() {
238      if (getPart().isEmpty()) {
239        addPart();
240      }
241      return getPart().get(0);
242    }
243
244    protected void listChildren(List<Property> children) {
245      super.listChildren(children);
246      children.add(new Property("name", "string", "The name of the parameter (reference to the operation definition).",
247          0, 1, name));
248      children.add(new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value));
249      children.add(new Property("resource", "Resource", "If the parameter is a whole resource.", 0, 1, resource));
250      children.add(new Property("part", "@Parameters.parameter", "A named part of a multi-part parameter.", 0,
251          java.lang.Integer.MAX_VALUE, part));
252    }
253
254    @Override
255    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
256      switch (_hash) {
257      case 3373707:
258        /* name */ return new Property("name", "string",
259            "The name of the parameter (reference to the operation definition).", 0, 1, name);
260      case -1410166417:
261        /* value[x] */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
262      case 111972721:
263        /* value */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
264      case -1535024575:
265        /* valueBase64Binary */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
266      case 733421943:
267        /* valueBoolean */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
268      case -786218365:
269        /* valueCanonical */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
270      case -766209282:
271        /* valueCode */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
272      case -766192449:
273        /* valueDate */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
274      case 1047929900:
275        /* valueDateTime */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
276      case -2083993440:
277        /* valueDecimal */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
278      case 231604844:
279        /* valueId */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
280      case -1668687056:
281        /* valueInstant */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
282      case -1668204915:
283        /* valueInteger */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
284      case -497880704:
285        /* valueMarkdown */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
286      case -1410178407:
287        /* valueOid */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
288      case -1249932027:
289        /* valuePositiveInt */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
290      case -1424603934:
291        /* valueString */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
292      case -765708322:
293        /* valueTime */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
294      case 26529417:
295        /* valueUnsignedInt */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
296      case -1410172357:
297        /* valueUri */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
298      case -1410172354:
299        /* valueUrl */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
300      case -765667124:
301        /* valueUuid */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
302      case -478981821:
303        /* valueAddress */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
304      case -67108992:
305        /* valueAnnotation */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
306      case -475566732:
307        /* valueAttachment */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
308      case 924902896:
309        /* valueCodeableConcept */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1,
310            value);
311      case -1887705029:
312        /* valueCoding */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
313      case 944904545:
314        /* valueContactPoint */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
315      case -2026205465:
316        /* valueHumanName */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
317      case -130498310:
318        /* valueIdentifier */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
319      case -1524344174:
320        /* valuePeriod */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
321      case -2029823716:
322        /* valueQuantity */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
323      case 2030761548:
324        /* valueRange */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
325      case 2030767386:
326        /* valueRatio */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
327      case 1755241690:
328        /* valueReference */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
329      case -962229101:
330        /* valueSampledData */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
331      case -540985785:
332        /* valueSignature */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
333      case -1406282469:
334        /* valueTiming */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
335      case -1858636920:
336        /* valueDosage */ return new Property("value[x]", "*", "If the parameter is a data type.", 0, 1, value);
337      case -341064690:
338        /* resource */ return new Property("resource", "Resource", "If the parameter is a whole resource.", 0, 1,
339            resource);
340      case 3433459:
341        /* part */ return new Property("part", "@Parameters.parameter", "A named part of a multi-part parameter.", 0,
342            java.lang.Integer.MAX_VALUE, part);
343      default:
344        return super.getNamedProperty(_hash, _name, _checkValid);
345      }
346
347    }
348
349    @Override
350    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
351      switch (hash) {
352      case 3373707:
353        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
354      case 111972721:
355        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // org.hl7.fhir.r4.model.Type
356      case -341064690:
357        /* resource */ return this.resource == null ? new Base[0] : new Base[] { this.resource }; // Resource
358      case 3433459:
359        /* part */ return this.part == null ? new Base[0] : this.part.toArray(new Base[this.part.size()]); // ParametersParameterComponent
360      default:
361        return super.getProperty(hash, name, checkValid);
362      }
363
364    }
365
366    @Override
367    public Base setProperty(int hash, String name, Base value) throws FHIRException {
368      switch (hash) {
369      case 3373707: // name
370        this.name = castToString(value); // StringType
371        return value;
372      case 111972721: // value
373        this.value = castToType(value); // org.hl7.fhir.r4.model.Type
374        return value;
375      case -341064690: // resource
376        this.resource = castToResource(value); // Resource
377        return value;
378      case 3433459: // part
379        this.getPart().add((ParametersParameterComponent) value); // ParametersParameterComponent
380        return value;
381      default:
382        return super.setProperty(hash, name, value);
383      }
384
385    }
386
387    @Override
388    public Base setProperty(String name, Base value) throws FHIRException {
389      if (name.equals("name")) {
390        this.name = castToString(value); // StringType
391      } else if (name.equals("value[x]")) {
392        this.value = castToType(value); // org.hl7.fhir.r4.model.Type
393      } else if (name.equals("resource")) {
394        this.resource = castToResource(value); // Resource
395      } else if (name.equals("part")) {
396        this.getPart().add((ParametersParameterComponent) value);
397      } else
398        return super.setProperty(name, value);
399      return value;
400    }
401
402  @Override
403  public void removeChild(String name, Base value) throws FHIRException {
404      if (name.equals("name")) {
405        this.name = null;
406      } else if (name.equals("value[x]")) {
407        this.value = null;
408      } else if (name.equals("resource")) {
409        this.resource = null;
410      } else if (name.equals("part")) {
411        this.getPart().remove((ParametersParameterComponent) value);
412      } else
413        super.removeChild(name, value);
414      
415    }
416
417    @Override
418    public Base makeProperty(int hash, String name) throws FHIRException {
419      switch (hash) {
420      case 3373707:
421        return getNameElement();
422      case -1410166417:
423        return getValue();
424      case 111972721:
425        return getValue();
426      case -341064690:
427        throw new FHIRException("Cannot make property resource as it is not a complex type"); // Resource
428      case 3433459:
429        return addPart();
430      default:
431        return super.makeProperty(hash, name);
432      }
433
434    }
435
436    @Override
437    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
438      switch (hash) {
439      case 3373707:
440        /* name */ return new String[] { "string" };
441      case 111972721:
442        /* value */ return new String[] { "*" };
443      case -341064690:
444        /* resource */ return new String[] { "Resource" };
445      case 3433459:
446        /* part */ return new String[] { "@Parameters.parameter" };
447      default:
448        return super.getTypesForProperty(hash, name);
449      }
450
451    }
452
453    @Override
454    public Base addChild(String name) throws FHIRException {
455      if (name.equals("name")) {
456        throw new FHIRException("Cannot call addChild on a singleton property Parameters.name");
457      } else if (name.equals("valueBase64Binary")) {
458        this.value = new Base64BinaryType();
459        return this.value;
460      } else if (name.equals("valueBoolean")) {
461        this.value = new BooleanType();
462        return this.value;
463      } else if (name.equals("valueCanonical")) {
464        this.value = new CanonicalType();
465        return this.value;
466      } else if (name.equals("valueCode")) {
467        this.value = new CodeType();
468        return this.value;
469      } else if (name.equals("valueDate")) {
470        this.value = new DateType();
471        return this.value;
472      } else if (name.equals("valueDateTime")) {
473        this.value = new DateTimeType();
474        return this.value;
475      } else if (name.equals("valueDecimal")) {
476        this.value = new DecimalType();
477        return this.value;
478      } else if (name.equals("valueId")) {
479        this.value = new IdType();
480        return this.value;
481      } else if (name.equals("valueInstant")) {
482        this.value = new InstantType();
483        return this.value;
484      } else if (name.equals("valueInteger")) {
485        this.value = new IntegerType();
486        return this.value;
487      } else if (name.equals("valueMarkdown")) {
488        this.value = new MarkdownType();
489        return this.value;
490      } else if (name.equals("valueOid")) {
491        this.value = new OidType();
492        return this.value;
493      } else if (name.equals("valuePositiveInt")) {
494        this.value = new PositiveIntType();
495        return this.value;
496      } else if (name.equals("valueString")) {
497        this.value = new StringType();
498        return this.value;
499      } else if (name.equals("valueTime")) {
500        this.value = new TimeType();
501        return this.value;
502      } else if (name.equals("valueUnsignedInt")) {
503        this.value = new UnsignedIntType();
504        return this.value;
505      } else if (name.equals("valueUri")) {
506        this.value = new UriType();
507        return this.value;
508      } else if (name.equals("valueUrl")) {
509        this.value = new UrlType();
510        return this.value;
511      } else if (name.equals("valueUuid")) {
512        this.value = new UuidType();
513        return this.value;
514      } else if (name.equals("valueAddress")) {
515        this.value = new Address();
516        return this.value;
517      } else if (name.equals("valueAge")) {
518        this.value = new Age();
519        return this.value;
520      } else if (name.equals("valueAnnotation")) {
521        this.value = new Annotation();
522        return this.value;
523      } else if (name.equals("valueAttachment")) {
524        this.value = new Attachment();
525        return this.value;
526      } else if (name.equals("valueCodeableConcept")) {
527        this.value = new CodeableConcept();
528        return this.value;
529      } else if (name.equals("valueCoding")) {
530        this.value = new Coding();
531        return this.value;
532      } else if (name.equals("valueContactPoint")) {
533        this.value = new ContactPoint();
534        return this.value;
535      } else if (name.equals("valueCount")) {
536        this.value = new Count();
537        return this.value;
538      } else if (name.equals("valueDistance")) {
539        this.value = new Distance();
540        return this.value;
541      } else if (name.equals("valueDuration")) {
542        this.value = new Duration();
543        return this.value;
544      } else if (name.equals("valueHumanName")) {
545        this.value = new HumanName();
546        return this.value;
547      } else if (name.equals("valueIdentifier")) {
548        this.value = new Identifier();
549        return this.value;
550      } else if (name.equals("valueMoney")) {
551        this.value = new Money();
552        return this.value;
553      } else if (name.equals("valuePeriod")) {
554        this.value = new Period();
555        return this.value;
556      } else if (name.equals("valueQuantity")) {
557        this.value = new Quantity();
558        return this.value;
559      } else if (name.equals("valueRange")) {
560        this.value = new Range();
561        return this.value;
562      } else if (name.equals("valueRatio")) {
563        this.value = new Ratio();
564        return this.value;
565      } else if (name.equals("valueReference")) {
566        this.value = new Reference();
567        return this.value;
568      } else if (name.equals("valueSampledData")) {
569        this.value = new SampledData();
570        return this.value;
571      } else if (name.equals("valueSignature")) {
572        this.value = new Signature();
573        return this.value;
574      } else if (name.equals("valueTiming")) {
575        this.value = new Timing();
576        return this.value;
577      } else if (name.equals("valueContactDetail")) {
578        this.value = new ContactDetail();
579        return this.value;
580      } else if (name.equals("valueContributor")) {
581        this.value = new Contributor();
582        return this.value;
583      } else if (name.equals("valueDataRequirement")) {
584        this.value = new DataRequirement();
585        return this.value;
586      } else if (name.equals("valueExpression")) {
587        this.value = new Expression();
588        return this.value;
589      } else if (name.equals("valueParameterDefinition")) {
590        this.value = new ParameterDefinition();
591        return this.value;
592      } else if (name.equals("valueRelatedArtifact")) {
593        this.value = new RelatedArtifact();
594        return this.value;
595      } else if (name.equals("valueTriggerDefinition")) {
596        this.value = new TriggerDefinition();
597        return this.value;
598      } else if (name.equals("valueUsageContext")) {
599        this.value = new UsageContext();
600        return this.value;
601      } else if (name.equals("valueDosage")) {
602        this.value = new Dosage();
603        return this.value;
604      } else if (name.equals("valueMeta")) {
605        this.value = new Meta();
606        return this.value;
607      } else if (name.equals("resource")) {
608        throw new FHIRException("Cannot call addChild on an abstract type Parameters.resource");
609      } else if (name.equals("part")) {
610        return addPart();
611      } else
612        return super.addChild(name);
613    }
614
615    public ParametersParameterComponent copy() {
616      ParametersParameterComponent dst = new ParametersParameterComponent();
617      copyValues(dst);
618      return dst;
619    }
620
621    public void copyValues(ParametersParameterComponent dst) {
622      super.copyValues(dst);
623      dst.name = name == null ? null : name.copy();
624      dst.value = value == null ? null : value.copy();
625      dst.resource = resource == null ? null : resource.copy();
626      if (part != null) {
627        dst.part = new ArrayList<ParametersParameterComponent>();
628        for (ParametersParameterComponent i : part)
629          dst.part.add(i.copy());
630      }
631      ;
632    }
633
634    @Override
635    public boolean equalsDeep(Base other_) {
636      if (!super.equalsDeep(other_))
637        return false;
638      if (!(other_ instanceof ParametersParameterComponent))
639        return false;
640      ParametersParameterComponent o = (ParametersParameterComponent) other_;
641      return compareDeep(name, o.name, true) && compareDeep(value, o.value, true)
642          && compareDeep(resource, o.resource, true) && compareDeep(part, o.part, true);
643    }
644
645    @Override
646    public boolean equalsShallow(Base other_) {
647      if (!super.equalsShallow(other_))
648        return false;
649      if (!(other_ instanceof ParametersParameterComponent))
650        return false;
651      ParametersParameterComponent o = (ParametersParameterComponent) other_;
652      return compareValues(name, o.name, true);
653    }
654
655    public boolean isEmpty() {
656      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, value, resource, part);
657    }
658
659    public String fhirType() {
660      return "Parameters.parameter";
661
662    }
663
664  }
665
666  /**
667   * A parameter passed to or received from the operation.
668   */
669  @Child(name = "parameter", type = {}, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
670  @Description(shortDefinition = "Operation Parameter", formalDefinition = "A parameter passed to or received from the operation.")
671  protected List<ParametersParameterComponent> parameter;
672
673  private static final long serialVersionUID = -1495940293L;
674
675  /**
676   * Constructor
677   */
678  public Parameters() {
679    super();
680  }
681
682  /**
683   * @return {@link #parameter} (A parameter passed to or received from the
684   *         operation.)
685   */
686  public List<ParametersParameterComponent> getParameter() {
687    if (this.parameter == null)
688      this.parameter = new ArrayList<ParametersParameterComponent>();
689    return this.parameter;
690  }
691
692  /**
693   * @return Returns a reference to <code>this</code> for easy method chaining
694   */
695  public Parameters setParameter(List<ParametersParameterComponent> theParameter) {
696    this.parameter = theParameter;
697    return this;
698  }
699
700  public boolean hasParameter() {
701    if (this.parameter == null)
702      return false;
703    for (ParametersParameterComponent item : this.parameter)
704      if (!item.isEmpty())
705        return true;
706    return false;
707  }
708
709  public ParametersParameterComponent addParameter() { // 3
710    ParametersParameterComponent t = new ParametersParameterComponent();
711    if (this.parameter == null)
712      this.parameter = new ArrayList<ParametersParameterComponent>();
713    this.parameter.add(t);
714    return t;
715  }
716
717  public Parameters addParameter(ParametersParameterComponent t) { // 3
718    if (t == null)
719      return this;
720    if (this.parameter == null)
721      this.parameter = new ArrayList<ParametersParameterComponent>();
722    this.parameter.add(t);
723    return this;
724  }
725
726  /**
727   * @return The first repetition of repeating field {@link #parameter}, creating
728   *         it if it does not already exist
729   */
730  public ParametersParameterComponent getParameterFirstRep() {
731    if (getParameter().isEmpty()) {
732      addParameter();
733    }
734    return getParameter().get(0);
735  }
736
737  protected void listChildren(List<Property> children) {
738    super.listChildren(children);
739    children.add(new Property("parameter", "", "A parameter passed to or received from the operation.", 0,
740        java.lang.Integer.MAX_VALUE, parameter));
741  }
742
743  @Override
744  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
745    switch (_hash) {
746    case 1954460585:
747      /* parameter */ return new Property("parameter", "", "A parameter passed to or received from the operation.", 0,
748          java.lang.Integer.MAX_VALUE, parameter);
749    default:
750      return super.getNamedProperty(_hash, _name, _checkValid);
751    }
752
753  }
754
755  @Override
756  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
757    switch (hash) {
758    case 1954460585:
759      /* parameter */ return this.parameter == null ? new Base[0]
760          : this.parameter.toArray(new Base[this.parameter.size()]); // ParametersParameterComponent
761    default:
762      return super.getProperty(hash, name, checkValid);
763    }
764
765  }
766
767  @Override
768  public Base setProperty(int hash, String name, Base value) throws FHIRException {
769    switch (hash) {
770    case 1954460585: // parameter
771      this.getParameter().add((ParametersParameterComponent) value); // ParametersParameterComponent
772      return value;
773    default:
774      return super.setProperty(hash, name, value);
775    }
776
777  }
778
779  @Override
780  public Base setProperty(String name, Base value) throws FHIRException {
781    if (name.equals("parameter")) {
782      this.getParameter().add((ParametersParameterComponent) value);
783    } else
784      return super.setProperty(name, value);
785    return value;
786  }
787
788  @Override
789  public void removeChild(String name, Base value) throws FHIRException {
790    if (name.equals("parameter")) {
791      this.getParameter().remove((ParametersParameterComponent) value);
792    } else
793      super.removeChild(name, value);
794    
795  }
796
797  @Override
798  public Base makeProperty(int hash, String name) throws FHIRException {
799    switch (hash) {
800    case 1954460585:
801      return addParameter();
802    default:
803      return super.makeProperty(hash, name);
804    }
805
806  }
807
808  @Override
809  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
810    switch (hash) {
811    case 1954460585:
812      /* parameter */ return new String[] {};
813    default:
814      return super.getTypesForProperty(hash, name);
815    }
816
817  }
818
819  @Override
820  public Base addChild(String name) throws FHIRException {
821    if (name.equals("parameter")) {
822      return addParameter();
823    } else
824      return super.addChild(name);
825  }
826
827  public String fhirType() {
828    return "Parameters";
829
830  }
831
832  public Parameters copy() {
833    Parameters dst = new Parameters();
834    copyValues(dst);
835    return dst;
836  }
837
838  public void copyValues(Parameters dst) {
839    super.copyValues(dst);
840    if (parameter != null) {
841      dst.parameter = new ArrayList<ParametersParameterComponent>();
842      for (ParametersParameterComponent i : parameter)
843        dst.parameter.add(i.copy());
844    }
845    ;
846  }
847
848  protected Parameters typedCopy() {
849    return copy();
850  }
851
852  @Override
853  public boolean equalsDeep(Base other_) {
854    if (!super.equalsDeep(other_))
855      return false;
856    if (!(other_ instanceof Parameters))
857      return false;
858    Parameters o = (Parameters) other_;
859    return compareDeep(parameter, o.parameter, true);
860  }
861
862  @Override
863  public boolean equalsShallow(Base other_) {
864    if (!super.equalsShallow(other_))
865      return false;
866    if (!(other_ instanceof Parameters))
867      return false;
868    Parameters o = (Parameters) other_;
869    return true;
870  }
871
872  public boolean isEmpty() {
873    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(parameter);
874  }
875
876  @Override
877  public ResourceType getResourceType() {
878    return ResourceType.Parameters;
879  }
880
881// added from java-adornments.txt:
882
883  public Parameters addParameter(String name, boolean b) {
884    addParameter().setName(name).setValue(new BooleanType(b));
885    return this;
886  }
887
888
889  public Parameters addParameter(String name, int i) {
890    addParameter().setName(name).setValue(new IntegerType(i));
891    return this;
892  }
893
894  
895  public Parameters addParameter(String name, String s) {
896    if (s != null)
897      addParameter().setName(name).setValue(new StringType(s));
898    return this;
899  }
900
901  public Parameters addParameter(String name, Type v) {
902    if (v != null)
903      addParameter().setName(name).setValue(v);
904    return this;
905  }
906
907  public Parameters setParameter(String name, boolean b) {
908    for (ParametersParameterComponent p : getParameter()) {
909      if (p.getName().equals(name)) {
910        p.setValue(new BooleanType(b));
911        return this;
912      }
913    }
914    addParameter().setName(name).setValue(new BooleanType(b));
915    return this;
916  }
917
918  public Parameters setParameter(String name, String s) {
919    if (s != null) {
920      for (ParametersParameterComponent p : getParameter()) {
921        if (p.getName().equals(name)) {
922          p.setValue(new StringType(s));
923          return this;
924        }
925      }
926      addParameter().setName(name).setValue(new StringType(s));
927    }
928    return this;
929  }
930
931  public Parameters setParameter(String name, Type v) {
932    if (v != null) {
933      for (ParametersParameterComponent p : getParameter()) {
934        if (p.getName().equals(name)) {
935          p.setValue(v);
936          return this;
937        }
938      }
939      addParameter().setName(name).setValue(v);
940    }
941    return this;
942  }
943
944  public boolean hasParameterValue(String name) {
945    for (ParametersParameterComponent p : getParameter()) {
946      if (p.getName().equals(name) && p.hasValue())
947        return true;
948    }
949    return false;
950  }
951
952  public boolean hasParameter(String name) {
953    for (ParametersParameterComponent p : getParameter()) {
954      if (p.getName().equals(name))
955        return true;
956    }
957    return false;
958  }
959
960  public Type getParameterValue(String name) {
961    for (ParametersParameterComponent p : getParameter()) {
962      if (p.getName().equals(name))
963        return p.getValue();
964    }
965    return null;
966  }
967
968  public ParametersParameterComponent getParameter(String name) {
969    for (ParametersParameterComponent p : getParameter()) {
970      if (p.getName().equals(name))
971        return p;
972    }
973    return null;
974  }
975
976  public List<Type> getParameterValues(String name) {
977    List<Type> res = new ArrayList<Type>();
978    for (ParametersParameterComponent p : getParameter()) {
979      if (p.getName().equals(name))
980        res.add(p.getValue());
981    }
982    return res;
983  }
984
985  public List<ParametersParameterComponent> getParameters(String name) {
986    List<ParametersParameterComponent> res = new ArrayList<ParametersParameterComponent>();
987    for (ParametersParameterComponent p : getParameter()) {
988      if (p.getName().equals(name))
989        res.add(p);
990    }
991    return res;
992  }
993
994  public boolean getParameterBool(String name) {
995    for (ParametersParameterComponent p : getParameter()) {
996      if (p.getName().equals(name)) {
997        if (p.getValue() instanceof BooleanType)
998          return ((BooleanType) p.getValue()).booleanValue();
999        boolean ok = Boolean.getBoolean(p.getValue().primitiveValue());
1000        return ok;
1001      }
1002    }
1003    return false;
1004  }
1005
1006// end addition
1007
1008}