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