blob: b7bd43793d030799729c698d59c7ac484ba1cbf9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
package com.netscape.cmscore.request;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* Subclass of Hashtable returned by IRequest.getExtDataInHashtable. Its
* purpose is to hide the fact that LDAP doesn't preserve the case of keys.
* It does this by lowercasing all keys used to access the Hashtable.
*/
public class ExtDataHashtable<V> extends Hashtable<String, V> {
/**
*
*/
private static final long serialVersionUID = 8401134619951331450L;
public ExtDataHashtable() {
super();
}
public ExtDataHashtable(int i) {
super(i);
}
public ExtDataHashtable(int i, float v) {
super(i, v);
}
public ExtDataHashtable(Map<? extends String, ? extends V> map) {
// the super constructor seems to call putAll, but I can't
// rely on that behaviour
super();
putAll(map);
}
public boolean containsKey(Object o) {
if (o instanceof String) {
String key = (String) o;
return super.containsKey(key.toLowerCase());
}
return super.containsKey(o);
}
public V get(Object o) {
if (o instanceof String) {
String key = (String) o;
return super.get(key.toLowerCase());
}
return super.get(o);
}
public V put(String oKey, V val) {
return super.put(oKey.toLowerCase(), val);
}
public void putAll(Map<? extends String, ? extends V> map) {
Set<? extends String> keys = map.keySet();
for (Iterator<? extends String> i = keys.iterator(); i.hasNext();) {
Object key = i.next();
put((String) key, map.get(key));
}
}
public V remove(Object o) {
if (o instanceof String) {
String key = (String) o;
return super.remove(key.toLowerCase());
}
return super.remove(o);
}
}
|