KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > beanutils > NestedTestBean


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
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
18 package org.apache.commons.beanutils;
19
20
21 import java.util.ArrayList JavaDoc;
22 import java.util.HashMap JavaDoc;
23 import java.util.List JavaDoc;
24 import java.util.Map JavaDoc;
25
26
27 /**
28  * Specialist test bean for complex nested properties.
29  *
30  * @author Robert Burrell Donkin
31  * @version $Revision: 1.4 $ $Date: 2004/02/28 13:18:36 $
32  */

33
34 public class NestedTestBean {
35     
36     
37     // ------------------------------------------------------------- Constructors
38
public NestedTestBean(String JavaDoc name) {
39         setName(name);
40     }
41     
42     
43     // ------------------------------------------------------------- Properties
44

45     private String JavaDoc name;
46     
47     public String JavaDoc getName() {
48         return name;
49     }
50     
51     public void setName(String JavaDoc name) {
52         this.name = name;
53     }
54     
55     
56     private String JavaDoc testString = "NOT SET";
57     
58     public String JavaDoc getTestString() {
59         return testString;
60     }
61     
62     public void setTestString(String JavaDoc testString) {
63         this.testString = testString;
64     }
65     
66     
67     private boolean testBoolean = false;
68     
69     public boolean getTestBoolean() {
70         return testBoolean;
71     }
72     
73     public void setTestBoolean(boolean testBoolean) {
74         this.testBoolean = testBoolean;
75     }
76     
77     
78     private NestedTestBean indexedBeans[];
79     
80     public void init() {
81         indexedBeans = new NestedTestBean[5];
82         indexedBeans[0] = new NestedTestBean("Bean@0");
83         indexedBeans[1] = new NestedTestBean("Bean@1");
84         indexedBeans[2] = new NestedTestBean("Bean@2");
85         indexedBeans[3] = new NestedTestBean("Bean@3");
86         indexedBeans[4] = new NestedTestBean("Bean@4");
87         
88         simpleBean = new NestedTestBean("Simple Property Bean");
89     };
90     
91     public NestedTestBean getIndexedProperty(int index) {
92         return (this.indexedBeans[index]);
93     }
94
95     public void setIndexedProperty(int index, NestedTestBean value) {
96         this.indexedBeans[index] = value;
97     }
98     
99     private NestedTestBean simpleBean;
100     
101     public NestedTestBean getSimpleBeanProperty() {
102         return simpleBean;
103     }
104     
105     // ------------------------------------------------------- Static Variables
106

107 }
108
Popular Tags