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

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

Issue 17578002: pkg/serialization: add format param to Serialization.read method (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fewer things Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/serialization/lib/src/format.dart » ('j') | 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 522a7d10658792714a83c393036a88abdc39df52..5ec329d2cb34705f04800723b0abfb66f80dbf65 100644
--- a/pkg/serialization/lib/serialization.dart
+++ b/pkg/serialization/lib/serialization.dart
@@ -361,7 +361,7 @@ class Serialization {
* The [format] parameter determines the form of the result. The default
* format returns a String in [json] format.
*/
- write(Object object, [Format format]) {
+ write(Object object, {Format format}) {
return newWriter(format).write(object);
}
@@ -370,13 +370,14 @@ class Serialization {
* want to do something more complex with the writer than just returning
* the final result.
*/
- Writer newWriter([Format format]) =>
- new Writer(this, format);
+ Writer newWriter([Format format]) => new Writer(this, format);
/**
* Read the serialized data from [input] and return the root object
* from the result. The [input] can be of any type that the [Format]
* reads/writes, but normally will be a [List], [Map], or a simple type.
+ * The [format] parameter determines the form of the result. The default
+ * format returns a String in [json] format.
* If there are objects that need to be resolved
* in the current context, they should be provided in [externals] as a
* Map from names to values. In particular, in the current implementation
@@ -384,8 +385,8 @@ class Serialization {
* class name as a key. In addition to the [externals] map provided here,
* values will be looked up in the [namedObjects] map.
*/
- read(input, [Map externals = const {}]) {
- return newReader().read(input, externals);
+ read(input, {Format format, Map externals: const {}}) {
+ return newReader(format).read(input, externals);
}
/**
@@ -500,6 +501,6 @@ class Serialization {
*/
class SerializationException implements Exception {
final String message;
- const SerializationException([this.message]);
- toString() => "SerializationException($message)";
+ const SerializationException(this.message);
+ String toString() => "SerializationException($message)";
}
« no previous file with comments | « no previous file | pkg/serialization/lib/src/format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698