1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary.exporter;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.exception.DuplicateKeyException;
20
21 import java.util.LinkedHashMap;
22 import java.util.Map;
23
24
25
26
27
28
29
30 @Deprecated
31 public class StringMap extends LinkedHashMap {
32 private static final long serialVersionUID = 7364206011639131063L;
33
34
35
36
37
38
39
40 public void set(String key, Map value) {
41 setUnique(key, value);
42 }
43
44
45
46
47
48
49
50 public void set(String key, String value) {
51 setUnique(key, value);
52 }
53
54
55
56
57
58
59
60
61 private void setUnique(String key, Object value) {
62 if (StringUtils.isBlank(key)) {
63 throw new IllegalArgumentException("invalid (blank) key");
64 }
65 if (value == null) {
66 throw new IllegalArgumentException("invalid (null) value");
67 }
68
69 if (containsKey(key)) {
70 throw new DuplicateKeyException("duplicate key '" + key + "'");
71 }
72
73 super.put(key, value);
74 }
75
76
77
78
79
80
81
82 public Object put(Object key, Object value) {
83 throw new UnsupportedOperationException("direct calls to put not supported");
84 }
85
86
87
88
89
90
91 public void putAll(Map m) {
92 throw new UnsupportedOperationException("direct calls to putAll not supported");
93 }
94 }