KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > beans > test > Bean1


1 /*
2  * Copyright (c) 2003, Inversoft
3  *
4  * This software is distribuable under the GNU Lesser General Public License.
5  * For more information visit gnu.org.
6  */

7 package com.inversoft.beans.test;
8
9 import java.util.HashMap JavaDoc;
10
11
12 /**
13  * This class is a simple JavaBean that is used in testing
14  * @author Brian Pontarelli
15  */

16 public class Bean1 extends SuperBean {
17
18     private Bean2 property1;
19     private Bean4 property4;
20
21     private Bean2[] array = new Bean2[1];
22     private Object JavaDoc[] objectArray = new Object JavaDoc[1];
23     private Bean2[][][] multiArray = new Bean2[1][2][3];
24     private Object JavaDoc[][][] multiObjectArray = new Object JavaDoc[1][2][3];
25
26     private String JavaDoc[] strArray = new String JavaDoc[3];
27     private String JavaDoc readOnly = "readOnly";
28     private String JavaDoc[] readOnlyIndexed = new String JavaDoc[] {"readOnly"};
29     private String JavaDoc string1;
30     private Integer JavaDoc integer1;
31     private Integer JavaDoc[] integerIndexed = new Integer JavaDoc[] { new Integer JavaDoc(1) };
32     private boolean boolean1;
33     private boolean[] booleanIndexed = new boolean[] {true};
34     private byte byte1;
35     private char char1;
36     private double double1;
37     private float float1;
38     private int int1;
39     private int[] intIndexed = new int[] {1};
40     private long long1;
41     private short short1;
42     private HashMap JavaDoc map;
43
44
45     /** Gets the property1 property */
46     public Bean2 getProperty1(){
47         return property1;
48     }
49
50     /** Sets the property1 property */
51     public void setProperty1(Bean2 value) {
52         this.property1 = value;
53     }
54
55     /** Gets the Property4 property */
56     public Bean4 getProperty4() {
57         return property4;
58     }
59
60     /** Sets the Property4 property */
61     public void setProperty4(Bean4 value) {
62         property4 = value;
63     }
64
65     /** Gets the indexed property. If indices is out of bounds, null is returned */
66     public Bean2 getIndexed(int index) {
67         if (index >= array.length) {
68             return null;
69         }
70
71         return array[index];
72     }
73
74     /** Sets the indexed property. If indices is out of bounds, an exception is thrown*/
75     public void setIndexed(int index, Bean2 value) {
76         array[index] = value;
77     }
78
79     public Bean2[] getSingleArray() {
80         return array;
81     }
82
83     public void setSingleArray(Bean2[] array) {
84         this.array = array;
85     }
86
87     public Object JavaDoc[] getSingleArrayObject() {
88         return objectArray;
89     }
90
91     public void setSingleArrayObject(Object JavaDoc[] objectArray) {
92         this.objectArray = objectArray;
93     }
94
95     public Bean2[][][] getMultiArray() {
96         return multiArray;
97     }
98
99     public void setMultiArray(Bean2[][][] multiArray) {
100         this.multiArray = multiArray;
101     }
102
103     public Object JavaDoc[][][] getMultiArrayObject() {
104         return multiObjectArray;
105     }
106
107     public void setMultiArrayObject(Object JavaDoc[][][] multiObjectArray) {
108         this.multiObjectArray = multiObjectArray;
109     }
110
111     /** Gets the indexed string property. If indices is out of bounds, null is returned */
112     public String JavaDoc getStringIndexed(int index) {
113         if (index >= strArray.length) {
114             return null;
115         }
116
117         return strArray[index];
118     }
119
120     /** Sets the indexed string property. If indices is out of bounds, an exception is thrown*/
121     public void setStringIndexed(int index, String JavaDoc value) {
122         strArray[index] = value;
123     }
124
125     /** Gets the ReadOnly property */
126     public String JavaDoc getReadOnly() {
127         return readOnly;
128     }
129
130     public String JavaDoc getReadOnlyIndexed(int index) {
131         return readOnlyIndexed[index];
132     }
133
134     /** Gets the String1 property */
135     public String JavaDoc getString1() {
136         return string1;
137     }
138
139     /** Sets the String1 property */
140     public void setString1(String JavaDoc value) {
141         string1 = value;
142     }
143
144     /** Gets the Integer1 property */
145     public Integer JavaDoc getInteger1() {
146         return integer1;
147     }
148
149     /** Sets the Integer1 property */
150     public void setInteger1(Integer JavaDoc value) {
151         integer1 = value;
152     }
153
154     public Integer JavaDoc getIntegerIndexed(int index) {
155         return integerIndexed[index];
156     }
157
158     public void setIntegerIndexed(int index, Integer JavaDoc integerIndexed) {
159         this.integerIndexed[index] = integerIndexed;
160     }
161
162     /** Gets the Boolean1 property */
163     public boolean isBoolean1() {
164         return boolean1;
165     }
166
167     /** Sets the Boolean1 property */
168     public void setBoolean1(boolean value) {
169         boolean1 = value;
170     }
171
172     /** Gets the booleanIndexed property */
173     public boolean isBooleanIndexed(int index) {
174         return booleanIndexed[index];
175     }
176
177     /** Sets the booleanIndexed property */
178     public void setBooleanIndexed(int index, boolean value) {
179         booleanIndexed[index] = value;
180     }
181
182     /** Gets the Byte1 property */
183     public byte getByte1() {
184         return byte1;
185     }
186
187     /** Sets the Byte1 property */
188     public void setByte1(byte value) {
189         byte1 = value;
190     }
191
192     /** Gets the Char1 property */
193     public char getChar1() {
194         return char1;
195     }
196
197     /** Sets the Char1 property */
198     public void setChar1(char value) {
199         char1 = value;
200     }
201
202     /** Gets the Double1 property */
203     public double getDouble1() {
204         return double1;
205     }
206
207     /** Sets the Double1 property */
208     public void setDouble1(double value) {
209         double1 = value;
210     }
211
212     /** Gets the Float1 property */
213     public float getFloat1() {
214         return float1;
215     }
216
217     /** Sets the Float1 property */
218     public void setFloat1(float value) {
219         float1 = value;
220     }
221
222     /** Gets the Int1 property */
223     public int getInt1() {
224         return int1;
225     }
226
227     /** Sets the Int1 property */
228     public void setInt1(int value) {
229         int1 = value;
230     }
231
232     /** Gets the intIndexed property */
233     public int getIntIndexed(int index) {
234         return intIndexed[index];
235     }
236
237     /** Sets the intIndexed property */
238     public void setIntIndexed(int index, int value) {
239         intIndexed[index] = value;
240     }
241
242     /** Gets the Long1 property */
243     public long getLong1() {
244         return long1;
245     }
246
247     /** Sets the Long1 property */
248     public void setLong1(long value) {
249         long1 = value;
250     }
251
252     /** Gets the Short1 property */
253     public short getShort1() {
254         return short1;
255     }
256
257     /** Sets the Short1 property */
258     public void setShort1(short value) {
259         short1 = value;
260     }
261
262     /** Gets the ThrowsAnException property */
263     public String JavaDoc getThrowsAnException() throws TestException {
264         throw new TestException();
265     }
266
267     /** Sets the ThrowsAnException property */
268     public void setThrowsAnException(String JavaDoc value) throws TestException{
269         throw new TestException();
270     }
271
272     /** Gets the NotAccessible property */
273     private String JavaDoc getNotAccessible() {
274         throw new NullPointerException JavaDoc();
275     }
276
277     /** Sets the NotAccessible property */
278     private void setNotAccessible(String JavaDoc value) {
279         throw new NullPointerException JavaDoc();
280     }
281
282     /** Gets the HashMap property */
283     public HashMap JavaDoc getHashMap() {
284         return map;
285     }
286
287     /** Sets the HashMap property */
288     public void setHashMap(HashMap JavaDoc map) {
289         this.map = map;
290     }
291
292     /** bad property */
293     public String JavaDoc get() {
294         return null;
295     }
296
297     /** bad property */
298     public void set(String JavaDoc s) {
299     }
300
301     /** bad property */
302     public boolean is() {
303         return false;
304     }
305
306     /** bad property */
307     public String JavaDoc get(int index) {
308         return null;
309     }
310
311     /** bad property */
312     public void set(int index, String JavaDoc s) {
313     }
314
315     /** bad property */
316     public boolean is(int index) {
317         return false;
318     }
319
320     /** bad property */
321     public void getBadProp() {
322     }
323
324     /** bad property */
325     public String JavaDoc setBadProp(String JavaDoc s) {
326         return null;
327     }
328
329     /** bad property */
330     public void isBadPropBool() {
331     }
332
333     /** bad property */
334     public void getBadProp(int index) {
335     }
336
337     /** bad property */
338     public String JavaDoc setBadProp(int index, String JavaDoc s) {
339         return null;
340     }
341
342     /** bad property */
343     public void isBadPropBool(int index) {
344     }
345
346     public String JavaDoc notAProp() {
347         return null;
348     }
349 }
Popular Tags