001: /*
002: * Copyright 2005 Joe Walker
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.getahead.dwrdemo.people;
017:
018: import org.directwebremoting.Security;
019:
020: /**
021: * @author Joe Walker [joe at getahead dot ltd dot uk]
022: */
023: public class Person {
024: /**
025: * @return the address
026: */
027: public String getAddress() {
028: return address;
029: }
030:
031: /**
032: * @param address the address to set
033: */
034: public void setAddress(String address) {
035: this .address = Security.escapeHtml(address);
036: }
037:
038: /**
039: * @return the id
040: */
041: public int getId() {
042: return id;
043: }
044:
045: /**
046: * @param id the id to set
047: */
048: public void setId(int id) {
049: this .id = id;
050: }
051:
052: /**
053: * @return the name
054: */
055: public String getName() {
056: return name;
057: }
058:
059: /**
060: * @param name the name to set
061: */
062: public void setName(String name) {
063: this .name = Security.escapeHtml(name);
064: }
065:
066: /**
067: * @return the salary
068: */
069: public float getSalary() {
070: return salary;
071: }
072:
073: /**
074: * @param salary the salary to set
075: */
076: public void setSalary(float salary) {
077: this .salary = salary;
078: }
079:
080: /**
081: * @return the phoneNumber
082: */
083: public String getPhoneNumber() {
084: return phoneNumber;
085: }
086:
087: /**
088: * @param phoneNumber the phoneNumber to set
089: */
090: public void setPhoneNumber(String phoneNumber) {
091: this .phoneNumber = phoneNumber;
092: }
093:
094: /* (non-Javadoc)
095: * @see java.lang.Object#equals(java.lang.Object)
096: */
097: @Override
098: public boolean equals(Object obj) {
099: if (obj == null) {
100: return false;
101: }
102:
103: if (obj == this ) {
104: return true;
105: }
106:
107: if (!this .getClass().equals(obj.getClass())) {
108: return false;
109: }
110:
111: Person that = (Person) obj;
112:
113: if (this .id != that.id) {
114: return false;
115: }
116:
117: return true;
118: }
119:
120: /* (non-Javadoc)
121: * @see java.lang.Object#hashCode()
122: */
123: @Override
124: public int hashCode() {
125: return 5924 + id;
126: }
127:
128: /* (non-Javadoc)
129: * @see java.lang.Object#toString()
130: */
131: @Override
132: public String toString() {
133: return "Person[id=" + id + ",name=" + name + "]";
134: }
135:
136: private String name;
137: private String address;
138: private String phoneNumber;
139: private float salary;
140: private int id;
141: }
|