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.Jira61TestCase;
23
24 /***
25 * Factory which creates beans for {@link Jira61TestCase}.
26 *
27 * @version $Revision: 553357 $ $Date: 2007-07-05 02:10:25 +0100 (Thu, 05 Jul 2007) $
28 */
29 public class Jira61BeanFactory {
30
31 /***
32 * Factory method which creates a new {@link TestBean}.
33 *
34 * @return a new {@link TestBean}.
35 */
36 public static TestBean createBean() {
37 return new TestBean();
38 }
39
40 /***
41 * Test Bean
42 */
43 public static class TestBean {
44
45 private String[] indexed = new String[] {"one", "two", "three"};
46 private String simple = "FOO";
47 private Map mapped = new HashMap();
48
49 /*** Default Constructor */
50 public TestBean() {
51 mapped.put("foo-key", "foo-value");
52 mapped.put("bar-key", "bar-value");
53 }
54
55 /***
56 * Return simpleReadOnly
57 *
58 * @return the simple value
59 */
60 public String getSimpleReadOnly() {
61 return simple;
62 }
63
64 /***
65 * Set simpleWriteOnly
66 *
67 * @param simple simple value
68 */
69 public void setSimpleWriteOnly(String simple) {
70 this.simple = simple;
71 }
72
73 /***
74 * Return indexed property.
75 *
76 * @param index The index
77 * @return The indexed value
78 */
79 public String getIndexedReadOnly(int index) {
80 return indexed[index];
81 }
82
83 /***
84 * Set indexed property.
85 *
86 * @param index The index
87 * @param value The indexed value
88 */
89 public void setIndexedWriteOnly(int index, String value) {
90 this.indexed[index] = value;
91 }
92
93 /***
94 * Return mapped property.
95 *
96 * @param key The mapped key
97 * @return The mapped value
98 */
99 public String getMappedReadOnly(String key) {
100 return (String)mapped.get(key);
101 }
102
103 /***
104 * Set mapped property.
105 *
106 * @param key The mapped key
107 * @param value The mapped value
108 */
109 public void setMappedWriteOnly(String key, String value) {
110 mapped.put(key, value);
111 }
112
113 }
114
115 }