KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > inversoft > util > test > Bean


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.util.test;
8
9
10 import com.inversoft.util.BaseException;
11
12
13 public class Bean {
14
15     private String JavaDoc name;
16
17
18     public Bean() {
19     }
20
21     public Bean(String JavaDoc name) {
22         this.name = name;
23     }
24
25     public String JavaDoc getName() {
26         return name;
27     }
28
29     public void setName(String JavaDoc name) {
30         this.name = name;
31     }
32
33     public void throwCheckedMethod() throws BaseException {
34         throw new BaseException();
35     }
36
37     public void throwUncheckedMethod() {
38         throw new NullPointerException JavaDoc();
39     }
40
41     public void assertMethod() {
42         throw new AssertionError JavaDoc();
43     }
44
45     private void hidden() {
46
47     }
48
49     public boolean equals(Object JavaDoc object) {
50
51         if (object == null) {
52             return false;
53         }
54
55         if (object instanceof Bean) {
56             Bean bean = (Bean) object;
57
58             if (name == bean.getName()) {
59                 return true;
60             }
61
62             if (name != null) {
63                 return name.equals(bean.getName());
64             }
65         }
66
67         return false;
68     }
69
70     public String JavaDoc toString() {
71         return name;
72     }
73 }
74
Popular Tags