1
2 package ca.uhn.fhir.model.dstu.valueset;
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import java.util.HashMap;
25 import java.util.Map;
26
27 import ca.uhn.fhir.model.api.IValueSetEnumBinder;
28
29 public enum PropertyRepresentationEnum {
30
31
32
33
34
35
36 XMLATTR("xmlAttr", "http://hl7.org/fhir/property-representation"),
37
38 ;
39
40
41
42
43
44 public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/property-representation";
45
46
47
48
49
50 public static final String VALUESET_NAME = "PropertyRepresentation";
51
52 private static Map<String, PropertyRepresentationEnum> CODE_TO_ENUM = new HashMap<String, PropertyRepresentationEnum>();
53 private static Map<String, Map<String, PropertyRepresentationEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, PropertyRepresentationEnum>>();
54
55 private final String myCode;
56 private final String mySystem;
57
58 static {
59 for (PropertyRepresentationEnum next : PropertyRepresentationEnum.values()) {
60 CODE_TO_ENUM.put(next.getCode(), next);
61
62 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
63 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, PropertyRepresentationEnum>());
64 }
65 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);
66 }
67 }
68
69
70
71
72 public String getCode() {
73 return myCode;
74 }
75
76
77
78
79 public String getSystem() {
80 return mySystem;
81 }
82
83
84
85
86 public PropertyRepresentationEnum forCode(String theCode) {
87 PropertyRepresentationEnum retVal = CODE_TO_ENUM.get(theCode);
88 return retVal;
89 }
90
91
92
93
94 public static final IValueSetEnumBinder<PropertyRepresentationEnum> VALUESET_BINDER = new IValueSetEnumBinder<PropertyRepresentationEnum>() {
95 @Override
96 public String toCodeString(PropertyRepresentationEnum theEnum) {
97 return theEnum.getCode();
98 }
99
100 @Override
101 public String toSystemString(PropertyRepresentationEnum theEnum) {
102 return theEnum.getSystem();
103 }
104
105 @Override
106 public PropertyRepresentationEnum fromCodeString(String theCodeString) {
107 return CODE_TO_ENUM.get(theCodeString);
108 }
109
110 @Override
111 public PropertyRepresentationEnum fromCodeString(String theCodeString, String theSystemString) {
112 Map<String, PropertyRepresentationEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
113 if (map == null) {
114 return null;
115 }
116 return map.get(theCodeString);
117 }
118
119 };
120
121
122
123
124 PropertyRepresentationEnum(String theCode, String theSystem) {
125 myCode = theCode;
126 mySystem = theSystem;
127 }
128
129
130 }