1 7 package org.jboss.test.webservice.samples; 8 9 11 17 public class Person 18 { 19 private String name; 20 private int age; 21 22 public Person() 23 { 24 } 25 26 public Person(String name, int age) 27 { 28 this.age = age; 29 this.name = name; 30 } 31 32 public int getAge() 33 { 34 return age; 35 } 36 37 public void setAge(int age) 38 { 39 this.age = age; 40 } 41 42 public String getName() 43 { 44 return name; 45 } 46 47 public void setName(String name) 48 { 49 this.name = name; 50 } 51 52 public boolean equals(Object o) 53 { 54 if (this == o) return true; 55 if (!(o instanceof Person)) return false; 56 57 final Person person = (Person)o; 58 59 if (age != person.age) return false; 60 if (!name.equals(person.name)) return false; 61 62 return true; 63 } 64 65 public int hashCode() 66 { 67 int result; 68 result = name.hashCode(); 69 result = 29 * result + age; 70 return result; 71 } 72 73 public String toString() 74 { 75 return "[name=" + name + ",age=" + age + "]"; 76 } 77 } 78 | Popular Tags |