
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 * 049 */ 050@DatatypeDef(name="WebTemplateInputValidation") 051public class WebTemplateInputValidation extends LogicalBase implements ICompositeType { 052 053 /** 054 * 055 */ 056 @Child(name = "range", type = {WebTemplateInputValidationRange.class}, order=0, min=0, max=1, modifier=false, summary=false) 057 @Description(shortDefinition="todo", formalDefinition="" ) 058 protected WebTemplateInputValidationRange range; 059 060 /** 061 * 062 */ 063 @Child(name = "precision", type = {WebTemplateInputValidationRange.class}, order=1, min=0, max=1, modifier=false, summary=false) 064 @Description(shortDefinition="todo", formalDefinition="" ) 065 protected WebTemplateInputValidationRange precision; 066 067 private static final long serialVersionUID = 1147023337L; 068 069 /** 070 * Constructor 071 */ 072 public WebTemplateInputValidation() { 073 super(); 074 } 075 076 /** 077 * @return {@link #range} () 078 */ 079 public WebTemplateInputValidationRange getRange() { 080 if (this.range == null) 081 if (Configuration.errorOnAutoCreate()) 082 throw new Error("Attempt to auto-create WebTemplateInputValidation.range"); 083 else if (Configuration.doAutoCreate()) 084 this.range = new WebTemplateInputValidationRange(); // cc 085 return this.range; 086 } 087 088 public boolean hasRange() { 089 return this.range != null && !this.range.isEmpty(); 090 } 091 092 /** 093 * @param value {@link #range} () 094 */ 095 public WebTemplateInputValidation setRange(WebTemplateInputValidationRange value) { 096 this.range = value; 097 return this; 098 } 099 100 /** 101 * @return {@link #precision} () 102 */ 103 public WebTemplateInputValidationRange getPrecision() { 104 if (this.precision == null) 105 if (Configuration.errorOnAutoCreate()) 106 throw new Error("Attempt to auto-create WebTemplateInputValidation.precision"); 107 else if (Configuration.doAutoCreate()) 108 this.precision = new WebTemplateInputValidationRange(); // cc 109 return this.precision; 110 } 111 112 public boolean hasPrecision() { 113 return this.precision != null && !this.precision.isEmpty(); 114 } 115 116 /** 117 * @param value {@link #precision} () 118 */ 119 public WebTemplateInputValidation setPrecision(WebTemplateInputValidationRange value) { 120 this.precision = value; 121 return this; 122 } 123 124 protected void listChildren(List<Property> children) { 125 super.listChildren(children); 126 children.add(new Property("range", "http://openehr.org/fhir/StructureDefinition/WebTemplateInputValidationRange", "", 0, 1, range)); 127 children.add(new Property("precision", "http://openehr.org/fhir/StructureDefinition/WebTemplateInputValidationRange", "", 0, 1, precision)); 128 } 129 130 @Override 131 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 132 switch (_hash) { 133 case 108280125: /*range*/ return new Property("range", "http://openehr.org/fhir/StructureDefinition/WebTemplateInputValidationRange", "", 0, 1, range); 134 case -1376177026: /*precision*/ return new Property("precision", "http://openehr.org/fhir/StructureDefinition/WebTemplateInputValidationRange", "", 0, 1, precision); 135 default: return super.getNamedProperty(_hash, _name, _checkValid); 136 } 137 138 } 139 140 @Override 141 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 142 switch (hash) { 143 case 108280125: /*range*/ return this.range == null ? new Base[0] : new Base[] {this.range}; // WebTemplateInputValidationRange 144 case -1376177026: /*precision*/ return this.precision == null ? new Base[0] : new Base[] {this.precision}; // WebTemplateInputValidationRange 145 default: return super.getProperty(hash, name, checkValid); 146 } 147 148 } 149 150 @Override 151 public Base setProperty(int hash, String name, Base value) throws FHIRException { 152 switch (hash) { 153 case 108280125: // range 154 this.range = (WebTemplateInputValidationRange) value; // WebTemplateInputValidationRange 155 return value; 156 case -1376177026: // precision 157 this.precision = (WebTemplateInputValidationRange) value; // WebTemplateInputValidationRange 158 return value; 159 default: return super.setProperty(hash, name, value); 160 } 161 162 } 163 164 @Override 165 public Base setProperty(String name, Base value) throws FHIRException { 166 if (name.equals("range")) { 167 this.range = (WebTemplateInputValidationRange) value; // WebTemplateInputValidationRange 168 } else if (name.equals("precision")) { 169 this.precision = (WebTemplateInputValidationRange) value; // WebTemplateInputValidationRange 170 } else 171 return super.setProperty(name, value); 172 return value; 173 } 174 175 @Override 176 public Base makeProperty(int hash, String name) throws FHIRException { 177 switch (hash) { 178 case 108280125: return getRange(); 179 case -1376177026: return getPrecision(); 180 default: return super.makeProperty(hash, name); 181 } 182 183 } 184 185 @Override 186 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 187 switch (hash) { 188 case 108280125: /*range*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/WebTemplateInputValidationRange"}; 189 case -1376177026: /*precision*/ return new String[] {"http://openehr.org/fhir/StructureDefinition/WebTemplateInputValidationRange"}; 190 default: return super.getTypesForProperty(hash, name); 191 } 192 193 } 194 195 @Override 196 public Base addChild(String name) throws FHIRException { 197 if (name.equals("range")) { 198 this.range = new WebTemplateInputValidationRange(); 199 return this.range; 200 } 201 else if (name.equals("precision")) { 202 this.precision = new WebTemplateInputValidationRange(); 203 return this.precision; 204 } 205 else 206 return super.addChild(name); 207 } 208 209 public String fhirType() { 210 return "WebTemplateInputValidation"; 211 212 } 213 214 public WebTemplateInputValidation copy() { 215 WebTemplateInputValidation dst = new WebTemplateInputValidation(); 216 copyValues(dst); 217 return dst; 218 } 219 220 public void copyValues(WebTemplateInputValidation dst) { 221 super.copyValues(dst); 222 dst.range = range == null ? null : range.copy(); 223 dst.precision = precision == null ? null : precision.copy(); 224 } 225 226 protected WebTemplateInputValidation typedCopy() { 227 return copy(); 228 } 229 230 @Override 231 public boolean equalsDeep(Base other_) { 232 if (!super.equalsDeep(other_)) 233 return false; 234 if (!(other_ instanceof WebTemplateInputValidation)) 235 return false; 236 WebTemplateInputValidation o = (WebTemplateInputValidation) other_; 237 return compareDeep(range, o.range, true) && compareDeep(precision, o.precision, true); 238 } 239 240 @Override 241 public boolean equalsShallow(Base other_) { 242 if (!super.equalsShallow(other_)) 243 return false; 244 if (!(other_ instanceof WebTemplateInputValidation)) 245 return false; 246 WebTemplateInputValidation o = (WebTemplateInputValidation) other_; 247 return true; 248 } 249 250 public boolean isEmpty() { 251 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(range, precision); 252 } 253 254 255} 256