1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
package org.apache.tapestry.record; |
16 |
|
|
17 |
|
import org.apache.hivemind.util.Defense; |
18 |
|
import org.apache.hivemind.util.ToStringBuilder; |
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
public class PropertyChangeImpl implements PropertyChange |
27 |
|
{ |
28 |
|
|
29 |
|
private String _componentPath; |
30 |
|
|
31 |
|
private String _propertyName; |
32 |
|
|
33 |
|
private Object _newValue; |
34 |
|
|
35 |
|
public PropertyChangeImpl(String componentPath, String propertyName, |
36 |
|
Object newValue) |
37 |
66 |
{ |
38 |
66 |
Defense.notNull(propertyName, "propertyName"); |
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
66 |
_componentPath = componentPath; |
44 |
66 |
_propertyName = propertyName; |
45 |
66 |
_newValue = newValue; |
46 |
66 |
} |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
public String getComponentPath() |
54 |
|
{ |
55 |
31 |
return _componentPath; |
56 |
|
} |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
public Object getNewValue() |
63 |
|
{ |
64 |
31 |
return _newValue; |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
public String getPropertyName() |
72 |
|
{ |
73 |
31 |
return _propertyName; |
74 |
|
} |
75 |
|
|
76 |
|
public String toString() |
77 |
|
{ |
78 |
44 |
ToStringBuilder builder = new ToStringBuilder(this); |
79 |
|
|
80 |
44 |
builder.append("componentPath", _componentPath); |
81 |
44 |
builder.append("propertyName", _propertyName); |
82 |
44 |
builder.append("newValue", _newValue); |
83 |
|
|
84 |
44 |
return builder.toString(); |
85 |
|
} |
86 |
|
|
87 |
|
public boolean equals(Object object) |
88 |
|
{ |
89 |
31 |
if (this == object) return true; |
90 |
|
|
91 |
30 |
if (object == null || object.getClass() != this.getClass()) |
92 |
1 |
return false; |
93 |
|
|
94 |
29 |
PropertyChangeImpl other = (PropertyChangeImpl) object; |
95 |
|
|
96 |
29 |
return same(_componentPath, other._componentPath) |
97 |
|
&& same(_propertyName, other._propertyName) |
98 |
|
&& same(_newValue, other._newValue); |
99 |
|
} |
100 |
|
|
101 |
|
private boolean same(Object o1, Object o2) |
102 |
|
{ |
103 |
85 |
return o1 == o2 || (o1 != null && o1.equals(o2)); |
104 |
|
} |
105 |
|
} |