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