001: /*
002: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: */
018: package test.org.mandarax.zkb;
019:
020: import java.io.Serializable;
021: import java.util.Date;
022: import java.util.GregorianCalendar;
023:
024: /**
025: * Sample bean class for test cases
026: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
027: * @version 3.4 <7 March 05>
028: * @since 2.2
029: */
030: public class Person implements Serializable {
031:
032: private int id = 0;
033: private String name = "";
034: private Date dob = (new GregorianCalendar(1966, 0, 12)).getTime();
035:
036: /**
037: * Constructor.
038: */
039: public Person() {
040: super ();
041: }
042:
043: /**
044: * Constructor. Pass id, name, the year/month and day of birth.
045: */
046: public Person(int anId, String aName, int yearOfBirth,
047: int monthOfBirth, int dayOfBirth) {
048: this ();
049:
050: id = anId;
051: name = aName;
052: dob = (new GregorianCalendar(yearOfBirth, monthOfBirth,
053: dayOfBirth)).getTime();
054: }
055:
056: /**
057: * Setter for id.
058: */
059: public void setId(int value) {
060: id = value;
061: }
062:
063: /**
064: * Setter for name.
065: */
066: public void setName(String value) {
067: name = value;
068: }
069:
070: /**
071: * Setter for dob.
072: */
073: public void setDob(Date value) {
074: dob = value;
075: }
076:
077: /**
078: * Getter for id.
079: */
080: public int getId() {
081: return id;
082: }
083:
084: /**
085: * Getter for name.
086: */
087: public String getName() {
088: return name;
089: }
090:
091: /**
092: * Getter for dob.
093: */
094: public Date getDob() {
095: return dob;
096: }
097:
098: /**
099: * Compare objects.
100: * @param obj another object
101: * @return a boolean
102: */
103: public boolean equals(Object obj) {
104: if ((obj == null) || (getClass() != obj.getClass())) {
105: return false;
106: }
107:
108: Person p = (Person) obj;
109:
110: return (getId() == p.getId()) && getName().equals(p.getName())
111: && getDob().equals(p.getDob());
112: }
113:
114: /**
115: * Get the hash code of the object.
116: * @return the hash code
117: */
118: public int hashCode() {
119: return id;
120: }
121: }
|