KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > digester > TestBean


1 /* $Id: TestBean.java 155412 2005-02-26 12:58:36Z dirkv $
2  *
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * 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
19 package org.apache.commons.digester;
20
21
22 /**
23  * General purpose test bean for Digester tests.
24  *
25  * @author Craig R. McClanahan
26  * @version $Revision$ $Date: 2005-02-26 04:58:36 -0800 (Sat, 26 Feb 2005) $
27  */

28
29 public class TestBean {
30
31
32     // ------------------------------------------------------------- Properties
33

34
35     /**
36      * A boolean property whose initial value is true.
37      */

38     private boolean booleanProperty = true;
39
40     public boolean getBooleanProperty() {
41         return (booleanProperty);
42     }
43
44     public void setBooleanProperty(boolean booleanProperty) {
45         this.booleanProperty = booleanProperty;
46     }
47
48
49     /**
50      * A double property.
51      */

52     private double doubleProperty = 321.0;
53
54     public double getDoubleProperty() {
55         return (this.doubleProperty);
56     }
57
58     public void setDoubleProperty(double doubleProperty) {
59         this.doubleProperty = doubleProperty;
60     }
61
62
63     /**
64      * A boolean property whose initial value is false
65      */

66     private boolean falseProperty = false;
67
68     public boolean getFalseProperty() {
69         return (falseProperty);
70     }
71
72     public void setFalseProperty(boolean falseProperty) {
73         this.falseProperty = falseProperty;
74     }
75
76
77     /**
78      * A float property.
79      */

80     private float floatProperty = (float) 123.0;
81
82     public float getFloatProperty() {
83         return (this.floatProperty);
84     }
85
86     public void setFloatProperty(float floatProperty) {
87         this.floatProperty = floatProperty;
88     }
89
90
91     /**
92      * Integer arrays that are accessed as an array as well as indexed.
93      */

94     private int intArray[] = { 0, 10, 20, 30, 40 };
95
96     public int[] getIntArray() {
97         return (this.intArray);
98     }
99
100     public void setIntArray(int intArray[]) {
101         this.intArray = intArray;
102     }
103
104     private int intIndexed[] = { 0, 10, 20, 30, 40 };
105
106     public int getIntIndexed(int index) {
107         return (intIndexed[index]);
108     }
109
110     public void setIntIndexed(int index, int value) {
111         intIndexed[index] = value;
112     }
113
114
115     private int intMultibox[] = new int[0];
116
117     public int[] getIntMultibox() {
118         return (this.intMultibox);
119     }
120
121     public void setIntMultibox(int intMultibox[]) {
122         this.intMultibox = intMultibox;
123     }
124
125     /**
126      * An integer property.
127      */

128     private int intProperty = 123;
129
130     public int getIntProperty() {
131         return (this.intProperty);
132     }
133
134     public void setIntProperty(int intProperty) {
135         this.intProperty = intProperty;
136     }
137
138
139     /**
140      * A long property.
141      */

142     private long longProperty = 321;
143
144     public long getLongProperty() {
145         return (this.longProperty);
146     }
147
148     public void setLongProperty(long longProperty) {
149         this.longProperty = longProperty;
150     }
151
152
153     /**
154      * A multiple-String SELECT element.
155      */

156     private String JavaDoc[] multipleSelect = { "Multiple 3", "Multiple 5",
157         "Multiple 7" };
158
159     public String JavaDoc[] getMultipleSelect() {
160         return (this.multipleSelect);
161     }
162
163     public void setMultipleSelect(String JavaDoc multipleSelect[]) {
164         this.multipleSelect = multipleSelect;
165     }
166
167
168     /**
169      * A nested reference to another test bean (populated as needed).
170      */

171     private TestBean nested = null;
172
173     public TestBean getNested() {
174         if (nested == null)
175             nested = new TestBean();
176         return (nested);
177     }
178
179
180     /**
181      * A String property with an initial value of null.
182      */

183     private String JavaDoc nullProperty = null;
184
185     public String JavaDoc getNullProperty() {
186         return (this.nullProperty);
187     }
188
189     public void setNullProperty(String JavaDoc nullProperty) {
190         this.nullProperty = nullProperty;
191     }
192
193
194     /**
195      * A short property.
196      */

197     private short shortProperty = (short) 987;
198
199     public short getShortProperty() {
200         return (this.shortProperty);
201     }
202
203     public void setShortProperty(short shortProperty) {
204         this.shortProperty = shortProperty;
205     }
206
207
208     /**
209      * A single-String value for a SELECT element.
210      */

211     private String JavaDoc singleSelect = "Single 5";
212
213     public String JavaDoc getSingleSelect() {
214         return (this.singleSelect);
215     }
216
217     public void setSingleSelect(String JavaDoc singleSelect) {
218         this.singleSelect = singleSelect;
219     }
220
221
222     /**
223      * String arrays that are accessed as an array as well as indexed.
224      */

225     private String JavaDoc stringArray[] =
226             { "String 0", "String 1", "String 2", "String 3", "String 4" };
227
228     public String JavaDoc[] getStringArray() {
229         return (this.stringArray);
230     }
231
232     public void setStringArray(String JavaDoc stringArray[]) {
233         this.stringArray = stringArray;
234     }
235
236     private String JavaDoc stringIndexed[] =
237             { "String 0", "String 1", "String 2", "String 3", "String 4" };
238
239     public String JavaDoc getStringIndexed(int index) {
240         return (stringIndexed[index]);
241     }
242
243     public void setStringIndexed(int index, String JavaDoc value) {
244         stringIndexed[index] = value;
245     }
246
247
248     /**
249      * A String property.
250      */

251     private String JavaDoc stringProperty = "This is a string";
252
253     public String JavaDoc getStringProperty() {
254         return (this.stringProperty);
255     }
256
257     public void setStringProperty(String JavaDoc stringProperty) {
258         this.stringProperty = stringProperty;
259     }
260
261     /**
262      * An empty String property.
263      */

264     private String JavaDoc emptyStringProperty = "";
265
266     public String JavaDoc getEmptyStringProperty() {
267         return (this.emptyStringProperty);
268     }
269
270     public void setEmptyStringProperty(String JavaDoc emptyStringProperty) {
271         this.emptyStringProperty = emptyStringProperty;
272     }
273
274
275 }
276
Popular Tags