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

Unified Diff: pkg/serialization/lib/serialization.dart

Issue 103283005: you can use a type for a rule in serialization (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/serialization/lib/serialization.dart
diff --git a/pkg/serialization/lib/serialization.dart b/pkg/serialization/lib/serialization.dart
index aa32bd7e826977cb794845b4deef03ba48256788..2920d8769146e172641d1db399b8dfb9ed61e21a 100644
--- a/pkg/serialization/lib/serialization.dart
+++ b/pkg/serialization/lib/serialization.dart
@@ -20,12 +20,11 @@
* address.street = 'N 34th';
* address.city = 'Seattle';
* var serialization = new Serialization()
- * ..addRuleFor(address);
+ * ..addRuleFor(Address);
* Map output = serialization.write(address);
*
- * This creates a new serialization and adds a rule for address objects. Right
- * now it has to be passed an address instance because of limitations using
- * Address as a literal. Then we ask the [Serialization] to write the address
+ * This creates a new serialization and adds a rule for address objects.
+ * Then we ask the [Serialization] to write the address
* and we get back a Map which is a [json]able representation of the state of
* the address and related objects. Note that while the output in this case
* is a [Map], the type will vary depending on which output format we've told
@@ -35,7 +34,7 @@
* fields of the address object. We can also specify those fields explicitly.
*
* var serialization = new Serialization()
- * ..addRuleFor(address,
+ * ..addRuleFor(Address,
* constructor: "create",
* constructorFields: ["number", "street"],
* fields: ["city"]);
@@ -47,7 +46,7 @@
* serialized.
*
* var serialization = new Serialization()
- * ..addRuleFor(address,
+ * ..addRuleFor(Address,
* constructor: "",
* excludeFields: ["other", "stuff"]);
*
@@ -189,7 +188,7 @@
* [Reader] or [Writer] respectively.
*
* new Serialization()
- * ..addRuleFor(new Person(), constructorFields: ["name"])
+ * ..addRuleFor(Person, constructorFields: ["name"])
* ..namedObjects['Person'] = reflect(new Person()).type;
*/
library serialization;
« 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