| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * This provides a general-purpose serialization facility for Dart objects. A | 6 * This provides a general-purpose serialization facility for Dart objects. A |
| 7 * [Serialization] is defined in terms of [SerializationRule]s and supports | 7 * [Serialization] is defined in terms of [SerializationRule]s and supports |
| 8 * reading and writing to different formats. | 8 * reading and writing to different formats. |
| 9 * | 9 * |
| 10 * ## Installing ## | 10 * ## Installing ## |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 if (_selfDescribing != null) return _selfDescribing; | 260 if (_selfDescribing != null) return _selfDescribing; |
| 261 return !rules.any((x) => x is CustomRule); | 261 return !rules.any((x) => x is CustomRule); |
| 262 } | 262 } |
| 263 | 263 |
| 264 /** | 264 /** |
| 265 * When we write out data using this serialization, should we also write | 265 * When we write out data using this serialization, should we also write |
| 266 * out a description of the rules. This is on by default unless using | 266 * out a description of the rules. This is on by default unless using |
| 267 * CustomRule subclasses, in which case it requires additional setup and | 267 * CustomRule subclasses, in which case it requires additional setup and |
| 268 * is off by default. | 268 * is off by default. |
| 269 */ | 269 */ |
| 270 void set selfDescribing(bool value) => _selfDescribing = value; | 270 void set selfDescribing(bool value) { |
| 271 _selfDescribing = value; |
| 272 } |
| 271 | 273 |
| 272 /** | 274 /** |
| 273 * Creates a new serialization with a default set of rules for primitives | 275 * Creates a new serialization with a default set of rules for primitives |
| 274 * and lists. | 276 * and lists. |
| 275 */ | 277 */ |
| 276 Serialization() { | 278 Serialization() { |
| 277 addDefaultRules(); | 279 addDefaultRules(); |
| 278 } | 280 } |
| 279 | 281 |
| 280 /** | 282 /** |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 } | 488 } |
| 487 | 489 |
| 488 /** | 490 /** |
| 489 * An exception class for errors during serialization. | 491 * An exception class for errors during serialization. |
| 490 */ | 492 */ |
| 491 class SerializationException implements Exception { | 493 class SerializationException implements Exception { |
| 492 final String message; | 494 final String message; |
| 493 const SerializationException([this.message]); | 495 const SerializationException([this.message]); |
| 494 toString() => "SerializationException($message)"; | 496 toString() => "SerializationException($message)"; |
| 495 } | 497 } |
| OLD | NEW |