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

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationRegion.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/NavigationRegion.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationRegion.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationRegion.java
index 0ae5a24c7c8a4733a45504a1c8d221f533d248a4..7c9df9256173eb73642dd99a55ca03d2ad725b80 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationRegion.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/NavigationRegion.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;
/**
@@ -38,12 +41,12 @@ public class NavigationRegion {
/**
* The offset of the region from which the user can navigate.
*/
- private final int offset;
+ private final Integer offset;
/**
* The length of the region from which the user can navigate.
*/
- private final int length;
+ private final Integer length;
/**
* The elements to which the given region is bound. By opening the declaration of the elements,
@@ -54,7 +57,7 @@ public class NavigationRegion {
/**
* Constructor for {@link NavigationRegion}.
*/
- public NavigationRegion(int offset, int length, List<Element> targets) {
+ public NavigationRegion(Integer offset, Integer length, List<Element> targets) {
this.offset = offset;
this.length = length;
this.targets = targets;
@@ -75,14 +78,14 @@ public class NavigationRegion {
/**
* The length of the region from which the user can navigate.
*/
- public int getLength() {
+ public Integer getLength() {
return length;
}
/**
* The offset of the region from which the user can navigate.
*/
- public int getOffset() {
+ public Integer getOffset() {
return offset;
}
@@ -94,6 +97,23 @@ public class NavigationRegion {
return targets;
}
+ public JsonObject toJson() {
+ // Create a JsonObject
+ JsonObject jsonObject = new JsonObject();
+
+ // offset
+ jsonObject.addProperty("offset", offset);
+
+ // length
+ jsonObject.addProperty("length", length);
+
+ // targets
+ // the type Object cannot be represented in JsonObject
+
+ // Return the JsonObject
+ return jsonObject;
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();

Powered by Google App Engine
This is Rietveld 408576698