001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
036import java.util.ArrayList;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.DatatypeDef;
044import ca.uhn.fhir.model.api.annotation.Description;
045/**
046 * Base definition for all elements that are defined inside a resource - but not those in a data type.
047 */
048@DatatypeDef(name="BackboneElement")
049public abstract class BackboneElement extends Element implements IBaseBackboneElement {
050
051    /**
052     * 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     */
054    @Child(name = "modifierExtension", type = {Extension.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=true)
055    @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." )
056    protected List<Extension> modifierExtension;
057
058    private static final long serialVersionUID = -1431673179L;
059
060  /**
061   * Constructor
062   */
063    public BackboneElement() {
064      super();
065    }
066
067    /**
068     * @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.)
069     */
070    public List<Extension> getModifierExtension() { 
071      if (this.modifierExtension == null)
072        this.modifierExtension = new ArrayList<Extension>();
073      return this.modifierExtension;
074    }
075
076    public boolean hasModifierExtension() { 
077      if (this.modifierExtension == null)
078        return false;
079      for (Extension item : this.modifierExtension)
080        if (!item.isEmpty())
081          return true;
082      return false;
083    }
084
085    /**
086     * @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.)
087     */
088    // syntactic sugar
089    public Extension addModifierExtension() { //3
090      Extension t = new Extension();
091      if (this.modifierExtension == null)
092        this.modifierExtension = new ArrayList<Extension>();
093      this.modifierExtension.add(t);
094      return t;
095    }
096
097    // syntactic sugar
098    public BackboneElement addModifierExtension(Extension t) { //3
099      if (t == null)
100        return this;
101      if (this.modifierExtension == null)
102        this.modifierExtension = new ArrayList<Extension>();
103      this.modifierExtension.add(t);
104      return this;
105    }
106
107      protected void listChildren(List<Property> childrenList) {
108        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));
109      }
110
111      @Override
112      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
113        switch (hash) {
114        case -298878168: /*modifierExtension*/ return this.modifierExtension == null ? new Base[0] : this.modifierExtension.toArray(new Base[this.modifierExtension.size()]); // Extension
115        default: return super.getProperty(hash, name, checkValid);
116        }
117
118      }
119
120      @Override
121      public void setProperty(int hash, String name, Base value) throws FHIRException {
122        switch (hash) {
123        case -298878168: // modifierExtension
124          this.getModifierExtension().add(castToExtension(value)); // Extension
125          break;
126        default: super.setProperty(hash, name, value);
127        }
128
129      }
130
131      @Override
132      public void setProperty(String name, Base value) throws FHIRException {
133        if (name.equals("modifierExtension"))
134          this.getModifierExtension().add(castToExtension(value));
135        else
136          super.setProperty(name, value);
137      }
138
139      @Override
140      public Base makeProperty(int hash, String name) throws FHIRException {
141        switch (hash) {
142        case -298878168:  return addModifierExtension(); // Extension
143        default: return super.makeProperty(hash, name);
144        }
145
146      }
147
148      @Override
149      public Base addChild(String name) throws FHIRException {
150        if (name.equals("modifierExtension")) {
151          return addModifierExtension();
152        }
153        else
154          return super.addChild(name);
155      }
156
157  public String fhirType() {
158    return "BackboneElement";
159
160  }
161
162      public abstract BackboneElement copy();
163
164      public void copyValues(BackboneElement dst) {
165        super.copyValues(dst);
166        if (modifierExtension != null) {
167          dst.modifierExtension = new ArrayList<Extension>();
168          for (Extension i : modifierExtension)
169            dst.modifierExtension.add(i.copy());
170        };
171      }
172
173      @Override
174      public boolean equalsDeep(Base other) {
175        if (!super.equalsDeep(other))
176          return false;
177        if (!(other instanceof BackboneElement))
178          return false;
179        BackboneElement o = (BackboneElement) other;
180        return compareDeep(modifierExtension, o.modifierExtension, true);
181      }
182
183      @Override
184      public boolean equalsShallow(Base other) {
185        if (!super.equalsShallow(other))
186          return false;
187        if (!(other instanceof BackboneElement))
188          return false;
189        BackboneElement o = (BackboneElement) other;
190        return true;
191      }
192
193      public boolean isEmpty() {
194        return super.isEmpty() && (modifierExtension == null || modifierExtension.isEmpty());
195      }
196
197
198}