001package org.hl7.fhir.r5.model; 002 003 004/* 005 * #%L 006 * org.hl7.fhir.r5 007 * %% 008 * Copyright (C) 2014 - 2019 Health Level 7 009 * %% 010 * Licensed under the Apache License, Version 2.0 (the \"License\"); 011 * you may not use this file except in compliance with the License. 012 * You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, software 017 * distributed under the License is distributed on an \"AS IS\" BASIS, 018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 019 * See the License for the specific language governing permissions and 020 * limitations under the License. 021 * #L% 022 */ 023 024/* 025 Copyright (c) 2011+, HL7, Inc. 026 All rights reserved. 027 028 Redistribution and use in source and binary forms, with or without modification, \ 029 are permitted provided that the following conditions are met: 030 031 * Redistributions of source code must retain the above copyright notice, this \ 032 list of conditions and the following disclaimer. 033 * Redistributions in binary form must reproduce the above copyright notice, \ 034 this list of conditions and the following disclaimer in the documentation \ 035 and/or other materials provided with the distribution. 036 * Neither the name of HL7 nor the names of its contributors may be used to 037 endorse or promote products derived from this software without specific 038 prior written permission. 039 040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 041 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 042 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 043 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 044 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 045 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 046 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 047 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 048 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 049 POSSIBILITY OF SUCH DAMAGE. 050 */ 051 052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent 053 054import java.util.ArrayList; 055import java.util.Date; 056import java.util.List; 057import org.hl7.fhir.r5.model.Enumerations.*; 058import org.hl7.fhir.instance.model.api.IBaseDatatypeElement; 059import org.hl7.fhir.exceptions.FHIRException; 060import org.hl7.fhir.instance.model.api.ICompositeType; 061import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 062import ca.uhn.fhir.model.api.annotation.Child; 063import ca.uhn.fhir.model.api.annotation.ChildOrder; 064import ca.uhn.fhir.model.api.annotation.DatatypeDef; 065import ca.uhn.fhir.model.api.annotation.Description; 066import ca.uhn.fhir.model.api.annotation.Block; 067 068/** 069 * Base StructureDefinition for BackboneType Type: Base definition for the few data types that are allowed to carry modifier extensions. 070 */ 071@DatatypeDef(name="BackboneType") 072public abstract class BackboneType extends DataType implements IBaseBackboneElement { 073 074 /** 075 * May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. 076 077Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself). 078 */ 079 @Child(name = "modifierExtension", type = {Extension.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=true) 080 @Description(shortDefinition="Extensions that cannot be ignored even if unrecognized", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself)." ) 081 protected List<Extension> modifierExtension; 082 083 private static final long serialVersionUID = -1431673179L; 084 085 /** 086 * Constructor 087 */ 088 public BackboneType() { 089 super(); 090 } 091 092 /** 093 * @return {@link #modifierExtension} (May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. 094 095Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).) 096 */ 097 public List<Extension> getModifierExtension() { 098 if (this.modifierExtension == null) 099 this.modifierExtension = new ArrayList<Extension>(); 100 return this.modifierExtension; 101 } 102 103 /** 104 * @return Returns a reference to <code>this</code> for easy method chaining 105 */ 106 public BackboneType setModifierExtension(List<Extension> theModifierExtension) { 107 this.modifierExtension = theModifierExtension; 108 return this; 109 } 110 111 public boolean hasModifierExtension() { 112 if (this.modifierExtension == null) 113 return false; 114 for (Extension item : this.modifierExtension) 115 if (!item.isEmpty()) 116 return true; 117 return false; 118 } 119 120 public Extension addModifierExtension() { //3 121 Extension t = new Extension(); 122 if (this.modifierExtension == null) 123 this.modifierExtension = new ArrayList<Extension>(); 124 this.modifierExtension.add(t); 125 return t; 126 } 127 128 public BackboneType addModifierExtension(Extension t) { //3 129 if (t == null) 130 return this; 131 if (this.modifierExtension == null) 132 this.modifierExtension = new ArrayList<Extension>(); 133 this.modifierExtension.add(t); 134 return this; 135 } 136 137 /** 138 * @return The first repetition of repeating field {@link #modifierExtension}, creating it if it does not already exist {3} 139 */ 140 public Extension getModifierExtensionFirstRep() { 141 if (getModifierExtension().isEmpty()) { 142 addModifierExtension(); 143 } 144 return getModifierExtension().get(0); 145 } 146 147 protected void listChildren(List<Property> children) { 148 super.listChildren(children); 149 children.add(new Property("modifierExtension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", 0, java.lang.Integer.MAX_VALUE, modifierExtension)); 150 } 151 152 @Override 153 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 154 switch (_hash) { 155 case -298878168: /*modifierExtension*/ return new Property("modifierExtension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", 0, java.lang.Integer.MAX_VALUE, modifierExtension); 156 default: return super.getNamedProperty(_hash, _name, _checkValid); 157 } 158 159 } 160 161 @Override 162 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 163 switch (hash) { 164 case -298878168: /*modifierExtension*/ return this.modifierExtension == null ? new Base[0] : this.modifierExtension.toArray(new Base[this.modifierExtension.size()]); // Extension 165 default: return super.getProperty(hash, name, checkValid); 166 } 167 168 } 169 170 @Override 171 public Base setProperty(int hash, String name, Base value) throws FHIRException { 172 switch (hash) { 173 case -298878168: // modifierExtension 174 this.getModifierExtension().add(TypeConvertor.castToExtension(value)); // Extension 175 return value; 176 default: return super.setProperty(hash, name, value); 177 } 178 179 } 180 181 @Override 182 public Base setProperty(String name, Base value) throws FHIRException { 183 if (name.equals("modifierExtension")) { 184 this.getModifierExtension().add(TypeConvertor.castToExtension(value)); 185 } else 186 return super.setProperty(name, value); 187 return value; 188 } 189 190 @Override 191 public Base makeProperty(int hash, String name) throws FHIRException { 192 switch (hash) { 193 case -298878168: return addModifierExtension(); 194 default: return super.makeProperty(hash, name); 195 } 196 197 } 198 199 @Override 200 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 201 switch (hash) { 202 case -298878168: /*modifierExtension*/ return new String[] {"Extension"}; 203 default: return super.getTypesForProperty(hash, name); 204 } 205 206 } 207 208 @Override 209 public Base addChild(String name) throws FHIRException { 210 if (name.equals("modifierExtension")) { 211 return addModifierExtension(); 212 } 213 else 214 return super.addChild(name); 215 } 216 217 public String fhirType() { 218 return "BackboneType"; 219 220 } 221 222 public abstract BackboneType copy(); 223 224 public void copyValues(BackboneType dst) { 225 super.copyValues(dst); 226 if (modifierExtension != null) { 227 dst.modifierExtension = new ArrayList<Extension>(); 228 for (Extension i : modifierExtension) 229 dst.modifierExtension.add(i.copy()); 230 }; 231 } 232 233 @Override 234 public boolean equalsDeep(Base other_) { 235 if (!super.equalsDeep(other_)) 236 return false; 237 if (!(other_ instanceof BackboneType)) 238 return false; 239 BackboneType o = (BackboneType) other_; 240 return compareDeep(modifierExtension, o.modifierExtension, true); 241 } 242 243 @Override 244 public boolean equalsShallow(Base other_) { 245 if (!super.equalsShallow(other_)) 246 return false; 247 if (!(other_ instanceof BackboneType)) 248 return false; 249 BackboneType o = (BackboneType) other_; 250 return true; 251 } 252 253 public boolean isEmpty() { 254 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(modifierExtension); 255 } 256 257// Manual code (from Configuration.txt)t: 258 259 public void checkNoModifiers(String noun, String verb) throws FHIRException { 260 if (hasModifierExtension()) { 261 throw new FHIRException("Found unknown Modifier Exceptions on "+noun+" doing "+verb); 262 } 263 264 } 265 266// end addition 267 268} 269