
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.r5.openehr.Enumerations.*; 038import org.hl7.fhir.exceptions.FHIRException; 039import org.hl7.fhir.r5.model.*; 040import org.hl7.fhir.instance.model.api.ICompositeType; 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.ChildOrder; 043import ca.uhn.fhir.model.api.annotation.DatatypeDef; 044import ca.uhn.fhir.model.api.annotation.Description; 045import ca.uhn.fhir.model.api.annotation.Block; 046 047/** 048 * Address of contact, which may be electronic or geographic. 049 */ 050@DatatypeDef(name="ADDRESS") 051public class ADDRESS extends LOCATABLE implements ICompositeType { 052 053 /** 054 * Archetypable structured address. 055 */ 056 @Child(name = "details", type = {ITEM_STRUCTURE.class}, order=0, min=1, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="Archetypable structured address", formalDefinition="Archetypable structured address." ) 058 protected ITEM_STRUCTURE details; 059 060 private static final long serialVersionUID = -713027011L; 061 062 /** 063 * Constructor 064 */ 065 public ADDRESS() { 066 super(); 067 } 068 069 /** 070 * Constructor 071 */ 072 public ADDRESS(ITEM_STRUCTURE details) { 073 super(); 074 this.setDetails(details); 075 } 076 077 /** 078 * @return {@link #details} (Archetypable structured address.) 079 */ 080 public ITEM_STRUCTURE getDetails() { 081 return this.details; 082 } 083 084 public boolean hasDetails() { 085 return this.details != null && !this.details.isEmpty(); 086 } 087 088 /** 089 * @param value {@link #details} (Archetypable structured address.) 090 */ 091 public ADDRESS setDetails(ITEM_STRUCTURE value) { 092 this.details = value; 093 return this; 094 } 095 096 protected void listChildren(List<Property> children) { 097 super.listChildren(children); 098 children.add(new Property("details", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "Archetypable structured address.", 0, 1, details)); 099 } 100 101 @Override 102 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 103 switch (_hash) { 104 case 1557721666: /*details*/ return new Property("details", "http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE", "Archetypable structured address.", 0, 1, details); 105 default: return super.getNamedProperty(_hash, _name, _checkValid); 106 } 107 108 } 109 110 @Override 111 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 112 switch (hash) { 113 case 1557721666: /*details*/ return this.details == null ? new Base[0] : new Base[] {this.details}; // ITEM_STRUCTURE 114 default: return super.getProperty(hash, name, checkValid); 115 } 116 117 } 118 119 @Override 120 public Base setProperty(int hash, String name, Base value) throws FHIRException { 121 switch (hash) { 122 case 1557721666: // details 123 this.details = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE 124 return value; 125 default: return super.setProperty(hash, name, value); 126 } 127 128 } 129 130 @Override 131 public Base setProperty(String name, Base value) throws FHIRException { 132 if (name.equals("details")) { 133 this.details = (ITEM_STRUCTURE) value; // ITEM_STRUCTURE 134 } else 135 return super.setProperty(name, value); 136 return value; 137 } 138 139 @Override 140 public Base makeProperty(int hash, String name) throws FHIRException { 141 switch (hash) { 142 case 1557721666: /*div*/ 143 throw new Error("Unable to make an instance of the abstract property 'details'"); 144 default: return super.makeProperty(hash, name); 145 } 146 147 } 148 149 @Override 150 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 151 switch (hash) { 152 case 1557721666: /*details*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/ITEM-STRUCTURE"}; 153 default: return super.getTypesForProperty(hash, name); 154 } 155 156 } 157 158 @Override 159 public Base addChild(String name) throws FHIRException { 160 if (name.equals("details")) { 161 throw new FHIRException("Cannot call addChild on an abstract type ADDRESS.details"); 162 } 163 else 164 return super.addChild(name); 165 } 166 167 public String fhirType() { 168 return "ADDRESS"; 169 170 } 171 172 public ADDRESS copy() { 173 ADDRESS dst = new ADDRESS(); 174 copyValues(dst); 175 return dst; 176 } 177 178 public void copyValues(ADDRESS dst) { 179 super.copyValues(dst); 180 dst.details = details == null ? null : details.copy(); 181 } 182 183 protected ADDRESS typedCopy() { 184 return copy(); 185 } 186 187 @Override 188 public boolean equalsDeep(Base other_) { 189 if (!super.equalsDeep(other_)) 190 return false; 191 if (!(other_ instanceof ADDRESS)) 192 return false; 193 ADDRESS o = (ADDRESS) other_; 194 return compareDeep(details, o.details, true); 195 } 196 197 @Override 198 public boolean equalsShallow(Base other_) { 199 if (!super.equalsShallow(other_)) 200 return false; 201 if (!(other_ instanceof ADDRESS)) 202 return false; 203 ADDRESS o = (ADDRESS) other_; 204 return true; 205 } 206 207 public boolean isEmpty() { 208 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(details); 209 } 210 211 212} 213