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

Unified Diff: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/HoverInformation.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/HoverInformation.java
diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/HoverInformation.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/HoverInformation.java
index 7c8ff307440e0a8222c354d045242caf900d215b..9e4c825eca242bd850060ff42fb74c7f1f790f37 100644
--- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/HoverInformation.java
+++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/HoverInformation.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;
/**
@@ -39,13 +42,13 @@ public class HoverInformation {
* The offset of the range of characters that encompases the cursor position and has the same hover
* information as the cursor position.
*/
- private final int offset;
+ private final Integer offset;
/**
* The length of the range of characters that encompases the cursor position and has the same hover
* information as the cursor position.
*/
- private final int length;
+ private final Integer length;
/**
* The path to the defining compilation unit of the library in which the referenced element is
@@ -99,7 +102,7 @@ public class HoverInformation {
/**
* Constructor for {@link HoverInformation}.
*/
- public HoverInformation(int offset, int length, String containingLibraryPath, String containingLibraryName, String dartdoc, String elementDescription, String elementKind, String parameter, String propagatedType, String staticType) {
+ public HoverInformation(Integer offset, Integer length, String containingLibraryPath, String containingLibraryName, String dartdoc, String elementDescription, String elementKind, String parameter, String propagatedType, String staticType) {
this.offset = offset;
this.length = length;
this.containingLibraryPath = containingLibraryPath;
@@ -176,7 +179,7 @@ public class HoverInformation {
* The length of the range of characters that encompases the cursor position and has the same hover
* information as the cursor position.
*/
- public int getLength() {
+ public Integer getLength() {
return length;
}
@@ -184,7 +187,7 @@ public class HoverInformation {
* The offset of the range of characters that encompases the cursor position and has the same hover
* information as the cursor position.
*/
- public int getOffset() {
+ public Integer getOffset() {
return offset;
}
@@ -212,6 +215,60 @@ public class HoverInformation {
return staticType;
}
+ public JsonObject toJson() {
+ // Create a JsonObject
+ JsonObject jsonObject = new JsonObject();
+
+ // offset
+ jsonObject.addProperty("offset", offset);
+
+ // length
+ jsonObject.addProperty("length", length);
+
+ // containingLibraryPath
+ if (containingLibraryPath != null) {
+ jsonObject.addProperty("containingLibraryPath", containingLibraryPath);
+ }
+
+ // containingLibraryName
+ if (containingLibraryName != null) {
+ jsonObject.addProperty("containingLibraryName", containingLibraryName);
+ }
+
+ // dartdoc
+ if (dartdoc != null) {
+ jsonObject.addProperty("dartdoc", dartdoc);
+ }
+
+ // elementDescription
+ if (elementDescription != null) {
+ jsonObject.addProperty("elementDescription", elementDescription);
+ }
+
+ // elementKind
+ if (elementKind != null) {
+ jsonObject.addProperty("elementKind", elementKind);
+ }
+
+ // parameter
+ if (parameter != null) {
+ jsonObject.addProperty("parameter", parameter);
+ }
+
+ // propagatedType
+ if (propagatedType != null) {
+ jsonObject.addProperty("propagatedType", propagatedType);
+ }
+
+ // staticType
+ if (staticType != null) {
+ jsonObject.addProperty("staticType", staticType);
+ }
+
+ // Return the JsonObject
+ return jsonObject;
+ }
+
@Override
public String toString() {
StringBuilder builder = new StringBuilder();

Powered by Google App Engine
This is Rietveld 408576698