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