KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > betwixt > io > read > PersonBean


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.betwixt.io.read;
17
18 /** <p><code>PersonBean</code> is a sample bean for use with the test cases.</p>
19   *
20   * @author Robert Burrell Donkin<
21   * @version $Revision: 1.4 $
22   */

23 public class PersonBean {
24     
25     private String JavaDoc forename;
26     private String JavaDoc surname;
27     
28     public PersonBean() {}
29     
30     public PersonBean(String JavaDoc forename, String JavaDoc surname)
31     {
32         setForename(forename);
33         setSurname(surname);
34     }
35     
36     public String JavaDoc getForename() {
37         return forename;
38     }
39     
40     public void setForename(String JavaDoc forename) {
41         this.forename = forename;
42     }
43
44     
45     public String JavaDoc getSurname() {
46         return surname;
47     }
48     
49     public void setSurname(String JavaDoc surname) {
50         this.surname = surname;
51     }
52     
53     public String JavaDoc toString() {
54         return "[" + this.getClass().getName() + ": forename=" + forename + " surname=" + surname + "]";
55     }
56     
57     public boolean equals( Object JavaDoc obj ) {
58         if ( obj == null ) return false;
59         return this.hashCode() == obj.hashCode();
60     }
61     
62     public int hashCode() {
63         return toString().hashCode();
64     }
65 }
66
Popular Tags