KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > loader > SamplePojo


1 package org.jboss.cache.loader;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.ArrayList JavaDoc;
5 import java.util.List JavaDoc;
6
7 /**
8  * @author Bela Ban
9  * @version $Id: SamplePojo.java,v 1.2 2005/07/24 00:06:21 msurtani Exp $
10  */

11 public class SamplePojo implements Serializable JavaDoc {
12    int age;
13    String JavaDoc name;
14    List JavaDoc hobbies=new ArrayList JavaDoc();
15
16    public SamplePojo(int age, String JavaDoc name) {
17       this.age=age;
18       this.name=name;
19    }
20
21    public int getAge() {
22       return age;
23    }
24
25    public void setAge(int age) {
26       this.age=age;
27    }
28
29    public String JavaDoc getName() {
30       return name;
31    }
32
33    public void setName(String JavaDoc name) {
34       this.name=name;
35    }
36
37    public List JavaDoc getHobbies() {
38       return hobbies;
39    }
40
41    public void setHobbies(List JavaDoc hobbies) {
42       this.hobbies=hobbies;
43    }
44
45    public String JavaDoc toString() {
46       return "name=" + name + ", age=" + age + ", hobbies=" + hobbies;
47    }
48
49    public boolean equals(Object JavaDoc o)
50    {
51        if (o instanceof SamplePojo)
52        {
53            SamplePojo other = (SamplePojo) o;
54            boolean equals = (name.equals(other.getName())) && (age == other.getAge()) && (hobbies.equals(other.getHobbies()));
55            return equals;
56        }
57        else
58            return false;
59    }
60 }
61
Popular Tags