
001package org.hl7.fhir.dstu3.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// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x 035import java.util.List; 036 037import org.hl7.fhir.exceptions.FHIRException; 038import org.hl7.fhir.instance.model.api.ICompositeType; 039import org.hl7.fhir.utilities.Utilities; 040 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.DatatypeDef; 043import ca.uhn.fhir.model.api.annotation.Description; 044/** 045 * 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. 046 */ 047@DatatypeDef(name="ParameterDefinition") 048public class ParameterDefinition extends Type implements ICompositeType { 049 050 public enum ParameterUse { 051 /** 052 * This is an input parameter. 053 */ 054 IN, 055 /** 056 * This is an output parameter. 057 */ 058 OUT, 059 /** 060 * added to help the parsers with the generic types 061 */ 062 NULL; 063 public static ParameterUse fromCode(String codeString) throws FHIRException { 064 if (codeString == null || "".equals(codeString)) 065 return null; 066 if ("in".equals(codeString)) 067 return IN; 068 if ("out".equals(codeString)) 069 return OUT; 070 if (Configuration.isAcceptInvalidEnums()) 071 return null; 072 else 073 throw new FHIRException("Unknown ParameterUse code '"+codeString+"'"); 074 } 075 public String toCode() { 076 switch (this) { 077 case IN: return "in"; 078 case OUT: return "out"; 079 case NULL: return null; 080 default: return "?"; 081 } 082 } 083 public String getSystem() { 084 switch (this) { 085 case IN: return "http://hl7.org/fhir/operation-parameter-use"; 086 case OUT: return "http://hl7.org/fhir/operation-parameter-use"; 087 case NULL: return null; 088 default: return "?"; 089 } 090 } 091 public String getDefinition() { 092 switch (this) { 093 case IN: return "This is an input parameter."; 094 case OUT: return "This is an output parameter."; 095 case NULL: return null; 096 default: return "?"; 097 } 098 } 099 public String getDisplay() { 100 switch (this) { 101 case IN: return "In"; 102 case OUT: return "Out"; 103 case NULL: return null; 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(PrimitiveType<?> code) throws FHIRException { 121 if (code == null) 122 return null; 123 if (code.isEmpty()) 124 return new Enumeration<ParameterUse>(this); 125 String codeString = 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 = {StructureDefinition.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 Reference profile; 196 197 /** 198 * The actual object that is the target of the reference (If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.) 199 */ 200 protected StructureDefinition profileTarget; 201 202 private static final long serialVersionUID = 660888127L; 203 204 /** 205 * Constructor 206 */ 207 public ParameterDefinition() { 208 super(); 209 } 210 211 /** 212 * Constructor 213 */ 214 public ParameterDefinition(Enumeration<ParameterUse> use, CodeType type) { 215 super(); 216 this.use = use; 217 this.type = type; 218 } 219 220 /** 221 * @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 222 */ 223 public CodeType getNameElement() { 224 if (this.name == null) 225 if (Configuration.errorOnAutoCreate()) 226 throw new Error("Attempt to auto-create ParameterDefinition.name"); 227 else if (Configuration.doAutoCreate()) 228 this.name = new CodeType(); // bb 229 return this.name; 230 } 231 232 public boolean hasNameElement() { 233 return this.name != null && !this.name.isEmpty(); 234 } 235 236 public boolean hasName() { 237 return this.name != null && !this.name.isEmpty(); 238 } 239 240 /** 241 * @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 242 */ 243 public ParameterDefinition setNameElement(CodeType value) { 244 this.name = value; 245 return this; 246 } 247 248 /** 249 * @return The name of the parameter used to allow access to the value of the parameter in evaluation contexts. 250 */ 251 public String getName() { 252 return this.name == null ? null : this.name.getValue(); 253 } 254 255 /** 256 * @param value The name of the parameter used to allow access to the value of the parameter in evaluation contexts. 257 */ 258 public ParameterDefinition setName(String value) { 259 if (Utilities.noString(value)) 260 this.name = null; 261 else { 262 if (this.name == null) 263 this.name = new CodeType(); 264 this.name.setValue(value); 265 } 266 return this; 267 } 268 269 /** 270 * @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 271 */ 272 public Enumeration<ParameterUse> getUseElement() { 273 if (this.use == null) 274 if (Configuration.errorOnAutoCreate()) 275 throw new Error("Attempt to auto-create ParameterDefinition.use"); 276 else if (Configuration.doAutoCreate()) 277 this.use = new Enumeration<ParameterUse>(new ParameterUseEnumFactory()); // bb 278 return this.use; 279 } 280 281 public boolean hasUseElement() { 282 return this.use != null && !this.use.isEmpty(); 283 } 284 285 public boolean hasUse() { 286 return this.use != null && !this.use.isEmpty(); 287 } 288 289 /** 290 * @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 291 */ 292 public ParameterDefinition setUseElement(Enumeration<ParameterUse> value) { 293 this.use = value; 294 return this; 295 } 296 297 /** 298 * @return Whether the parameter is input or output for the module. 299 */ 300 public ParameterUse getUse() { 301 return this.use == null ? null : this.use.getValue(); 302 } 303 304 /** 305 * @param value Whether the parameter is input or output for the module. 306 */ 307 public ParameterDefinition setUse(ParameterUse value) { 308 if (this.use == null) 309 this.use = new Enumeration<ParameterUse>(new ParameterUseEnumFactory()); 310 this.use.setValue(value); 311 return this; 312 } 313 314 /** 315 * @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 316 */ 317 public IntegerType getMinElement() { 318 if (this.min == null) 319 if (Configuration.errorOnAutoCreate()) 320 throw new Error("Attempt to auto-create ParameterDefinition.min"); 321 else if (Configuration.doAutoCreate()) 322 this.min = new IntegerType(); // bb 323 return this.min; 324 } 325 326 public boolean hasMinElement() { 327 return this.min != null && !this.min.isEmpty(); 328 } 329 330 public boolean hasMin() { 331 return this.min != null && !this.min.isEmpty(); 332 } 333 334 /** 335 * @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 336 */ 337 public ParameterDefinition setMinElement(IntegerType value) { 338 this.min = value; 339 return this; 340 } 341 342 /** 343 * @return The minimum number of times this parameter SHALL appear in the request or response. 344 */ 345 public int getMin() { 346 return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue(); 347 } 348 349 /** 350 * @param value The minimum number of times this parameter SHALL appear in the request or response. 351 */ 352 public ParameterDefinition setMin(int value) { 353 if (this.min == null) 354 this.min = new IntegerType(); 355 this.min.setValue(value); 356 return this; 357 } 358 359 /** 360 * @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 361 */ 362 public StringType getMaxElement() { 363 if (this.max == null) 364 if (Configuration.errorOnAutoCreate()) 365 throw new Error("Attempt to auto-create ParameterDefinition.max"); 366 else if (Configuration.doAutoCreate()) 367 this.max = new StringType(); // bb 368 return this.max; 369 } 370 371 public boolean hasMaxElement() { 372 return this.max != null && !this.max.isEmpty(); 373 } 374 375 public boolean hasMax() { 376 return this.max != null && !this.max.isEmpty(); 377 } 378 379 /** 380 * @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 381 */ 382 public ParameterDefinition setMaxElement(StringType value) { 383 this.max = value; 384 return this; 385 } 386 387 /** 388 * @return The maximum number of times this element is permitted to appear in the request or response. 389 */ 390 public String getMax() { 391 return this.max == null ? null : this.max.getValue(); 392 } 393 394 /** 395 * @param value The maximum number of times this element is permitted to appear in the request or response. 396 */ 397 public ParameterDefinition setMax(String value) { 398 if (Utilities.noString(value)) 399 this.max = null; 400 else { 401 if (this.max == null) 402 this.max = new StringType(); 403 this.max.setValue(value); 404 } 405 return this; 406 } 407 408 /** 409 * @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 410 */ 411 public StringType getDocumentationElement() { 412 if (this.documentation == null) 413 if (Configuration.errorOnAutoCreate()) 414 throw new Error("Attempt to auto-create ParameterDefinition.documentation"); 415 else if (Configuration.doAutoCreate()) 416 this.documentation = new StringType(); // bb 417 return this.documentation; 418 } 419 420 public boolean hasDocumentationElement() { 421 return this.documentation != null && !this.documentation.isEmpty(); 422 } 423 424 public boolean hasDocumentation() { 425 return this.documentation != null && !this.documentation.isEmpty(); 426 } 427 428 /** 429 * @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 430 */ 431 public ParameterDefinition setDocumentationElement(StringType value) { 432 this.documentation = value; 433 return this; 434 } 435 436 /** 437 * @return A brief discussion of what the parameter is for and how it is used by the module. 438 */ 439 public String getDocumentation() { 440 return this.documentation == null ? null : this.documentation.getValue(); 441 } 442 443 /** 444 * @param value A brief discussion of what the parameter is for and how it is used by the module. 445 */ 446 public ParameterDefinition setDocumentation(String value) { 447 if (Utilities.noString(value)) 448 this.documentation = null; 449 else { 450 if (this.documentation == null) 451 this.documentation = new StringType(); 452 this.documentation.setValue(value); 453 } 454 return this; 455 } 456 457 /** 458 * @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 459 */ 460 public CodeType getTypeElement() { 461 if (this.type == null) 462 if (Configuration.errorOnAutoCreate()) 463 throw new Error("Attempt to auto-create ParameterDefinition.type"); 464 else if (Configuration.doAutoCreate()) 465 this.type = new CodeType(); // bb 466 return this.type; 467 } 468 469 public boolean hasTypeElement() { 470 return this.type != null && !this.type.isEmpty(); 471 } 472 473 public boolean hasType() { 474 return this.type != null && !this.type.isEmpty(); 475 } 476 477 /** 478 * @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 479 */ 480 public ParameterDefinition setTypeElement(CodeType value) { 481 this.type = value; 482 return this; 483 } 484 485 /** 486 * @return The type of the parameter. 487 */ 488 public String getType() { 489 return this.type == null ? null : this.type.getValue(); 490 } 491 492 /** 493 * @param value The type of the parameter. 494 */ 495 public ParameterDefinition setType(String value) { 496 if (this.type == null) 497 this.type = new CodeType(); 498 this.type.setValue(value); 499 return this; 500 } 501 502 /** 503 * @return {@link #profile} (If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.) 504 */ 505 public Reference getProfile() { 506 if (this.profile == null) 507 if (Configuration.errorOnAutoCreate()) 508 throw new Error("Attempt to auto-create ParameterDefinition.profile"); 509 else if (Configuration.doAutoCreate()) 510 this.profile = new Reference(); // cc 511 return this.profile; 512 } 513 514 public boolean hasProfile() { 515 return this.profile != null && !this.profile.isEmpty(); 516 } 517 518 /** 519 * @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.) 520 */ 521 public ParameterDefinition setProfile(Reference value) { 522 this.profile = value; 523 return this; 524 } 525 526 /** 527 * @return {@link #profile} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.) 528 */ 529 public StructureDefinition getProfileTarget() { 530 if (this.profileTarget == null) 531 if (Configuration.errorOnAutoCreate()) 532 throw new Error("Attempt to auto-create ParameterDefinition.profile"); 533 else if (Configuration.doAutoCreate()) 534 this.profileTarget = new StructureDefinition(); // aa 535 return this.profileTarget; 536 } 537 538 /** 539 * @param value {@link #profile} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (If specified, this indicates a profile that the input data must conform to, or that the output data will conform to.) 540 */ 541 public ParameterDefinition setProfileTarget(StructureDefinition value) { 542 this.profileTarget = value; 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", "Reference(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", "Reference(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}; // Reference 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 = castToReference(value); // Reference 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 = castToReference(value); // Reference 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 getProfile(); 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[] {"Reference"}; 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 singleton property ParameterDefinition.name"); 673 } 674 else if (name.equals("use")) { 675 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.use"); 676 } 677 else if (name.equals("min")) { 678 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.min"); 679 } 680 else if (name.equals("max")) { 681 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.max"); 682 } 683 else if (name.equals("documentation")) { 684 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.documentation"); 685 } 686 else if (name.equals("type")) { 687 throw new FHIRException("Cannot call addChild on a singleton property ParameterDefinition.type"); 688 } 689 else if (name.equals("profile")) { 690 this.profile = new Reference(); 691 return this.profile; 692 } 693 else 694 return super.addChild(name); 695 } 696 697 public String fhirType() { 698 return "ParameterDefinition"; 699 700 } 701 702 public ParameterDefinition copy() { 703 ParameterDefinition dst = new ParameterDefinition(); 704 copyValues(dst); 705 dst.name = name == null ? null : name.copy(); 706 dst.use = use == null ? null : use.copy(); 707 dst.min = min == null ? null : min.copy(); 708 dst.max = max == null ? null : max.copy(); 709 dst.documentation = documentation == null ? null : documentation.copy(); 710 dst.type = type == null ? null : type.copy(); 711 dst.profile = profile == null ? null : profile.copy(); 712 return dst; 713 } 714 715 protected ParameterDefinition typedCopy() { 716 return copy(); 717 } 718 719 @Override 720 public boolean equalsDeep(Base other_) { 721 if (!super.equalsDeep(other_)) 722 return false; 723 if (!(other_ instanceof ParameterDefinition)) 724 return false; 725 ParameterDefinition o = (ParameterDefinition) other_; 726 return compareDeep(name, o.name, true) && compareDeep(use, o.use, true) && compareDeep(min, o.min, true) 727 && compareDeep(max, o.max, true) && compareDeep(documentation, o.documentation, true) && compareDeep(type, o.type, true) 728 && compareDeep(profile, o.profile, true); 729 } 730 731 @Override 732 public boolean equalsShallow(Base other_) { 733 if (!super.equalsShallow(other_)) 734 return false; 735 if (!(other_ instanceof ParameterDefinition)) 736 return false; 737 ParameterDefinition o = (ParameterDefinition) other_; 738 return compareValues(name, o.name, true) && compareValues(use, o.use, true) && compareValues(min, o.min, true) 739 && compareValues(max, o.max, true) && compareValues(documentation, o.documentation, true) && compareValues(type, o.type, true) 740 ; 741 } 742 743 public boolean isEmpty() { 744 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, use, min, max, documentation 745 , type, profile); 746 } 747 748 749}