|
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 |
| private String _componentPath; |
|
29 |
| |
|
30 |
| private String _propertyName; |
|
31 |
| |
|
32 |
| private Object _newValue; |
|
33 |
| |
|
34 |
231
| public PropertyChangeImpl(String componentPath, String propertyName, Object newValue)
|
|
35 |
| { |
|
36 |
231
| Defense.notNull(propertyName, "propertyName");
|
|
37 |
| |
|
38 |
| |
|
39 |
| |
|
40 |
| |
|
41 |
231
| _componentPath = componentPath;
|
|
42 |
231
| _propertyName = propertyName;
|
|
43 |
231
| _newValue = newValue;
|
|
44 |
| } |
|
45 |
| |
|
46 |
| |
|
47 |
| |
|
48 |
| |
|
49 |
| |
|
50 |
126
| public String getComponentPath()
|
|
51 |
| { |
|
52 |
126
| return _componentPath;
|
|
53 |
| } |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
126
| public Object getNewValue()
|
|
60 |
| { |
|
61 |
126
| return _newValue;
|
|
62 |
| } |
|
63 |
| |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
126
| public String getPropertyName()
|
|
69 |
| { |
|
70 |
126
| return _propertyName;
|
|
71 |
| } |
|
72 |
| |
|
73 |
3
| public String toString()
|
|
74 |
| { |
|
75 |
3
| ToStringBuilder builder = new ToStringBuilder(this);
|
|
76 |
| |
|
77 |
3
| builder.append("componentPath", _componentPath);
|
|
78 |
3
| builder.append("propertyName", _propertyName);
|
|
79 |
3
| builder.append("newValue", _newValue);
|
|
80 |
| |
|
81 |
3
| return builder.toString();
|
|
82 |
| } |
|
83 |
| |
|
84 |
93
| public boolean equals(Object object)
|
|
85 |
| { |
|
86 |
93
| if (this == object)
|
|
87 |
3
| return true;
|
|
88 |
| |
|
89 |
90
| if (object == null || object.getClass() != this.getClass())
|
|
90 |
3
| return false;
|
|
91 |
| |
|
92 |
87
| PropertyChangeImpl other = (PropertyChangeImpl) object;
|
|
93 |
| |
|
94 |
87
| return same(_componentPath, other._componentPath)
|
|
95 |
| && same(_propertyName, other._propertyName) && same(_newValue, other._newValue); |
|
96 |
| } |
|
97 |
| |
|
98 |
255
| private boolean same(Object o1, Object o2)
|
|
99 |
| { |
|
100 |
255
| return o1 == o2 || (o1 != null && o1.equals(o2));
|
|
101 |
| } |
|
102 |
| } |