001package org.hl7.fhir.instance.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 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.*; 040/** 041 * Base definition for all elements that are defined inside a resource - but not those in a data type. 042 */ 043@DatatypeDef(name="BackboneElement") 044public abstract class BackboneElement extends Element implements IBaseBackboneElement { 045 046 /** 047 * 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. 048 */ 049 @Child(name = "modifierExtension", type = {Extension.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=false) 050 @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." ) 051 protected List<Extension> modifierExtension; 052 053 private static final long serialVersionUID = -1431673179L; 054 055 /* 056 * Constructor 057 */ 058 public BackboneElement() { 059 super(); 060 } 061 062 /** 063 * @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.) 064 */ 065 public List<Extension> getModifierExtension() { 066 if (this.modifierExtension == null) 067 this.modifierExtension = new ArrayList<Extension>(); 068 return this.modifierExtension; 069 } 070 071 public boolean hasModifierExtension() { 072 if (this.modifierExtension == null) 073 return false; 074 for (Extension item : this.modifierExtension) 075 if (!item.isEmpty()) 076 return true; 077 return false; 078 } 079 080 /** 081 * @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.) 082 */ 083 // syntactic sugar 084 public Extension addModifierExtension() { //3 085 Extension t = new Extension(); 086 if (this.modifierExtension == null) 087 this.modifierExtension = new ArrayList<Extension>(); 088 this.modifierExtension.add(t); 089 return t; 090 } 091 092 // syntactic sugar 093 public BackboneElement addModifierExtension(Extension t) { //3 094 if (t == null) 095 return this; 096 if (this.modifierExtension == null) 097 this.modifierExtension = new ArrayList<Extension>(); 098 this.modifierExtension.add(t); 099 return this; 100 } 101 102 protected void listChildren(List<Property> childrenList) { 103 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)); 104 } 105 106 @Override 107 public void setProperty(String name, Base value) throws FHIRException { 108 if (name.equals("modifierExtension")) 109 this.getModifierExtension().add(castToExtension(value)); 110 else 111 super.setProperty(name, value); 112 } 113 114 @Override 115 public Base addChild(String name) throws FHIRException { 116 if (name.equals("modifierExtension")) { 117 return addModifierExtension(); 118 } 119 else 120 return super.addChild(name); 121 } 122 123 public String fhirType() { 124 return "BackboneElement"; 125 126 } 127 128 public abstract BackboneElement copy(); 129 130 public void copyValues(BackboneElement dst) { 131 super.copyValues(dst); 132 if (modifierExtension != null) { 133 dst.modifierExtension = new ArrayList<Extension>(); 134 for (Extension i : modifierExtension) 135 dst.modifierExtension.add(i.copy()); 136 }; 137 } 138 139 @Override 140 public boolean equalsDeep(Base other) { 141 if (!super.equalsDeep(other)) 142 return false; 143 if (!(other instanceof BackboneElement)) 144 return false; 145 BackboneElement o = (BackboneElement) other; 146 return compareDeep(modifierExtension, o.modifierExtension, true); 147 } 148 149 @Override 150 public boolean equalsShallow(Base other) { 151 if (!super.equalsShallow(other)) 152 return false; 153 if (!(other instanceof BackboneElement)) 154 return false; 155 BackboneElement o = (BackboneElement) other; 156 return true; 157 } 158 159 public boolean isEmpty() { 160 return super.isEmpty() && (modifierExtension == null || modifierExtension.isEmpty()); 161 } 162 163 164} 165