001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.harmony.beans.tests.support.mock;
019:
020: import java.io.Serializable;
021:
022: public class MockJavaBean implements Serializable {
023: /**
024: * Comment for <code>serialVersionUID</code>
025: */
026: private static final long serialVersionUID = 1L;
027:
028: private String beanName;
029:
030: private String propertyOne;
031:
032: private Integer propertyTwo;
033:
034: private String propertyThree;
035:
036: private String[] propertyFour;
037:
038: private String[] propertyFive;
039:
040: private Integer[] propertySix;
041:
042: private String[] propertySeven;
043:
044: private String protectedProp;
045:
046: private String propertyWithoutSet;
047:
048: private boolean booleanProperty;
049:
050: @SuppressWarnings("unused")
051: private int propertyWithoutGet;
052:
053: private String propertyWithDifferentGetSet;
054:
055: private int propertyWithInvalidGet;
056:
057: private int propertyWithoutPublicGet;
058:
059: private int propertyWithGet1Param;
060:
061: private int propertyWithIs1Param;
062:
063: private int propertyWithSet2Param;
064:
065: private int propertyWithIsGet;
066:
067: @SuppressWarnings("unused")
068: private int propertyWithVoidGet;
069:
070: public Void getPropertyWithVoidGet() {
071: return null;
072: }
073:
074: public void setPropertyWithVoidGet(int propertyWithVoidGet) {
075: this .propertyWithVoidGet = propertyWithVoidGet;
076: }
077:
078: public MockJavaBean() {
079: this .beanName = getClass().getName();
080: }
081:
082: public MockJavaBean(String beanName) {
083: this .beanName = beanName;
084: }
085:
086: public String getXXX() {
087: return propertyThree;
088: }
089:
090: public String getPropertyWithDifferentGetSet() {
091: return propertyWithDifferentGetSet;
092: }
093:
094: public void setPropertyWithDifferentGetSet(int value) {
095: this .propertyWithDifferentGetSet = String.valueOf(value);
096: }
097:
098: public String getPropertyWithoutSet() {
099: return propertyWithoutSet;
100: }
101:
102: public void setPropertyWithoutGet(int value) {
103: this .propertyWithoutGet = value;
104: }
105:
106: public String getPropertyWithInvalidGet() {
107: return String.valueOf(propertyWithInvalidGet);
108: }
109:
110: public void setPropertyWithInvalidGet(String value) {
111: propertyWithInvalidGet = Integer.valueOf(value);
112: }
113:
114: /**
115: * @return Returns the beanName.
116: */
117: public String getBeanName() {
118: return beanName;
119: }
120:
121: /**
122: * @param beanName
123: * The beanName to set.
124: */
125: public void setBeanName(String beanName) {
126: this .beanName = beanName;
127: }
128:
129: /**
130: * @return Returns the propertyOne.
131: */
132: public String getPropertyOne() {
133: return propertyOne;
134: }
135:
136: /**
137: * @param propertyOne
138: * The propertyOne to set.
139: */
140: public void setPropertyOne(String propertyOne) {
141: this .propertyOne = propertyOne;
142: }
143:
144: /**
145: * @return Returns the propertyTwo.
146: */
147: public Integer getPropertyTwo() {
148: return propertyTwo;
149: }
150:
151: /**
152: * @param propertyTwo
153: * The propertyTwo to set.
154: */
155: public void setPropertyTwo(Integer propertyTwo) {
156: this .propertyTwo = propertyTwo;
157: }
158:
159: public String invalidGetMethod(String arg) {
160: // for PropertyDescriptorTest: with args
161: return arg;
162: }
163:
164: public void invalidGetMethod() {
165: // for PropertyDescriptorTest
166: // return void
167: }
168:
169: /**
170: * @return Returns the propertyThree.
171: */
172: public String getPropertyThree() {
173: return propertyThree;
174: }
175:
176: /**
177: * @param propertyThree
178: * The propertyThree to set.
179: */
180: public void setPropertyThree(String propertyThree) {
181: this .propertyThree = propertyThree;
182: }
183:
184: /**
185: * @return Returns the propertyFour.
186: */
187: public String[] getPropertyFour() {
188: return propertyFour;
189: }
190:
191: /**
192: * @param propertyFour
193: * The propertyFour to set.
194: */
195: public void setPropertyFour(String[] propertyFour) {
196: this .propertyFour = propertyFour;
197: }
198:
199: public String getPropertyFour(int i) {
200: return getPropertyFour()[i];
201: }
202:
203: public String getPropertyFive(int i, int j) {
204: return getPropertyFour()[i];
205: }
206:
207: public void getPropertyFourInvalid(int i) {
208:
209: }
210:
211: public void setPropertyFour(int i, String value) {
212: propertyFour[i] = value;
213: }
214:
215: public void setPropertyFour(int i, int value) {
216: propertyFour[i] = "";
217: }
218:
219: public int setPropertyFourInvalid(int i, String value) {
220: return i;
221: }
222:
223: public void setPropertyFourInvalid2(String i, String value) {
224: // return i;
225: }
226:
227: /**
228: * @return Returns the propertyFive.
229: */
230: public String[] getPropertyFive() {
231: return propertyFive;
232: }
233:
234: /**
235: * @param propertyFive
236: * The propertyFive to set.
237: */
238: public void setPropertyFive(String[] propertyFive) {
239: this .propertyFive = propertyFive;
240: }
241:
242: public String getPropertyFive(int i) {
243: return getPropertyFive()[i];
244: }
245:
246: public void setPropertyFive(int i, String value) {
247: propertyFive[i] = value;
248: }
249:
250: /**
251: * @return Returns the protectedProp.
252: */
253: protected String getProtectedProp() {
254: return protectedProp;
255: }
256:
257: /**
258: * @param protectedProp
259: * The protectedProp to set.
260: */
261: protected void setProtectedProp(String protectedProp) {
262: this .protectedProp = protectedProp;
263: }
264:
265: /**
266: * @return Returns the propertySix.
267: */
268: public Integer[] getPropertySix() {
269: return propertySix;
270: }
271:
272: public Integer getPropertySix(int i) {
273: return null;
274: }
275:
276: /**
277: * @param propertySix
278: * The propertySix to set.
279: */
280: public void setPropertySix(Integer[] propertySix) {
281: this .propertySix = propertySix;
282: }
283:
284: public void setPropertySix(int i, Integer value) {
285:
286: }
287:
288: public void addMockPropertyChangeListener(
289: MockPropertyChangeListener listener) {
290:
291: }
292:
293: public void removeMockPropertyChangeListener(
294: MockPropertyChangeListener listener) {
295:
296: }
297:
298: int isPropertyWithoutPublicGet() {
299: return propertyWithoutPublicGet;
300: }
301:
302: int getPropertyWithoutPublicGet() {
303: return propertyWithoutPublicGet;
304: }
305:
306: public void setPropertyWithoutPublicGet(int propertyWithoutPublicGet) {
307: this .propertyWithoutPublicGet = propertyWithoutPublicGet;
308: }
309:
310: public int isPropertyWithIs1Param(int i) {
311: return propertyWithIs1Param;
312: }
313:
314: public int getPropertyWithIs1Param() {
315: return propertyWithIs1Param;
316: }
317:
318: public void setPropertyWithIs1Param(int value) {
319: this .propertyWithIs1Param = value;
320: }
321:
322: public int getPropertyWithGet1Param(int i) {
323: return propertyWithGet1Param;
324: }
325:
326: public void setPropertyWithGet1Param(int propertyWithGet1Param) {
327: this .propertyWithGet1Param = propertyWithGet1Param;
328: }
329:
330: public int getPropertyWithSet2Param() {
331: return propertyWithSet2Param;
332: }
333:
334: public void setPropertyWithSet2Param(int propertyWithSet2Param,
335: int j) {
336: this .propertyWithSet2Param = propertyWithSet2Param;
337: }
338:
339: public int isPropertyWithIsGet() {
340: return propertyWithIsGet;
341: }
342:
343: public int getPropertyWithIsGet() {
344: return propertyWithIsGet;
345: }
346:
347: public void setPropertyWithIsGet(int propertyWithIsGet) {
348: this .propertyWithIsGet = propertyWithIsGet;
349: }
350:
351: public boolean isBooleanProperty() {
352: return booleanProperty;
353: }
354:
355: public boolean getBooleanProperty() {
356: return booleanProperty;
357: }
358:
359: public void setbooleanProperty(boolean booleanProperty) {
360: this .booleanProperty = booleanProperty;
361: }
362:
363: public Integer getPropertySeven(int i) {
364: return Integer.valueOf(propertySeven[i]);
365: }
366:
367: public void setPropertySeven(int i, Integer I) {
368: propertySeven[i] = String.valueOf(I);
369: }
370:
371: public String[] getPropertySeven() {
372: return propertySeven;
373: }
374:
375: public void setPropertySeven(String[] propertySeven) {
376: this.propertySeven = propertySeven;
377: }
378: }
|