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

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java

Issue 485213004: Generate a toJson method onto our generated types, int is now represented as the wrapped Integer in… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java
index f1080155b880d8932bfc59578c5f3c7739a7f152..ce03a407b008ffb6082b6afdd32c4d0df69039dd 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Position.java
@@ -20,6 +20,9 @@ import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.google.dart.server.utilities.general.ObjectUtilities;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
import org.apache.commons.lang3.StringUtils;
/**
@@ -43,12 +46,12 @@ public class Position {
/**
* The offset of the position.
*/
- private final int offset;
+ private final Integer offset;
/**
* Constructor for {@link Position}.
*/
- public Position(String file, int offset) {
+ public Position(String file, Integer offset) {
this.file = file;
this.offset = offset;
}
@@ -74,10 +77,24 @@ public class Position {
/**
* The offset of the position.
*/
- public int getOffset() {
+ public Integer getOffset() {
return offset;
}
+ public JsonObject toJson() {
+ // Create a JsonObject
+ JsonObject jsonObject = new JsonObject();
+
+ // file
+ jsonObject.addProperty("file", file);
+
+ // offset
+ jsonObject.addProperty("offset", offset);
+
+ // Return the JsonObject
+ return jsonObject;
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();

Powered by Google App Engine
This is Rietveld 408576698