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