1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
package net.admin4j.vo; |
15 | |
|
16 | |
import java.io.Serializable; |
17 | |
|
18 | |
import net.admin4j.deps.commons.beanutils.BeanUtils; |
19 | |
import net.admin4j.deps.commons.lang3.builder.EqualsBuilder; |
20 | |
import net.admin4j.deps.commons.lang3.builder.HashCodeBuilder; |
21 | |
import net.admin4j.deps.commons.lang3.builder.ReflectionToStringBuilder; |
22 | |
import net.admin4j.deps.commons.lang3.exception.ContextedRuntimeException; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 565 | public abstract class BaseVO implements Serializable, Cloneable { |
30 | |
|
31 | |
private static final long serialVersionUID = 2618192279106780874L; |
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
@Override |
37 | |
public int hashCode() { |
38 | |
return HashCodeBuilder.reflectionHashCode(17, 37, this); |
39 | |
} |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
@Override |
45 | |
public boolean equals(Object obj) { |
46 | |
return EqualsBuilder.reflectionEquals(this, obj); |
47 | |
} |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
@Override |
53 | |
public Object clone() throws CloneNotSupportedException { |
54 | |
try { |
55 | |
return BeanUtils.cloneBean(this); |
56 | 0 | } catch (Exception e) { |
57 | |
throw new ContextedRuntimeException("Error cloning value object", e) |
58 | |
.addContextValue("class", this.getClass().getName()); |
59 | |
} |
60 | |
} |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
@Override |
66 | |
public String toString() { |
67 | |
return new ReflectionToStringBuilder(this).toString(); |
68 | |
} |
69 | |
|
70 | |
} |