KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > getahead > dwrdemo > people > Person


1 /*
2  * Copyright 2005 Joe Walker
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.getahead.dwrdemo.people;
17
18 import org.directwebremoting.Security;
19
20 /**
21  * @author Joe Walker [joe at getahead dot ltd dot uk]
22  */

23 public class Person
24 {
25     /**
26      * @return the address
27      */

28     public String JavaDoc getAddress()
29     {
30         return address;
31     }
32
33     /**
34      * @param address the address to set
35      */

36     public void setAddress(String JavaDoc address)
37     {
38         this.address = Security.escapeHtml(address);
39     }
40
41     /**
42      * @return the id
43      */

44     public int getId()
45     {
46         return id;
47     }
48
49     /**
50      * @param id the id to set
51      */

52     public void setId(int id)
53     {
54         this.id = id;
55     }
56
57     /**
58      * @return the name
59      */

60     public String JavaDoc getName()
61     {
62         return name;
63     }
64
65     /**
66      * @param name the name to set
67      */

68     public void setName(String JavaDoc name)
69     {
70         this.name = Security.escapeHtml(name);
71     }
72
73     /**
74      * @return the salary
75      */

76     public float getSalary()
77     {
78         return salary;
79     }
80
81     /**
82      * @param salary the salary to set
83      */

84     public void setSalary(float salary)
85     {
86         this.salary = salary;
87     }
88
89     /* (non-Javadoc)
90      * @see java.lang.Object#equals(java.lang.Object)
91      */

92     public boolean equals(Object JavaDoc obj)
93     {
94         if (obj == null)
95         {
96             return false;
97         }
98
99         if (obj == this)
100         {
101             return true;
102         }
103
104         if (!this.getClass().equals(obj.getClass()))
105         {
106             return false;
107         }
108
109         Person that = (Person) obj;
110
111         if (this.id != that.id)
112         {
113             return false;
114         }
115
116         return true;
117     }
118
119     /* (non-Javadoc)
120      * @see java.lang.Object#hashCode()
121      */

122     public int hashCode()
123     {
124         return 5924 + id;
125     }
126
127     /* (non-Javadoc)
128      * @see java.lang.Object#toString()
129      */

130     public String JavaDoc toString()
131     {
132         return "Person[id=" + id + ",name=" + name + "]";
133     }
134
135     private String JavaDoc name;
136     private String JavaDoc address;
137     private float salary;
138     private int id;
139 }
140
Popular Tags