IndexedTestBean.java
Upload User: yntgsq
Upload Date: 2021-04-28
Package Size: 45995k
Code Size: 3k
Category:

Java Develop

Development Platform:

Java

  1. /*
  2.  * Copyright 2002-2006 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. package org.springframework.beans;
  17. import java.util.ArrayList;
  18. import java.util.Collection;
  19. import java.util.HashMap;
  20. import java.util.List;
  21. import java.util.Map;
  22. import java.util.Set;
  23. import java.util.SortedMap;
  24. import java.util.SortedSet;
  25. import java.util.TreeSet;
  26. /**
  27.  * @author Juergen Hoeller
  28.  * @since 11.11.2003
  29.  */
  30. public class IndexedTestBean {
  31. private TestBean[] array;
  32. private Collection collection;
  33. private List list;
  34. private Set set;
  35. private SortedSet sortedSet;
  36. private Map map;
  37. private SortedMap sortedMap;
  38. public IndexedTestBean() {
  39. this(true);
  40. }
  41. public IndexedTestBean(boolean populate) {
  42. if (populate) {
  43. populate();
  44. }
  45. }
  46. public void populate() {
  47. TestBean tb0 = new TestBean("name0", 0);
  48. TestBean tb1 = new TestBean("name1", 0);
  49. TestBean tb2 = new TestBean("name2", 0);
  50. TestBean tb3 = new TestBean("name3", 0);
  51. TestBean tb4 = new TestBean("name4", 0);
  52. TestBean tb5 = new TestBean("name5", 0);
  53. TestBean tb6 = new TestBean("name6", 0);
  54. TestBean tb7 = new TestBean("name7", 0);
  55. TestBean tbX = new TestBean("nameX", 0);
  56. TestBean tbY = new TestBean("nameY", 0);
  57. this.array = new TestBean[] {tb0, tb1};
  58. this.list = new ArrayList();
  59. this.list.add(tb2);
  60. this.list.add(tb3);
  61. this.set = new TreeSet();
  62. this.set.add(tb6);
  63. this.set.add(tb7);
  64. this.map = new HashMap();
  65. this.map.put("key1", tb4);
  66. this.map.put("key2", tb5);
  67. this.map.put("key.3", tb5);
  68. List list = new ArrayList();
  69. list.add(tbX);
  70. list.add(tbY);
  71. this.map.put("key4", list);
  72. }
  73. public TestBean[] getArray() {
  74. return array;
  75. }
  76. public void setArray(TestBean[] array) {
  77. this.array = array;
  78. }
  79. public Collection getCollection() {
  80. return collection;
  81. }
  82. public void setCollection(Collection collection) {
  83. this.collection = collection;
  84. }
  85. public List getList() {
  86. return list;
  87. }
  88. public void setList(List list) {
  89. this.list = list;
  90. }
  91. public Set getSet() {
  92. return set;
  93. }
  94. public void setSet(Set set) {
  95. this.set = set;
  96. }
  97. public SortedSet getSortedSet() {
  98. return sortedSet;
  99. }
  100. public void setSortedSet(SortedSet sortedSet) {
  101. this.sortedSet = sortedSet;
  102. }
  103. public Map getMap() {
  104. return map;
  105. }
  106. public void setMap(Map map) {
  107. this.map = map;
  108. }
  109. public SortedMap getSortedMap() {
  110. return sortedMap;
  111. }
  112. public void setSortedMap(SortedMap sortedMap) {
  113. this.sortedMap = sortedMap;
  114. }
  115. }