Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: pkg/serialization/lib/serialization.dart

Issue 11889039: Fix ClosureRule comment (Issue 7893) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Setup 10 * Setup
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 * minimum necessary information in [create] and do more of the work in 80 * minimum necessary information in [create] and do more of the work in
81 * [setState]. 81 * [setState].
82 * 82 *
83 * The other way to do this is not creating a subclass, but by using a 83 * The other way to do this is not creating a subclass, but by using a
84 * [ClosureRule] and giving it functions for how to create 84 * [ClosureRule] and giving it functions for how to create
85 * the address. 85 * the address.
86 * 86 *
87 * addressToMap(a) => {"number" : a.number, "street" : a.street, 87 * addressToMap(a) => {"number" : a.number, "street" : a.street,
88 * "city" : a.city}; 88 * "city" : a.city};
89 * createAddress(Map m) => new Address.create(m["number"], m["street"]); 89 * createAddress(Map m) => new Address.create(m["number"], m["street"]);
90 * fillInAddress(Map m, Address a) => a.city = m["city"]; 90 * fillInAddress(Address a, Map m) => a.city = m["city"];
91 * var serialization = new Serialization() 91 * var serialization = new Serialization()
92 * ..addRule( 92 * ..addRule(
93 * new ClosureRule(anAddress.runtimeType, 93 * new ClosureRule(anAddress.runtimeType,
94 * addressToMap, createAddress, fillInAddress); 94 * addressToMap, createAddress, fillInAddress);
95 * 95 *
96 * In this case we have created standalone functions rather than 96 * In this case we have created standalone functions rather than
97 * methods in a subclass and we pass them to the constructor of 97 * methods in a subclass and we pass them to the constructor of
98 * [ClosureRule]. In this case we've also had them use maps rather than 98 * [ClosureRule]. In this case we've also had them use maps rather than
99 * lists for the state, but either would work as long as the rule is 99 * lists for the state, but either would work as long as the rule is
100 * consistent with the representation it uses. We pass it the runtimeType 100 * consistent with the representation it uses. We pass it the runtimeType
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 } 456 }
457 } 457 }
458 458
459 /** 459 /**
460 * An exception class for errors during serialization. 460 * An exception class for errors during serialization.
461 */ 461 */
462 class SerializationException implements Exception { 462 class SerializationException implements Exception {
463 final String message; 463 final String message;
464 const SerializationException([this.message]); 464 const SerializationException([this.message]);
465 } 465 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698