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