1 16 17 package org.springframework.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.SortedSet ; 26 import java.util.TreeSet ; 27 28 32 public class IndexedTestBean { 33 34 private TestBean[] array; 35 36 private List list; 37 38 private SortedSet sortedSet; 39 40 private Set set; 41 42 private Collection collection; 43 44 private Map 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 (); 69 this.list.add(tb2); 70 this.list.add(tb3); 71 this.set = new TreeSet (); 72 this.set.add(tb6); 73 this.set.add(tb7); 74 this.map = new HashMap (); 75 this.map.put("key1", tb4); 76 this.map.put("key2", tb5); 77 this.map.put("key.3", tb5); 78 List list = new ArrayList (); 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 getList() { 93 return list; 94 } 95 96 public void setList(List list) { 97 this.list = list; 98 } 99 100 public SortedSet getSortedSet() { 101 return sortedSet; 102 } 103 104 public void setSortedSet(SortedSet sortedSet) { 105 this.sortedSet = sortedSet; 106 } 107 108 public Set getSet() { 109 return set; 110 } 111 112 public void setSet(Set set) { 113 this.set = set; 114 } 115 116 public Collection getCollection() { 117 return collection; 118 } 119 120 public void setCollection(Collection collection) { 121 this.collection = collection; 122 } 123 124 public Map getMap() { 125 return map; 126 } 127 128 public void setMap(Map map) { 129 this.map = map; 130 } 131 132 } 133 | Popular Tags |