9package org.dartlang.analysis.server.protocol;
11import java.util.Arrays;
14import com.google.common.collect.Lists;
15import com.google.dart.server.utilities.general.JsonUtilities;
16import com.google.dart.server.utilities.general.ObjectUtilities;
17import com.google.gson.JsonArray;
18import com.google.gson.JsonElement;
19import com.google.gson.JsonObject;
20import com.google.gson.JsonPrimitive;
21import org.apache.commons.lang3.builder.HashCodeBuilder;
22import java.util.ArrayList;
23import java.util.Iterator;
24import org.apache.commons.lang3.StringUtils;
31@SuppressWarnings(
"unused")
42 private final String libraryPath;
47 private final String kind;
52 private final String
name;
82 this.libraryPath = libraryPath;
85 this.typeArguments = typeArguments;
86 this.returnType = returnType;
87 this.parameterTypes = parameterTypes;
88 this.parameterNames = parameterNames;
96 ObjectUtilities.
equals(other.libraryPath, libraryPath) &&
97 ObjectUtilities.equals(other.kind, kind) &&
98 ObjectUtilities.equals(other.name,
name) &&
99 ObjectUtilities.equals(other.typeArguments, typeArguments) &&
100 ObjectUtilities.equals(other.returnType, returnType) &&
101 ObjectUtilities.equals(other.parameterTypes, parameterTypes) &&
102 ObjectUtilities.equals(other.parameterNames, parameterNames);
108 String libraryPath = jsonObject.get(
"libraryPath") ==
null ? null : jsonObject.get(
"libraryPath").getAsString();
109 String kind = jsonObject.get(
"kind").getAsString();
110 String
name = jsonObject.get(
"name") ==
null ? null : jsonObject.get(
"name").getAsString();
114 List<String> parameterNames = jsonObject.get(
"parameterNames") ==
null ? null : JsonUtilities.decodeStringList(jsonObject.get(
"parameterNames").getAsJsonArray());
119 if (jsonArray ==
null) {
122 ArrayList<RuntimeCompletionExpressionType> list =
new ArrayList<RuntimeCompletionExpressionType>(jsonArray.size());
123 Iterator<JsonElement> iterator = jsonArray.iterator();
124 while (iterator.hasNext()) {
125 list.add(fromJson(iterator.next().getAsJsonObject()));
158 return parameterNames;
166 return parameterTypes;
181 return typeArguments;
186 HashCodeBuilder
builder =
new HashCodeBuilder();
192 builder.append(parameterTypes);
193 builder.append(parameterNames);
198 JsonObject jsonObject =
new JsonObject();
199 if (libraryPath !=
null) {
200 jsonObject.addProperty(
"libraryPath", libraryPath);
202 jsonObject.addProperty(
"kind", kind);
204 jsonObject.addProperty(
"name",
name);
206 if (typeArguments !=
null) {
207 JsonArray jsonArrayTypeArguments =
new JsonArray();
209 jsonArrayTypeArguments.add(elt.toJson());
211 jsonObject.add(
"typeArguments", jsonArrayTypeArguments);
213 if (returnType !=
null) {
214 jsonObject.add(
"returnType", returnType.
toJson());
216 if (parameterTypes !=
null) {
217 JsonArray jsonArrayParameterTypes =
new JsonArray();
219 jsonArrayParameterTypes.add(elt.toJson());
221 jsonObject.add(
"parameterTypes", jsonArrayParameterTypes);
223 if (parameterNames !=
null) {
224 JsonArray jsonArrayParameterNames =
new JsonArray();
225 for (String elt : parameterNames) {
226 jsonArrayParameterNames.add(
new JsonPrimitive(elt));
228 jsonObject.add(
"parameterNames", jsonArrayParameterNames);
235 StringBuilder
builder =
new StringBuilder();
237 builder.append(
"libraryPath=");
238 builder.append(libraryPath +
", ");
243 builder.append(
"typeArguments=");
244 builder.append(StringUtils.join(typeArguments,
", ") +
", ");
246 builder.append(returnType +
", ");
247 builder.append(
"parameterTypes=");
248 builder.append(StringUtils.join(parameterTypes,
", ") +
", ");
249 builder.append(
"parameterNames=");
250 builder.append(StringUtils.join(parameterNames,
", "));
List< RuntimeCompletionExpressionType > getTypeArguments()
boolean equals(Object obj)
List< String > getParameterNames()
static List< RuntimeCompletionExpressionType > fromJsonArray(JsonArray jsonArray)
RuntimeCompletionExpressionType getReturnType()
static RuntimeCompletionExpressionType fromJson(JsonObject jsonObject)
RuntimeCompletionExpressionType(String libraryPath, String kind, String name, List< RuntimeCompletionExpressionType > typeArguments, RuntimeCompletionExpressionType returnType, List< RuntimeCompletionExpressionType > parameterTypes, List< String > parameterNames)
List< RuntimeCompletionExpressionType > getParameterTypes()
DEF_SWITCHES_START aot vmservice shared library name