
001package org.hl7.fhir.r5.openehr; 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.r5.openehr.Enumerations.*; 038import org.hl7.fhir.exceptions.FHIRException; 039import org.hl7.fhir.r5.model.*; 040import org.hl7.fhir.instance.model.api.ICompositeType; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.ChildOrder; 043import ca.uhn.fhir.model.api.annotation.DatatypeDef; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046 047/** 048 * Logical single value data structure. Used to represent any data which is logically a single value, such as a person?s height or weight. 049 */ 050@DatatypeDef(name="ITEM_SINGLE") 051public class ITEM_SINGLE extends ITEM_STRUCTURE implements ICompositeType { 052 053 /** 054 * 055 */ 056 @Child(name = "item", type = {ELEMENT.class}, order=0, min=1, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="", formalDefinition="" ) 058 protected ELEMENT item; 059 060 private static final long serialVersionUID = 1729811823L; 061 062 /** 063 * Constructor 064 */ 065 public ITEM_SINGLE() { 066 super(); 067 } 068 069 /** 070 * Constructor 071 */ 072 public ITEM_SINGLE(ELEMENT item) { 073 super(); 074 this.setItem(item); 075 } 076 077 /** 078 * @return {@link #item} () 079 */ 080 public ELEMENT getItem() { 081 if (this.item == null) 082 if (Configuration.errorOnAutoCreate()) 083 throw new Error("Attempt to auto-create ITEM_SINGLE.item"); 084 else if (Configuration.doAutoCreate()) 085 this.item = new ELEMENT(); // cc 086 return this.item; 087 } 088 089 public boolean hasItem() { 090 return this.item != null && !this.item.isEmpty(); 091 } 092 093 /** 094 * @param value {@link #item} () 095 */ 096 public ITEM_SINGLE setItem(ELEMENT value) { 097 this.item = value; 098 return this; 099 } 100 101 protected void listChildren(List<Property> children) { 102 super.listChildren(children); 103 children.add(new Property("item", "http://openehr.org/fhir/StructureDefinition/ELEMENT", "", 0, 1, item)); 104 } 105 106 @Override 107 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 108 switch (_hash) { 109 case 3242771: /*item*/ return new Property("item", "http://openehr.org/fhir/StructureDefinition/ELEMENT", "", 0, 1, item); 110 default: return super.getNamedProperty(_hash, _name, _checkValid); 111 } 112 113 } 114 115 @Override 116 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 117 switch (hash) { 118 case 3242771: /*item*/ return this.item == null ? new Base[0] : new Base[] {this.item}; // ELEMENT 119 default: return super.getProperty(hash, name, checkValid); 120 } 121 122 } 123 124 @Override 125 public Base setProperty(int hash, String name, Base value) throws FHIRException { 126 switch (hash) { 127 case 3242771: // item 128 this.item = (ELEMENT) value; // ELEMENT 129 return value; 130 default: return super.setProperty(hash, name, value); 131 } 132 133 } 134 135 @Override 136 public Base setProperty(String name, Base value) throws FHIRException { 137 if (name.equals("item")) { 138 this.item = (ELEMENT) value; // ELEMENT 139 } else 140 return super.setProperty(name, value); 141 return value; 142 } 143 144 @Override 145 public Base makeProperty(int hash, String name) throws FHIRException { 146 switch (hash) { 147 case 3242771: return getItem(); 148 default: return super.makeProperty(hash, name); 149 } 150 151 } 152 153 @Override 154 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 155 switch (hash) { 156 case 3242771: /*item*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/ELEMENT"}; 157 default: return super.getTypesForProperty(hash, name); 158 } 159 160 } 161 162 @Override 163 public Base addChild(String name) throws FHIRException { 164 if (name.equals("item")) { 165 this.item = new ELEMENT(); 166 return this.item; 167 } 168 else 169 return super.addChild(name); 170 } 171 172 public String fhirType() { 173 return "ITEM_SINGLE"; 174 175 } 176 177 public ITEM_SINGLE copy() { 178 ITEM_SINGLE dst = new ITEM_SINGLE(); 179 copyValues(dst); 180 return dst; 181 } 182 183 public void copyValues(ITEM_SINGLE dst) { 184 super.copyValues(dst); 185 dst.item = item == null ? null : item.copy(); 186 } 187 188 protected ITEM_SINGLE typedCopy() { 189 return copy(); 190 } 191 192 @Override 193 public boolean equalsDeep(Base other_) { 194 if (!super.equalsDeep(other_)) 195 return false; 196 if (!(other_ instanceof ITEM_SINGLE)) 197 return false; 198 ITEM_SINGLE o = (ITEM_SINGLE) other_; 199 return compareDeep(item, o.item, true); 200 } 201 202 @Override 203 public boolean equalsShallow(Base other_) { 204 if (!super.equalsShallow(other_)) 205 return false; 206 if (!(other_ instanceof ITEM_SINGLE)) 207 return false; 208 ITEM_SINGLE o = (ITEM_SINGLE) other_; 209 return true; 210 } 211 212 public boolean isEmpty() { 213 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item); 214 } 215 216 217} 218