
001package org.hl7.fhir.r5.openehr; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import org.hl7.fhir.utilities.Utilities; 038import org.hl7.fhir.r5.openehr.Enumerations.*; 039import org.hl7.fhir.exceptions.FHIRException; 040import org.hl7.fhir.r5.model.*; 041import org.hl7.fhir.instance.model.api.ICompositeType; 042import ca.uhn.fhir.model.api.annotation.Child; 043import ca.uhn.fhir.model.api.annotation.ChildOrder; 044import ca.uhn.fhir.model.api.annotation.DatatypeDef; 045import ca.uhn.fhir.model.api.annotation.Description; 046import ca.uhn.fhir.model.api.annotation.Block; 047 048/** 049 * Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to 050 */ 051@DatatypeDef(name="LOCATABLE_REF") 052public class LOCATABLE_REF extends OBJECT_REF implements ICompositeType { 053 054 /** 055 * Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to 056 */ 057 @Child(name = "path", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=false) 058 @Description(shortDefinition="Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute", formalDefinition="Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to" ) 059 protected StringType path; 060 061 private static final long serialVersionUID = 1599579760L; 062 063 /** 064 * Constructor 065 */ 066 public LOCATABLE_REF() { 067 super(); 068 } 069 070 /** 071 * @return {@link #path} (Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value 072 */ 073 public StringType getPathElement() { 074 if (this.path == null) 075 if (Configuration.errorOnAutoCreate()) 076 throw new Error("Attempt to auto-create LOCATABLE_REF.path"); 077 else if (Configuration.doAutoCreate()) 078 this.path = new StringType(); // bb 079 return this.path; 080 } 081 082 public boolean hasPathElement() { 083 return this.path != null && !this.path.isEmpty(); 084 } 085 086 public boolean hasPath() { 087 return this.path != null && !this.path.isEmpty(); 088 } 089 090 /** 091 * @param value {@link #path} (Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value 092 */ 093 public LOCATABLE_REF setPathElement(StringType value) { 094 this.path = value; 095 return this; 096 } 097 098 /** 099 * @return Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to 100 */ 101 public String getPath() { 102 return this.path == null ? null : this.path.getValue(); 103 } 104 105 /** 106 * @param value Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to 107 */ 108 public LOCATABLE_REF setPath(String value) { 109 if (Utilities.noString(value)) 110 this.path = null; 111 else { 112 if (this.path == null) 113 this.path = new StringType(); 114 this.path.setValue(value); 115 } 116 return this; 117 } 118 119 protected void listChildren(List<Property> children) { 120 super.listChildren(children); 121 children.add(new Property("path", "string", "Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to", 0, 1, path)); 122 } 123 124 @Override 125 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 126 switch (_hash) { 127 case 3433509: /*path*/ return new Property("path", "string", "Reference to a LOCATABLE instance inside the top-level content structure inside a VERSION<T> identified by the id attribute. The path attribute is applied to the object that VERSION.data points to", 0, 1, path); 128 default: return super.getNamedProperty(_hash, _name, _checkValid); 129 } 130 131 } 132 133 @Override 134 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 135 switch (hash) { 136 case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType 137 default: return super.getProperty(hash, name, checkValid); 138 } 139 140 } 141 142 @Override 143 public Base setProperty(int hash, String name, Base value) throws FHIRException { 144 switch (hash) { 145 case 3433509: // path 146 this.path = TypeConvertor.castToString(value); // StringType 147 return value; 148 default: return super.setProperty(hash, name, value); 149 } 150 151 } 152 153 @Override 154 public Base setProperty(String name, Base value) throws FHIRException { 155 if (name.equals("path")) { 156 this.path = TypeConvertor.castToString(value); // StringType 157 } else 158 return super.setProperty(name, value); 159 return value; 160 } 161 162 @Override 163 public Base makeProperty(int hash, String name) throws FHIRException { 164 switch (hash) { 165 case 3433509: return getPathElement(); 166 default: return super.makeProperty(hash, name); 167 } 168 169 } 170 171 @Override 172 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 173 switch (hash) { 174 case 3433509: /*path*/ return new String[] {"string"}; 175 default: return super.getTypesForProperty(hash, name); 176 } 177 178 } 179 180 @Override 181 public Base addChild(String name) throws FHIRException { 182 if (name.equals("path")) { 183 throw new FHIRException("Cannot call addChild on a singleton property LOCATABLE_REF.path"); 184 } 185 else 186 return super.addChild(name); 187 } 188 189 public String fhirType() { 190 return "LOCATABLE_REF"; 191 192 } 193 194 public LOCATABLE_REF copy() { 195 LOCATABLE_REF dst = new LOCATABLE_REF(); 196 copyValues(dst); 197 return dst; 198 } 199 200 public void copyValues(LOCATABLE_REF dst) { 201 super.copyValues(dst); 202 dst.path = path == null ? null : path.copy(); 203 } 204 205 protected LOCATABLE_REF typedCopy() { 206 return copy(); 207 } 208 209 @Override 210 public boolean equalsDeep(Base other_) { 211 if (!super.equalsDeep(other_)) 212 return false; 213 if (!(other_ instanceof LOCATABLE_REF)) 214 return false; 215 LOCATABLE_REF o = (LOCATABLE_REF) other_; 216 return compareDeep(path, o.path, true); 217 } 218 219 @Override 220 public boolean equalsShallow(Base other_) { 221 if (!super.equalsShallow(other_)) 222 return false; 223 if (!(other_ instanceof LOCATABLE_REF)) 224 return false; 225 LOCATABLE_REF o = (LOCATABLE_REF) other_; 226 return compareValues(path, o.path, true); 227 } 228 229 public boolean isEmpty() { 230 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path); 231 } 232 233 234} 235