001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1 033import java.util.List; 034 035import org.hl7.fhir.exceptions.FHIRException; 036import org.hl7.fhir.instance.model.api.ICompositeType; 037import org.hl7.fhir.utilities.Utilities; 038 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.DatatypeDef; 041import ca.uhn.fhir.model.api.annotation.Description; 042 043/** 044 * The parameters to the module. This collection specifies both the input and 045 * output parameters. Input parameters are provided by the caller as part of the 046 * $evaluate operation. Output parameters are included in the GuidanceResponse. 047 */ 048@DatatypeDef(name = "ParameterDefinition") 049public class ParameterDefinition extends Type implements ICompositeType { 050 051 public enum ParameterUse { 052 /** 053 * This is an input parameter. 054 */ 055 IN, 056 /** 057 * This is an output parameter. 058 */ 059 OUT, 060 /** 061 * added to help the parsers with the generic types 062 */ 063 NULL; 064 065 public static ParameterUse fromCode(String codeString) throws FHIRException { 066 if (codeString == null || "".equals(codeString)) 067 return null; 068 if ("in".equals(codeString)) 069 return IN; 070 if ("out".equals(codeString)) 071 return OUT; 072 if (Configuration.isAcceptInvalidEnums()) 073 return null; 074 else 075 throw new FHIRException("Unknown ParameterUse code '" + codeString + "'"); 076 } 077 078 public String toCode() { 079 switch (this) { 080 case IN: 081 return "in"; 082 case OUT: 083 return "out"; 084 case NULL: 085 return null; 086 default: 087 return "?"; 088 } 089 } 090 091 public String getSystem() { 092 switch (this) { 093 case IN: 094 return "http://hl7.org/fhir/operation-parameter-use"; 095 case OUT: 096 return "http://hl7.org/fhir/operation-parameter-use"; 097 case NULL: 098 return null; 099 default: 100 return "?"; 101 } 102 } 103 104 public String getDefinition() { 105 switch (this) { 106 case IN: 107 return "This is an input parameter."; 108 case OUT: 109 return "This is an output parameter."; 110 case NULL: 111 return null; 112 default: 113 return "?"; 114 } 115 } 116 117 public String getDisplay() { 118 switch (this) { 119 case IN: 120 return "In"; 121 case OUT: 122 return "Out"; 123 case NULL: 124 return null; 125 default: 126 return "?"; 127 } 128 } 129 } 130 131 public static class ParameterUseEnumFactory implements EnumFactory<ParameterUse> { 132 public ParameterUse fromCode(String codeString) throws IllegalArgumentException { 133 if (codeString == null || "".equals(codeString)) 134 if (codeString == null || "".equals(codeString)) 135 return null; 136 if ("in".equals(codeString)) 137 return ParameterUse.IN; 138 if ("out".equals(codeString)) 139 return ParameterUse.OUT; 140 throw new IllegalArgumentException("Unknown ParameterUse code '" + codeString + "'"); 141 } 142 143 public Enumeration<ParameterUse> fromType(PrimitiveType<?> code) throws FHIRException { 144 if (code == null) 145 return null; 146 if (code.isEmpty()) 147 return new Enumeration<ParameterUse>(this, ParameterUse.NULL, code); 148 String codeString = code.asStringValue(); 149 if (codeString == null || "".equals(codeString)) 150 return new Enumeration<ParameterUse>(this, ParameterUse.NULL, code); 151 if ("in".equals(codeString)) 152 return new Enumeration<ParameterUse>(this, ParameterUse.IN, code); 153 if ("out".equals(codeString)) 154 return new Enumeration<ParameterUse>(this, ParameterUse.OUT, code); 155 throw new FHIRException("Unknown ParameterUse code '" + codeString + "'"); 156 } 157 158 public String toCode(ParameterUse code) { 159 if (code == ParameterUse.IN) 160 return "in"; 161 if (code == ParameterUse.OUT) 162 return "out"; 163 return "?"; 164 } 165 166 public String toSystem(ParameterUse code) { 167 return code.getSystem(); 168 } 169 } 170 171 /** 172 * The name of the parameter used to allow access to the value of the parameter 173 * in evaluation contexts. 174 */ 175 @Child(name = "name", type = { CodeType.class }, order = 0, min = 0, max = 1, modifier = false, summary = true) 176 @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.") 177 protected CodeType name; 178 179 /** 180 * Whether the parameter is input or output for the module. 181 */ 182 @Child(name = "use", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true) 183 @Description(shortDefinition = "in | out", formalDefinition = "Whether the parameter is input or output for the module.") 184 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/operation-parameter-use") 185 protected Enumeration<ParameterUse> use; 186 187 /** 188 * The minimum number of times this parameter SHALL appear in the request or 189 * response. 190 */ 191 @Child(name = "min", type = { IntegerType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true) 192 @Description(shortDefinition = "Minimum cardinality", formalDefinition = "The minimum number of times this parameter SHALL appear in the request or response.") 193 protected IntegerType min; 194 195 /** 196 * The maximum number of times this element is permitted to appear in the 197 * request or response. 198 */ 199 @Child(name = "max", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true) 200 @Description(shortDefinition = "Maximum cardinality (a number of *)", formalDefinition = "The maximum number of times this element is permitted to appear in the request or response.") 201 protected StringType max; 202 203 /** 204 * A brief discussion of what the parameter is for and how it is used by the 205 * module. 206 */ 207 @Child(name = "documentation", type = { 208 StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = true) 209 @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.") 210 protected StringType documentation; 211 212 /** 213 * The type of the parameter. 214 */ 215 @Child(name = "type", type = { CodeType.class }, order = 5, min = 1, max = 1, modifier = false, summary = true) 216 @Description(shortDefinition = "What type of value", formalDefinition = "The type of the parameter.") 217 @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/all-types") 218 protected CodeType type; 219 220 /** 221 * If specified, this indicates a profile that the input data must conform to, 222 * or that the output data will conform to. 223 */ 224 @Child(name = "profile", type = { 225 CanonicalType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true) 226 @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.") 227 protected CanonicalType profile; 228 229 private static final long serialVersionUID = -1891730734L; 230 231 /** 232 * Constructor 233 */ 234 public ParameterDefinition() { 235 super(); 236 } 237 238 /** 239 * Constructor 240 */ 241 public ParameterDefinition(Enumeration<ParameterUse> use, CodeType type) { 242 super(); 243 this.use = use; 244 this.type = type; 245 } 246 247 /** 248 * @return {@link #name} (The name of the parameter used to allow access to the 249 * value of the parameter in evaluation contexts.). This is the 250 * underlying object with id, value and extensions. The accessor 251 * "getName" gives direct access to the value 252 */ 253 public CodeType getNameElement() { 254 if (this.name == null) 255 if (Configuration.errorOnAutoCreate()) 256 throw new Error("Attempt to auto-create ParameterDefinition.name"); 257 else if (Configuration.doAutoCreate()) 258 this.name = new CodeType(); // bb 259 return this.name; 260 } 261 262 public boolean hasNameElement() { 263 return this.name != null && !this.name.isEmpty(); 264 } 265 266 public boolean hasName() { 267 return this.name != null && !this.name.isEmpty(); 268 } 269 270 /** 271 * @param value {@link #name} (The name of the parameter used to allow access to 272 * the value of the parameter in evaluation contexts.). This is the 273 * underlying object with id, value and extensions. The accessor 274 * "getName" gives direct access to the value 275 */ 276 public ParameterDefinition setNameElement(CodeType value) { 277 this.name = value; 278 return this; 279 } 280 281 /** 282 * @return The name of the parameter used to allow access to the value of the 283 * parameter in evaluation contexts. 284 */ 285 public String getName() { 286 return this.name == null ? null : this.name.getValue(); 287 } 288 289 /** 290 * @param value The name of the parameter used to allow access to the value of 291 * the parameter in evaluation contexts. 292 */ 293 public ParameterDefinition setName(String value) { 294 if (Utilities.noString(value)) 295 this.name = null; 296 else { 297 if (this.name == null) 298 this.name = new CodeType(); 299 this.name.setValue(value); 300 } 301 return this; 302 } 303 304 /** 305 * @return {@link #use} (Whether the parameter is input or output for the 306 * module.). This is the underlying object with id, value and 307 * extensions. The accessor "getUse" gives direct access to the value 308 */ 309 public Enumeration<ParameterUse> getUseElement() { 310 if (this.use == null) 311 if (Configuration.errorOnAutoCreate()) 312 throw new Error("Attempt to auto-create ParameterDefinition.use"); 313 else if (Configuration.doAutoCreate()) 314 this.use = new Enumeration<ParameterUse>(new ParameterUseEnumFactory()); // bb 315 return this.use; 316 } 317 318 public boolean hasUseElement() { 319 return this.use != null && !this.use.isEmpty(); 320 } 321 322 public boolean hasUse() { 323 return this.use != null && !this.use.isEmpty(); 324 } 325 326 /** 327 * @param value {@link #use} (Whether the parameter is input or output for the 328 * module.). This is the underlying object with id, value and 329 * extensions. The accessor "getUse" gives direct access to the 330 * value 331 */ 332 public ParameterDefinition setUseElement(Enumeration<ParameterUse> value) { 333 this.use = value; 334 return this; 335 } 336 337 /** 338 * @return Whether the parameter is input or output for the module. 339 */ 340 public ParameterUse getUse() { 341 return this.use == null ? null : this.use.getValue(); 342 } 343 344 /** 345 * @param value Whether the parameter is input or output for the module. 346 */ 347 public ParameterDefinition setUse(ParameterUse value) { 348 if (this.use == null) 349 this.use = new Enumeration<ParameterUse>(new ParameterUseEnumFactory()); 350 this.use.setValue(value); 351 return this; 352 } 353 354 /** 355 * @return {@link #min} (The minimum number of times this parameter SHALL appear 356 * in the request or response.). This is the underlying object with id, 357 * value and extensions. The accessor "getMin" gives direct access to 358 * the value 359 */ 360 public IntegerType getMinElement() { 361 if (this.min == null) 362 if (Configuration.errorOnAutoCreate()) 363 throw new Error("Attempt to auto-create ParameterDefinition.min"); 364 else if (Configuration.doAutoCreate()) 365 this.min = new IntegerType(); // bb 366 return this.min; 367 } 368 369 public boolean hasMinElement() { 370 return this.min != null && !this.min.isEmpty(); 371 } 372 373 public boolean hasMin() { 374 return this.min != null && !this.min.isEmpty(); 375 } 376 377 /** 378 * @param value {@link #min} (The minimum number of times this parameter SHALL 379 * appear in the request or response.). This is the underlying 380 * object with id, value and extensions. The accessor "getMin" 381 * gives direct access to the value 382 */ 383 public ParameterDefinition setMinElement(IntegerType value) { 384 this.min = value; 385 return this; 386 } 387 388 /** 389 * @return The minimum number of times this parameter SHALL appear in the 390 * request or response. 391 */ 392 public int getMin() { 393 return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue(); 394 } 395 396 /** 397 * @param value The minimum number of times this parameter SHALL appear in the 398 * request or response. 399 */ 400 public ParameterDefinition setMin(int value) { 401 if (this.min == null) 402 this.min = new IntegerType(); 403 this.min.setValue(value); 404 return this; 405 } 406 407 /** 408 * @return {@link #max} (The maximum number of times this element is permitted 409 * to appear in the request or response.). This is the underlying object 410 * with id, value and extensions. The accessor "getMax" gives direct 411 * access to the value 412 */ 413 public StringType getMaxElement() { 414 if (this.max == null) 415 if (Configuration.errorOnAutoCreate()) 416 throw new Error("Attempt to auto-create ParameterDefinition.max"); 417 else if (Configuration.doAutoCreate()) 418 this.max = new StringType(); // bb 419 return this.max; 420 } 421 422 public boolean hasMaxElement() { 423 return this.max != null && !this.max.isEmpty(); 424 } 425 426 public boolean hasMax() { 427 return this.max != null && !this.max.isEmpty(); 428 } 429 430 /** 431 * @param value {@link #max} (The maximum number of times this element is 432 * permitted to appear in the request or response.). This is the 433 * underlying object with id, value and extensions. The accessor 434 * "getMax" gives direct access to the value 435 */ 436 public ParameterDefinition setMaxElement(StringType value) { 437 this.max = value; 438 return this; 439 } 440 441 /** 442 * @return The maximum number of times this element is permitted to appear in 443 * the request or response. 444 */ 445 public String getMax() { 446 return this.max == null ? null : this.max.getValue(); 447 } 448 449 /** 450 * @param value The maximum number of times this element is permitted to appear 451 * in the request or response. 452 */ 453 public ParameterDefinition setMax(String value) { 454 if (Utilities.noString(value)) 455 this.max = null; 456 else { 457 if (this.max == null) 458 this.max = new StringType(); 459 this.max.setValue(value); 460 } 461 return this; 462 } 463 464 /** 465 * @return {@link #documentation} (A brief discussion of what the parameter is 466 * for and how it is used by the module.). This is the underlying object 467 * with id, value and extensions. The accessor "getDocumentation" gives 468 * direct access to the value 469 */ 470 public StringType getDocumentationElement() { 471 if (this.documentation == null) 472 if (Configuration.errorOnAutoCreate()) 473 throw new Error("Attempt to auto-create ParameterDefinition.documentation"); 474 else if (Configuration.doAutoCreate()) 475 this.documentation = new StringType(); // bb 476 return this.documentation; 477 } 478 479 public boolean hasDocumentationElement() { 480 return this.documentation != null && !this.documentation.isEmpty(); 481 } 482 483 public boolean hasDocumentation() { 484 return this.documentation != null && !this.documentation.isEmpty(); 485 } 486 487 /** 488 * @param value {@link #documentation} (A brief discussion of what the parameter 489 * is for and how it is used by the module.). This is the 490 * underlying object with id, value and extensions. The accessor 491 * "getDocumentation" gives direct access to the value 492 */ 493 public ParameterDefinition setDocumentationElement(StringType value) { 494 this.documentation = value; 495 return this; 496 } 497 498 /** 499 * @return A brief discussion of what the parameter is for and how it is used by 500 * the module. 501 */ 502 public String getDocumentation() { 503 return this.documentation == null ? null : this.documentation.getValue(); 504 } 505 506 /** 507 * @param value A brief discussion of what the parameter is for and how it is 508 * used by the module. 509 */ 510 public ParameterDefinition setDocumentation(String value) { 511 if (Utilities.noString(value)) 512 this.documentation = null; 513 else { 514 if (this.documentation == null) 515 this.documentation = new StringType(); 516 this.documentation.setValue(value); 517 } 518 return this; 519 } 520 521 /** 522 * @return {@link #type} (The type of the parameter.). This is the underlying 523 * object with id, value and extensions. The accessor "getType" gives 524 * direct access to the value 525 */ 526 public CodeType getTypeElement() { 527 if (this.type == null) 528 if (Configuration.errorOnAutoCreate()) 529 throw new Error("Attempt to auto-create ParameterDefinition.type"); 530 else if (Configuration.doAutoCreate()) 531 this.type = new CodeType(); // bb 532 return this.type; 533 } 534 535 public boolean hasTypeElement() { 536 return this.type != null && !this.type.isEmpty(); 537 } 538 539 public boolean hasType() { 540 return this.type != null && !this.type.isEmpty(); 541 } 542 543 /** 544 * @param value {@link #type} (The type of the parameter.). This is the 545 * underlying object with id, value and extensions. The accessor 546 * "getType" gives direct access to the value 547 */ 548 public ParameterDefinition setTypeElement(CodeType value) { 549 this.type = value; 550 return this; 551 } 552 553 /** 554 * @return The type of the parameter. 555 */ 556 public String getType() { 557 return this.type == null ? null : this.type.getValue(); 558 } 559 560 /** 561 * @param value The type of the parameter. 562 */ 563 public ParameterDefinition setType(String value) { 564 if (this.type == null) 565 this.type = new CodeType(); 566 this.type.setValue(value); 567 return this; 568 } 569 570 /** 571 * @return {@link #profile} (If specified, this indicates a profile that the 572 * input data must conform to, or that the output data will conform 573 * to.). This is the underlying object with id, value and extensions. 574 * The accessor "getProfile" gives direct access to the value 575 */ 576 public CanonicalType getProfileElement() { 577 if (this.profile == null) 578 if (Configuration.errorOnAutoCreate()) 579 throw new Error("Attempt to auto-create ParameterDefinition.profile"); 580 else if (Configuration.doAutoCreate()) 581 this.profile = new CanonicalType(); // bb 582 return this.profile; 583 } 584 585 public boolean hasProfileElement() { 586 return this.profile != null && !this.profile.isEmpty(); 587 } 588 589 public boolean hasProfile() { 590 return this.profile != null && !this.profile.isEmpty(); 591 } 592 593 /** 594 * @param value {@link #profile} (If specified, this indicates a profile that 595 * the input data must conform to, or that the output data will 596 * conform to.). This is the underlying object with id, value and 597 * extensions. The accessor "getProfile" gives direct access to the 598 * value 599 */ 600 public ParameterDefinition setProfileElement(CanonicalType value) { 601 this.profile = value; 602 return this; 603 } 604 605 /** 606 * @return If specified, this indicates a profile that the input data must 607 * conform to, or that the output data will conform to. 608 */ 609 public String getProfile() { 610 return this.profile == null ? null : this.profile.getValue(); 611 } 612 613 /** 614 * @param value If specified, this indicates a profile that the input data must 615 * conform to, or that the output data will conform to. 616 */ 617 public ParameterDefinition setProfile(String value) { 618 if (Utilities.noString(value)) 619 this.profile = null; 620 else { 621 if (this.profile == null) 622 this.profile = new CanonicalType(); 623 this.profile.setValue(value); 624 } 625 return this; 626 } 627 628 protected void listChildren(List<Property> children) { 629 super.listChildren(children); 630 children.add(new Property("name", "code", 631 "The name of the parameter used to allow access to the value of the parameter in evaluation contexts.", 0, 1, 632 name)); 633 children.add(new Property("use", "code", "Whether the parameter is input or output for the module.", 0, 1, use)); 634 children.add(new Property("min", "integer", 635 "The minimum number of times this parameter SHALL appear in the request or response.", 0, 1, min)); 636 children.add(new Property("max", "string", 637 "The maximum number of times this element is permitted to appear in the request or response.", 0, 1, max)); 638 children.add(new Property("documentation", "string", 639 "A brief discussion of what the parameter is for and how it is used by the module.", 0, 1, documentation)); 640 children.add(new Property("type", "code", "The type of the parameter.", 0, 1, type)); 641 children.add(new Property("profile", "canonical(StructureDefinition)", 642 "If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.", 643 0, 1, profile)); 644 } 645 646 @Override 647 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 648 switch (_hash) { 649 case 3373707: 650 /* name */ return new Property("name", "code", 651 "The name of the parameter used to allow access to the value of the parameter in evaluation contexts.", 0, 1, 652 name); 653 case 116103: 654 /* use */ return new Property("use", "code", "Whether the parameter is input or output for the module.", 0, 1, 655 use); 656 case 108114: 657 /* min */ return new Property("min", "integer", 658 "The minimum number of times this parameter SHALL appear in the request or response.", 0, 1, min); 659 case 107876: 660 /* max */ return new Property("max", "string", 661 "The maximum number of times this element is permitted to appear in the request or response.", 0, 1, max); 662 case 1587405498: 663 /* documentation */ return new Property("documentation", "string", 664 "A brief discussion of what the parameter is for and how it is used by the module.", 0, 1, documentation); 665 case 3575610: 666 /* type */ return new Property("type", "code", "The type of the parameter.", 0, 1, type); 667 case -309425751: 668 /* profile */ return new Property("profile", "canonical(StructureDefinition)", 669 "If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.", 670 0, 1, profile); 671 default: 672 return super.getNamedProperty(_hash, _name, _checkValid); 673 } 674 675 } 676 677 @Override 678 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 679 switch (hash) { 680 case 3373707: 681 /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // CodeType 682 case 116103: 683 /* use */ return this.use == null ? new Base[0] : new Base[] { this.use }; // Enumeration<ParameterUse> 684 case 108114: 685 /* min */ return this.min == null ? new Base[0] : new Base[] { this.min }; // IntegerType 686 case 107876: 687 /* max */ return this.max == null ? new Base[0] : new Base[] { this.max }; // StringType 688 case 1587405498: 689 /* documentation */ return this.documentation == null ? new Base[0] : new Base[] { this.documentation }; // StringType 690 case 3575610: 691 /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeType 692 case -309425751: 693 /* profile */ return this.profile == null ? new Base[0] : new Base[] { this.profile }; // CanonicalType 694 default: 695 return super.getProperty(hash, name, checkValid); 696 } 697 698 } 699 700 @Override 701 public Base setProperty(int hash, String name, Base value) throws FHIRException { 702 switch (hash) { 703 case 3373707: // name 704 this.name = castToCode(value); // CodeType 705 return value; 706 case 116103: // use 707 value = new ParameterUseEnumFactory().fromType(castToCode(value)); 708 this.use = (Enumeration) value; // Enumeration<ParameterUse> 709 return value; 710 case 108114: // min 711 this.min = castToInteger(value); // IntegerType 712 return value; 713 case 107876: // max 714 this.max = castToString(value); // StringType 715 return value; 716 case 1587405498: // documentation 717 this.documentation = castToString(value); // StringType 718 return value; 719 case 3575610: // type 720 this.type = castToCode(value); // CodeType 721 return value; 722 case -309425751: // profile 723 this.profile = castToCanonical(value); // CanonicalType 724 return value; 725 default: 726 return super.setProperty(hash, name, value); 727 } 728 729 } 730 731 @Override 732 public Base setProperty(String name, Base value) throws FHIRException { 733 if (name.equals("name")) { 734 this.name = castToCode(value); // CodeType 735 } else if (name.equals("use")) { 736 value = new ParameterUseEnumFactory().fromType(castToCode(value)); 737 this.use = (Enumeration) value; // Enumeration<ParameterUse> 738 } else if (name.equals("min")) { 739 this.min = castToInteger(value); // IntegerType 740 } else if (name.equals("max")) { 741 this.max = castToString(value); // StringType 742 } else if (name.equals("documentation")) { 743 this.documentation = castToString(value); // StringType 744 } else if (name.equals("type")) { 745 this.type = castToCode(value); // CodeType 746 } else if (name.equals("profile")) { 747 this.profile = castToCanonical(value); // CanonicalType 748 } else 749 return super.setProperty(name, value); 750 return value; 751 } 752 753 @Override 754 public Base makeProperty(int hash, String name) throws FHIRException { 755 switch (hash) { 756 case 3373707: 757 return getNameElement(); 758 case 116103: 759 return getUseElement(); 760 case 108114: 761 return getMinElement(); 762 case 107876: 763 return getMaxElement(); 764 case 1587405498: 765 return getDocumentationElement(); 766 case 3575610: 767 return getTypeElement(); 768 case -309425751: 769 return getProfileElement(); 770 default: 771 return super.makeProperty(hash, name); 772 } 773 774 } 775 776 @Override 777 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 778 switch (hash) { 779 case 3373707: 780 /* name */ return new String[] { "code" }; 781 case 116103: 782 /* use */ return new String[] { "code" }; 783 case 108114: 784 /* min */ return new String[] { "integer" }; 785 case 107876: 786 /* max */ return new String[] { "string" }; 787 case 1587405498: 788 /* documentation */ return new String[] { "string" }; 789 case 3575610: 790 /* type */ return new String[] { "code" }; 791 case -309425751: 792 /* profile */ return new String[] { "canonical" }; 793 default: 794 return super.getTypesForProperty(hash, name); 795 } 796 797 } 798 799 @Override 800 public Base addChild(String name) throws FHIRException { 801 if (name.equals("name")) { 802 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.name"); 803 } else if (name.equals("use")) { 804 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.use"); 805 } else if (name.equals("min")) { 806 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.min"); 807 } else if (name.equals("max")) { 808 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.max"); 809 } else if (name.equals("documentation")) { 810 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.documentation"); 811 } else if (name.equals("type")) { 812 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.type"); 813 } else if (name.equals("profile")) { 814 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.profile"); 815 } else 816 return super.addChild(name); 817 } 818 819 public String fhirType() { 820 return "ParameterDefinition"; 821 822 } 823 824 public ParameterDefinition copy() { 825 ParameterDefinition dst = new ParameterDefinition(); 826 copyValues(dst); 827 return dst; 828 } 829 830 public void copyValues(ParameterDefinition dst) { 831 super.copyValues(dst); 832 dst.name = name == null ? null : name.copy(); 833 dst.use = use == null ? null : use.copy(); 834 dst.min = min == null ? null : min.copy(); 835 dst.max = max == null ? null : max.copy(); 836 dst.documentation = documentation == null ? null : documentation.copy(); 837 dst.type = type == null ? null : type.copy(); 838 dst.profile = profile == null ? null : profile.copy(); 839 } 840 841 protected ParameterDefinition typedCopy() { 842 return copy(); 843 } 844 845 @Override 846 public boolean equalsDeep(Base other_) { 847 if (!super.equalsDeep(other_)) 848 return false; 849 if (!(other_ instanceof ParameterDefinition)) 850 return false; 851 ParameterDefinition o = (ParameterDefinition) other_; 852 return compareDeep(name, o.name, true) && compareDeep(use, o.use, true) && compareDeep(min, o.min, true) 853 && compareDeep(max, o.max, true) && compareDeep(documentation, o.documentation, true) 854 && compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true); 855 } 856 857 @Override 858 public boolean equalsShallow(Base other_) { 859 if (!super.equalsShallow(other_)) 860 return false; 861 if (!(other_ instanceof ParameterDefinition)) 862 return false; 863 ParameterDefinition o = (ParameterDefinition) other_; 864 return compareValues(name, o.name, true) && compareValues(use, o.use, true) && compareValues(min, o.min, true) 865 && compareValues(max, o.max, true) && compareValues(documentation, o.documentation, true) 866 && compareValues(type, o.type, true); 867 } 868 869 public boolean isEmpty() { 870 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, use, min, max, documentation, type, profile); 871 } 872 873}