View Javadoc
1   /*
2    * Copyright 2002-2008 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.tests.sample.beans;
18  
19  import java.util.ArrayList;
20  import java.util.Collection;
21  import java.util.HashMap;
22  import java.util.List;
23  import java.util.Map;
24  import java.util.Set;
25  import java.util.SortedMap;
26  import java.util.SortedSet;
27  import java.util.TreeSet;
28  
29  /**
30   * @author Juergen Hoeller
31   * @since 11.11.2003
32   */
33  public class IndexedTestBean {
34  
35  	private TestBean[] array;
36  
37  	private Collection<?> collection;
38  
39  	private List list;
40  
41  	private Set<? super Object> set;
42  
43  	private SortedSet<? super Object> sortedSet;
44  
45  	private Map map;
46  
47  	private SortedMap sortedMap;
48  
49  
50  	public IndexedTestBean() {
51  		this(true);
52  	}
53  
54  	public IndexedTestBean(boolean populate) {
55  		if (populate) {
56  			populate();
57  		}
58  	}
59  
60  	public void populate() {
61  		TestBean tb0 = new TestBean("name0", 0);
62  		TestBean tb1 = new TestBean("name1", 0);
63  		TestBean tb2 = new TestBean("name2", 0);
64  		TestBean tb3 = new TestBean("name3", 0);
65  		TestBean tb4 = new TestBean("name4", 0);
66  		TestBean tb5 = new TestBean("name5", 0);
67  		TestBean tb6 = new TestBean("name6", 0);
68  		TestBean tb7 = new TestBean("name7", 0);
69  		TestBean tbX = new TestBean("nameX", 0);
70  		TestBean tbY = new TestBean("nameY", 0);
71  		this.array = new TestBean[] {tb0, tb1};
72  		this.list = new ArrayList<Object>();
73  		this.list.add(tb2);
74  		this.list.add(tb3);
75  		this.set = new TreeSet<Object>();
76  		this.set.add(tb6);
77  		this.set.add(tb7);
78  		this.map = new HashMap<Object, Object>();
79  		this.map.put("key1", tb4);
80  		this.map.put("key2", tb5);
81  		this.map.put("key.3", tb5);
82  		List list = new ArrayList();
83  		list.add(tbX);
84  		list.add(tbY);
85  		this.map.put("key4", list);
86  	}
87  
88  
89  	public TestBean[] getArray() {
90  		return array;
91  	}
92  
93  	public void setArray(TestBean[] array) {
94  		this.array = array;
95  	}
96  
97  	public Collection<?> getCollection() {
98  		return collection;
99  	}
100 
101 	public void setCollection(Collection<?> collection) {
102 		this.collection = collection;
103 	}
104 
105 	public List getList() {
106 		return list;
107 	}
108 
109 	public void setList(List list) {
110 		this.list = list;
111 	}
112 
113 	public Set<?> getSet() {
114 		return set;
115 	}
116 
117 	public void setSet(Set<? super Object> set) {
118 		this.set = set;
119 	}
120 
121 	public SortedSet<? super Object> getSortedSet() {
122 		return sortedSet;
123 	}
124 
125 	public void setSortedSet(SortedSet<? super Object> sortedSet) {
126 		this.sortedSet = sortedSet;
127 	}
128 
129 	public Map getMap() {
130 		return map;
131 	}
132 
133 	public void setMap(Map map) {
134 		this.map = map;
135 	}
136 
137 	public SortedMap getSortedMap() {
138 		return sortedMap;
139 	}
140 
141 	public void setSortedMap(SortedMap sortedMap) {
142 		this.sortedMap = sortedMap;
143 	}
144 
145 }