1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.util; |
17 | |
|
18 | |
import java.util.Collection; |
19 | |
import java.util.Map; |
20 | |
import java.util.Properties; |
21 | |
import java.util.Set; |
22 | |
|
23 | |
import org.kuali.rice.krad.util.properties.PropertyTree; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
public class JstlPropertyHolder implements Map { |
44 | |
private PropertyTree propertyTree; |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | 0 | public JstlPropertyHolder() { |
50 | 0 | propertyTree = null; |
51 | 0 | } |
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
public void setProperties(Properties properties) { |
59 | 0 | propertyTree = new PropertyTree(properties); |
60 | 0 | } |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
protected void setPropertyTree(PropertyTree tree) { |
70 | 0 | propertyTree = tree; |
71 | 0 | } |
72 | |
|
73 | |
|
74 | |
|
75 | |
@Override |
76 | |
public Object get(Object key) { |
77 | 0 | if (propertyTree == null) { |
78 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
79 | |
} |
80 | 0 | return this.propertyTree.get(key); |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public int size() { |
85 | 0 | if (propertyTree == null) { |
86 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
87 | |
} |
88 | 0 | return this.propertyTree.size(); |
89 | |
} |
90 | |
|
91 | |
@Override |
92 | |
public void clear() { |
93 | 0 | if (propertyTree == null) { |
94 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
95 | |
} |
96 | 0 | this.propertyTree.clear(); |
97 | 0 | } |
98 | |
|
99 | |
@Override |
100 | |
public boolean isEmpty() { |
101 | 0 | if (propertyTree == null) { |
102 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
103 | |
} |
104 | 0 | return this.propertyTree.isEmpty(); |
105 | |
} |
106 | |
|
107 | |
@Override |
108 | |
public boolean containsKey(Object key) { |
109 | 0 | if (propertyTree == null) { |
110 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
111 | |
} |
112 | 0 | return this.propertyTree.containsKey(key); |
113 | |
} |
114 | |
|
115 | |
@Override |
116 | |
public boolean containsValue(Object value) { |
117 | 0 | if (propertyTree == null) { |
118 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
119 | |
} |
120 | 0 | return this.propertyTree.containsValue(value); |
121 | |
} |
122 | |
|
123 | |
@Override |
124 | |
public Collection values() { |
125 | 0 | if (propertyTree == null) { |
126 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
127 | |
} |
128 | 0 | return this.propertyTree.values(); |
129 | |
} |
130 | |
|
131 | |
@Override |
132 | |
public void putAll(Map m) { |
133 | 0 | if (propertyTree == null) { |
134 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
135 | |
} |
136 | 0 | this.propertyTree.putAll(m); |
137 | 0 | } |
138 | |
|
139 | |
@Override |
140 | |
public Set entrySet() { |
141 | 0 | if (propertyTree == null) { |
142 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
143 | |
} |
144 | 0 | return this.propertyTree.entrySet(); |
145 | |
} |
146 | |
|
147 | |
@Override |
148 | |
public Set keySet() { |
149 | 0 | if (propertyTree == null) { |
150 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
151 | |
} |
152 | 0 | return this.propertyTree.keySet(); |
153 | |
} |
154 | |
|
155 | |
@Override |
156 | |
public Object remove(Object key) { |
157 | 0 | if (propertyTree == null) { |
158 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
159 | |
} |
160 | 0 | return this.propertyTree.remove(key); |
161 | |
} |
162 | |
|
163 | |
@Override |
164 | |
public Object put(Object key, Object value) { |
165 | 0 | if (propertyTree == null) { |
166 | 0 | throw new IllegalStateException("propertyTree has not been initialized"); |
167 | |
} |
168 | 0 | return this.propertyTree.put(key, value); |
169 | |
} |
170 | |
} |