1 16 17 package org.springframework.beans; 18 19 import java.io.Serializable ; 20 21 import org.springframework.util.ObjectUtils; 22 23 28 public class SerializablePerson implements Person, Serializable { 29 30 private String name; 31 private int age; 32 33 public int getAge() { 34 return age; 35 } 36 37 public void setAge(int age) { 38 this.age = age; 39 } 40 41 public String getName() { 42 return name; 43 } 44 45 public void setName(String name) { 46 this.name = name; 47 } 48 49 public Object echo(Object o) throws Throwable { 50 if (o instanceof Throwable ) { 51 throw (Throwable ) o; 52 } 53 return o; 54 } 55 56 public boolean equals(Object other) { 57 if (!(other instanceof SerializablePerson)) { 58 return false; 59 } 60 SerializablePerson p = (SerializablePerson) other; 61 return p.age == age && ObjectUtils.nullSafeEquals(name, p.name); 62 } 63 64 } 65 | Popular Tags |