1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.core.util;
17
18 import java.io.IOException;
19 import java.io.InputStream;
20 import java.io.OutputStream;
21 import java.io.Reader;
22 import java.util.InvalidPropertiesFormatException;
23 import java.util.Map;
24 import java.util.Properties;
25
26
27
28
29
30
31
32 public class ImmutableProperties extends Properties {
33
34 public ImmutableProperties(Properties properties){
35 super();
36 for(Object o: properties.keySet()){
37 super.put(o, properties.get(o));
38 }
39 }
40
41 @Override
42 public synchronized void load(InputStream inStream) throws IOException {
43 throw new UnsupportedOperationException("This class is immutable");
44 }
45
46 @Override
47 public synchronized void load(Reader reader) throws IOException {
48 throw new UnsupportedOperationException("This class is immutable");
49 }
50
51 @Override
52 public synchronized void loadFromXML(InputStream in) throws IOException,
53 InvalidPropertiesFormatException {
54 throw new UnsupportedOperationException("This class is immutable");
55 }
56
57 @Deprecated
58 @Override
59 public synchronized void save(OutputStream out, String comments) {
60 throw new UnsupportedOperationException("This class is immutable");
61 }
62
63 @Override
64 public synchronized Object setProperty(String key, String value) {
65 throw new UnsupportedOperationException("This class is immutable");
66 }
67
68 @Override
69 public synchronized Object put(Object key, Object value) {
70 throw new UnsupportedOperationException("This class is immutable");
71 }
72
73 @Override
74 public synchronized void putAll(Map<? extends Object, ? extends Object> t) {
75 throw new UnsupportedOperationException("This class is immutable");
76 }
77
78 @Override
79 public synchronized Object remove(Object key) {
80 throw new UnsupportedOperationException("This class is immutable");
81 }
82
83 }