OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library observe.src.change_record; | 5 library observe.src.change_record; |
6 | 6 |
7 import 'package:observe/observe.dart'; | 7 import 'package:observe/observe.dart'; |
8 | 8 |
9 | |
10 /// Records a change to an [Observable]. | 9 /// Records a change to an [Observable]. |
11 // TODO(jmesserly): remove this type | 10 // TODO(jmesserly): remove this type |
12 abstract class ChangeRecord {} | 11 abstract class ChangeRecord {} |
13 | 12 |
14 /// A change record to a field of an observable object. | 13 /// A change record to a field of an observable object. |
15 class PropertyChangeRecord<T> extends ChangeRecord { | 14 class PropertyChangeRecord<T> extends ChangeRecord { |
16 /// The object that changed. | 15 /// The object that changed. |
17 final object; | 16 final object; |
18 | 17 |
19 /// The name of the property that changed. | 18 /// The name of the property that changed. |
20 final Symbol name; | 19 final Symbol name; |
21 | 20 |
22 /// The previous value of the property. | 21 /// The previous value of the property. |
23 final T oldValue; | 22 final T oldValue; |
24 | 23 |
25 /// The new value of the property. | 24 /// The new value of the property. |
26 final T newValue; | 25 final T newValue; |
27 | 26 |
28 PropertyChangeRecord(this.object, this.name, this.oldValue, this.newValue); | 27 PropertyChangeRecord(this.object, this.name, this.oldValue, this.newValue); |
29 | 28 |
30 String toString() => | 29 String toString() => |
31 '#<PropertyChangeRecord $name from: $oldValue to: $newValue>'; | 30 '#<PropertyChangeRecord $name from: $oldValue to: $newValue>'; |
32 } | 31 } |
OLD | NEW |