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