001package org.hl7.fhir.dstu2.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.dstu2 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023 024/* 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 053// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 054import java.util.ArrayList; 055import java.util.List; 056 057import ca.uhn.fhir.model.api.annotation.Child; 058import ca.uhn.fhir.model.api.annotation.DatatypeDef; 059import ca.uhn.fhir.model.api.annotation.Description; 060import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 061import org.hl7.fhir.exceptions.FHIRException; 062/** 063 * Base definition for all elements that are defined inside a resource - but not those in a data type. 064 */ 065@DatatypeDef(name="BackboneElement") 066public abstract class BackboneElement extends Element implements IBaseBackboneElement { 067 068 /** 069 * 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. 070 */ 071 @Child(name = "modifierExtension", type = {Extension.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=false) 072 @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." ) 073 protected List<Extension> modifierExtension; 074 075 private static final long serialVersionUID = -1431673179L; 076 077 /* 078 * Constructor 079 */ 080 public BackboneElement() { 081 super(); 082 } 083 084 /** 085 * @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.) 086 */ 087 public List<Extension> getModifierExtension() { 088 if (this.modifierExtension == null) 089 this.modifierExtension = new ArrayList<Extension>(); 090 return this.modifierExtension; 091 } 092 093 public boolean hasModifierExtension() { 094 if (this.modifierExtension == null) 095 return false; 096 for (Extension item : this.modifierExtension) 097 if (!item.isEmpty()) 098 return true; 099 return false; 100 } 101 102 /** 103 * @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.) 104 */ 105 // syntactic sugar 106 public Extension addModifierExtension() { //3 107 Extension t = new Extension(); 108 if (this.modifierExtension == null) 109 this.modifierExtension = new ArrayList<Extension>(); 110 this.modifierExtension.add(t); 111 return t; 112 } 113 114 // syntactic sugar 115 public BackboneElement addModifierExtension(Extension t) { //3 116 if (t == null) 117 return this; 118 if (this.modifierExtension == null) 119 this.modifierExtension = new ArrayList<Extension>(); 120 this.modifierExtension.add(t); 121 return this; 122 } 123 124 protected void listChildren(List<Property> childrenList) { 125 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)); 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 addChild(String name) throws FHIRException { 138 if (name.equals("modifierExtension")) { 139 return addModifierExtension(); 140 } 141 else 142 return super.addChild(name); 143 } 144 145 public String fhirType() { 146 return "BackboneElement"; 147 148 } 149 150 public abstract BackboneElement copy(); 151 152 public void copyValues(BackboneElement dst) { 153 super.copyValues(dst); 154 if (modifierExtension != null) { 155 dst.modifierExtension = new ArrayList<Extension>(); 156 for (Extension i : modifierExtension) 157 dst.modifierExtension.add(i.copy()); 158 }; 159 } 160 161 @Override 162 public boolean equalsDeep(Base other) { 163 if (!super.equalsDeep(other)) 164 return false; 165 if (!(other instanceof BackboneElement)) 166 return false; 167 BackboneElement o = (BackboneElement) other; 168 return compareDeep(modifierExtension, o.modifierExtension, true); 169 } 170 171 @Override 172 public boolean equalsShallow(Base other) { 173 if (!super.equalsShallow(other)) 174 return false; 175 if (!(other instanceof BackboneElement)) 176 return false; 177 BackboneElement o = (BackboneElement) other; 178 return true; 179 } 180 181 public boolean isEmpty() { 182 return super.isEmpty() && (modifierExtension == null || modifierExtension.isEmpty()); 183 } 184 185 186} 187