001package org.hl7.fhir.r4.model.codesystems;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, 
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this 
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, 
034     this list of conditions and the following disclaimer in the documentation 
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
049  POSSIBILITY OF SUCH DAMAGE.
050  
051*/
052
053// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
054
055
056import org.hl7.fhir.r4.model.EnumFactory;
057
058public class DataTypesEnumFactory implements EnumFactory<DataTypes> {
059
060  public DataTypes fromCode(String codeString) throws IllegalArgumentException {
061    if (codeString == null || "".equals(codeString))
062      return null;
063    if ("Address".equals(codeString))
064      return DataTypes.ADDRESS;
065    if ("Age".equals(codeString))
066      return DataTypes.AGE;
067    if ("Annotation".equals(codeString))
068      return DataTypes.ANNOTATION;
069    if ("Attachment".equals(codeString))
070      return DataTypes.ATTACHMENT;
071    if ("BackboneElement".equals(codeString))
072      return DataTypes.BACKBONEELEMENT;
073    if ("CodeableConcept".equals(codeString))
074      return DataTypes.CODEABLECONCEPT;
075    if ("Coding".equals(codeString))
076      return DataTypes.CODING;
077    if ("ContactDetail".equals(codeString))
078      return DataTypes.CONTACTDETAIL;
079    if ("ContactPoint".equals(codeString))
080      return DataTypes.CONTACTPOINT;
081    if ("Contributor".equals(codeString))
082      return DataTypes.CONTRIBUTOR;
083    if ("Count".equals(codeString))
084      return DataTypes.COUNT;
085    if ("DataRequirement".equals(codeString))
086      return DataTypes.DATAREQUIREMENT;
087    if ("Distance".equals(codeString))
088      return DataTypes.DISTANCE;
089    if ("Dosage".equals(codeString))
090      return DataTypes.DOSAGE;
091    if ("Duration".equals(codeString))
092      return DataTypes.DURATION;
093    if ("Element".equals(codeString))
094      return DataTypes.ELEMENT;
095    if ("ElementDefinition".equals(codeString))
096      return DataTypes.ELEMENTDEFINITION;
097    if ("Expression".equals(codeString))
098      return DataTypes.EXPRESSION;
099    if ("Extension".equals(codeString))
100      return DataTypes.EXTENSION;
101    if ("HumanName".equals(codeString))
102      return DataTypes.HUMANNAME;
103    if ("Identifier".equals(codeString))
104      return DataTypes.IDENTIFIER;
105    if ("MarketingStatus".equals(codeString))
106      return DataTypes.MARKETINGSTATUS;
107    if ("Meta".equals(codeString))
108      return DataTypes.META;
109    if ("Money".equals(codeString))
110      return DataTypes.MONEY;
111    if ("MoneyQuantity".equals(codeString))
112      return DataTypes.MONEYQUANTITY;
113    if ("Narrative".equals(codeString))
114      return DataTypes.NARRATIVE;
115    if ("ParameterDefinition".equals(codeString))
116      return DataTypes.PARAMETERDEFINITION;
117    if ("Period".equals(codeString))
118      return DataTypes.PERIOD;
119    if ("Population".equals(codeString))
120      return DataTypes.POPULATION;
121    if ("ProdCharacteristic".equals(codeString))
122      return DataTypes.PRODCHARACTERISTIC;
123    if ("ProductShelfLife".equals(codeString))
124      return DataTypes.PRODUCTSHELFLIFE;
125    if ("Quantity".equals(codeString))
126      return DataTypes.QUANTITY;
127    if ("Range".equals(codeString))
128      return DataTypes.RANGE;
129    if ("Ratio".equals(codeString))
130      return DataTypes.RATIO;
131    if ("Reference".equals(codeString))
132      return DataTypes.REFERENCE;
133    if ("RelatedArtifact".equals(codeString))
134      return DataTypes.RELATEDARTIFACT;
135    if ("SampledData".equals(codeString))
136      return DataTypes.SAMPLEDDATA;
137    if ("Signature".equals(codeString))
138      return DataTypes.SIGNATURE;
139    if ("SimpleQuantity".equals(codeString))
140      return DataTypes.SIMPLEQUANTITY;
141    if ("SubstanceAmount".equals(codeString))
142      return DataTypes.SUBSTANCEAMOUNT;
143    if ("Timing".equals(codeString))
144      return DataTypes.TIMING;
145    if ("TriggerDefinition".equals(codeString))
146      return DataTypes.TRIGGERDEFINITION;
147    if ("UsageContext".equals(codeString))
148      return DataTypes.USAGECONTEXT;
149    if ("base64Binary".equals(codeString))
150      return DataTypes.BASE64BINARY;
151    if ("boolean".equals(codeString))
152      return DataTypes.BOOLEAN;
153    if ("canonical".equals(codeString))
154      return DataTypes.CANONICAL;
155    if ("code".equals(codeString))
156      return DataTypes.CODE;
157    if ("date".equals(codeString))
158      return DataTypes.DATE;
159    if ("dateTime".equals(codeString))
160      return DataTypes.DATETIME;
161    if ("decimal".equals(codeString))
162      return DataTypes.DECIMAL;
163    if ("id".equals(codeString))
164      return DataTypes.ID;
165    if ("instant".equals(codeString))
166      return DataTypes.INSTANT;
167    if ("integer".equals(codeString))
168      return DataTypes.INTEGER;
169    if ("markdown".equals(codeString))
170      return DataTypes.MARKDOWN;
171    if ("oid".equals(codeString))
172      return DataTypes.OID;
173    if ("positiveInt".equals(codeString))
174      return DataTypes.POSITIVEINT;
175    if ("string".equals(codeString))
176      return DataTypes.STRING;
177    if ("time".equals(codeString))
178      return DataTypes.TIME;
179    if ("unsignedInt".equals(codeString))
180      return DataTypes.UNSIGNEDINT;
181    if ("uri".equals(codeString))
182      return DataTypes.URI;
183    if ("url".equals(codeString))
184      return DataTypes.URL;
185    if ("uuid".equals(codeString))
186      return DataTypes.UUID;
187    if ("xhtml".equals(codeString))
188      return DataTypes.XHTML;
189    throw new IllegalArgumentException("Unknown DataTypes code '"+codeString+"'");
190  }
191
192  public String toCode(DataTypes code) {
193    if (code == DataTypes.ADDRESS)
194      return "Address";
195    if (code == DataTypes.AGE)
196      return "Age";
197    if (code == DataTypes.ANNOTATION)
198      return "Annotation";
199    if (code == DataTypes.ATTACHMENT)
200      return "Attachment";
201    if (code == DataTypes.BACKBONEELEMENT)
202      return "BackboneElement";
203    if (code == DataTypes.CODEABLECONCEPT)
204      return "CodeableConcept";
205    if (code == DataTypes.CODING)
206      return "Coding";
207    if (code == DataTypes.CONTACTDETAIL)
208      return "ContactDetail";
209    if (code == DataTypes.CONTACTPOINT)
210      return "ContactPoint";
211    if (code == DataTypes.CONTRIBUTOR)
212      return "Contributor";
213    if (code == DataTypes.COUNT)
214      return "Count";
215    if (code == DataTypes.DATAREQUIREMENT)
216      return "DataRequirement";
217    if (code == DataTypes.DISTANCE)
218      return "Distance";
219    if (code == DataTypes.DOSAGE)
220      return "Dosage";
221    if (code == DataTypes.DURATION)
222      return "Duration";
223    if (code == DataTypes.ELEMENT)
224      return "Element";
225    if (code == DataTypes.ELEMENTDEFINITION)
226      return "ElementDefinition";
227    if (code == DataTypes.EXPRESSION)
228      return "Expression";
229    if (code == DataTypes.EXTENSION)
230      return "Extension";
231    if (code == DataTypes.HUMANNAME)
232      return "HumanName";
233    if (code == DataTypes.IDENTIFIER)
234      return "Identifier";
235    if (code == DataTypes.MARKETINGSTATUS)
236      return "MarketingStatus";
237    if (code == DataTypes.META)
238      return "Meta";
239    if (code == DataTypes.MONEY)
240      return "Money";
241    if (code == DataTypes.MONEYQUANTITY)
242      return "MoneyQuantity";
243    if (code == DataTypes.NARRATIVE)
244      return "Narrative";
245    if (code == DataTypes.PARAMETERDEFINITION)
246      return "ParameterDefinition";
247    if (code == DataTypes.PERIOD)
248      return "Period";
249    if (code == DataTypes.POPULATION)
250      return "Population";
251    if (code == DataTypes.PRODCHARACTERISTIC)
252      return "ProdCharacteristic";
253    if (code == DataTypes.PRODUCTSHELFLIFE)
254      return "ProductShelfLife";
255    if (code == DataTypes.QUANTITY)
256      return "Quantity";
257    if (code == DataTypes.RANGE)
258      return "Range";
259    if (code == DataTypes.RATIO)
260      return "Ratio";
261    if (code == DataTypes.REFERENCE)
262      return "Reference";
263    if (code == DataTypes.RELATEDARTIFACT)
264      return "RelatedArtifact";
265    if (code == DataTypes.SAMPLEDDATA)
266      return "SampledData";
267    if (code == DataTypes.SIGNATURE)
268      return "Signature";
269    if (code == DataTypes.SIMPLEQUANTITY)
270      return "SimpleQuantity";
271    if (code == DataTypes.SUBSTANCEAMOUNT)
272      return "SubstanceAmount";
273    if (code == DataTypes.TIMING)
274      return "Timing";
275    if (code == DataTypes.TRIGGERDEFINITION)
276      return "TriggerDefinition";
277    if (code == DataTypes.USAGECONTEXT)
278      return "UsageContext";
279    if (code == DataTypes.BASE64BINARY)
280      return "base64Binary";
281    if (code == DataTypes.BOOLEAN)
282      return "boolean";
283    if (code == DataTypes.CANONICAL)
284      return "canonical";
285    if (code == DataTypes.CODE)
286      return "code";
287    if (code == DataTypes.DATE)
288      return "date";
289    if (code == DataTypes.DATETIME)
290      return "dateTime";
291    if (code == DataTypes.DECIMAL)
292      return "decimal";
293    if (code == DataTypes.ID)
294      return "id";
295    if (code == DataTypes.INSTANT)
296      return "instant";
297    if (code == DataTypes.INTEGER)
298      return "integer";
299    if (code == DataTypes.MARKDOWN)
300      return "markdown";
301    if (code == DataTypes.OID)
302      return "oid";
303    if (code == DataTypes.POSITIVEINT)
304      return "positiveInt";
305    if (code == DataTypes.STRING)
306      return "string";
307    if (code == DataTypes.TIME)
308      return "time";
309    if (code == DataTypes.UNSIGNEDINT)
310      return "unsignedInt";
311    if (code == DataTypes.URI)
312      return "uri";
313    if (code == DataTypes.URL)
314      return "url";
315    if (code == DataTypes.UUID)
316      return "uuid";
317    if (code == DataTypes.XHTML)
318      return "xhtml";
319    return "?";
320  }
321
322    public String toSystem(DataTypes code) {
323      return code.getSystem();
324      }
325
326}
327