KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > beans > IndexedTestBean


1 /*
2  * Copyright 2002-2005 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.beans;
18
19 import java.util.ArrayList JavaDoc;
20 import java.util.Collection JavaDoc;
21 import java.util.HashMap JavaDoc;
22 import java.util.List JavaDoc;
23 import java.util.Map JavaDoc;
24 import java.util.Set JavaDoc;
25 import java.util.SortedSet JavaDoc;
26 import java.util.TreeSet JavaDoc;
27
28 /**
29  * @author Juergen Hoeller
30  * @since 11.11.2003
31  */

32 public class IndexedTestBean {
33
34     private TestBean[] array;
35
36     private List JavaDoc list;
37
38     private SortedSet JavaDoc sortedSet;
39
40     private Set JavaDoc set;
41
42     private Collection JavaDoc collection;
43
44     private Map JavaDoc map;
45
46     public IndexedTestBean() {
47         this(true);
48     }
49
50     public IndexedTestBean(boolean populate) {
51         if (populate) {
52             populate();
53         }
54     }
55
56     public void populate() {
57         TestBean tb0 = new TestBean("name0", 0);
58         TestBean tb1 = new TestBean("name1", 0);
59         TestBean tb2 = new TestBean("name2", 0);
60         TestBean tb3 = new TestBean("name3", 0);
61         TestBean tb4 = new TestBean("name4", 0);
62         TestBean tb5 = new TestBean("name5", 0);
63         TestBean tb6 = new TestBean("name6", 0);
64         TestBean tb7 = new TestBean("name7", 0);
65         TestBean tbX = new TestBean("nameX", 0);
66         TestBean tbY = new TestBean("nameY", 0);
67         this.array = new TestBean[] {tb0, tb1};
68         this.list = new ArrayList JavaDoc();
69         this.list.add(tb2);
70         this.list.add(tb3);
71         this.set = new TreeSet JavaDoc();
72         this.set.add(tb6);
73         this.set.add(tb7);
74         this.map = new HashMap JavaDoc();
75         this.map.put("key1", tb4);
76         this.map.put("key2", tb5);
77         this.map.put("key.3", tb5);
78         List JavaDoc list = new ArrayList JavaDoc();
79         list.add(tbX);
80         list.add(tbY);
81         this.map.put("key4", list);
82     }
83
84     public TestBean[] getArray() {
85         return array;
86     }
87
88     public void setArray(TestBean[] array) {
89         this.array = array;
90     }
91
92     public List JavaDoc getList() {
93         return list;
94     }
95
96     public void setList(List JavaDoc list) {
97         this.list = list;
98     }
99
100     public SortedSet JavaDoc getSortedSet() {
101         return sortedSet;
102     }
103
104     public void setSortedSet(SortedSet JavaDoc sortedSet) {
105         this.sortedSet = sortedSet;
106     }
107
108     public Set JavaDoc getSet() {
109         return set;
110     }
111
112     public void setSet(Set JavaDoc set) {
113         this.set = set;
114     }
115
116     public Collection JavaDoc getCollection() {
117         return collection;
118     }
119
120     public void setCollection(Collection JavaDoc collection) {
121         this.collection = collection;
122     }
123
124     public Map JavaDoc getMap() {
125         return map;
126     }
127
128     public void setMap(Map JavaDoc map) {
129         this.map = map;
130     }
131
132 }
133
Popular Tags