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