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

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Location.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/Location.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Location.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Location.java
index b62205a23540dee585bc082f9a960282de12598b..e999eafadcdd8f62eea50221317120aa04667224 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Location.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/Location.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,27 +46,27 @@ public class Location {
/**
* The offset of the range.
*/
- private final int offset;
+ private final Integer offset;
/**
* The length of the range.
*/
- private final int length;
+ private final Integer length;
/**
* The one-based index of the line containing the first character of the range.
*/
- private final int startLine;
+ private final Integer startLine;
/**
* The one-based index of the column containing the first character of the range.
*/
- private final int startColumn;
+ private final Integer startColumn;
/**
* Constructor for {@link Location}.
*/
- public Location(String file, int offset, int length, int startLine, int startColumn) {
+ public Location(String file, Integer offset, Integer length, Integer startLine, Integer startColumn) {
this.file = file;
this.offset = offset;
this.length = length;
@@ -95,31 +98,54 @@ public class Location {
/**
* The length of the range.
*/
- public int getLength() {
+ public Integer getLength() {
return length;
}
/**
* The offset of the range.
*/
- public int getOffset() {
+ public Integer getOffset() {
return offset;
}
/**
* The one-based index of the column containing the first character of the range.
*/
- public int getStartColumn() {
+ public Integer getStartColumn() {
return startColumn;
}
/**
* The one-based index of the line containing the first character of the range.
*/
- public int getStartLine() {
+ public Integer getStartLine() {
return startLine;
}
+ public JsonObject toJson() {
+ // Create a JsonObject
+ JsonObject jsonObject = new JsonObject();
+
+ // file
+ jsonObject.addProperty("file", file);
+
+ // offset
+ jsonObject.addProperty("offset", offset);
+
+ // length
+ jsonObject.addProperty("length", length);
+
+ // startLine
+ jsonObject.addProperty("startLine", startLine);
+
+ // startColumn
+ jsonObject.addProperty("startColumn", startColumn);
+
+ // Return the JsonObject
+ return jsonObject;
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();

Powered by Google App Engine
This is Rietveld 408576698