1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jxpath;
18
19 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.HashSet;
22 import java.util.List;
23 import java.util.Map;
24 import java.util.Set;
25
26 import org.apache.commons.jxpath.util.ValueUtils;
27
28
29
30
31
32
33
34 public class TestBean {
35
36
37
38
39
40
41 private NestedTestBean[] beans;
42 {
43 beans = new NestedTestBean[2];
44 beans[0] = new NestedTestBean("Name 1");
45 beans[1] = new NestedTestBean("Name 2");
46 beans[1].setInt(3);
47 }
48
49 public NestedTestBean[] getBeans() {
50 return beans;
51 }
52
53 public void setBeans(NestedTestBean[] beans) {
54 this.beans = beans;
55 }
56
57
58
59
60 private boolean bool = false;
61 public boolean isBoolean() {
62 return bool;
63 }
64
65 public void setBoolean(boolean bool) {
66 this.bool = bool;
67 }
68
69 private int integer = 1;
70
71
72
73 public int getInt() {
74 return integer;
75 }
76
77 public void setInt(int integer) {
78 this.integer = integer;
79 }
80
81
82
83
84 private int[] array = { 1, 2, 3, 4 };
85 public int[] getIntegers() {
86 return array;
87 }
88
89 public int getIntegers(int index) {
90 return array[index];
91 }
92
93 public void setIntegers(int index, int value) {
94 if (index >= array.length) {
95 array = (int[]) ValueUtils.expandCollection(array, index + 1);
96 }
97 array[index] = value;
98 }
99
100
101
102
103 private ArrayList list;
104 public List getList() {
105 if (list == null) {
106 list = new ArrayList();
107 list.add("String 3");
108 list.add(new Integer(3));
109 list.add(new NestedTestBean("Name 3"));
110 }
111 return list;
112 }
113
114
115
116
117 private HashMap map;
118 {
119 map = new HashMap();
120 map.put("Key1", "Value 1");
121 map.put("Key2", new NestedTestBean("Name 6"));
122 }
123
124 public Map getMap() {
125 return map;
126 }
127
128 public void setMap(Map map) {
129 this.map = (HashMap) map;
130 }
131
132
133
134
135 private NestedTestBean nestedBean = new NestedTestBean("Name 0");
136 public NestedTestBean getNestedBean() {
137 return nestedBean;
138 }
139
140 public void setNestedBean(NestedTestBean bean) {
141 this.nestedBean = bean;
142 }
143
144 private NestedTestBean object = new NestedTestBean("Name 5");
145
146
147
148
149 public Object getObject() {
150 return object;
151 }
152
153
154
155
156 public Object getObjects() {
157 return getIntegers();
158 }
159
160
161
162
163 private HashSet set;
164 public Set getSet() {
165 if (set == null) {
166 set = new HashSet();
167 set.add("String 4");
168 set.add(new Integer(4));
169 set.add(new NestedTestBean("Name 4"));
170 }
171 return set;
172 }
173
174 public String toString() {
175 return "ROOT";
176 }
177 }