1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.modeshape.common.collection;
25
26 import java.io.IOException;
27 import java.io.InputStream;
28 import java.io.OutputStream;
29 import java.io.PrintStream;
30 import java.io.PrintWriter;
31 import java.util.Collection;
32 import java.util.Collections;
33 import java.util.Enumeration;
34 import java.util.Map;
35 import java.util.Properties;
36 import java.util.Set;
37 import java.util.Map.Entry;
38 import net.jcip.annotations.Immutable;
39
40
41
42
43 @Immutable
44 public class UnmodifiableProperties extends Properties {
45
46
47
48 private static final long serialVersionUID = -4670639332874922546L;
49 private Properties delegate;
50
51 public UnmodifiableProperties( Properties props ) {
52 super();
53 this.delegate = props != null ? props : new Properties();
54 }
55
56
57
58
59 @Override
60 public synchronized Object clone() {
61 return new UnmodifiableProperties(this.delegate);
62 }
63
64
65
66
67 @Override
68 public synchronized boolean contains( Object value ) {
69 return delegate.contains(value);
70 }
71
72
73
74
75 @Override
76 public boolean containsKey( Object key ) {
77 return this.delegate.containsKey(key);
78 }
79
80
81
82
83 @Override
84 public boolean containsValue( Object value ) {
85 return this.delegate.containsValue(value);
86 }
87
88
89
90
91 @Override
92 public Enumeration<Object> elements() {
93 return this.delegate.elements();
94 }
95
96
97
98
99 @Override
100 public boolean equals( Object o ) {
101 return this.delegate.equals(o);
102 }
103
104
105
106
107 @Override
108 public Object get( Object key ) {
109 return this.delegate.get(key);
110 }
111
112
113
114
115 @Override
116 public String getProperty( String key,
117 String defaultValue ) {
118 return this.delegate.getProperty(key, defaultValue);
119 }
120
121
122
123
124 @Override
125 public String getProperty( String key ) {
126 return this.delegate.getProperty(key);
127 }
128
129
130
131
132 @Override
133 public int hashCode() {
134 return this.delegate.hashCode();
135 }
136
137
138
139
140 @Override
141 public boolean isEmpty() {
142 return this.delegate.isEmpty();
143 }
144
145
146
147
148 @Override
149 public Enumeration<Object> keys() {
150 return this.delegate.keys();
151 }
152
153
154
155
156 @Override
157 public void list( PrintStream out ) {
158 this.delegate.list(out);
159 }
160
161
162
163
164 @Override
165 public void list( PrintWriter out ) {
166 this.delegate.list(out);
167 }
168
169
170
171
172 @Override
173 public Enumeration<?> propertyNames() {
174 return this.delegate.propertyNames();
175 }
176
177
178
179
180
181
182 @Deprecated
183 @Override
184 public void save( OutputStream out,
185 String comments ) {
186 this.delegate.save(out, comments);
187 }
188
189
190
191
192 @Override
193 public int size() {
194 return this.delegate.size();
195 }
196
197
198
199
200 @Override
201 public void store( OutputStream out,
202 String comments ) throws IOException {
203 this.delegate.store(out, comments);
204 }
205
206
207
208
209 @Override
210 public void storeToXML( OutputStream os,
211 String comment,
212 String encoding ) throws IOException {
213 this.delegate.storeToXML(os, comment, encoding);
214 }
215
216
217
218
219 @Override
220 public void storeToXML( OutputStream os,
221 String comment ) throws IOException {
222 this.delegate.storeToXML(os, comment);
223 }
224
225
226
227
228 @Override
229 public String toString() {
230 return this.delegate.toString();
231 }
232
233
234
235
236 @Override
237 public Collection<Object> values() {
238 return this.delegate.values();
239 }
240
241
242
243
244 @Override
245 public synchronized void clear() {
246 throw new UnsupportedOperationException();
247 }
248
249
250
251
252 @Override
253 public Set<Entry<Object, Object>> entrySet() {
254 return Collections.unmodifiableSet(super.entrySet());
255 }
256
257
258
259
260 @Override
261 public Set<Object> keySet() {
262 return Collections.unmodifiableSet(super.keySet());
263 }
264
265
266
267
268 @Override
269 public synchronized void load( InputStream inStream ) {
270 throw new UnsupportedOperationException();
271 }
272
273
274
275
276 @Override
277 public synchronized void loadFromXML( InputStream in ) {
278 throw new UnsupportedOperationException();
279 }
280
281
282
283
284 @Override
285 public synchronized Object put( Object key,
286 Object value ) {
287 throw new UnsupportedOperationException();
288 }
289
290
291
292
293 @Override
294 public synchronized void putAll( Map<? extends Object, ? extends Object> t ) {
295 throw new UnsupportedOperationException();
296 }
297
298
299
300
301 @Override
302 public synchronized Object remove( Object key ) {
303 throw new UnsupportedOperationException();
304 }
305
306
307
308
309 @Override
310 public synchronized Object setProperty( String key,
311 String value ) {
312 throw new UnsupportedOperationException();
313 }
314
315 }