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