|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| package org.apache.tapestry.util; |
|
16 |
| |
|
17 |
| import java.util.ArrayList; |
|
18 |
| import java.util.Collections; |
|
19 |
| import java.util.HashMap; |
|
20 |
| import java.util.List; |
|
21 |
| import java.util.Map; |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| public class BasePropertyHolder implements IPropertyHolder |
|
32 |
| { |
|
33 |
| private static final int MAP_SIZE = 7; |
|
34 |
| private Map properties; |
|
35 |
| |
|
36 |
11790
| public String getProperty(String name)
|
|
37 |
| { |
|
38 |
11790
| if (properties == null)
|
|
39 |
10476
| return null;
|
|
40 |
| |
|
41 |
1314
| return (String) properties.get(name);
|
|
42 |
| } |
|
43 |
| |
|
44 |
174
| public void setProperty(String name, String value)
|
|
45 |
| { |
|
46 |
174
| if (value == null)
|
|
47 |
| { |
|
48 |
0
| removeProperty(name);
|
|
49 |
0
| return;
|
|
50 |
| } |
|
51 |
| |
|
52 |
174
| if (properties == null)
|
|
53 |
120
| properties = new HashMap(MAP_SIZE);
|
|
54 |
| |
|
55 |
174
| properties.put(name, value);
|
|
56 |
| } |
|
57 |
| |
|
58 |
0
| public void removeProperty(String name)
|
|
59 |
| { |
|
60 |
0
| if (properties == null)
|
|
61 |
0
| return;
|
|
62 |
| |
|
63 |
0
| properties.remove(name);
|
|
64 |
| } |
|
65 |
| |
|
66 |
6
| public List getPropertyNames()
|
|
67 |
| { |
|
68 |
6
| if (properties == null)
|
|
69 |
0
| return Collections.EMPTY_LIST;
|
|
70 |
| |
|
71 |
6
| List result = new ArrayList(properties.keySet());
|
|
72 |
| |
|
73 |
6
| Collections.sort(result);
|
|
74 |
| |
|
75 |
6
| return result;
|
|
76 |
| } |
|
77 |
| |
|
78 |
| } |