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 org.hl7.fhir.r4.model.Enumerations.*; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.ChildOrder; 043import ca.uhn.fhir.model.api.annotation.Description; 044import ca.uhn.fhir.model.api.annotation.DatatypeDef; 045import ca.uhn.fhir.model.api.annotation.Block; 046import org.hl7.fhir.instance.model.api.*; 047import org.hl7.fhir.exceptions.FHIRException; 048/** 049 * The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse. 050 */ 051@DatatypeDef(name="ParameterDefinition") 052public class ParameterDefinition extends Type implements ICompositeType { 053 054 public enum ParameterUse { 055 /** 056 * This is an input parameter. 057 */ 058 IN, 059 /** 060 * This is an output parameter. 061 */ 062 OUT, 063 /** 064 * added to help the parsers with the generic types 065 */ 066 NULL; 067 public static ParameterUse fromCode(String codeString) throws FHIRException { 068 if (codeString == null || "".equals(codeString)) 069 return null; 070 if ("in".equals(codeString)) 071 return IN; 072 if ("out".equals(codeString)) 073 return OUT; 074 if (Configuration.isAcceptInvalidEnums()) 075 return null; 076 else 077 throw new FHIRException("Unknown ParameterUse code '"+codeString+"'"); 078 } 079 public String toCode() { 080 switch (this) { 081 case IN: return "in"; 082 case OUT: return "out"; 083 default: return "?"; 084 } 085 } 086 public String getSystem() { 087 switch (this) { 088 case IN: return "http://hl7.org/fhir/operation-parameter-use"; 089 case OUT: return "http://hl7.org/fhir/operation-parameter-use"; 090 default: return "?"; 091 } 092 } 093 public String getDefinition() { 094 switch (this) { 095 case IN: return "This is an input parameter."; 096 case OUT: return "This is an output parameter."; 097 default: return "?"; 098 } 099 } 100 public String getDisplay() { 101 switch (this) { 102 case IN: return "In"; 103 case OUT: return "Out"; 104 default: return "?"; 105 } 106 } 107 } 108 109 public static class ParameterUseEnumFactory implements EnumFactory<ParameterUse> { 110 public ParameterUse fromCode(String codeString) throws IllegalArgumentException { 111 if (codeString == null || "".equals(codeString)) 112 if (codeString == null || "".equals(codeString)) 113 return null; 114 if ("in".equals(codeString)) 115 return ParameterUse.IN; 116 if ("out".equals(codeString)) 117 return ParameterUse.OUT; 118 throw new IllegalArgumentException("Unknown ParameterUse code '"+codeString+"'"); 119 } 120 public Enumeration<ParameterUse> fromType(Base code) throws FHIRException { 121 if (code == null) 122 return null; 123 if (code.isEmpty()) 124 return new Enumeration<ParameterUse>(this); 125 String codeString = ((PrimitiveType) code).asStringValue(); 126 if (codeString == null || "".equals(codeString)) 127 return null; 128 if ("in".equals(codeString)) 129 return new Enumeration<ParameterUse>(this, ParameterUse.IN); 130 if ("out".equals(codeString)) 131 return new Enumeration<ParameterUse>(this, ParameterUse.OUT); 132 throw new FHIRException("Unknown ParameterUse code '"+codeString+"'"); 133 } 134 public String toCode(ParameterUse code) { 135 if (code == ParameterUse.IN) 136 return "in"; 137 if (code == ParameterUse.OUT) 138 return "out"; 139 return "?"; 140 } 141 public String toSystem(ParameterUse code) { 142 return code.getSystem(); 143 } 144 } 145 146 /** 147 * The name of the parameter used to allow access to the value of the parameter in evaluation contexts. 148 */ 149 @Child(name = "name", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true) 150 @Description(shortDefinition="Name used to access the parameter value", formalDefinition="The name of the parameter used to allow access to the value of the parameter in evaluation contexts." ) 151 protected CodeType name; 152 153 /** 154 * Whether the parameter is input or output for the module. 155 */ 156 @Child(name = "use", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true) 157 @Description(shortDefinition="in | out", formalDefinition="Whether the parameter is input or output for the module." ) 158 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/operation-parameter-use") 159 protected Enumeration<ParameterUse> use; 160 161 /** 162 * The minimum number of times this parameter SHALL appear in the request or response. 163 */ 164 @Child(name = "min", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true) 165 @Description(shortDefinition="Minimum cardinality", formalDefinition="The minimum number of times this parameter SHALL appear in the request or response." ) 166 protected IntegerType min; 167 168 /** 169 * The maximum number of times this element is permitted to appear in the request or response. 170 */ 171 @Child(name = "max", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true) 172 @Description(shortDefinition="Maximum cardinality (a number of *)", formalDefinition="The maximum number of times this element is permitted to appear in the request or response." ) 173 protected StringType max; 174 175 /** 176 * A brief discussion of what the parameter is for and how it is used by the module. 177 */ 178 @Child(name = "documentation", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true) 179 @Description(shortDefinition="A brief description of the parameter", formalDefinition="A brief discussion of what the parameter is for and how it is used by the module." ) 180 protected StringType documentation; 181 182 /** 183 * The type of the parameter. 184 */ 185 @Child(name = "type", type = {CodeType.class}, order=5, min=1, max=1, modifier=false, summary=true) 186 @Description(shortDefinition="What type of value", formalDefinition="The type of the parameter." ) 187 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/all-types") 188 protected CodeType type; 189 190 /** 191 * If specified, this indicates a profile that the input data must conform to, or that the output data will conform to. 192 */ 193 @Child(name = "profile", type = {CanonicalType.class}, order=6, min=0, max=1, modifier=false, summary=true) 194 @Description(shortDefinition="What profile the value is expected to be", formalDefinition="If specified, this indicates a profile that the input data must conform to, or that the output data will conform to." ) 195 protected CanonicalType profile; 196 197 private static final long serialVersionUID = -1891730734L; 198 199 /** 200 * Constructor 201 */ 202 public ParameterDefinition() { 203 super(); 204 } 205 206 /** 207 * Constructor 208 */ 209 public ParameterDefinition(Enumeration<ParameterUse> use, CodeType type) { 210 super(); 211 this.use = use; 212 this.type = type; 213 } 214 215 /** 216 * @return {@link #name} (The name of the parameter used to allow access to the value of the parameter in evaluation contexts.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 217 */ 218 public CodeType getNameElement() { 219 if (this.name == null) 220 if (Configuration.errorOnAutoCreate()) 221 throw new Error("Attempt to auto-create ParameterDefinition.name"); 222 else if (Configuration.doAutoCreate()) 223 this.name = new CodeType(); // bb 224 return this.name; 225 } 226 227 public boolean hasNameElement() { 228 return this.name != null && !this.name.isEmpty(); 229 } 230 231 public boolean hasName() { 232 return this.name != null && !this.name.isEmpty(); 233 } 234 235 /** 236 * @param value {@link #name} (The name of the parameter used to allow access to the value of the parameter in evaluation contexts.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 237 */ 238 public ParameterDefinition setNameElement(CodeType value) { 239 this.name = value; 240 return this; 241 } 242 243 /** 244 * @return The name of the parameter used to allow access to the value of the parameter in evaluation contexts. 245 */ 246 public String getName() { 247 return this.name == null ? null : this.name.getValue(); 248 } 249 250 /** 251 * @param value The name of the parameter used to allow access to the value of the parameter in evaluation contexts. 252 */ 253 public ParameterDefinition setName(String value) { 254 if (Utilities.noString(value)) 255 this.name = null; 256 else { 257 if (this.name == null) 258 this.name = new CodeType(); 259 this.name.setValue(value); 260 } 261 return this; 262 } 263 264 /** 265 * @return {@link #use} (Whether the parameter is input or output for the module.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 266 */ 267 public Enumeration<ParameterUse> getUseElement() { 268 if (this.use == null) 269 if (Configuration.errorOnAutoCreate()) 270 throw new Error("Attempt to auto-create ParameterDefinition.use"); 271 else if (Configuration.doAutoCreate()) 272 this.use = new Enumeration<ParameterUse>(new ParameterUseEnumFactory()); // bb 273 return this.use; 274 } 275 276 public boolean hasUseElement() { 277 return this.use != null && !this.use.isEmpty(); 278 } 279 280 public boolean hasUse() { 281 return this.use != null && !this.use.isEmpty(); 282 } 283 284 /** 285 * @param value {@link #use} (Whether the parameter is input or output for the module.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value 286 */ 287 public ParameterDefinition setUseElement(Enumeration<ParameterUse> value) { 288 this.use = value; 289 return this; 290 } 291 292 /** 293 * @return Whether the parameter is input or output for the module. 294 */ 295 public ParameterUse getUse() { 296 return this.use == null ? null : this.use.getValue(); 297 } 298 299 /** 300 * @param value Whether the parameter is input or output for the module. 301 */ 302 public ParameterDefinition setUse(ParameterUse value) { 303 if (this.use == null) 304 this.use = new Enumeration<ParameterUse>(new ParameterUseEnumFactory()); 305 this.use.setValue(value); 306 return this; 307 } 308 309 /** 310 * @return {@link #min} (The minimum number of times this parameter SHALL appear in the request or response.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value 311 */ 312 public IntegerType getMinElement() { 313 if (this.min == null) 314 if (Configuration.errorOnAutoCreate()) 315 throw new Error("Attempt to auto-create ParameterDefinition.min"); 316 else if (Configuration.doAutoCreate()) 317 this.min = new IntegerType(); // bb 318 return this.min; 319 } 320 321 public boolean hasMinElement() { 322 return this.min != null && !this.min.isEmpty(); 323 } 324 325 public boolean hasMin() { 326 return this.min != null && !this.min.isEmpty(); 327 } 328 329 /** 330 * @param value {@link #min} (The minimum number of times this parameter SHALL appear in the request or response.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value 331 */ 332 public ParameterDefinition setMinElement(IntegerType value) { 333 this.min = value; 334 return this; 335 } 336 337 /** 338 * @return The minimum number of times this parameter SHALL appear in the request or response. 339 */ 340 public int getMin() { 341 return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue(); 342 } 343 344 /** 345 * @param value The minimum number of times this parameter SHALL appear in the request or response. 346 */ 347 public ParameterDefinition setMin(int value) { 348 if (this.min == null) 349 this.min = new IntegerType(); 350 this.min.setValue(value); 351 return this; 352 } 353 354 /** 355 * @return {@link #max} (The maximum number of times this element is permitted to appear in the request or response.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value 356 */ 357 public StringType getMaxElement() { 358 if (this.max == null) 359 if (Configuration.errorOnAutoCreate()) 360 throw new Error("Attempt to auto-create ParameterDefinition.max"); 361 else if (Configuration.doAutoCreate()) 362 this.max = new StringType(); // bb 363 return this.max; 364 } 365 366 public boolean hasMaxElement() { 367 return this.max != null && !this.max.isEmpty(); 368 } 369 370 public boolean hasMax() { 371 return this.max != null && !this.max.isEmpty(); 372 } 373 374 /** 375 * @param value {@link #max} (The maximum number of times this element is permitted to appear in the request or response.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value 376 */ 377 public ParameterDefinition setMaxElement(StringType value) { 378 this.max = value; 379 return this; 380 } 381 382 /** 383 * @return The maximum number of times this element is permitted to appear in the request or response. 384 */ 385 public String getMax() { 386 return this.max == null ? null : this.max.getValue(); 387 } 388 389 /** 390 * @param value The maximum number of times this element is permitted to appear in the request or response. 391 */ 392 public ParameterDefinition setMax(String value) { 393 if (Utilities.noString(value)) 394 this.max = null; 395 else { 396 if (this.max == null) 397 this.max = new StringType(); 398 this.max.setValue(value); 399 } 400 return this; 401 } 402 403 /** 404 * @return {@link #documentation} (A brief discussion of what the parameter is for and how it is used by the module.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value 405 */ 406 public StringType getDocumentationElement() { 407 if (this.documentation == null) 408 if (Configuration.errorOnAutoCreate()) 409 throw new Error("Attempt to auto-create ParameterDefinition.documentation"); 410 else if (Configuration.doAutoCreate()) 411 this.documentation = new StringType(); // bb 412 return this.documentation; 413 } 414 415 public boolean hasDocumentationElement() { 416 return this.documentation != null && !this.documentation.isEmpty(); 417 } 418 419 public boolean hasDocumentation() { 420 return this.documentation != null && !this.documentation.isEmpty(); 421 } 422 423 /** 424 * @param value {@link #documentation} (A brief discussion of what the parameter is for and how it is used by the module.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value 425 */ 426 public ParameterDefinition setDocumentationElement(StringType value) { 427 this.documentation = value; 428 return this; 429 } 430 431 /** 432 * @return A brief discussion of what the parameter is for and how it is used by the module. 433 */ 434 public String getDocumentation() { 435 return this.documentation == null ? null : this.documentation.getValue(); 436 } 437 438 /** 439 * @param value A brief discussion of what the parameter is for and how it is used by the module. 440 */ 441 public ParameterDefinition setDocumentation(String value) { 442 if (Utilities.noString(value)) 443 this.documentation = null; 444 else { 445 if (this.documentation == null) 446 this.documentation = new StringType(); 447 this.documentation.setValue(value); 448 } 449 return this; 450 } 451 452 /** 453 * @return {@link #type} (The type of the parameter.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 454 */ 455 public CodeType getTypeElement() { 456 if (this.type == null) 457 if (Configuration.errorOnAutoCreate()) 458 throw new Error("Attempt to auto-create ParameterDefinition.type"); 459 else if (Configuration.doAutoCreate()) 460 this.type = new CodeType(); // bb 461 return this.type; 462 } 463 464 public boolean hasTypeElement() { 465 return this.type != null && !this.type.isEmpty(); 466 } 467 468 public boolean hasType() { 469 return this.type != null && !this.type.isEmpty(); 470 } 471 472 /** 473 * @param value {@link #type} (The type of the parameter.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value 474 */ 475 public ParameterDefinition setTypeElement(CodeType value) { 476 this.type = value; 477 return this; 478 } 479 480 /** 481 * @return The type of the parameter. 482 */ 483 public String getType() { 484 return this.type == null ? null : this.type.getValue(); 485 } 486 487 /** 488 * @param value The type of the parameter. 489 */ 490 public ParameterDefinition setType(String value) { 491 if (this.type == null) 492 this.type = new CodeType(); 493 this.type.setValue(value); 494 return this; 495 } 496 497 /** 498 * @return {@link #profile} (If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value 499 */ 500 public CanonicalType getProfileElement() { 501 if (this.profile == null) 502 if (Configuration.errorOnAutoCreate()) 503 throw new Error("Attempt to auto-create ParameterDefinition.profile"); 504 else if (Configuration.doAutoCreate()) 505 this.profile = new CanonicalType(); // bb 506 return this.profile; 507 } 508 509 public boolean hasProfileElement() { 510 return this.profile != null && !this.profile.isEmpty(); 511 } 512 513 public boolean hasProfile() { 514 return this.profile != null && !this.profile.isEmpty(); 515 } 516 517 /** 518 * @param value {@link #profile} (If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.). This is the underlying object with id, value and extensions. The accessor "getProfile" gives direct access to the value 519 */ 520 public ParameterDefinition setProfileElement(CanonicalType value) { 521 this.profile = value; 522 return this; 523 } 524 525 /** 526 * @return If specified, this indicates a profile that the input data must conform to, or that the output data will conform to. 527 */ 528 public String getProfile() { 529 return this.profile == null ? null : this.profile.getValue(); 530 } 531 532 /** 533 * @param value If specified, this indicates a profile that the input data must conform to, or that the output data will conform to. 534 */ 535 public ParameterDefinition setProfile(String value) { 536 if (Utilities.noString(value)) 537 this.profile = null; 538 else { 539 if (this.profile == null) 540 this.profile = new CanonicalType(); 541 this.profile.setValue(value); 542 } 543 return this; 544 } 545 546 protected void listChildren(List<Property> children) { 547 super.listChildren(children); 548 children.add(new Property("name", "code", "The name of the parameter used to allow access to the value of the parameter in evaluation contexts.", 0, 1, name)); 549 children.add(new Property("use", "code", "Whether the parameter is input or output for the module.", 0, 1, use)); 550 children.add(new Property("min", "integer", "The minimum number of times this parameter SHALL appear in the request or response.", 0, 1, min)); 551 children.add(new Property("max", "string", "The maximum number of times this element is permitted to appear in the request or response.", 0, 1, max)); 552 children.add(new Property("documentation", "string", "A brief discussion of what the parameter is for and how it is used by the module.", 0, 1, documentation)); 553 children.add(new Property("type", "code", "The type of the parameter.", 0, 1, type)); 554 children.add(new Property("profile", "canonical(StructureDefinition)", "If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.", 0, 1, profile)); 555 } 556 557 @Override 558 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 559 switch (_hash) { 560 case 3373707: /*name*/ return new Property("name", "code", "The name of the parameter used to allow access to the value of the parameter in evaluation contexts.", 0, 1, name); 561 case 116103: /*use*/ return new Property("use", "code", "Whether the parameter is input or output for the module.", 0, 1, use); 562 case 108114: /*min*/ return new Property("min", "integer", "The minimum number of times this parameter SHALL appear in the request or response.", 0, 1, min); 563 case 107876: /*max*/ return new Property("max", "string", "The maximum number of times this element is permitted to appear in the request or response.", 0, 1, max); 564 case 1587405498: /*documentation*/ return new Property("documentation", "string", "A brief discussion of what the parameter is for and how it is used by the module.", 0, 1, documentation); 565 case 3575610: /*type*/ return new Property("type", "code", "The type of the parameter.", 0, 1, type); 566 case -309425751: /*profile*/ return new Property("profile", "canonical(StructureDefinition)", "If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.", 0, 1, profile); 567 default: return super.getNamedProperty(_hash, _name, _checkValid); 568 } 569 570 } 571 572 @Override 573 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 574 switch (hash) { 575 case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // CodeType 576 case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<ParameterUse> 577 case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // IntegerType 578 case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType 579 case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType 580 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType 581 case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // CanonicalType 582 default: return super.getProperty(hash, name, checkValid); 583 } 584 585 } 586 587 @Override 588 public Base setProperty(int hash, String name, Base value) throws FHIRException { 589 switch (hash) { 590 case 3373707: // name 591 this.name = castToCode(value); // CodeType 592 return value; 593 case 116103: // use 594 value = new ParameterUseEnumFactory().fromType(castToCode(value)); 595 this.use = (Enumeration) value; // Enumeration<ParameterUse> 596 return value; 597 case 108114: // min 598 this.min = castToInteger(value); // IntegerType 599 return value; 600 case 107876: // max 601 this.max = castToString(value); // StringType 602 return value; 603 case 1587405498: // documentation 604 this.documentation = castToString(value); // StringType 605 return value; 606 case 3575610: // type 607 this.type = castToCode(value); // CodeType 608 return value; 609 case -309425751: // profile 610 this.profile = castToCanonical(value); // CanonicalType 611 return value; 612 default: return super.setProperty(hash, name, value); 613 } 614 615 } 616 617 @Override 618 public Base setProperty(String name, Base value) throws FHIRException { 619 if (name.equals("name")) { 620 this.name = castToCode(value); // CodeType 621 } else if (name.equals("use")) { 622 value = new ParameterUseEnumFactory().fromType(castToCode(value)); 623 this.use = (Enumeration) value; // Enumeration<ParameterUse> 624 } else if (name.equals("min")) { 625 this.min = castToInteger(value); // IntegerType 626 } else if (name.equals("max")) { 627 this.max = castToString(value); // StringType 628 } else if (name.equals("documentation")) { 629 this.documentation = castToString(value); // StringType 630 } else if (name.equals("type")) { 631 this.type = castToCode(value); // CodeType 632 } else if (name.equals("profile")) { 633 this.profile = castToCanonical(value); // CanonicalType 634 } else 635 return super.setProperty(name, value); 636 return value; 637 } 638 639 @Override 640 public Base makeProperty(int hash, String name) throws FHIRException { 641 switch (hash) { 642 case 3373707: return getNameElement(); 643 case 116103: return getUseElement(); 644 case 108114: return getMinElement(); 645 case 107876: return getMaxElement(); 646 case 1587405498: return getDocumentationElement(); 647 case 3575610: return getTypeElement(); 648 case -309425751: return getProfileElement(); 649 default: return super.makeProperty(hash, name); 650 } 651 652 } 653 654 @Override 655 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 656 switch (hash) { 657 case 3373707: /*name*/ return new String[] {"code"}; 658 case 116103: /*use*/ return new String[] {"code"}; 659 case 108114: /*min*/ return new String[] {"integer"}; 660 case 107876: /*max*/ return new String[] {"string"}; 661 case 1587405498: /*documentation*/ return new String[] {"string"}; 662 case 3575610: /*type*/ return new String[] {"code"}; 663 case -309425751: /*profile*/ return new String[] {"canonical"}; 664 default: return super.getTypesForProperty(hash, name); 665 } 666 667 } 668 669 @Override 670 public Base addChild(String name) throws FHIRException { 671 if (name.equals("name")) { 672 throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.name"); 673 } 674 else if (name.equals("use")) { 675 throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.use"); 676 } 677 else if (name.equals("min")) { 678 throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.min"); 679 } 680 else if (name.equals("max")) { 681 throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.max"); 682 } 683 else if (name.equals("documentation")) { 684 throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.documentation"); 685 } 686 else if (name.equals("type")) { 687 throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.type"); 688 } 689 else if (name.equals("profile")) { 690 throw new FHIRException("Cannot call addChild on a primitive type ParameterDefinition.profile"); 691 } 692 else 693 return super.addChild(name); 694 } 695 696 public String fhirType() { 697 return "ParameterDefinition"; 698 699 } 700 701 public ParameterDefinition copy() { 702 ParameterDefinition dst = new ParameterDefinition(); 703 copyValues(dst); 704 return dst; 705 } 706 707 public void copyValues(ParameterDefinition dst) { 708 super.copyValues(dst); 709 dst.name = name == null ? null : name.copy(); 710 dst.use = use == null ? null : use.copy(); 711 dst.min = min == null ? null : min.copy(); 712 dst.max = max == null ? null : max.copy(); 713 dst.documentation = documentation == null ? null : documentation.copy(); 714 dst.type = type == null ? null : type.copy(); 715 dst.profile = profile == null ? null : profile.copy(); 716 } 717 718 protected ParameterDefinition typedCopy() { 719 return copy(); 720 } 721 722 @Override 723 public boolean equalsDeep(Base other_) { 724 if (!super.equalsDeep(other_)) 725 return false; 726 if (!(other_ instanceof ParameterDefinition)) 727 return false; 728 ParameterDefinition o = (ParameterDefinition) other_; 729 return compareDeep(name, o.name, true) && compareDeep(use, o.use, true) && compareDeep(min, o.min, true) 730 && compareDeep(max, o.max, true) && compareDeep(documentation, o.documentation, true) && compareDeep(type, o.type, true) 731 && compareDeep(profile, o.profile, true); 732 } 733 734 @Override 735 public boolean equalsShallow(Base other_) { 736 if (!super.equalsShallow(other_)) 737 return false; 738 if (!(other_ instanceof ParameterDefinition)) 739 return false; 740 ParameterDefinition o = (ParameterDefinition) other_; 741 return compareValues(name, o.name, true) && compareValues(use, o.use, true) && compareValues(min, o.min, true) 742 && compareValues(max, o.max, true) && compareValues(documentation, o.documentation, true) && compareValues(type, o.type, true) 743 ; 744 } 745 746 public boolean isEmpty() { 747 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, use, min, max, documentation 748 , type, profile); 749 } 750 751 752}