01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package org.apache.commons.beanutils;
19:
20: /**
21: * Specialist test bean for complex nested properties.
22: *
23: * @author Robert Burrell Donkin
24: * @version $Revision: 469737 $ $Date: 2006-11-01 01:16:55 +0000 (Wed, 01 Nov 2006) $
25: */
26:
27: public class NestedTestBean {
28:
29: // ------------------------------------------------------------- Constructors
30: public NestedTestBean(String name) {
31: setName(name);
32: }
33:
34: // ------------------------------------------------------------- Properties
35:
36: private String name;
37:
38: public String getName() {
39: return name;
40: }
41:
42: public void setName(String name) {
43: this .name = name;
44: }
45:
46: private String testString = "NOT SET";
47:
48: public String getTestString() {
49: return testString;
50: }
51:
52: public void setTestString(String testString) {
53: this .testString = testString;
54: }
55:
56: private boolean testBoolean = false;
57:
58: public boolean getTestBoolean() {
59: return testBoolean;
60: }
61:
62: public void setTestBoolean(boolean testBoolean) {
63: this .testBoolean = testBoolean;
64: }
65:
66: private NestedTestBean indexedBeans[];
67:
68: public void init() {
69: indexedBeans = new NestedTestBean[5];
70: indexedBeans[0] = new NestedTestBean("Bean@0");
71: indexedBeans[1] = new NestedTestBean("Bean@1");
72: indexedBeans[2] = new NestedTestBean("Bean@2");
73: indexedBeans[3] = new NestedTestBean("Bean@3");
74: indexedBeans[4] = new NestedTestBean("Bean@4");
75:
76: simpleBean = new NestedTestBean("Simple Property Bean");
77: }
78:
79: public NestedTestBean getIndexedProperty(int index) {
80: return (this .indexedBeans[index]);
81: }
82:
83: public void setIndexedProperty(int index, NestedTestBean value) {
84: this .indexedBeans[index] = value;
85: }
86:
87: private NestedTestBean simpleBean;
88:
89: public NestedTestBean getSimpleBeanProperty() {
90: return simpleBean;
91: }
92:
93: // ------------------------------------------------------- Static Variables
94:
95: }
|