1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.beanutils.bugs.other;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 import org.apache.commons.beanutils.bugs.Jira18TestCase;
23
24 /***
25 * Factory whcih creates <i>package</i> scope beans with
26 * public methods for {@link Jira18TestCase}.
27 *
28 * @version $Revision: 556237 $ $Date: 2007-07-14 08:27:18 +0100 (Sat, 14 Jul 2007) $
29 */
30 public class Jira18BeanFactory {
31
32 /***
33 * Factory method which creates package friendly beans.
34 *
35 * @return The a package friendly bean with public methods
36 */
37 public static Object createBean() {
38 return new PackageFriendlyBean();
39 }
40
41
42 static class PackageFriendlyBean {
43
44 private String[] indexed = new String[] {"one", "two", "three"};
45 private String simple = "FOO";
46 private Map mapped = new HashMap();
47
48 /*** Default Constructor */
49 public PackageFriendlyBean() {
50 mapped.put("foo-key", "foo-value");
51 mapped.put("bar-key", "bar-value");
52 }
53 /***
54 * Return simple property.
55 *
56 * @return The simple value
57 */
58 public String getSimple() {
59 return simple;
60 }
61
62 /***
63 * Set simple property.
64 *
65 * @param simple The simple value
66 */
67 public void setSimple(String simple) {
68 this.simple = simple;
69 }
70
71 /***
72 * Return indexed property.
73 *
74 * @param index The index
75 * @return The indexed value
76 */
77 public String getIndexed(int index) {
78 return indexed[index];
79 }
80
81 /***
82 * Set indexed property.
83 *
84 * @param index The index
85 * @param value The indexed value
86 */
87 public void setIndexed(int index, String value) {
88 this.indexed[index] = value;
89 }
90
91 /***
92 * Return mapped property.
93 *
94 * @param key The mapped key
95 * @return The mapped value
96 */
97 public String getMapped(String key) {
98 return (String)mapped.get(key);
99 }
100
101 /***
102 * Set mapped property.
103 *
104 * @param key The mapped key
105 * @param value The mapped value
106 */
107 public void setMapped(String key, String value) {
108 mapped.put(key, value);
109 }
110
111 }
112
113 }