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