Chromium Code Reviews| Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/CompletionSuggestion.java |
| diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/CompletionSuggestion.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/CompletionSuggestion.java |
| index 9e3f071c530f33ea221d6fb1840874cf45ebe044..4fac4d1e51ea8e606b809dfec82fe0a5135c2ea6 100644 |
| --- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/CompletionSuggestion.java |
| +++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/CompletionSuggestion.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; |
| /** |
| @@ -57,12 +60,12 @@ public class CompletionSuggestion { |
| * The offset, relative to the beginning of the completion, of where the selection should be placed |
| * after insertion. |
| */ |
| - private final int selectionOffset; |
| + private final Integer selectionOffset; |
| /** |
| * The number of characters that should be selected after insertion. |
| */ |
| - private final int selectionLength; |
| + private final Integer selectionLength; |
| /** |
| * True if the suggested element is deprecated. |
| @@ -115,13 +118,13 @@ public class CompletionSuggestion { |
| * The number of required parameters for the function or method being suggested. This field is |
| * omitted if the parameterNames field is omitted. |
| */ |
| - private final int requiredParameterCount; |
| + private final Integer requiredParameterCount; |
| /** |
| * The number of positional parameters for the function or method being suggested. This field is |
| * omitted if the parameterNames field is omitted. |
| */ |
| - private final int positionalParameterCount; |
| + private final Integer positionalParameterCount; |
| /** |
| * The name of the optional parameter being suggested. This field is omitted if the suggestion is |
| @@ -138,7 +141,7 @@ public class CompletionSuggestion { |
| /** |
| * Constructor for {@link CompletionSuggestion}. |
| */ |
| - public CompletionSuggestion(String kind, String relevance, String completion, int selectionOffset, int selectionLength, Boolean isDeprecated, Boolean isPotential, String docSummary, String docComplete, String declaringType, String returnType, List<String> parameterNames, List<String> parameterTypes, int requiredParameterCount, int positionalParameterCount, String parameterName, String parameterType) { |
| + public CompletionSuggestion(String kind, String relevance, String completion, Integer selectionOffset, Integer selectionLength, Boolean isDeprecated, Boolean isPotential, String docSummary, String docComplete, String declaringType, String returnType, List<String> parameterNames, List<String> parameterTypes, Integer requiredParameterCount, Integer positionalParameterCount, String parameterName, String parameterType) { |
| this.kind = kind; |
| this.relevance = relevance; |
| this.completion = completion; |
| @@ -275,7 +278,7 @@ public class CompletionSuggestion { |
| * The number of positional parameters for the function or method being suggested. This field is |
| * omitted if the parameterNames field is omitted. |
| */ |
| - public int getPositionalParameterCount() { |
| + public Integer getPositionalParameterCount() { |
| return positionalParameterCount; |
| } |
| @@ -290,7 +293,7 @@ public class CompletionSuggestion { |
| * The number of required parameters for the function or method being suggested. This field is |
| * omitted if the parameterNames field is omitted. |
| */ |
| - public int getRequiredParameterCount() { |
| + public Integer getRequiredParameterCount() { |
| return requiredParameterCount; |
| } |
| @@ -305,7 +308,7 @@ public class CompletionSuggestion { |
| /** |
| * The number of characters that should be selected after insertion. |
| */ |
| - public int getSelectionLength() { |
| + public Integer getSelectionLength() { |
| return selectionLength; |
| } |
| @@ -313,10 +316,85 @@ public class CompletionSuggestion { |
| * The offset, relative to the beginning of the completion, of where the selection should be placed |
| * after insertion. |
| */ |
| - public int getSelectionOffset() { |
| + public Integer getSelectionOffset() { |
| return selectionOffset; |
| } |
| + public JsonObject toJson() { |
| + // Create a JsonObject |
| + JsonObject jsonObject = new JsonObject(); |
| + |
| + // kind |
| + jsonObject.addProperty("kind", kind); |
| + |
| + // relevance |
| + jsonObject.addProperty("relevance", relevance); |
| + |
| + // completion |
| + jsonObject.addProperty("completion", completion); |
| + |
| + // selectionOffset |
| + jsonObject.addProperty("selectionOffset", selectionOffset); |
| + |
| + // selectionLength |
| + jsonObject.addProperty("selectionLength", selectionLength); |
| + |
| + // isDeprecated |
| + jsonObject.addProperty("isDeprecated", isDeprecated); |
| + |
| + // isPotential |
| + jsonObject.addProperty("isPotential", isPotential); |
| + |
| + // docSummary |
| + if (docSummary != null) { |
| + jsonObject.addProperty("docSummary", docSummary); |
| + } |
| + |
| + // docComplete |
| + if (docComplete != null) { |
| + jsonObject.addProperty("docComplete", docComplete); |
| + } |
| + |
| + // declaringType |
| + if (declaringType != null) { |
| + jsonObject.addProperty("declaringType", declaringType); |
| + } |
| + |
| + // returnType |
| + if (returnType != null) { |
| + jsonObject.addProperty("returnType", returnType); |
| + } |
| + |
| + // parameterNames |
| + // the type Object cannot be represented in JsonObject |
|
Paul Berry
2014/08/19 20:51:12
parameterNames isn't an object, it's a List<String
jwren
2014/08/20 20:51:20
Done.
|
| + |
| + // parameterTypes |
| + // the type Object cannot be represented in JsonObject |
| + |
| + // requiredParameterCount |
| + if (requiredParameterCount != null) { |
| + jsonObject.addProperty("requiredParameterCount", requiredParameterCount); |
| + } |
| + |
| + // positionalParameterCount |
| + if (positionalParameterCount != null) { |
| + jsonObject.addProperty("positionalParameterCount", positionalParameterCount); |
| + } |
| + |
| + // parameterName |
| + if (parameterName != null) { |
| + jsonObject.addProperty("parameterName", parameterName); |
| + } |
| + |
| + // parameterType |
| + if (parameterType != null) { |
| + jsonObject.addProperty("parameterType", parameterType); |
| + } |
| + |
| + // Return the JsonObject |
| + return jsonObject; |
| + } |
| + |
| @Override |
| public String toString() { |
| StringBuilder builder = new StringBuilder(); |