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 Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0 033 034import org.hl7.fhir.r4.model.EnumFactory; 035 036public class DataAbsentReasonEnumFactory implements EnumFactory<DataAbsentReason> { 037 038 public DataAbsentReason fromCode(String codeString) throws IllegalArgumentException { 039 if (codeString == null || "".equals(codeString)) 040 return null; 041 if ("unknown".equals(codeString)) 042 return DataAbsentReason.UNKNOWN; 043 if ("asked-unknown".equals(codeString)) 044 return DataAbsentReason.ASKEDUNKNOWN; 045 if ("temp-unknown".equals(codeString)) 046 return DataAbsentReason.TEMPUNKNOWN; 047 if ("not-asked".equals(codeString)) 048 return DataAbsentReason.NOTASKED; 049 if ("asked-declined".equals(codeString)) 050 return DataAbsentReason.ASKEDDECLINED; 051 if ("masked".equals(codeString)) 052 return DataAbsentReason.MASKED; 053 if ("not-applicable".equals(codeString)) 054 return DataAbsentReason.NOTAPPLICABLE; 055 if ("unsupported".equals(codeString)) 056 return DataAbsentReason.UNSUPPORTED; 057 if ("as-text".equals(codeString)) 058 return DataAbsentReason.ASTEXT; 059 if ("error".equals(codeString)) 060 return DataAbsentReason.ERROR; 061 if ("not-a-number".equals(codeString)) 062 return DataAbsentReason.NOTANUMBER; 063 if ("negative-infinity".equals(codeString)) 064 return DataAbsentReason.NEGATIVEINFINITY; 065 if ("positive-infinity".equals(codeString)) 066 return DataAbsentReason.POSITIVEINFINITY; 067 if ("not-performed".equals(codeString)) 068 return DataAbsentReason.NOTPERFORMED; 069 if ("not-permitted".equals(codeString)) 070 return DataAbsentReason.NOTPERMITTED; 071 throw new IllegalArgumentException("Unknown DataAbsentReason code '" + codeString + "'"); 072 } 073 074 public String toCode(DataAbsentReason code) { 075 if (code == DataAbsentReason.NULL) 076 return null; 077 if (code == DataAbsentReason.UNKNOWN) 078 return "unknown"; 079 if (code == DataAbsentReason.ASKEDUNKNOWN) 080 return "asked-unknown"; 081 if (code == DataAbsentReason.TEMPUNKNOWN) 082 return "temp-unknown"; 083 if (code == DataAbsentReason.NOTASKED) 084 return "not-asked"; 085 if (code == DataAbsentReason.ASKEDDECLINED) 086 return "asked-declined"; 087 if (code == DataAbsentReason.MASKED) 088 return "masked"; 089 if (code == DataAbsentReason.NOTAPPLICABLE) 090 return "not-applicable"; 091 if (code == DataAbsentReason.UNSUPPORTED) 092 return "unsupported"; 093 if (code == DataAbsentReason.ASTEXT) 094 return "as-text"; 095 if (code == DataAbsentReason.ERROR) 096 return "error"; 097 if (code == DataAbsentReason.NOTANUMBER) 098 return "not-a-number"; 099 if (code == DataAbsentReason.NEGATIVEINFINITY) 100 return "negative-infinity"; 101 if (code == DataAbsentReason.POSITIVEINFINITY) 102 return "positive-infinity"; 103 if (code == DataAbsentReason.NOTPERFORMED) 104 return "not-performed"; 105 if (code == DataAbsentReason.NOTPERMITTED) 106 return "not-permitted"; 107 return "?"; 108 } 109 110 public String toSystem(DataAbsentReason code) { 111 return code.getSystem(); 112 } 113 114}