001package org.hl7.fhir.r5.model; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.utilities.Utilities; 038import org.hl7.fhir.r5.model.Enumerations.*; 039import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import ca.uhn.fhir.model.api.annotation.ResourceDef; 043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 044import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 045import ca.uhn.fhir.model.api.annotation.Child; 046import ca.uhn.fhir.model.api.annotation.ChildOrder; 047import ca.uhn.fhir.model.api.annotation.Description; 048import ca.uhn.fhir.model.api.annotation.Block; 049 050/** 051 * A food or supplement that is consumed by patients. 052 */ 053@ResourceDef(name="NutritionProduct", profile="http://hl7.org/fhir/StructureDefinition/NutritionProduct") 054public class NutritionProduct extends DomainResource { 055 056 public enum NutritionProductStatus { 057 /** 058 * The product can be used. 059 */ 060 ACTIVE, 061 /** 062 * The product is not expected or allowed to be used. 063 */ 064 INACTIVE, 065 /** 066 * This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".). 067 */ 068 ENTEREDINERROR, 069 /** 070 * added to help the parsers with the generic types 071 */ 072 NULL; 073 public static NutritionProductStatus fromCode(String codeString) throws FHIRException { 074 if (codeString == null || "".equals(codeString)) 075 return null; 076 if ("active".equals(codeString)) 077 return ACTIVE; 078 if ("inactive".equals(codeString)) 079 return INACTIVE; 080 if ("entered-in-error".equals(codeString)) 081 return ENTEREDINERROR; 082 if (Configuration.isAcceptInvalidEnums()) 083 return null; 084 else 085 throw new FHIRException("Unknown NutritionProductStatus code '"+codeString+"'"); 086 } 087 public String toCode() { 088 switch (this) { 089 case ACTIVE: return "active"; 090 case INACTIVE: return "inactive"; 091 case ENTEREDINERROR: return "entered-in-error"; 092 case NULL: return null; 093 default: return "?"; 094 } 095 } 096 public String getSystem() { 097 switch (this) { 098 case ACTIVE: return "http://hl7.org/fhir/nutritionproduct-status"; 099 case INACTIVE: return "http://hl7.org/fhir/nutritionproduct-status"; 100 case ENTEREDINERROR: return "http://hl7.org/fhir/nutritionproduct-status"; 101 case NULL: return null; 102 default: return "?"; 103 } 104 } 105 public String getDefinition() { 106 switch (this) { 107 case ACTIVE: return "The product can be used."; 108 case INACTIVE: return "The product is not expected or allowed to be used."; 109 case ENTEREDINERROR: return "This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"cancelled\" rather than \"entered-in-error\".)."; 110 case NULL: return null; 111 default: return "?"; 112 } 113 } 114 public String getDisplay() { 115 switch (this) { 116 case ACTIVE: return "Active"; 117 case INACTIVE: return "Inactive"; 118 case ENTEREDINERROR: return "Entered in Error"; 119 case NULL: return null; 120 default: return "?"; 121 } 122 } 123 } 124 125 public static class NutritionProductStatusEnumFactory implements EnumFactory<NutritionProductStatus> { 126 public NutritionProductStatus fromCode(String codeString) throws IllegalArgumentException { 127 if (codeString == null || "".equals(codeString)) 128 if (codeString == null || "".equals(codeString)) 129 return null; 130 if ("active".equals(codeString)) 131 return NutritionProductStatus.ACTIVE; 132 if ("inactive".equals(codeString)) 133 return NutritionProductStatus.INACTIVE; 134 if ("entered-in-error".equals(codeString)) 135 return NutritionProductStatus.ENTEREDINERROR; 136 throw new IllegalArgumentException("Unknown NutritionProductStatus code '"+codeString+"'"); 137 } 138 public Enumeration<NutritionProductStatus> fromType(PrimitiveType<?> code) throws FHIRException { 139 if (code == null) 140 return null; 141 if (code.isEmpty()) 142 return new Enumeration<NutritionProductStatus>(this, NutritionProductStatus.NULL, code); 143 String codeString = ((PrimitiveType) code).asStringValue(); 144 if (codeString == null || "".equals(codeString)) 145 return new Enumeration<NutritionProductStatus>(this, NutritionProductStatus.NULL, code); 146 if ("active".equals(codeString)) 147 return new Enumeration<NutritionProductStatus>(this, NutritionProductStatus.ACTIVE, code); 148 if ("inactive".equals(codeString)) 149 return new Enumeration<NutritionProductStatus>(this, NutritionProductStatus.INACTIVE, code); 150 if ("entered-in-error".equals(codeString)) 151 return new Enumeration<NutritionProductStatus>(this, NutritionProductStatus.ENTEREDINERROR, code); 152 throw new FHIRException("Unknown NutritionProductStatus code '"+codeString+"'"); 153 } 154 public String toCode(NutritionProductStatus code) { 155 if (code == NutritionProductStatus.ACTIVE) 156 return "active"; 157 if (code == NutritionProductStatus.INACTIVE) 158 return "inactive"; 159 if (code == NutritionProductStatus.ENTEREDINERROR) 160 return "entered-in-error"; 161 return "?"; 162 } 163 public String toSystem(NutritionProductStatus code) { 164 return code.getSystem(); 165 } 166 } 167 168 @Block() 169 public static class NutritionProductNutrientComponent extends BackboneElement implements IBaseBackboneElement { 170 /** 171 * The (relevant) nutrients in the product. 172 */ 173 @Child(name = "item", type = {CodeableReference.class}, order=1, min=0, max=1, modifier=false, summary=false) 174 @Description(shortDefinition="The (relevant) nutrients in the product", formalDefinition="The (relevant) nutrients in the product." ) 175 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/nutrition-product-nutrient") 176 protected CodeableReference item; 177 178 /** 179 * The amount of nutrient expressed in one or more units: X per pack / per serving / per dose. 180 */ 181 @Child(name = "amount", type = {Ratio.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 182 @Description(shortDefinition="The amount of nutrient expressed in one or more units: X per pack / per serving / per dose", formalDefinition="The amount of nutrient expressed in one or more units: X per pack / per serving / per dose." ) 183 protected List<Ratio> amount; 184 185 private static final long serialVersionUID = -776277304L; 186 187 /** 188 * Constructor 189 */ 190 public NutritionProductNutrientComponent() { 191 super(); 192 } 193 194 /** 195 * @return {@link #item} (The (relevant) nutrients in the product.) 196 */ 197 public CodeableReference getItem() { 198 if (this.item == null) 199 if (Configuration.errorOnAutoCreate()) 200 throw new Error("Attempt to auto-create NutritionProductNutrientComponent.item"); 201 else if (Configuration.doAutoCreate()) 202 this.item = new CodeableReference(); // cc 203 return this.item; 204 } 205 206 public boolean hasItem() { 207 return this.item != null && !this.item.isEmpty(); 208 } 209 210 /** 211 * @param value {@link #item} (The (relevant) nutrients in the product.) 212 */ 213 public NutritionProductNutrientComponent setItem(CodeableReference value) { 214 this.item = value; 215 return this; 216 } 217 218 /** 219 * @return {@link #amount} (The amount of nutrient expressed in one or more units: X per pack / per serving / per dose.) 220 */ 221 public List<Ratio> getAmount() { 222 if (this.amount == null) 223 this.amount = new ArrayList<Ratio>(); 224 return this.amount; 225 } 226 227 /** 228 * @return Returns a reference to <code>this</code> for easy method chaining 229 */ 230 public NutritionProductNutrientComponent setAmount(List<Ratio> theAmount) { 231 this.amount = theAmount; 232 return this; 233 } 234 235 public boolean hasAmount() { 236 if (this.amount == null) 237 return false; 238 for (Ratio item : this.amount) 239 if (!item.isEmpty()) 240 return true; 241 return false; 242 } 243 244 public Ratio addAmount() { //3 245 Ratio t = new Ratio(); 246 if (this.amount == null) 247 this.amount = new ArrayList<Ratio>(); 248 this.amount.add(t); 249 return t; 250 } 251 252 public NutritionProductNutrientComponent addAmount(Ratio t) { //3 253 if (t == null) 254 return this; 255 if (this.amount == null) 256 this.amount = new ArrayList<Ratio>(); 257 this.amount.add(t); 258 return this; 259 } 260 261 /** 262 * @return The first repetition of repeating field {@link #amount}, creating it if it does not already exist {3} 263 */ 264 public Ratio getAmountFirstRep() { 265 if (getAmount().isEmpty()) { 266 addAmount(); 267 } 268 return getAmount().get(0); 269 } 270 271 protected void listChildren(List<Property> children) { 272 super.listChildren(children); 273 children.add(new Property("item", "CodeableReference(Substance)", "The (relevant) nutrients in the product.", 0, 1, item)); 274 children.add(new Property("amount", "Ratio", "The amount of nutrient expressed in one or more units: X per pack / per serving / per dose.", 0, java.lang.Integer.MAX_VALUE, amount)); 275 } 276 277 @Override 278 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 279 switch (_hash) { 280 case 3242771: /*item*/ return new Property("item", "CodeableReference(Substance)", "The (relevant) nutrients in the product.", 0, 1, item); 281 case -1413853096: /*amount*/ return new Property("amount", "Ratio", "The amount of nutrient expressed in one or more units: X per pack / per serving / per dose.", 0, java.lang.Integer.MAX_VALUE, amount); 282 default: return super.getNamedProperty(_hash, _name, _checkValid); 283 } 284 285 } 286 287 @Override 288 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 289 switch (hash) { 290 case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // CodeableReference 291 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : this.amount.toArray(new Base[this.amount.size()]); // Ratio 292 default: return super.getProperty(hash, name, checkValid); 293 } 294 295 } 296 297 @Override 298 public Base setProperty(int hash, String name, Base value) throws FHIRException { 299 switch (hash) { 300 case 3242771: // item 301 this.item = TypeConvertor.castToCodeableReference(value); // CodeableReference 302 return value; 303 case -1413853096: // amount 304 this.getAmount().add(TypeConvertor.castToRatio(value)); // Ratio 305 return value; 306 default: return super.setProperty(hash, name, value); 307 } 308 309 } 310 311 @Override 312 public Base setProperty(String name, Base value) throws FHIRException { 313 if (name.equals("item")) { 314 this.item = TypeConvertor.castToCodeableReference(value); // CodeableReference 315 } else if (name.equals("amount")) { 316 this.getAmount().add(TypeConvertor.castToRatio(value)); 317 } else 318 return super.setProperty(name, value); 319 return value; 320 } 321 322 @Override 323 public Base makeProperty(int hash, String name) throws FHIRException { 324 switch (hash) { 325 case 3242771: return getItem(); 326 case -1413853096: return addAmount(); 327 default: return super.makeProperty(hash, name); 328 } 329 330 } 331 332 @Override 333 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 334 switch (hash) { 335 case 3242771: /*item*/ return new String[] {"CodeableReference"}; 336 case -1413853096: /*amount*/ return new String[] {"Ratio"}; 337 default: return super.getTypesForProperty(hash, name); 338 } 339 340 } 341 342 @Override 343 public Base addChild(String name) throws FHIRException { 344 if (name.equals("item")) { 345 this.item = new CodeableReference(); 346 return this.item; 347 } 348 else if (name.equals("amount")) { 349 return addAmount(); 350 } 351 else 352 return super.addChild(name); 353 } 354 355 public NutritionProductNutrientComponent copy() { 356 NutritionProductNutrientComponent dst = new NutritionProductNutrientComponent(); 357 copyValues(dst); 358 return dst; 359 } 360 361 public void copyValues(NutritionProductNutrientComponent dst) { 362 super.copyValues(dst); 363 dst.item = item == null ? null : item.copy(); 364 if (amount != null) { 365 dst.amount = new ArrayList<Ratio>(); 366 for (Ratio i : amount) 367 dst.amount.add(i.copy()); 368 }; 369 } 370 371 @Override 372 public boolean equalsDeep(Base other_) { 373 if (!super.equalsDeep(other_)) 374 return false; 375 if (!(other_ instanceof NutritionProductNutrientComponent)) 376 return false; 377 NutritionProductNutrientComponent o = (NutritionProductNutrientComponent) other_; 378 return compareDeep(item, o.item, true) && compareDeep(amount, o.amount, true); 379 } 380 381 @Override 382 public boolean equalsShallow(Base other_) { 383 if (!super.equalsShallow(other_)) 384 return false; 385 if (!(other_ instanceof NutritionProductNutrientComponent)) 386 return false; 387 NutritionProductNutrientComponent o = (NutritionProductNutrientComponent) other_; 388 return true; 389 } 390 391 public boolean isEmpty() { 392 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, amount); 393 } 394 395 public String fhirType() { 396 return "NutritionProduct.nutrient"; 397 398 } 399 400 } 401 402 @Block() 403 public static class NutritionProductIngredientComponent extends BackboneElement implements IBaseBackboneElement { 404 /** 405 * The ingredient contained in the product. 406 */ 407 @Child(name = "item", type = {CodeableReference.class}, order=1, min=1, max=1, modifier=false, summary=true) 408 @Description(shortDefinition="The ingredient contained in the product", formalDefinition="The ingredient contained in the product." ) 409 protected CodeableReference item; 410 411 /** 412 * The amount of ingredient that is in the product. 413 */ 414 @Child(name = "amount", type = {Ratio.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 415 @Description(shortDefinition="The amount of ingredient that is in the product", formalDefinition="The amount of ingredient that is in the product." ) 416 protected List<Ratio> amount; 417 418 private static final long serialVersionUID = -776277304L; 419 420 /** 421 * Constructor 422 */ 423 public NutritionProductIngredientComponent() { 424 super(); 425 } 426 427 /** 428 * Constructor 429 */ 430 public NutritionProductIngredientComponent(CodeableReference item) { 431 super(); 432 this.setItem(item); 433 } 434 435 /** 436 * @return {@link #item} (The ingredient contained in the product.) 437 */ 438 public CodeableReference getItem() { 439 if (this.item == null) 440 if (Configuration.errorOnAutoCreate()) 441 throw new Error("Attempt to auto-create NutritionProductIngredientComponent.item"); 442 else if (Configuration.doAutoCreate()) 443 this.item = new CodeableReference(); // cc 444 return this.item; 445 } 446 447 public boolean hasItem() { 448 return this.item != null && !this.item.isEmpty(); 449 } 450 451 /** 452 * @param value {@link #item} (The ingredient contained in the product.) 453 */ 454 public NutritionProductIngredientComponent setItem(CodeableReference value) { 455 this.item = value; 456 return this; 457 } 458 459 /** 460 * @return {@link #amount} (The amount of ingredient that is in the product.) 461 */ 462 public List<Ratio> getAmount() { 463 if (this.amount == null) 464 this.amount = new ArrayList<Ratio>(); 465 return this.amount; 466 } 467 468 /** 469 * @return Returns a reference to <code>this</code> for easy method chaining 470 */ 471 public NutritionProductIngredientComponent setAmount(List<Ratio> theAmount) { 472 this.amount = theAmount; 473 return this; 474 } 475 476 public boolean hasAmount() { 477 if (this.amount == null) 478 return false; 479 for (Ratio item : this.amount) 480 if (!item.isEmpty()) 481 return true; 482 return false; 483 } 484 485 public Ratio addAmount() { //3 486 Ratio t = new Ratio(); 487 if (this.amount == null) 488 this.amount = new ArrayList<Ratio>(); 489 this.amount.add(t); 490 return t; 491 } 492 493 public NutritionProductIngredientComponent addAmount(Ratio t) { //3 494 if (t == null) 495 return this; 496 if (this.amount == null) 497 this.amount = new ArrayList<Ratio>(); 498 this.amount.add(t); 499 return this; 500 } 501 502 /** 503 * @return The first repetition of repeating field {@link #amount}, creating it if it does not already exist {3} 504 */ 505 public Ratio getAmountFirstRep() { 506 if (getAmount().isEmpty()) { 507 addAmount(); 508 } 509 return getAmount().get(0); 510 } 511 512 protected void listChildren(List<Property> children) { 513 super.listChildren(children); 514 children.add(new Property("item", "CodeableReference(NutritionProduct)", "The ingredient contained in the product.", 0, 1, item)); 515 children.add(new Property("amount", "Ratio", "The amount of ingredient that is in the product.", 0, java.lang.Integer.MAX_VALUE, amount)); 516 } 517 518 @Override 519 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 520 switch (_hash) { 521 case 3242771: /*item*/ return new Property("item", "CodeableReference(NutritionProduct)", "The ingredient contained in the product.", 0, 1, item); 522 case -1413853096: /*amount*/ return new Property("amount", "Ratio", "The amount of ingredient that is in the product.", 0, java.lang.Integer.MAX_VALUE, amount); 523 default: return super.getNamedProperty(_hash, _name, _checkValid); 524 } 525 526 } 527 528 @Override 529 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 530 switch (hash) { 531 case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // CodeableReference 532 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : this.amount.toArray(new Base[this.amount.size()]); // Ratio 533 default: return super.getProperty(hash, name, checkValid); 534 } 535 536 } 537 538 @Override 539 public Base setProperty(int hash, String name, Base value) throws FHIRException { 540 switch (hash) { 541 case 3242771: // item 542 this.item = TypeConvertor.castToCodeableReference(value); // CodeableReference 543 return value; 544 case -1413853096: // amount 545 this.getAmount().add(TypeConvertor.castToRatio(value)); // Ratio 546 return value; 547 default: return super.setProperty(hash, name, value); 548 } 549 550 } 551 552 @Override 553 public Base setProperty(String name, Base value) throws FHIRException { 554 if (name.equals("item")) { 555 this.item = TypeConvertor.castToCodeableReference(value); // CodeableReference 556 } else if (name.equals("amount")) { 557 this.getAmount().add(TypeConvertor.castToRatio(value)); 558 } else 559 return super.setProperty(name, value); 560 return value; 561 } 562 563 @Override 564 public Base makeProperty(int hash, String name) throws FHIRException { 565 switch (hash) { 566 case 3242771: return getItem(); 567 case -1413853096: return addAmount(); 568 default: return super.makeProperty(hash, name); 569 } 570 571 } 572 573 @Override 574 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 575 switch (hash) { 576 case 3242771: /*item*/ return new String[] {"CodeableReference"}; 577 case -1413853096: /*amount*/ return new String[] {"Ratio"}; 578 default: return super.getTypesForProperty(hash, name); 579 } 580 581 } 582 583 @Override 584 public Base addChild(String name) throws FHIRException { 585 if (name.equals("item")) { 586 this.item = new CodeableReference(); 587 return this.item; 588 } 589 else if (name.equals("amount")) { 590 return addAmount(); 591 } 592 else 593 return super.addChild(name); 594 } 595 596 public NutritionProductIngredientComponent copy() { 597 NutritionProductIngredientComponent dst = new NutritionProductIngredientComponent(); 598 copyValues(dst); 599 return dst; 600 } 601 602 public void copyValues(NutritionProductIngredientComponent dst) { 603 super.copyValues(dst); 604 dst.item = item == null ? null : item.copy(); 605 if (amount != null) { 606 dst.amount = new ArrayList<Ratio>(); 607 for (Ratio i : amount) 608 dst.amount.add(i.copy()); 609 }; 610 } 611 612 @Override 613 public boolean equalsDeep(Base other_) { 614 if (!super.equalsDeep(other_)) 615 return false; 616 if (!(other_ instanceof NutritionProductIngredientComponent)) 617 return false; 618 NutritionProductIngredientComponent o = (NutritionProductIngredientComponent) other_; 619 return compareDeep(item, o.item, true) && compareDeep(amount, o.amount, true); 620 } 621 622 @Override 623 public boolean equalsShallow(Base other_) { 624 if (!super.equalsShallow(other_)) 625 return false; 626 if (!(other_ instanceof NutritionProductIngredientComponent)) 627 return false; 628 NutritionProductIngredientComponent o = (NutritionProductIngredientComponent) other_; 629 return true; 630 } 631 632 public boolean isEmpty() { 633 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, amount); 634 } 635 636 public String fhirType() { 637 return "NutritionProduct.ingredient"; 638 639 } 640 641 } 642 643 @Block() 644 public static class NutritionProductCharacteristicComponent extends BackboneElement implements IBaseBackboneElement { 645 /** 646 * A code specifying which characteristic of the product is being described (for example, colour, shape). 647 */ 648 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false) 649 @Description(shortDefinition="Code specifying the type of characteristic", formalDefinition="A code specifying which characteristic of the product is being described (for example, colour, shape)." ) 650 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/measurement-property") 651 protected CodeableConcept type; 652 653 /** 654 * The actual characteristic value corresponding to the type. 655 */ 656 @Child(name = "value", type = {CodeableConcept.class, StringType.class, Quantity.class, Base64BinaryType.class, Attachment.class, BooleanType.class}, order=2, min=1, max=1, modifier=false, summary=false) 657 @Description(shortDefinition="The value of the characteristic", formalDefinition="The actual characteristic value corresponding to the type." ) 658 protected DataType value; 659 660 private static final long serialVersionUID = -1659186716L; 661 662 /** 663 * Constructor 664 */ 665 public NutritionProductCharacteristicComponent() { 666 super(); 667 } 668 669 /** 670 * Constructor 671 */ 672 public NutritionProductCharacteristicComponent(CodeableConcept type, DataType value) { 673 super(); 674 this.setType(type); 675 this.setValue(value); 676 } 677 678 /** 679 * @return {@link #type} (A code specifying which characteristic of the product is being described (for example, colour, shape).) 680 */ 681 public CodeableConcept getType() { 682 if (this.type == null) 683 if (Configuration.errorOnAutoCreate()) 684 throw new Error("Attempt to auto-create NutritionProductCharacteristicComponent.type"); 685 else if (Configuration.doAutoCreate()) 686 this.type = new CodeableConcept(); // cc 687 return this.type; 688 } 689 690 public boolean hasType() { 691 return this.type != null && !this.type.isEmpty(); 692 } 693 694 /** 695 * @param value {@link #type} (A code specifying which characteristic of the product is being described (for example, colour, shape).) 696 */ 697 public NutritionProductCharacteristicComponent setType(CodeableConcept value) { 698 this.type = value; 699 return this; 700 } 701 702 /** 703 * @return {@link #value} (The actual characteristic value corresponding to the type.) 704 */ 705 public DataType getValue() { 706 return this.value; 707 } 708 709 /** 710 * @return {@link #value} (The actual characteristic value corresponding to the type.) 711 */ 712 public CodeableConcept getValueCodeableConcept() throws FHIRException { 713 if (this.value == null) 714 this.value = new CodeableConcept(); 715 if (!(this.value instanceof CodeableConcept)) 716 throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered"); 717 return (CodeableConcept) this.value; 718 } 719 720 public boolean hasValueCodeableConcept() { 721 return this != null && this.value instanceof CodeableConcept; 722 } 723 724 /** 725 * @return {@link #value} (The actual characteristic value corresponding to the type.) 726 */ 727 public StringType getValueStringType() throws FHIRException { 728 if (this.value == null) 729 this.value = new StringType(); 730 if (!(this.value instanceof StringType)) 731 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered"); 732 return (StringType) this.value; 733 } 734 735 public boolean hasValueStringType() { 736 return this != null && this.value instanceof StringType; 737 } 738 739 /** 740 * @return {@link #value} (The actual characteristic value corresponding to the type.) 741 */ 742 public Quantity getValueQuantity() throws FHIRException { 743 if (this.value == null) 744 this.value = new Quantity(); 745 if (!(this.value instanceof Quantity)) 746 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered"); 747 return (Quantity) this.value; 748 } 749 750 public boolean hasValueQuantity() { 751 return this != null && this.value instanceof Quantity; 752 } 753 754 /** 755 * @return {@link #value} (The actual characteristic value corresponding to the type.) 756 */ 757 public Base64BinaryType getValueBase64BinaryType() throws FHIRException { 758 if (this.value == null) 759 this.value = new Base64BinaryType(); 760 if (!(this.value instanceof Base64BinaryType)) 761 throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "+this.value.getClass().getName()+" was encountered"); 762 return (Base64BinaryType) this.value; 763 } 764 765 public boolean hasValueBase64BinaryType() { 766 return this != null && this.value instanceof Base64BinaryType; 767 } 768 769 /** 770 * @return {@link #value} (The actual characteristic value corresponding to the type.) 771 */ 772 public Attachment getValueAttachment() throws FHIRException { 773 if (this.value == null) 774 this.value = new Attachment(); 775 if (!(this.value instanceof Attachment)) 776 throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered"); 777 return (Attachment) this.value; 778 } 779 780 public boolean hasValueAttachment() { 781 return this != null && this.value instanceof Attachment; 782 } 783 784 /** 785 * @return {@link #value} (The actual characteristic value corresponding to the type.) 786 */ 787 public BooleanType getValueBooleanType() throws FHIRException { 788 if (this.value == null) 789 this.value = new BooleanType(); 790 if (!(this.value instanceof BooleanType)) 791 throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered"); 792 return (BooleanType) this.value; 793 } 794 795 public boolean hasValueBooleanType() { 796 return this != null && this.value instanceof BooleanType; 797 } 798 799 public boolean hasValue() { 800 return this.value != null && !this.value.isEmpty(); 801 } 802 803 /** 804 * @param value {@link #value} (The actual characteristic value corresponding to the type.) 805 */ 806 public NutritionProductCharacteristicComponent setValue(DataType value) { 807 if (value != null && !(value instanceof CodeableConcept || value instanceof StringType || value instanceof Quantity || value instanceof Base64BinaryType || value instanceof Attachment || value instanceof BooleanType)) 808 throw new FHIRException("Not the right type for NutritionProduct.characteristic.value[x]: "+value.fhirType()); 809 this.value = value; 810 return this; 811 } 812 813 protected void listChildren(List<Property> children) { 814 super.listChildren(children); 815 children.add(new Property("type", "CodeableConcept", "A code specifying which characteristic of the product is being described (for example, colour, shape).", 0, 1, type)); 816 children.add(new Property("value[x]", "CodeableConcept|string|Quantity|base64Binary|Attachment|boolean", "The actual characteristic value corresponding to the type.", 0, 1, value)); 817 } 818 819 @Override 820 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 821 switch (_hash) { 822 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "A code specifying which characteristic of the product is being described (for example, colour, shape).", 0, 1, type); 823 case -1410166417: /*value[x]*/ return new Property("value[x]", "CodeableConcept|string|Quantity|base64Binary|Attachment|boolean", "The actual characteristic value corresponding to the type.", 0, 1, value); 824 case 111972721: /*value*/ return new Property("value[x]", "CodeableConcept|string|Quantity|base64Binary|Attachment|boolean", "The actual characteristic value corresponding to the type.", 0, 1, value); 825 case 924902896: /*valueCodeableConcept*/ return new Property("value[x]", "CodeableConcept", "The actual characteristic value corresponding to the type.", 0, 1, value); 826 case -1424603934: /*valueString*/ return new Property("value[x]", "string", "The actual characteristic value corresponding to the type.", 0, 1, value); 827 case -2029823716: /*valueQuantity*/ return new Property("value[x]", "Quantity", "The actual characteristic value corresponding to the type.", 0, 1, value); 828 case -1535024575: /*valueBase64Binary*/ return new Property("value[x]", "base64Binary", "The actual characteristic value corresponding to the type.", 0, 1, value); 829 case -475566732: /*valueAttachment*/ return new Property("value[x]", "Attachment", "The actual characteristic value corresponding to the type.", 0, 1, value); 830 case 733421943: /*valueBoolean*/ return new Property("value[x]", "boolean", "The actual characteristic value corresponding to the type.", 0, 1, value); 831 default: return super.getNamedProperty(_hash, _name, _checkValid); 832 } 833 834 } 835 836 @Override 837 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 838 switch (hash) { 839 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 840 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType 841 default: return super.getProperty(hash, name, checkValid); 842 } 843 844 } 845 846 @Override 847 public Base setProperty(int hash, String name, Base value) throws FHIRException { 848 switch (hash) { 849 case 3575610: // type 850 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 851 return value; 852 case 111972721: // value 853 this.value = TypeConvertor.castToType(value); // DataType 854 return value; 855 default: return super.setProperty(hash, name, value); 856 } 857 858 } 859 860 @Override 861 public Base setProperty(String name, Base value) throws FHIRException { 862 if (name.equals("type")) { 863 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 864 } else if (name.equals("value[x]")) { 865 this.value = TypeConvertor.castToType(value); // DataType 866 } else 867 return super.setProperty(name, value); 868 return value; 869 } 870 871 @Override 872 public Base makeProperty(int hash, String name) throws FHIRException { 873 switch (hash) { 874 case 3575610: return getType(); 875 case -1410166417: return getValue(); 876 case 111972721: return getValue(); 877 default: return super.makeProperty(hash, name); 878 } 879 880 } 881 882 @Override 883 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 884 switch (hash) { 885 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 886 case 111972721: /*value*/ return new String[] {"CodeableConcept", "string", "Quantity", "base64Binary", "Attachment", "boolean"}; 887 default: return super.getTypesForProperty(hash, name); 888 } 889 890 } 891 892 @Override 893 public Base addChild(String name) throws FHIRException { 894 if (name.equals("type")) { 895 this.type = new CodeableConcept(); 896 return this.type; 897 } 898 else if (name.equals("valueCodeableConcept")) { 899 this.value = new CodeableConcept(); 900 return this.value; 901 } 902 else if (name.equals("valueString")) { 903 this.value = new StringType(); 904 return this.value; 905 } 906 else if (name.equals("valueQuantity")) { 907 this.value = new Quantity(); 908 return this.value; 909 } 910 else if (name.equals("valueBase64Binary")) { 911 this.value = new Base64BinaryType(); 912 return this.value; 913 } 914 else if (name.equals("valueAttachment")) { 915 this.value = new Attachment(); 916 return this.value; 917 } 918 else if (name.equals("valueBoolean")) { 919 this.value = new BooleanType(); 920 return this.value; 921 } 922 else 923 return super.addChild(name); 924 } 925 926 public NutritionProductCharacteristicComponent copy() { 927 NutritionProductCharacteristicComponent dst = new NutritionProductCharacteristicComponent(); 928 copyValues(dst); 929 return dst; 930 } 931 932 public void copyValues(NutritionProductCharacteristicComponent dst) { 933 super.copyValues(dst); 934 dst.type = type == null ? null : type.copy(); 935 dst.value = value == null ? null : value.copy(); 936 } 937 938 @Override 939 public boolean equalsDeep(Base other_) { 940 if (!super.equalsDeep(other_)) 941 return false; 942 if (!(other_ instanceof NutritionProductCharacteristicComponent)) 943 return false; 944 NutritionProductCharacteristicComponent o = (NutritionProductCharacteristicComponent) other_; 945 return compareDeep(type, o.type, true) && compareDeep(value, o.value, true); 946 } 947 948 @Override 949 public boolean equalsShallow(Base other_) { 950 if (!super.equalsShallow(other_)) 951 return false; 952 if (!(other_ instanceof NutritionProductCharacteristicComponent)) 953 return false; 954 NutritionProductCharacteristicComponent o = (NutritionProductCharacteristicComponent) other_; 955 return true; 956 } 957 958 public boolean isEmpty() { 959 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value); 960 } 961 962 public String fhirType() { 963 return "NutritionProduct.characteristic"; 964 965 } 966 967 } 968 969 @Block() 970 public static class NutritionProductInstanceComponent extends BackboneElement implements IBaseBackboneElement { 971 /** 972 * The amount of items or instances that the resource considers, for instance when referring to 2 identical units together. 973 */ 974 @Child(name = "quantity", type = {Quantity.class}, order=1, min=0, max=1, modifier=false, summary=false) 975 @Description(shortDefinition="The amount of items or instances", formalDefinition="The amount of items or instances that the resource considers, for instance when referring to 2 identical units together." ) 976 protected Quantity quantity; 977 978 /** 979 * The identifier for the physical instance, typically a serial number or manufacturer number. 980 */ 981 @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 982 @Description(shortDefinition="The identifier for the physical instance, typically a serial number or manufacturer number", formalDefinition="The identifier for the physical instance, typically a serial number or manufacturer number." ) 983 protected List<Identifier> identifier; 984 985 /** 986 * The name for the specific product. 987 */ 988 @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false) 989 @Description(shortDefinition="The name for the specific product", formalDefinition="The name for the specific product." ) 990 protected StringType name; 991 992 /** 993 * The identification of the batch or lot of the product. 994 */ 995 @Child(name = "lotNumber", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false) 996 @Description(shortDefinition="The identification of the batch or lot of the product", formalDefinition="The identification of the batch or lot of the product." ) 997 protected StringType lotNumber; 998 999 /** 1000 * The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed. 1001 */ 1002 @Child(name = "expiry", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=false) 1003 @Description(shortDefinition="The expiry date or date and time for the product", formalDefinition="The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed." ) 1004 protected DateTimeType expiry; 1005 1006 /** 1007 * The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed. 1008 */ 1009 @Child(name = "useBy", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=false) 1010 @Description(shortDefinition="The date until which the product is expected to be good for consumption", formalDefinition="The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed." ) 1011 protected DateTimeType useBy; 1012 1013 /** 1014 * An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled. 1015 */ 1016 @Child(name = "biologicalSourceEvent", type = {Identifier.class}, order=7, min=0, max=1, modifier=false, summary=false) 1017 @Description(shortDefinition="An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled", formalDefinition="An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled." ) 1018 protected Identifier biologicalSourceEvent; 1019 1020 private static final long serialVersionUID = -954985011L; 1021 1022 /** 1023 * Constructor 1024 */ 1025 public NutritionProductInstanceComponent() { 1026 super(); 1027 } 1028 1029 /** 1030 * @return {@link #quantity} (The amount of items or instances that the resource considers, for instance when referring to 2 identical units together.) 1031 */ 1032 public Quantity getQuantity() { 1033 if (this.quantity == null) 1034 if (Configuration.errorOnAutoCreate()) 1035 throw new Error("Attempt to auto-create NutritionProductInstanceComponent.quantity"); 1036 else if (Configuration.doAutoCreate()) 1037 this.quantity = new Quantity(); // cc 1038 return this.quantity; 1039 } 1040 1041 public boolean hasQuantity() { 1042 return this.quantity != null && !this.quantity.isEmpty(); 1043 } 1044 1045 /** 1046 * @param value {@link #quantity} (The amount of items or instances that the resource considers, for instance when referring to 2 identical units together.) 1047 */ 1048 public NutritionProductInstanceComponent setQuantity(Quantity value) { 1049 this.quantity = value; 1050 return this; 1051 } 1052 1053 /** 1054 * @return {@link #identifier} (The identifier for the physical instance, typically a serial number or manufacturer number.) 1055 */ 1056 public List<Identifier> getIdentifier() { 1057 if (this.identifier == null) 1058 this.identifier = new ArrayList<Identifier>(); 1059 return this.identifier; 1060 } 1061 1062 /** 1063 * @return Returns a reference to <code>this</code> for easy method chaining 1064 */ 1065 public NutritionProductInstanceComponent setIdentifier(List<Identifier> theIdentifier) { 1066 this.identifier = theIdentifier; 1067 return this; 1068 } 1069 1070 public boolean hasIdentifier() { 1071 if (this.identifier == null) 1072 return false; 1073 for (Identifier item : this.identifier) 1074 if (!item.isEmpty()) 1075 return true; 1076 return false; 1077 } 1078 1079 public Identifier addIdentifier() { //3 1080 Identifier t = new Identifier(); 1081 if (this.identifier == null) 1082 this.identifier = new ArrayList<Identifier>(); 1083 this.identifier.add(t); 1084 return t; 1085 } 1086 1087 public NutritionProductInstanceComponent addIdentifier(Identifier t) { //3 1088 if (t == null) 1089 return this; 1090 if (this.identifier == null) 1091 this.identifier = new ArrayList<Identifier>(); 1092 this.identifier.add(t); 1093 return this; 1094 } 1095 1096 /** 1097 * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3} 1098 */ 1099 public Identifier getIdentifierFirstRep() { 1100 if (getIdentifier().isEmpty()) { 1101 addIdentifier(); 1102 } 1103 return getIdentifier().get(0); 1104 } 1105 1106 /** 1107 * @return {@link #name} (The name for the specific product.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 1108 */ 1109 public StringType getNameElement() { 1110 if (this.name == null) 1111 if (Configuration.errorOnAutoCreate()) 1112 throw new Error("Attempt to auto-create NutritionProductInstanceComponent.name"); 1113 else if (Configuration.doAutoCreate()) 1114 this.name = new StringType(); // bb 1115 return this.name; 1116 } 1117 1118 public boolean hasNameElement() { 1119 return this.name != null && !this.name.isEmpty(); 1120 } 1121 1122 public boolean hasName() { 1123 return this.name != null && !this.name.isEmpty(); 1124 } 1125 1126 /** 1127 * @param value {@link #name} (The name for the specific product.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value 1128 */ 1129 public NutritionProductInstanceComponent setNameElement(StringType value) { 1130 this.name = value; 1131 return this; 1132 } 1133 1134 /** 1135 * @return The name for the specific product. 1136 */ 1137 public String getName() { 1138 return this.name == null ? null : this.name.getValue(); 1139 } 1140 1141 /** 1142 * @param value The name for the specific product. 1143 */ 1144 public NutritionProductInstanceComponent setName(String value) { 1145 if (Utilities.noString(value)) 1146 this.name = null; 1147 else { 1148 if (this.name == null) 1149 this.name = new StringType(); 1150 this.name.setValue(value); 1151 } 1152 return this; 1153 } 1154 1155 /** 1156 * @return {@link #lotNumber} (The identification of the batch or lot of the product.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value 1157 */ 1158 public StringType getLotNumberElement() { 1159 if (this.lotNumber == null) 1160 if (Configuration.errorOnAutoCreate()) 1161 throw new Error("Attempt to auto-create NutritionProductInstanceComponent.lotNumber"); 1162 else if (Configuration.doAutoCreate()) 1163 this.lotNumber = new StringType(); // bb 1164 return this.lotNumber; 1165 } 1166 1167 public boolean hasLotNumberElement() { 1168 return this.lotNumber != null && !this.lotNumber.isEmpty(); 1169 } 1170 1171 public boolean hasLotNumber() { 1172 return this.lotNumber != null && !this.lotNumber.isEmpty(); 1173 } 1174 1175 /** 1176 * @param value {@link #lotNumber} (The identification of the batch or lot of the product.). This is the underlying object with id, value and extensions. The accessor "getLotNumber" gives direct access to the value 1177 */ 1178 public NutritionProductInstanceComponent setLotNumberElement(StringType value) { 1179 this.lotNumber = value; 1180 return this; 1181 } 1182 1183 /** 1184 * @return The identification of the batch or lot of the product. 1185 */ 1186 public String getLotNumber() { 1187 return this.lotNumber == null ? null : this.lotNumber.getValue(); 1188 } 1189 1190 /** 1191 * @param value The identification of the batch or lot of the product. 1192 */ 1193 public NutritionProductInstanceComponent setLotNumber(String value) { 1194 if (Utilities.noString(value)) 1195 this.lotNumber = null; 1196 else { 1197 if (this.lotNumber == null) 1198 this.lotNumber = new StringType(); 1199 this.lotNumber.setValue(value); 1200 } 1201 return this; 1202 } 1203 1204 /** 1205 * @return {@link #expiry} (The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.). This is the underlying object with id, value and extensions. The accessor "getExpiry" gives direct access to the value 1206 */ 1207 public DateTimeType getExpiryElement() { 1208 if (this.expiry == null) 1209 if (Configuration.errorOnAutoCreate()) 1210 throw new Error("Attempt to auto-create NutritionProductInstanceComponent.expiry"); 1211 else if (Configuration.doAutoCreate()) 1212 this.expiry = new DateTimeType(); // bb 1213 return this.expiry; 1214 } 1215 1216 public boolean hasExpiryElement() { 1217 return this.expiry != null && !this.expiry.isEmpty(); 1218 } 1219 1220 public boolean hasExpiry() { 1221 return this.expiry != null && !this.expiry.isEmpty(); 1222 } 1223 1224 /** 1225 * @param value {@link #expiry} (The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.). This is the underlying object with id, value and extensions. The accessor "getExpiry" gives direct access to the value 1226 */ 1227 public NutritionProductInstanceComponent setExpiryElement(DateTimeType value) { 1228 this.expiry = value; 1229 return this; 1230 } 1231 1232 /** 1233 * @return The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed. 1234 */ 1235 public Date getExpiry() { 1236 return this.expiry == null ? null : this.expiry.getValue(); 1237 } 1238 1239 /** 1240 * @param value The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed. 1241 */ 1242 public NutritionProductInstanceComponent setExpiry(Date value) { 1243 if (value == null) 1244 this.expiry = null; 1245 else { 1246 if (this.expiry == null) 1247 this.expiry = new DateTimeType(); 1248 this.expiry.setValue(value); 1249 } 1250 return this; 1251 } 1252 1253 /** 1254 * @return {@link #useBy} (The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.). This is the underlying object with id, value and extensions. The accessor "getUseBy" gives direct access to the value 1255 */ 1256 public DateTimeType getUseByElement() { 1257 if (this.useBy == null) 1258 if (Configuration.errorOnAutoCreate()) 1259 throw new Error("Attempt to auto-create NutritionProductInstanceComponent.useBy"); 1260 else if (Configuration.doAutoCreate()) 1261 this.useBy = new DateTimeType(); // bb 1262 return this.useBy; 1263 } 1264 1265 public boolean hasUseByElement() { 1266 return this.useBy != null && !this.useBy.isEmpty(); 1267 } 1268 1269 public boolean hasUseBy() { 1270 return this.useBy != null && !this.useBy.isEmpty(); 1271 } 1272 1273 /** 1274 * @param value {@link #useBy} (The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.). This is the underlying object with id, value and extensions. The accessor "getUseBy" gives direct access to the value 1275 */ 1276 public NutritionProductInstanceComponent setUseByElement(DateTimeType value) { 1277 this.useBy = value; 1278 return this; 1279 } 1280 1281 /** 1282 * @return The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed. 1283 */ 1284 public Date getUseBy() { 1285 return this.useBy == null ? null : this.useBy.getValue(); 1286 } 1287 1288 /** 1289 * @param value The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed. 1290 */ 1291 public NutritionProductInstanceComponent setUseBy(Date value) { 1292 if (value == null) 1293 this.useBy = null; 1294 else { 1295 if (this.useBy == null) 1296 this.useBy = new DateTimeType(); 1297 this.useBy.setValue(value); 1298 } 1299 return this; 1300 } 1301 1302 /** 1303 * @return {@link #biologicalSourceEvent} (An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.) 1304 */ 1305 public Identifier getBiologicalSourceEvent() { 1306 if (this.biologicalSourceEvent == null) 1307 if (Configuration.errorOnAutoCreate()) 1308 throw new Error("Attempt to auto-create NutritionProductInstanceComponent.biologicalSourceEvent"); 1309 else if (Configuration.doAutoCreate()) 1310 this.biologicalSourceEvent = new Identifier(); // cc 1311 return this.biologicalSourceEvent; 1312 } 1313 1314 public boolean hasBiologicalSourceEvent() { 1315 return this.biologicalSourceEvent != null && !this.biologicalSourceEvent.isEmpty(); 1316 } 1317 1318 /** 1319 * @param value {@link #biologicalSourceEvent} (An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.) 1320 */ 1321 public NutritionProductInstanceComponent setBiologicalSourceEvent(Identifier value) { 1322 this.biologicalSourceEvent = value; 1323 return this; 1324 } 1325 1326 protected void listChildren(List<Property> children) { 1327 super.listChildren(children); 1328 children.add(new Property("quantity", "Quantity", "The amount of items or instances that the resource considers, for instance when referring to 2 identical units together.", 0, 1, quantity)); 1329 children.add(new Property("identifier", "Identifier", "The identifier for the physical instance, typically a serial number or manufacturer number.", 0, java.lang.Integer.MAX_VALUE, identifier)); 1330 children.add(new Property("name", "string", "The name for the specific product.", 0, 1, name)); 1331 children.add(new Property("lotNumber", "string", "The identification of the batch or lot of the product.", 0, 1, lotNumber)); 1332 children.add(new Property("expiry", "dateTime", "The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.", 0, 1, expiry)); 1333 children.add(new Property("useBy", "dateTime", "The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.", 0, 1, useBy)); 1334 children.add(new Property("biologicalSourceEvent", "Identifier", "An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.", 0, 1, biologicalSourceEvent)); 1335 } 1336 1337 @Override 1338 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1339 switch (_hash) { 1340 case -1285004149: /*quantity*/ return new Property("quantity", "Quantity", "The amount of items or instances that the resource considers, for instance when referring to 2 identical units together.", 0, 1, quantity); 1341 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "The identifier for the physical instance, typically a serial number or manufacturer number.", 0, java.lang.Integer.MAX_VALUE, identifier); 1342 case 3373707: /*name*/ return new Property("name", "string", "The name for the specific product.", 0, 1, name); 1343 case 462547450: /*lotNumber*/ return new Property("lotNumber", "string", "The identification of the batch or lot of the product.", 0, 1, lotNumber); 1344 case -1289159373: /*expiry*/ return new Property("expiry", "dateTime", "The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.", 0, 1, expiry); 1345 case 111577150: /*useBy*/ return new Property("useBy", "dateTime", "The time after which the product is no longer expected to be in proper condition, or its use is not advised or not allowed.", 0, 1, useBy); 1346 case -654468482: /*biologicalSourceEvent*/ return new Property("biologicalSourceEvent", "Identifier", "An identifier that supports traceability to the event during which material in this product from one or more biological entities was obtained or pooled.", 0, 1, biologicalSourceEvent); 1347 default: return super.getNamedProperty(_hash, _name, _checkValid); 1348 } 1349 1350 } 1351 1352 @Override 1353 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1354 switch (hash) { 1355 case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity 1356 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier 1357 case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType 1358 case 462547450: /*lotNumber*/ return this.lotNumber == null ? new Base[0] : new Base[] {this.lotNumber}; // StringType 1359 case -1289159373: /*expiry*/ return this.expiry == null ? new Base[0] : new Base[] {this.expiry}; // DateTimeType 1360 case 111577150: /*useBy*/ return this.useBy == null ? new Base[0] : new Base[] {this.useBy}; // DateTimeType 1361 case -654468482: /*biologicalSourceEvent*/ return this.biologicalSourceEvent == null ? new Base[0] : new Base[] {this.biologicalSourceEvent}; // Identifier 1362 default: return super.getProperty(hash, name, checkValid); 1363 } 1364 1365 } 1366 1367 @Override 1368 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1369 switch (hash) { 1370 case -1285004149: // quantity 1371 this.quantity = TypeConvertor.castToQuantity(value); // Quantity 1372 return value; 1373 case -1618432855: // identifier 1374 this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier 1375 return value; 1376 case 3373707: // name 1377 this.name = TypeConvertor.castToString(value); // StringType 1378 return value; 1379 case 462547450: // lotNumber 1380 this.lotNumber = TypeConvertor.castToString(value); // StringType 1381 return value; 1382 case -1289159373: // expiry 1383 this.expiry = TypeConvertor.castToDateTime(value); // DateTimeType 1384 return value; 1385 case 111577150: // useBy 1386 this.useBy = TypeConvertor.castToDateTime(value); // DateTimeType 1387 return value; 1388 case -654468482: // biologicalSourceEvent 1389 this.biologicalSourceEvent = TypeConvertor.castToIdentifier(value); // Identifier 1390 return value; 1391 default: return super.setProperty(hash, name, value); 1392 } 1393 1394 } 1395 1396 @Override 1397 public Base setProperty(String name, Base value) throws FHIRException { 1398 if (name.equals("quantity")) { 1399 this.quantity = TypeConvertor.castToQuantity(value); // Quantity 1400 } else if (name.equals("identifier")) { 1401 this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); 1402 } else if (name.equals("name")) { 1403 this.name = TypeConvertor.castToString(value); // StringType 1404 } else if (name.equals("lotNumber")) { 1405 this.lotNumber = TypeConvertor.castToString(value); // StringType 1406 } else if (name.equals("expiry")) { 1407 this.expiry = TypeConvertor.castToDateTime(value); // DateTimeType 1408 } else if (name.equals("useBy")) { 1409 this.useBy = TypeConvertor.castToDateTime(value); // DateTimeType 1410 } else if (name.equals("biologicalSourceEvent")) { 1411 this.biologicalSourceEvent = TypeConvertor.castToIdentifier(value); // Identifier 1412 } else 1413 return super.setProperty(name, value); 1414 return value; 1415 } 1416 1417 @Override 1418 public Base makeProperty(int hash, String name) throws FHIRException { 1419 switch (hash) { 1420 case -1285004149: return getQuantity(); 1421 case -1618432855: return addIdentifier(); 1422 case 3373707: return getNameElement(); 1423 case 462547450: return getLotNumberElement(); 1424 case -1289159373: return getExpiryElement(); 1425 case 111577150: return getUseByElement(); 1426 case -654468482: return getBiologicalSourceEvent(); 1427 default: return super.makeProperty(hash, name); 1428 } 1429 1430 } 1431 1432 @Override 1433 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1434 switch (hash) { 1435 case -1285004149: /*quantity*/ return new String[] {"Quantity"}; 1436 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 1437 case 3373707: /*name*/ return new String[] {"string"}; 1438 case 462547450: /*lotNumber*/ return new String[] {"string"}; 1439 case -1289159373: /*expiry*/ return new String[] {"dateTime"}; 1440 case 111577150: /*useBy*/ return new String[] {"dateTime"}; 1441 case -654468482: /*biologicalSourceEvent*/ return new String[] {"Identifier"}; 1442 default: return super.getTypesForProperty(hash, name); 1443 } 1444 1445 } 1446 1447 @Override 1448 public Base addChild(String name) throws FHIRException { 1449 if (name.equals("quantity")) { 1450 this.quantity = new Quantity(); 1451 return this.quantity; 1452 } 1453 else if (name.equals("identifier")) { 1454 return addIdentifier(); 1455 } 1456 else if (name.equals("name")) { 1457 throw new FHIRException("Cannot call addChild on a singleton property NutritionProduct.instance.name"); 1458 } 1459 else if (name.equals("lotNumber")) { 1460 throw new FHIRException("Cannot call addChild on a singleton property NutritionProduct.instance.lotNumber"); 1461 } 1462 else if (name.equals("expiry")) { 1463 throw new FHIRException("Cannot call addChild on a singleton property NutritionProduct.instance.expiry"); 1464 } 1465 else if (name.equals("useBy")) { 1466 throw new FHIRException("Cannot call addChild on a singleton property NutritionProduct.instance.useBy"); 1467 } 1468 else if (name.equals("biologicalSourceEvent")) { 1469 this.biologicalSourceEvent = new Identifier(); 1470 return this.biologicalSourceEvent; 1471 } 1472 else 1473 return super.addChild(name); 1474 } 1475 1476 public NutritionProductInstanceComponent copy() { 1477 NutritionProductInstanceComponent dst = new NutritionProductInstanceComponent(); 1478 copyValues(dst); 1479 return dst; 1480 } 1481 1482 public void copyValues(NutritionProductInstanceComponent dst) { 1483 super.copyValues(dst); 1484 dst.quantity = quantity == null ? null : quantity.copy(); 1485 if (identifier != null) { 1486 dst.identifier = new ArrayList<Identifier>(); 1487 for (Identifier i : identifier) 1488 dst.identifier.add(i.copy()); 1489 }; 1490 dst.name = name == null ? null : name.copy(); 1491 dst.lotNumber = lotNumber == null ? null : lotNumber.copy(); 1492 dst.expiry = expiry == null ? null : expiry.copy(); 1493 dst.useBy = useBy == null ? null : useBy.copy(); 1494 dst.biologicalSourceEvent = biologicalSourceEvent == null ? null : biologicalSourceEvent.copy(); 1495 } 1496 1497 @Override 1498 public boolean equalsDeep(Base other_) { 1499 if (!super.equalsDeep(other_)) 1500 return false; 1501 if (!(other_ instanceof NutritionProductInstanceComponent)) 1502 return false; 1503 NutritionProductInstanceComponent o = (NutritionProductInstanceComponent) other_; 1504 return compareDeep(quantity, o.quantity, true) && compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) 1505 && compareDeep(lotNumber, o.lotNumber, true) && compareDeep(expiry, o.expiry, true) && compareDeep(useBy, o.useBy, true) 1506 && compareDeep(biologicalSourceEvent, o.biologicalSourceEvent, true); 1507 } 1508 1509 @Override 1510 public boolean equalsShallow(Base other_) { 1511 if (!super.equalsShallow(other_)) 1512 return false; 1513 if (!(other_ instanceof NutritionProductInstanceComponent)) 1514 return false; 1515 NutritionProductInstanceComponent o = (NutritionProductInstanceComponent) other_; 1516 return compareValues(name, o.name, true) && compareValues(lotNumber, o.lotNumber, true) && compareValues(expiry, o.expiry, true) 1517 && compareValues(useBy, o.useBy, true); 1518 } 1519 1520 public boolean isEmpty() { 1521 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, identifier, name 1522 , lotNumber, expiry, useBy, biologicalSourceEvent); 1523 } 1524 1525 public String fhirType() { 1526 return "NutritionProduct.instance"; 1527 1528 } 1529 1530 } 1531 1532 /** 1533 * The code assigned to the product, for example a USDA NDB number, a USDA FDC ID number, or a Langual code. 1534 */ 1535 @Child(name = "code", type = {CodeableConcept.class}, order=0, min=0, max=1, modifier=false, summary=true) 1536 @Description(shortDefinition="A code that can identify the detailed nutrients and ingredients in a specific food product", formalDefinition="The code assigned to the product, for example a USDA NDB number, a USDA FDC ID number, or a Langual code." ) 1537 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/edible-substance-type") 1538 protected CodeableConcept code; 1539 1540 /** 1541 * The current state of the product. 1542 */ 1543 @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) 1544 @Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="The current state of the product." ) 1545 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/nutritionproduct-status") 1546 protected Enumeration<NutritionProductStatus> status; 1547 1548 /** 1549 * Nutrition products can have different classifications - according to its nutritional properties, preparation methods, etc. 1550 */ 1551 @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1552 @Description(shortDefinition="Broad product groups or categories used to classify the product, such as Legume and Legume Products, Beverages, or Beef Products", formalDefinition="Nutrition products can have different classifications - according to its nutritional properties, preparation methods, etc." ) 1553 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/nutrition-product-category") 1554 protected List<CodeableConcept> category; 1555 1556 /** 1557 * The organisation (manufacturer, representative or legal authorization holder) that is responsible for the device. 1558 */ 1559 @Child(name = "manufacturer", type = {Organization.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1560 @Description(shortDefinition="Manufacturer, representative or officially responsible for the product", formalDefinition="The organisation (manufacturer, representative or legal authorization holder) that is responsible for the device." ) 1561 protected List<Reference> manufacturer; 1562 1563 /** 1564 * The product's nutritional information expressed by the nutrients. 1565 */ 1566 @Child(name = "nutrient", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1567 @Description(shortDefinition="The product's nutritional information expressed by the nutrients", formalDefinition="The product's nutritional information expressed by the nutrients." ) 1568 protected List<NutritionProductNutrientComponent> nutrient; 1569 1570 /** 1571 * Ingredients contained in this product. 1572 */ 1573 @Child(name = "ingredient", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1574 @Description(shortDefinition="Ingredients contained in this product", formalDefinition="Ingredients contained in this product." ) 1575 protected List<NutritionProductIngredientComponent> ingredient; 1576 1577 /** 1578 * Allergens that are known or suspected to be a part of this nutrition product. 1579 */ 1580 @Child(name = "knownAllergen", type = {CodeableReference.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1581 @Description(shortDefinition="Known or suspected allergens that are a part of this product", formalDefinition="Allergens that are known or suspected to be a part of this nutrition product." ) 1582 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/allergen-class") 1583 protected List<CodeableReference> knownAllergen; 1584 1585 /** 1586 * Specifies descriptive properties of the nutrition product. 1587 */ 1588 @Child(name = "characteristic", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1589 @Description(shortDefinition="Specifies descriptive properties of the nutrition product", formalDefinition="Specifies descriptive properties of the nutrition product." ) 1590 protected List<NutritionProductCharacteristicComponent> characteristic; 1591 1592 /** 1593 * Conveys instance-level information about this product item. One or several physical, countable instances or occurrences of the product. 1594 */ 1595 @Child(name = "instance", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1596 @Description(shortDefinition="One or several physical instances or occurrences of the nutrition product", formalDefinition="Conveys instance-level information about this product item. One or several physical, countable instances or occurrences of the product." ) 1597 protected List<NutritionProductInstanceComponent> instance; 1598 1599 /** 1600 * Comments made about the product. 1601 */ 1602 @Child(name = "note", type = {Annotation.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 1603 @Description(shortDefinition="Comments made about the product", formalDefinition="Comments made about the product." ) 1604 protected List<Annotation> note; 1605 1606 private static final long serialVersionUID = 182320595L; 1607 1608 /** 1609 * Constructor 1610 */ 1611 public NutritionProduct() { 1612 super(); 1613 } 1614 1615 /** 1616 * Constructor 1617 */ 1618 public NutritionProduct(NutritionProductStatus status) { 1619 super(); 1620 this.setStatus(status); 1621 } 1622 1623 /** 1624 * @return {@link #code} (The code assigned to the product, for example a USDA NDB number, a USDA FDC ID number, or a Langual code.) 1625 */ 1626 public CodeableConcept getCode() { 1627 if (this.code == null) 1628 if (Configuration.errorOnAutoCreate()) 1629 throw new Error("Attempt to auto-create NutritionProduct.code"); 1630 else if (Configuration.doAutoCreate()) 1631 this.code = new CodeableConcept(); // cc 1632 return this.code; 1633 } 1634 1635 public boolean hasCode() { 1636 return this.code != null && !this.code.isEmpty(); 1637 } 1638 1639 /** 1640 * @param value {@link #code} (The code assigned to the product, for example a USDA NDB number, a USDA FDC ID number, or a Langual code.) 1641 */ 1642 public NutritionProduct setCode(CodeableConcept value) { 1643 this.code = value; 1644 return this; 1645 } 1646 1647 /** 1648 * @return {@link #status} (The current state of the product.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1649 */ 1650 public Enumeration<NutritionProductStatus> getStatusElement() { 1651 if (this.status == null) 1652 if (Configuration.errorOnAutoCreate()) 1653 throw new Error("Attempt to auto-create NutritionProduct.status"); 1654 else if (Configuration.doAutoCreate()) 1655 this.status = new Enumeration<NutritionProductStatus>(new NutritionProductStatusEnumFactory()); // bb 1656 return this.status; 1657 } 1658 1659 public boolean hasStatusElement() { 1660 return this.status != null && !this.status.isEmpty(); 1661 } 1662 1663 public boolean hasStatus() { 1664 return this.status != null && !this.status.isEmpty(); 1665 } 1666 1667 /** 1668 * @param value {@link #status} (The current state of the product.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value 1669 */ 1670 public NutritionProduct setStatusElement(Enumeration<NutritionProductStatus> value) { 1671 this.status = value; 1672 return this; 1673 } 1674 1675 /** 1676 * @return The current state of the product. 1677 */ 1678 public NutritionProductStatus getStatus() { 1679 return this.status == null ? null : this.status.getValue(); 1680 } 1681 1682 /** 1683 * @param value The current state of the product. 1684 */ 1685 public NutritionProduct setStatus(NutritionProductStatus value) { 1686 if (this.status == null) 1687 this.status = new Enumeration<NutritionProductStatus>(new NutritionProductStatusEnumFactory()); 1688 this.status.setValue(value); 1689 return this; 1690 } 1691 1692 /** 1693 * @return {@link #category} (Nutrition products can have different classifications - according to its nutritional properties, preparation methods, etc.) 1694 */ 1695 public List<CodeableConcept> getCategory() { 1696 if (this.category == null) 1697 this.category = new ArrayList<CodeableConcept>(); 1698 return this.category; 1699 } 1700 1701 /** 1702 * @return Returns a reference to <code>this</code> for easy method chaining 1703 */ 1704 public NutritionProduct setCategory(List<CodeableConcept> theCategory) { 1705 this.category = theCategory; 1706 return this; 1707 } 1708 1709 public boolean hasCategory() { 1710 if (this.category == null) 1711 return false; 1712 for (CodeableConcept item : this.category) 1713 if (!item.isEmpty()) 1714 return true; 1715 return false; 1716 } 1717 1718 public CodeableConcept addCategory() { //3 1719 CodeableConcept t = new CodeableConcept(); 1720 if (this.category == null) 1721 this.category = new ArrayList<CodeableConcept>(); 1722 this.category.add(t); 1723 return t; 1724 } 1725 1726 public NutritionProduct addCategory(CodeableConcept t) { //3 1727 if (t == null) 1728 return this; 1729 if (this.category == null) 1730 this.category = new ArrayList<CodeableConcept>(); 1731 this.category.add(t); 1732 return this; 1733 } 1734 1735 /** 1736 * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist {3} 1737 */ 1738 public CodeableConcept getCategoryFirstRep() { 1739 if (getCategory().isEmpty()) { 1740 addCategory(); 1741 } 1742 return getCategory().get(0); 1743 } 1744 1745 /** 1746 * @return {@link #manufacturer} (The organisation (manufacturer, representative or legal authorization holder) that is responsible for the device.) 1747 */ 1748 public List<Reference> getManufacturer() { 1749 if (this.manufacturer == null) 1750 this.manufacturer = new ArrayList<Reference>(); 1751 return this.manufacturer; 1752 } 1753 1754 /** 1755 * @return Returns a reference to <code>this</code> for easy method chaining 1756 */ 1757 public NutritionProduct setManufacturer(List<Reference> theManufacturer) { 1758 this.manufacturer = theManufacturer; 1759 return this; 1760 } 1761 1762 public boolean hasManufacturer() { 1763 if (this.manufacturer == null) 1764 return false; 1765 for (Reference item : this.manufacturer) 1766 if (!item.isEmpty()) 1767 return true; 1768 return false; 1769 } 1770 1771 public Reference addManufacturer() { //3 1772 Reference t = new Reference(); 1773 if (this.manufacturer == null) 1774 this.manufacturer = new ArrayList<Reference>(); 1775 this.manufacturer.add(t); 1776 return t; 1777 } 1778 1779 public NutritionProduct addManufacturer(Reference t) { //3 1780 if (t == null) 1781 return this; 1782 if (this.manufacturer == null) 1783 this.manufacturer = new ArrayList<Reference>(); 1784 this.manufacturer.add(t); 1785 return this; 1786 } 1787 1788 /** 1789 * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist {3} 1790 */ 1791 public Reference getManufacturerFirstRep() { 1792 if (getManufacturer().isEmpty()) { 1793 addManufacturer(); 1794 } 1795 return getManufacturer().get(0); 1796 } 1797 1798 /** 1799 * @return {@link #nutrient} (The product's nutritional information expressed by the nutrients.) 1800 */ 1801 public List<NutritionProductNutrientComponent> getNutrient() { 1802 if (this.nutrient == null) 1803 this.nutrient = new ArrayList<NutritionProductNutrientComponent>(); 1804 return this.nutrient; 1805 } 1806 1807 /** 1808 * @return Returns a reference to <code>this</code> for easy method chaining 1809 */ 1810 public NutritionProduct setNutrient(List<NutritionProductNutrientComponent> theNutrient) { 1811 this.nutrient = theNutrient; 1812 return this; 1813 } 1814 1815 public boolean hasNutrient() { 1816 if (this.nutrient == null) 1817 return false; 1818 for (NutritionProductNutrientComponent item : this.nutrient) 1819 if (!item.isEmpty()) 1820 return true; 1821 return false; 1822 } 1823 1824 public NutritionProductNutrientComponent addNutrient() { //3 1825 NutritionProductNutrientComponent t = new NutritionProductNutrientComponent(); 1826 if (this.nutrient == null) 1827 this.nutrient = new ArrayList<NutritionProductNutrientComponent>(); 1828 this.nutrient.add(t); 1829 return t; 1830 } 1831 1832 public NutritionProduct addNutrient(NutritionProductNutrientComponent t) { //3 1833 if (t == null) 1834 return this; 1835 if (this.nutrient == null) 1836 this.nutrient = new ArrayList<NutritionProductNutrientComponent>(); 1837 this.nutrient.add(t); 1838 return this; 1839 } 1840 1841 /** 1842 * @return The first repetition of repeating field {@link #nutrient}, creating it if it does not already exist {3} 1843 */ 1844 public NutritionProductNutrientComponent getNutrientFirstRep() { 1845 if (getNutrient().isEmpty()) { 1846 addNutrient(); 1847 } 1848 return getNutrient().get(0); 1849 } 1850 1851 /** 1852 * @return {@link #ingredient} (Ingredients contained in this product.) 1853 */ 1854 public List<NutritionProductIngredientComponent> getIngredient() { 1855 if (this.ingredient == null) 1856 this.ingredient = new ArrayList<NutritionProductIngredientComponent>(); 1857 return this.ingredient; 1858 } 1859 1860 /** 1861 * @return Returns a reference to <code>this</code> for easy method chaining 1862 */ 1863 public NutritionProduct setIngredient(List<NutritionProductIngredientComponent> theIngredient) { 1864 this.ingredient = theIngredient; 1865 return this; 1866 } 1867 1868 public boolean hasIngredient() { 1869 if (this.ingredient == null) 1870 return false; 1871 for (NutritionProductIngredientComponent item : this.ingredient) 1872 if (!item.isEmpty()) 1873 return true; 1874 return false; 1875 } 1876 1877 public NutritionProductIngredientComponent addIngredient() { //3 1878 NutritionProductIngredientComponent t = new NutritionProductIngredientComponent(); 1879 if (this.ingredient == null) 1880 this.ingredient = new ArrayList<NutritionProductIngredientComponent>(); 1881 this.ingredient.add(t); 1882 return t; 1883 } 1884 1885 public NutritionProduct addIngredient(NutritionProductIngredientComponent t) { //3 1886 if (t == null) 1887 return this; 1888 if (this.ingredient == null) 1889 this.ingredient = new ArrayList<NutritionProductIngredientComponent>(); 1890 this.ingredient.add(t); 1891 return this; 1892 } 1893 1894 /** 1895 * @return The first repetition of repeating field {@link #ingredient}, creating it if it does not already exist {3} 1896 */ 1897 public NutritionProductIngredientComponent getIngredientFirstRep() { 1898 if (getIngredient().isEmpty()) { 1899 addIngredient(); 1900 } 1901 return getIngredient().get(0); 1902 } 1903 1904 /** 1905 * @return {@link #knownAllergen} (Allergens that are known or suspected to be a part of this nutrition product.) 1906 */ 1907 public List<CodeableReference> getKnownAllergen() { 1908 if (this.knownAllergen == null) 1909 this.knownAllergen = new ArrayList<CodeableReference>(); 1910 return this.knownAllergen; 1911 } 1912 1913 /** 1914 * @return Returns a reference to <code>this</code> for easy method chaining 1915 */ 1916 public NutritionProduct setKnownAllergen(List<CodeableReference> theKnownAllergen) { 1917 this.knownAllergen = theKnownAllergen; 1918 return this; 1919 } 1920 1921 public boolean hasKnownAllergen() { 1922 if (this.knownAllergen == null) 1923 return false; 1924 for (CodeableReference item : this.knownAllergen) 1925 if (!item.isEmpty()) 1926 return true; 1927 return false; 1928 } 1929 1930 public CodeableReference addKnownAllergen() { //3 1931 CodeableReference t = new CodeableReference(); 1932 if (this.knownAllergen == null) 1933 this.knownAllergen = new ArrayList<CodeableReference>(); 1934 this.knownAllergen.add(t); 1935 return t; 1936 } 1937 1938 public NutritionProduct addKnownAllergen(CodeableReference t) { //3 1939 if (t == null) 1940 return this; 1941 if (this.knownAllergen == null) 1942 this.knownAllergen = new ArrayList<CodeableReference>(); 1943 this.knownAllergen.add(t); 1944 return this; 1945 } 1946 1947 /** 1948 * @return The first repetition of repeating field {@link #knownAllergen}, creating it if it does not already exist {3} 1949 */ 1950 public CodeableReference getKnownAllergenFirstRep() { 1951 if (getKnownAllergen().isEmpty()) { 1952 addKnownAllergen(); 1953 } 1954 return getKnownAllergen().get(0); 1955 } 1956 1957 /** 1958 * @return {@link #characteristic} (Specifies descriptive properties of the nutrition product.) 1959 */ 1960 public List<NutritionProductCharacteristicComponent> getCharacteristic() { 1961 if (this.characteristic == null) 1962 this.characteristic = new ArrayList<NutritionProductCharacteristicComponent>(); 1963 return this.characteristic; 1964 } 1965 1966 /** 1967 * @return Returns a reference to <code>this</code> for easy method chaining 1968 */ 1969 public NutritionProduct setCharacteristic(List<NutritionProductCharacteristicComponent> theCharacteristic) { 1970 this.characteristic = theCharacteristic; 1971 return this; 1972 } 1973 1974 public boolean hasCharacteristic() { 1975 if (this.characteristic == null) 1976 return false; 1977 for (NutritionProductCharacteristicComponent item : this.characteristic) 1978 if (!item.isEmpty()) 1979 return true; 1980 return false; 1981 } 1982 1983 public NutritionProductCharacteristicComponent addCharacteristic() { //3 1984 NutritionProductCharacteristicComponent t = new NutritionProductCharacteristicComponent(); 1985 if (this.characteristic == null) 1986 this.characteristic = new ArrayList<NutritionProductCharacteristicComponent>(); 1987 this.characteristic.add(t); 1988 return t; 1989 } 1990 1991 public NutritionProduct addCharacteristic(NutritionProductCharacteristicComponent t) { //3 1992 if (t == null) 1993 return this; 1994 if (this.characteristic == null) 1995 this.characteristic = new ArrayList<NutritionProductCharacteristicComponent>(); 1996 this.characteristic.add(t); 1997 return this; 1998 } 1999 2000 /** 2001 * @return The first repetition of repeating field {@link #characteristic}, creating it if it does not already exist {3} 2002 */ 2003 public NutritionProductCharacteristicComponent getCharacteristicFirstRep() { 2004 if (getCharacteristic().isEmpty()) { 2005 addCharacteristic(); 2006 } 2007 return getCharacteristic().get(0); 2008 } 2009 2010 /** 2011 * @return {@link #instance} (Conveys instance-level information about this product item. One or several physical, countable instances or occurrences of the product.) 2012 */ 2013 public List<NutritionProductInstanceComponent> getInstance() { 2014 if (this.instance == null) 2015 this.instance = new ArrayList<NutritionProductInstanceComponent>(); 2016 return this.instance; 2017 } 2018 2019 /** 2020 * @return Returns a reference to <code>this</code> for easy method chaining 2021 */ 2022 public NutritionProduct setInstance(List<NutritionProductInstanceComponent> theInstance) { 2023 this.instance = theInstance; 2024 return this; 2025 } 2026 2027 public boolean hasInstance() { 2028 if (this.instance == null) 2029 return false; 2030 for (NutritionProductInstanceComponent item : this.instance) 2031 if (!item.isEmpty()) 2032 return true; 2033 return false; 2034 } 2035 2036 public NutritionProductInstanceComponent addInstance() { //3 2037 NutritionProductInstanceComponent t = new NutritionProductInstanceComponent(); 2038 if (this.instance == null) 2039 this.instance = new ArrayList<NutritionProductInstanceComponent>(); 2040 this.instance.add(t); 2041 return t; 2042 } 2043 2044 public NutritionProduct addInstance(NutritionProductInstanceComponent t) { //3 2045 if (t == null) 2046 return this; 2047 if (this.instance == null) 2048 this.instance = new ArrayList<NutritionProductInstanceComponent>(); 2049 this.instance.add(t); 2050 return this; 2051 } 2052 2053 /** 2054 * @return The first repetition of repeating field {@link #instance}, creating it if it does not already exist {3} 2055 */ 2056 public NutritionProductInstanceComponent getInstanceFirstRep() { 2057 if (getInstance().isEmpty()) { 2058 addInstance(); 2059 } 2060 return getInstance().get(0); 2061 } 2062 2063 /** 2064 * @return {@link #note} (Comments made about the product.) 2065 */ 2066 public List<Annotation> getNote() { 2067 if (this.note == null) 2068 this.note = new ArrayList<Annotation>(); 2069 return this.note; 2070 } 2071 2072 /** 2073 * @return Returns a reference to <code>this</code> for easy method chaining 2074 */ 2075 public NutritionProduct setNote(List<Annotation> theNote) { 2076 this.note = theNote; 2077 return this; 2078 } 2079 2080 public boolean hasNote() { 2081 if (this.note == null) 2082 return false; 2083 for (Annotation item : this.note) 2084 if (!item.isEmpty()) 2085 return true; 2086 return false; 2087 } 2088 2089 public Annotation addNote() { //3 2090 Annotation t = new Annotation(); 2091 if (this.note == null) 2092 this.note = new ArrayList<Annotation>(); 2093 this.note.add(t); 2094 return t; 2095 } 2096 2097 public NutritionProduct addNote(Annotation t) { //3 2098 if (t == null) 2099 return this; 2100 if (this.note == null) 2101 this.note = new ArrayList<Annotation>(); 2102 this.note.add(t); 2103 return this; 2104 } 2105 2106 /** 2107 * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3} 2108 */ 2109 public Annotation getNoteFirstRep() { 2110 if (getNote().isEmpty()) { 2111 addNote(); 2112 } 2113 return getNote().get(0); 2114 } 2115 2116 protected void listChildren(List<Property> children) { 2117 super.listChildren(children); 2118 children.add(new Property("code", "CodeableConcept", "The code assigned to the product, for example a USDA NDB number, a USDA FDC ID number, or a Langual code.", 0, 1, code)); 2119 children.add(new Property("status", "code", "The current state of the product.", 0, 1, status)); 2120 children.add(new Property("category", "CodeableConcept", "Nutrition products can have different classifications - according to its nutritional properties, preparation methods, etc.", 0, java.lang.Integer.MAX_VALUE, category)); 2121 children.add(new Property("manufacturer", "Reference(Organization)", "The organisation (manufacturer, representative or legal authorization holder) that is responsible for the device.", 0, java.lang.Integer.MAX_VALUE, manufacturer)); 2122 children.add(new Property("nutrient", "", "The product's nutritional information expressed by the nutrients.", 0, java.lang.Integer.MAX_VALUE, nutrient)); 2123 children.add(new Property("ingredient", "", "Ingredients contained in this product.", 0, java.lang.Integer.MAX_VALUE, ingredient)); 2124 children.add(new Property("knownAllergen", "CodeableReference(Substance)", "Allergens that are known or suspected to be a part of this nutrition product.", 0, java.lang.Integer.MAX_VALUE, knownAllergen)); 2125 children.add(new Property("characteristic", "", "Specifies descriptive properties of the nutrition product.", 0, java.lang.Integer.MAX_VALUE, characteristic)); 2126 children.add(new Property("instance", "", "Conveys instance-level information about this product item. One or several physical, countable instances or occurrences of the product.", 0, java.lang.Integer.MAX_VALUE, instance)); 2127 children.add(new Property("note", "Annotation", "Comments made about the product.", 0, java.lang.Integer.MAX_VALUE, note)); 2128 } 2129 2130 @Override 2131 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2132 switch (_hash) { 2133 case 3059181: /*code*/ return new Property("code", "CodeableConcept", "The code assigned to the product, for example a USDA NDB number, a USDA FDC ID number, or a Langual code.", 0, 1, code); 2134 case -892481550: /*status*/ return new Property("status", "code", "The current state of the product.", 0, 1, status); 2135 case 50511102: /*category*/ return new Property("category", "CodeableConcept", "Nutrition products can have different classifications - according to its nutritional properties, preparation methods, etc.", 0, java.lang.Integer.MAX_VALUE, category); 2136 case -1969347631: /*manufacturer*/ return new Property("manufacturer", "Reference(Organization)", "The organisation (manufacturer, representative or legal authorization holder) that is responsible for the device.", 0, java.lang.Integer.MAX_VALUE, manufacturer); 2137 case -1671151641: /*nutrient*/ return new Property("nutrient", "", "The product's nutritional information expressed by the nutrients.", 0, java.lang.Integer.MAX_VALUE, nutrient); 2138 case -206409263: /*ingredient*/ return new Property("ingredient", "", "Ingredients contained in this product.", 0, java.lang.Integer.MAX_VALUE, ingredient); 2139 case 1093336805: /*knownAllergen*/ return new Property("knownAllergen", "CodeableReference(Substance)", "Allergens that are known or suspected to be a part of this nutrition product.", 0, java.lang.Integer.MAX_VALUE, knownAllergen); 2140 case 366313883: /*characteristic*/ return new Property("characteristic", "", "Specifies descriptive properties of the nutrition product.", 0, java.lang.Integer.MAX_VALUE, characteristic); 2141 case 555127957: /*instance*/ return new Property("instance", "", "Conveys instance-level information about this product item. One or several physical, countable instances or occurrences of the product.", 0, java.lang.Integer.MAX_VALUE, instance); 2142 case 3387378: /*note*/ return new Property("note", "Annotation", "Comments made about the product.", 0, java.lang.Integer.MAX_VALUE, note); 2143 default: return super.getNamedProperty(_hash, _name, _checkValid); 2144 } 2145 2146 } 2147 2148 @Override 2149 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2150 switch (hash) { 2151 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 2152 case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<NutritionProductStatus> 2153 case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept 2154 case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference 2155 case -1671151641: /*nutrient*/ return this.nutrient == null ? new Base[0] : this.nutrient.toArray(new Base[this.nutrient.size()]); // NutritionProductNutrientComponent 2156 case -206409263: /*ingredient*/ return this.ingredient == null ? new Base[0] : this.ingredient.toArray(new Base[this.ingredient.size()]); // NutritionProductIngredientComponent 2157 case 1093336805: /*knownAllergen*/ return this.knownAllergen == null ? new Base[0] : this.knownAllergen.toArray(new Base[this.knownAllergen.size()]); // CodeableReference 2158 case 366313883: /*characteristic*/ return this.characteristic == null ? new Base[0] : this.characteristic.toArray(new Base[this.characteristic.size()]); // NutritionProductCharacteristicComponent 2159 case 555127957: /*instance*/ return this.instance == null ? new Base[0] : this.instance.toArray(new Base[this.instance.size()]); // NutritionProductInstanceComponent 2160 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 2161 default: return super.getProperty(hash, name, checkValid); 2162 } 2163 2164 } 2165 2166 @Override 2167 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2168 switch (hash) { 2169 case 3059181: // code 2170 this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 2171 return value; 2172 case -892481550: // status 2173 value = new NutritionProductStatusEnumFactory().fromType(TypeConvertor.castToCode(value)); 2174 this.status = (Enumeration) value; // Enumeration<NutritionProductStatus> 2175 return value; 2176 case 50511102: // category 2177 this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept 2178 return value; 2179 case -1969347631: // manufacturer 2180 this.getManufacturer().add(TypeConvertor.castToReference(value)); // Reference 2181 return value; 2182 case -1671151641: // nutrient 2183 this.getNutrient().add((NutritionProductNutrientComponent) value); // NutritionProductNutrientComponent 2184 return value; 2185 case -206409263: // ingredient 2186 this.getIngredient().add((NutritionProductIngredientComponent) value); // NutritionProductIngredientComponent 2187 return value; 2188 case 1093336805: // knownAllergen 2189 this.getKnownAllergen().add(TypeConvertor.castToCodeableReference(value)); // CodeableReference 2190 return value; 2191 case 366313883: // characteristic 2192 this.getCharacteristic().add((NutritionProductCharacteristicComponent) value); // NutritionProductCharacteristicComponent 2193 return value; 2194 case 555127957: // instance 2195 this.getInstance().add((NutritionProductInstanceComponent) value); // NutritionProductInstanceComponent 2196 return value; 2197 case 3387378: // note 2198 this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation 2199 return value; 2200 default: return super.setProperty(hash, name, value); 2201 } 2202 2203 } 2204 2205 @Override 2206 public Base setProperty(String name, Base value) throws FHIRException { 2207 if (name.equals("code")) { 2208 this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 2209 } else if (name.equals("status")) { 2210 value = new NutritionProductStatusEnumFactory().fromType(TypeConvertor.castToCode(value)); 2211 this.status = (Enumeration) value; // Enumeration<NutritionProductStatus> 2212 } else if (name.equals("category")) { 2213 this.getCategory().add(TypeConvertor.castToCodeableConcept(value)); 2214 } else if (name.equals("manufacturer")) { 2215 this.getManufacturer().add(TypeConvertor.castToReference(value)); 2216 } else if (name.equals("nutrient")) { 2217 this.getNutrient().add((NutritionProductNutrientComponent) value); 2218 } else if (name.equals("ingredient")) { 2219 this.getIngredient().add((NutritionProductIngredientComponent) value); 2220 } else if (name.equals("knownAllergen")) { 2221 this.getKnownAllergen().add(TypeConvertor.castToCodeableReference(value)); 2222 } else if (name.equals("characteristic")) { 2223 this.getCharacteristic().add((NutritionProductCharacteristicComponent) value); 2224 } else if (name.equals("instance")) { 2225 this.getInstance().add((NutritionProductInstanceComponent) value); 2226 } else if (name.equals("note")) { 2227 this.getNote().add(TypeConvertor.castToAnnotation(value)); 2228 } else 2229 return super.setProperty(name, value); 2230 return value; 2231 } 2232 2233 @Override 2234 public Base makeProperty(int hash, String name) throws FHIRException { 2235 switch (hash) { 2236 case 3059181: return getCode(); 2237 case -892481550: return getStatusElement(); 2238 case 50511102: return addCategory(); 2239 case -1969347631: return addManufacturer(); 2240 case -1671151641: return addNutrient(); 2241 case -206409263: return addIngredient(); 2242 case 1093336805: return addKnownAllergen(); 2243 case 366313883: return addCharacteristic(); 2244 case 555127957: return addInstance(); 2245 case 3387378: return addNote(); 2246 default: return super.makeProperty(hash, name); 2247 } 2248 2249 } 2250 2251 @Override 2252 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2253 switch (hash) { 2254 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 2255 case -892481550: /*status*/ return new String[] {"code"}; 2256 case 50511102: /*category*/ return new String[] {"CodeableConcept"}; 2257 case -1969347631: /*manufacturer*/ return new String[] {"Reference"}; 2258 case -1671151641: /*nutrient*/ return new String[] {}; 2259 case -206409263: /*ingredient*/ return new String[] {}; 2260 case 1093336805: /*knownAllergen*/ return new String[] {"CodeableReference"}; 2261 case 366313883: /*characteristic*/ return new String[] {}; 2262 case 555127957: /*instance*/ return new String[] {}; 2263 case 3387378: /*note*/ return new String[] {"Annotation"}; 2264 default: return super.getTypesForProperty(hash, name); 2265 } 2266 2267 } 2268 2269 @Override 2270 public Base addChild(String name) throws FHIRException { 2271 if (name.equals("code")) { 2272 this.code = new CodeableConcept(); 2273 return this.code; 2274 } 2275 else if (name.equals("status")) { 2276 throw new FHIRException("Cannot call addChild on a singleton property NutritionProduct.status"); 2277 } 2278 else if (name.equals("category")) { 2279 return addCategory(); 2280 } 2281 else if (name.equals("manufacturer")) { 2282 return addManufacturer(); 2283 } 2284 else if (name.equals("nutrient")) { 2285 return addNutrient(); 2286 } 2287 else if (name.equals("ingredient")) { 2288 return addIngredient(); 2289 } 2290 else if (name.equals("knownAllergen")) { 2291 return addKnownAllergen(); 2292 } 2293 else if (name.equals("characteristic")) { 2294 return addCharacteristic(); 2295 } 2296 else if (name.equals("instance")) { 2297 return addInstance(); 2298 } 2299 else if (name.equals("note")) { 2300 return addNote(); 2301 } 2302 else 2303 return super.addChild(name); 2304 } 2305 2306 public String fhirType() { 2307 return "NutritionProduct"; 2308 2309 } 2310 2311 public NutritionProduct copy() { 2312 NutritionProduct dst = new NutritionProduct(); 2313 copyValues(dst); 2314 return dst; 2315 } 2316 2317 public void copyValues(NutritionProduct dst) { 2318 super.copyValues(dst); 2319 dst.code = code == null ? null : code.copy(); 2320 dst.status = status == null ? null : status.copy(); 2321 if (category != null) { 2322 dst.category = new ArrayList<CodeableConcept>(); 2323 for (CodeableConcept i : category) 2324 dst.category.add(i.copy()); 2325 }; 2326 if (manufacturer != null) { 2327 dst.manufacturer = new ArrayList<Reference>(); 2328 for (Reference i : manufacturer) 2329 dst.manufacturer.add(i.copy()); 2330 }; 2331 if (nutrient != null) { 2332 dst.nutrient = new ArrayList<NutritionProductNutrientComponent>(); 2333 for (NutritionProductNutrientComponent i : nutrient) 2334 dst.nutrient.add(i.copy()); 2335 }; 2336 if (ingredient != null) { 2337 dst.ingredient = new ArrayList<NutritionProductIngredientComponent>(); 2338 for (NutritionProductIngredientComponent i : ingredient) 2339 dst.ingredient.add(i.copy()); 2340 }; 2341 if (knownAllergen != null) { 2342 dst.knownAllergen = new ArrayList<CodeableReference>(); 2343 for (CodeableReference i : knownAllergen) 2344 dst.knownAllergen.add(i.copy()); 2345 }; 2346 if (characteristic != null) { 2347 dst.characteristic = new ArrayList<NutritionProductCharacteristicComponent>(); 2348 for (NutritionProductCharacteristicComponent i : characteristic) 2349 dst.characteristic.add(i.copy()); 2350 }; 2351 if (instance != null) { 2352 dst.instance = new ArrayList<NutritionProductInstanceComponent>(); 2353 for (NutritionProductInstanceComponent i : instance) 2354 dst.instance.add(i.copy()); 2355 }; 2356 if (note != null) { 2357 dst.note = new ArrayList<Annotation>(); 2358 for (Annotation i : note) 2359 dst.note.add(i.copy()); 2360 }; 2361 } 2362 2363 protected NutritionProduct typedCopy() { 2364 return copy(); 2365 } 2366 2367 @Override 2368 public boolean equalsDeep(Base other_) { 2369 if (!super.equalsDeep(other_)) 2370 return false; 2371 if (!(other_ instanceof NutritionProduct)) 2372 return false; 2373 NutritionProduct o = (NutritionProduct) other_; 2374 return compareDeep(code, o.code, true) && compareDeep(status, o.status, true) && compareDeep(category, o.category, true) 2375 && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(nutrient, o.nutrient, true) && compareDeep(ingredient, o.ingredient, true) 2376 && compareDeep(knownAllergen, o.knownAllergen, true) && compareDeep(characteristic, o.characteristic, true) 2377 && compareDeep(instance, o.instance, true) && compareDeep(note, o.note, true); 2378 } 2379 2380 @Override 2381 public boolean equalsShallow(Base other_) { 2382 if (!super.equalsShallow(other_)) 2383 return false; 2384 if (!(other_ instanceof NutritionProduct)) 2385 return false; 2386 NutritionProduct o = (NutritionProduct) other_; 2387 return compareValues(status, o.status, true); 2388 } 2389 2390 public boolean isEmpty() { 2391 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, status, category, manufacturer 2392 , nutrient, ingredient, knownAllergen, characteristic, instance, note); 2393 } 2394 2395 @Override 2396 public ResourceType getResourceType() { 2397 return ResourceType.NutritionProduct; 2398 } 2399 2400 /** 2401 * Search parameter: <b>code</b> 2402 * <p> 2403 * Description: <b>The code identifying a specific nutrition product</b><br> 2404 * Type: <b>token</b><br> 2405 * Path: <b>NutritionProduct.code</b><br> 2406 * </p> 2407 */ 2408 @SearchParamDefinition(name="code", path="NutritionProduct.code", description="The code identifying a specific nutrition product", type="token" ) 2409 public static final String SP_CODE = "code"; 2410 /** 2411 * <b>Fluent Client</b> search parameter constant for <b>code</b> 2412 * <p> 2413 * Description: <b>The code identifying a specific nutrition product</b><br> 2414 * Type: <b>token</b><br> 2415 * Path: <b>NutritionProduct.code</b><br> 2416 * </p> 2417 */ 2418 public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); 2419 2420 /** 2421 * Search parameter: <b>identifier</b> 2422 * <p> 2423 * Description: <b>The identifier for the physical instance, typically a serial number</b><br> 2424 * Type: <b>token</b><br> 2425 * Path: <b>NutritionProduct.instance.identifier</b><br> 2426 * </p> 2427 */ 2428 @SearchParamDefinition(name="identifier", path="NutritionProduct.instance.identifier", description="The identifier for the physical instance, typically a serial number", type="token" ) 2429 public static final String SP_IDENTIFIER = "identifier"; 2430 /** 2431 * <b>Fluent Client</b> search parameter constant for <b>identifier</b> 2432 * <p> 2433 * Description: <b>The identifier for the physical instance, typically a serial number</b><br> 2434 * Type: <b>token</b><br> 2435 * Path: <b>NutritionProduct.instance.identifier</b><br> 2436 * </p> 2437 */ 2438 public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); 2439 2440 /** 2441 * Search parameter: <b>lot-number</b> 2442 * <p> 2443 * Description: <b>The lot number</b><br> 2444 * Type: <b>token</b><br> 2445 * Path: <b>NutritionProduct.instance.lotNumber</b><br> 2446 * </p> 2447 */ 2448 @SearchParamDefinition(name="lot-number", path="NutritionProduct.instance.lotNumber", description="The lot number", type="token" ) 2449 public static final String SP_LOT_NUMBER = "lot-number"; 2450 /** 2451 * <b>Fluent Client</b> search parameter constant for <b>lot-number</b> 2452 * <p> 2453 * Description: <b>The lot number</b><br> 2454 * Type: <b>token</b><br> 2455 * Path: <b>NutritionProduct.instance.lotNumber</b><br> 2456 * </p> 2457 */ 2458 public static final ca.uhn.fhir.rest.gclient.TokenClientParam LOT_NUMBER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_LOT_NUMBER); 2459 2460 /** 2461 * Search parameter: <b>serial-number</b> 2462 * <p> 2463 * Description: <b>The serial number</b><br> 2464 * Type: <b>token</b><br> 2465 * Path: <b>NutritionProduct.instance.identifier</b><br> 2466 * </p> 2467 */ 2468 @SearchParamDefinition(name="serial-number", path="NutritionProduct.instance.identifier", description="The serial number", type="token" ) 2469 public static final String SP_SERIAL_NUMBER = "serial-number"; 2470 /** 2471 * <b>Fluent Client</b> search parameter constant for <b>serial-number</b> 2472 * <p> 2473 * Description: <b>The serial number</b><br> 2474 * Type: <b>token</b><br> 2475 * Path: <b>NutritionProduct.instance.identifier</b><br> 2476 * </p> 2477 */ 2478 public static final ca.uhn.fhir.rest.gclient.TokenClientParam SERIAL_NUMBER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SERIAL_NUMBER); 2479 2480 /** 2481 * Search parameter: <b>status</b> 2482 * <p> 2483 * Description: <b>The broad product group or category of the nutrition product</b><br> 2484 * Type: <b>token</b><br> 2485 * Path: <b>NutritionProduct.category</b><br> 2486 * </p> 2487 */ 2488 @SearchParamDefinition(name="status", path="NutritionProduct.category", description="The broad product group or category of the nutrition product", type="token" ) 2489 public static final String SP_STATUS = "status"; 2490 /** 2491 * <b>Fluent Client</b> search parameter constant for <b>status</b> 2492 * <p> 2493 * Description: <b>The broad product group or category of the nutrition product</b><br> 2494 * Type: <b>token</b><br> 2495 * Path: <b>NutritionProduct.category</b><br> 2496 * </p> 2497 */ 2498 public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS); 2499 2500 2501} 2502