001 002package ca.uhn.fhir.model.dstu2.valueset; 003 004import ca.uhn.fhir.model.api.*; 005import java.util.HashMap; 006import java.util.Map; 007 008public enum ConditionsCodesEnum { 009 010 /** 011 * Display: <b>Headache</b><br> 012 * Code Value: <b>123987</b> 013 * 014 * Headache 015 */ 016 HEADACHE("123987", "http://hl7.org/fhir/fm-conditions"), 017 018 ; 019 020 /** 021 * Identifier for this Value Set: 022 * 023 */ 024 public static final String VALUESET_IDENTIFIER = ""; 025 026 /** 027 * Name for this Value Set: 028 * Conditions Codes 029 */ 030 public static final String VALUESET_NAME = "Conditions Codes"; 031 032 private static Map<String, ConditionsCodesEnum> CODE_TO_ENUM = new HashMap<String, ConditionsCodesEnum>(); 033 private static Map<String, Map<String, ConditionsCodesEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, ConditionsCodesEnum>>(); 034 035 private final String myCode; 036 private final String mySystem; 037 038 static { 039 for (ConditionsCodesEnum next : ConditionsCodesEnum.values()) { 040 CODE_TO_ENUM.put(next.getCode(), next); 041 042 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { 043 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, ConditionsCodesEnum>()); 044 } 045 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); 046 } 047 } 048 049 /** 050 * Returns the code associated with this enumerated value 051 */ 052 public String getCode() { 053 return myCode; 054 } 055 056 /** 057 * Returns the code system associated with this enumerated value 058 */ 059 public String getSystem() { 060 return mySystem; 061 } 062 063 /** 064 * Returns the enumerated value associated with this code 065 */ 066 public static ConditionsCodesEnum forCode(String theCode) { 067 ConditionsCodesEnum retVal = CODE_TO_ENUM.get(theCode); 068 return retVal; 069 } 070 071 /** 072 * Converts codes to their respective enumerated values 073 */ 074 public static final IValueSetEnumBinder<ConditionsCodesEnum> VALUESET_BINDER = new IValueSetEnumBinder<ConditionsCodesEnum>() { 075 @Override 076 public String toCodeString(ConditionsCodesEnum theEnum) { 077 return theEnum.getCode(); 078 } 079 080 @Override 081 public String toSystemString(ConditionsCodesEnum theEnum) { 082 return theEnum.getSystem(); 083 } 084 085 @Override 086 public ConditionsCodesEnum fromCodeString(String theCodeString) { 087 return CODE_TO_ENUM.get(theCodeString); 088 } 089 090 @Override 091 public ConditionsCodesEnum fromCodeString(String theCodeString, String theSystemString) { 092 Map<String, ConditionsCodesEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); 093 if (map == null) { 094 return null; 095 } 096 return map.get(theCodeString); 097 } 098 099 }; 100 101 /** 102 * Constructor 103 */ 104 ConditionsCodesEnum(String theCode, String theSystem) { 105 myCode = theCode; 106 mySystem = theSystem; 107 } 108 109 110}