KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sape > carbon > core > util > reflection > test > SimpleTestBean


1 /*
2  * The contents of this file are subject to the Sapient Public License
3  * Version 1.0 (the "License"); you may not use this file except in compliance
4  * with the License. You may obtain a copy of the License at
5  * http://carbon.sf.net/License.html.
6  *
7  * Software distributed under the License is distributed on an "AS IS" basis,
8  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
9  * the specific language governing rights and limitations under the License.
10  *
11  * The Original Code is The Carbon Component Framework.
12  *
13  * The Initial Developer of the Original Code is Sapient Corporation
14  *
15  * Copyright (C) 2003 Sapient Corporation. All Rights Reserved.
16  */

17
18 package org.sape.carbon.core.util.reflection.test;
19
20 import java.util.Collection JavaDoc;
21
22 /**
23  * Simple bean object used in the <code>BeanUtilTest</code>
24  * jUnit test cases.
25  *
26  * Copyright 2002 Sapient
27  * @since carbon 1.0
28  * @author Jordan Reed, August 2002
29  * @version $Revision: 1.3 $($Author: dvoet $ / $Date: 2003/05/05 21:21:24 $)
30  */

31 public class SimpleTestBean {
32     /** Simple string property. */
33     private String JavaDoc simpleString;
34
35     /** Simple primitive integer property. */
36     private int primitiveInt;
37
38     /** Simple primitive boolean property. */
39     private boolean simpleBoolean;
40
41     /**
42      * Boolean property that is incorrected exposed by having
43      * a <code>getIncorrectBoolean</code> method instead of a
44      * <code>isIncorrectBoolean</code> method.
45      */

46     private boolean incorrectBoolean;
47
48     /**
49      * Boolean property that has two overlapping getter methods.
50      * This includes a <code>isOverlapReadBoolean</code> and
51      * <code>getOverlapReadBoolean</code>.
52      */

53     private boolean overlapReadBoolean;
54
55     /**
56      * Read-only property.
57      */

58     private String JavaDoc readOnlyString;
59
60     /**
61      * This string will only exposed with a write method. It is made public
62      * so that the test harness can get its value.
63      */

64     public String JavaDoc writeOnlyString;
65
66     /**
67      * Collection property.
68      */

69     private Collection JavaDoc collection;
70
71     /**
72      * Public no-arg constructor.
73      */

74     public SimpleTestBean() {
75     }
76
77     /**
78      * Constructor that takes an initial value for the read-only
79      * property.
80      *
81      * @param readOnlyString initial value of the read-only property.
82      */

83     public SimpleTestBean(String JavaDoc readOnlyString) {
84         this.readOnlyString = readOnlyString;
85     }
86
87     /**
88      * Setter for the simple string property
89      *
90      * @param simpleString new value of the simple string property
91      */

92     public void setSimpleString(String JavaDoc simpleString) {
93         this.simpleString = simpleString;
94     }
95
96     /**
97      * Getter for the simple string property
98      *
99      * @return value of the simple string property
100      */

101     public String JavaDoc getSimpleString() {
102         return this.simpleString;
103     }
104
105     /**
106      * Setter for the primitive int property
107      *
108      * @param new value for the primitive int property
109      */

110     public void setPrimitiveInt(int primitiveInt) {
111         this.primitiveInt = primitiveInt;
112     }
113
114     /**
115      * Getter for the primitive int property.
116      *
117      * @return the value of the primitive int property
118      */

119     public int getPrimitiveInt() {
120         return this.primitiveInt;
121     }
122
123     /**
124      * Getter for the read only property.
125      *
126      * @return the value of the read only property
127      */

128     public String JavaDoc getReadOnlyString() {
129         return this.readOnlyString;
130     }
131
132     /**
133      * Setter for the write only property.
134      *
135      * @param writeOnlyString value of the write only property
136      */

137     public void setWriteOnlyString(String JavaDoc writeOnlyString) {
138         this.writeOnlyString = writeOnlyString;
139     }
140
141     /**
142      * Setter for the collection property.
143      *
144      * @param collection the new value of the collection property
145      */

146     public void setCollection(Collection JavaDoc collection) {
147         this.collection = collection;
148     }
149
150     /**
151      * Getter for the collection property.
152      *
153      * @return the value of the collection property
154      */

155     public Collection JavaDoc getCollection() {
156         return this.collection;
157     }
158
159     /**
160      * Setter for the simple boolean property.
161      *
162      * @param simpleBoolean the new value of the simpel boolean property
163      */

164     public void setSimpleBoolean(boolean simpleBoolean) {
165         this.simpleBoolean = simpleBoolean;
166     }
167
168     /**
169      * Getter for the simple boolean property.
170      *
171      * @return the value of the simple boolean property.
172      */

173     public boolean isSimpleBoolean() {
174         return this.simpleBoolean;
175     }
176
177     /**
178      * Setter for the incorrect boolean property.
179      *
180      * @param incorrectBoolean the value of the incorrect boolean property
181      */

182     public void setIncorrectBoolean(boolean incorrectBoolean) {
183         this.incorrectBoolean = incorrectBoolean;
184     }
185
186     /**
187      * Improperly-named getter for the incorrect boolean property.
188      *
189      * @return the value of the incorrect boolean property.
190      */

191     public boolean getIncorrectBoolean() {
192         return this.incorrectBoolean;
193     }
194
195     /**
196      * Setter for the overlap read boolean property
197      *
198      * @param overlapReadBoolean the value of the overlap
199      * read boolean property.
200      */

201     public void setOverlapReadBoolean(boolean overlapReadBoolean) {
202         this.overlapReadBoolean = overlapReadBoolean;
203     }
204
205     /**
206      * The correctly named getter method for the overlap read
207      * boolean property.
208      *
209      * @return the overlap read boolean property
210      */

211     public boolean isOverlapReadBoolean() {
212         return this.overlapReadBoolean;
213     }
214
215     /**
216      * The incorrectly named getter for the overlap read
217      * boolean property.
218      *
219      * @return Always throws <code>IllegalStateException</code>
220      * @throws IllegalStateException if the method is called.
221      */

222     public boolean getOverlapReadBoolean() {
223         throw new IllegalStateException JavaDoc(
224             "This method should never be invoked.");
225     }
226
227 }
228
Popular Tags