001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034
035import org.hl7.fhir.r4.model.EnumFactory;
036
037public class DataAbsentReasonEnumFactory implements EnumFactory<DataAbsentReason> {
038
039  public DataAbsentReason fromCode(String codeString) throws IllegalArgumentException {
040    if (codeString == null || "".equals(codeString))
041      return null;
042    if ("unknown".equals(codeString))
043      return DataAbsentReason.UNKNOWN;
044    if ("asked-unknown".equals(codeString))
045      return DataAbsentReason.ASKEDUNKNOWN;
046    if ("temp-unknown".equals(codeString))
047      return DataAbsentReason.TEMPUNKNOWN;
048    if ("not-asked".equals(codeString))
049      return DataAbsentReason.NOTASKED;
050    if ("asked-declined".equals(codeString))
051      return DataAbsentReason.ASKEDDECLINED;
052    if ("masked".equals(codeString))
053      return DataAbsentReason.MASKED;
054    if ("not-applicable".equals(codeString))
055      return DataAbsentReason.NOTAPPLICABLE;
056    if ("unsupported".equals(codeString))
057      return DataAbsentReason.UNSUPPORTED;
058    if ("as-text".equals(codeString))
059      return DataAbsentReason.ASTEXT;
060    if ("error".equals(codeString))
061      return DataAbsentReason.ERROR;
062    if ("not-a-number".equals(codeString))
063      return DataAbsentReason.NOTANUMBER;
064    if ("negative-infinity".equals(codeString))
065      return DataAbsentReason.NEGATIVEINFINITY;
066    if ("positive-infinity".equals(codeString))
067      return DataAbsentReason.POSITIVEINFINITY;
068    if ("not-performed".equals(codeString))
069      return DataAbsentReason.NOTPERFORMED;
070    if ("not-permitted".equals(codeString))
071      return DataAbsentReason.NOTPERMITTED;
072    throw new IllegalArgumentException("Unknown DataAbsentReason code '"+codeString+"'");
073  }
074
075  public String toCode(DataAbsentReason code) {
076    if (code == DataAbsentReason.UNKNOWN)
077      return "unknown";
078    if (code == DataAbsentReason.ASKEDUNKNOWN)
079      return "asked-unknown";
080    if (code == DataAbsentReason.TEMPUNKNOWN)
081      return "temp-unknown";
082    if (code == DataAbsentReason.NOTASKED)
083      return "not-asked";
084    if (code == DataAbsentReason.ASKEDDECLINED)
085      return "asked-declined";
086    if (code == DataAbsentReason.MASKED)
087      return "masked";
088    if (code == DataAbsentReason.NOTAPPLICABLE)
089      return "not-applicable";
090    if (code == DataAbsentReason.UNSUPPORTED)
091      return "unsupported";
092    if (code == DataAbsentReason.ASTEXT)
093      return "as-text";
094    if (code == DataAbsentReason.ERROR)
095      return "error";
096    if (code == DataAbsentReason.NOTANUMBER)
097      return "not-a-number";
098    if (code == DataAbsentReason.NEGATIVEINFINITY)
099      return "negative-infinity";
100    if (code == DataAbsentReason.POSITIVEINFINITY)
101      return "positive-infinity";
102    if (code == DataAbsentReason.NOTPERFORMED)
103      return "not-performed";
104    if (code == DataAbsentReason.NOTPERMITTED)
105      return "not-permitted";
106    return "?";
107  }
108
109    public String toSystem(DataAbsentReason code) {
110      return code.getSystem();
111      }
112
113}
114