001package org.hl7.fhir.dstu2016may.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 033import java.util.ArrayList; 034import java.util.List; 035 036import org.hl7.fhir.exceptions.FHIRException; 037import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 038 039import ca.uhn.fhir.model.api.annotation.Child; 040import ca.uhn.fhir.model.api.annotation.DatatypeDef; 041import ca.uhn.fhir.model.api.annotation.Description; 042/** 043 * Base definition for all elements that are defined inside a resource - but not those in a data type. 044 */ 045@DatatypeDef(name="BackboneElement") 046public abstract class BackboneElement extends Element implements IBaseBackboneElement { 047 048 /** 049 * 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 that contains it. Usually modifier elements provide negation or qualification. In order 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 is allowed to 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. 050 */ 051 @Child(name = "modifierExtension", type = {Extension.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=true) 052 @Description(shortDefinition="Extensions that cannot be ignored", 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 that contains it. Usually modifier elements provide negation or qualification. In order 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 is allowed to 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." ) 053 protected List<Extension> modifierExtension; 054 055 private static final long serialVersionUID = -1431673179L; 056 057 /** 058 * Constructor 059 */ 060 public BackboneElement() { 061 super(); 062 } 063 064 /** 065 * @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 that contains it. Usually modifier elements provide negation or qualification. In order 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 is allowed to 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.) 066 */ 067 public List<Extension> getModifierExtension() { 068 if (this.modifierExtension == null) 069 this.modifierExtension = new ArrayList<Extension>(); 070 return this.modifierExtension; 071 } 072 073 public boolean hasModifierExtension() { 074 if (this.modifierExtension == null) 075 return false; 076 for (Extension item : this.modifierExtension) 077 if (!item.isEmpty()) 078 return true; 079 return false; 080 } 081 082 /** 083 * @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 that contains it. Usually modifier elements provide negation or qualification. In order 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 is allowed to 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.) 084 */ 085 // syntactic sugar 086 public Extension addModifierExtension() { //3 087 Extension t = new Extension(); 088 if (this.modifierExtension == null) 089 this.modifierExtension = new ArrayList<Extension>(); 090 this.modifierExtension.add(t); 091 return t; 092 } 093 094 // syntactic sugar 095 public BackboneElement addModifierExtension(Extension t) { //3 096 if (t == null) 097 return this; 098 if (this.modifierExtension == null) 099 this.modifierExtension = new ArrayList<Extension>(); 100 this.modifierExtension.add(t); 101 return this; 102 } 103 104 protected void listChildren(List<Property> childrenList) { 105 childrenList.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 that contains it. Usually modifier elements provide negation or qualification. In order 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 is allowed to 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.", 0, java.lang.Integer.MAX_VALUE, modifierExtension)); 106 } 107 108 @Override 109 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 110 switch (hash) { 111 case -298878168: /*modifierExtension*/ return this.modifierExtension == null ? new Base[0] : this.modifierExtension.toArray(new Base[this.modifierExtension.size()]); // Extension 112 default: return super.getProperty(hash, name, checkValid); 113 } 114 115 } 116 117 @Override 118 public void setProperty(int hash, String name, Base value) throws FHIRException { 119 switch (hash) { 120 case -298878168: // modifierExtension 121 this.getModifierExtension().add(castToExtension(value)); // Extension 122 break; 123 default: super.setProperty(hash, name, value); 124 } 125 126 } 127 128 @Override 129 public void setProperty(String name, Base value) throws FHIRException { 130 if (name.equals("modifierExtension")) 131 this.getModifierExtension().add(castToExtension(value)); 132 else 133 super.setProperty(name, value); 134 } 135 136 @Override 137 public Base makeProperty(int hash, String name) throws FHIRException { 138 switch (hash) { 139 case -298878168: return addModifierExtension(); // Extension 140 default: return super.makeProperty(hash, name); 141 } 142 143 } 144 145 @Override 146 public Base addChild(String name) throws FHIRException { 147 if (name.equals("modifierExtension")) { 148 return addModifierExtension(); 149 } 150 else 151 return super.addChild(name); 152 } 153 154 public String fhirType() { 155 return "BackboneElement"; 156 157 } 158 159 public abstract BackboneElement copy(); 160 161 public void copyValues(BackboneElement dst) { 162 super.copyValues(dst); 163 if (modifierExtension != null) { 164 dst.modifierExtension = new ArrayList<Extension>(); 165 for (Extension i : modifierExtension) 166 dst.modifierExtension.add(i.copy()); 167 }; 168 } 169 170 @Override 171 public boolean equalsDeep(Base other) { 172 if (!super.equalsDeep(other)) 173 return false; 174 if (!(other instanceof BackboneElement)) 175 return false; 176 BackboneElement o = (BackboneElement) other; 177 return compareDeep(modifierExtension, o.modifierExtension, true); 178 } 179 180 @Override 181 public boolean equalsShallow(Base other) { 182 if (!super.equalsShallow(other)) 183 return false; 184 if (!(other instanceof BackboneElement)) 185 return false; 186 BackboneElement o = (BackboneElement) other; 187 return true; 188 } 189 190 public boolean isEmpty() { 191 return super.isEmpty() && (modifierExtension == null || modifierExtension.isEmpty()); 192 } 193 194 195} 196