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")
41 private final String
name;
46 private final String kind;
51 private final int fileIndex;
61 private final int line;
66 private final int column;
71 private final int codeOffset;
76 private final int codeLength;
82 private final String className;
88 private final String mixinName;
97 private final String parameters;
102 public ElementDeclaration(String
name, String kind,
int fileIndex,
int offset,
int line,
int column,
int codeOffset,
int codeLength, String className, String mixinName, String parameters) {
105 this.fileIndex = fileIndex;
108 this.column = column;
109 this.codeOffset = codeOffset;
110 this.codeLength = codeLength;
111 this.className = className;
112 this.mixinName = mixinName;
113 this.parameters = parameters;
122 ObjectUtilities.equals(other.kind, kind) &&
123 other.fileIndex == fileIndex &&
125 other.line ==
line &&
126 other.column == column &&
127 other.codeOffset == codeOffset &&
128 other.codeLength == codeLength &&
129 ObjectUtilities.equals(other.className, className) &&
130 ObjectUtilities.equals(other.mixinName, mixinName) &&
131 ObjectUtilities.equals(other.parameters, parameters);
137 String
name = jsonObject.get(
"name").getAsString();
138 String kind = jsonObject.get(
"kind").getAsString();
139 int fileIndex = jsonObject.get(
"fileIndex").getAsInt();
140 int offset = jsonObject.get(
"offset").getAsInt();
141 int line = jsonObject.get(
"line").getAsInt();
142 int column = jsonObject.get(
"column").getAsInt();
143 int codeOffset = jsonObject.get(
"codeOffset").getAsInt();
144 int codeLength = jsonObject.get(
"codeLength").getAsInt();
145 String className = jsonObject.get(
"className") ==
null ? null : jsonObject.get(
"className").getAsString();
146 String mixinName = jsonObject.get(
"mixinName") ==
null ? null : jsonObject.get(
"mixinName").getAsString();
147 String parameters = jsonObject.get(
"parameters") ==
null ? null : jsonObject.get(
"parameters").getAsString();
148 return new ElementDeclaration(
name, kind, fileIndex,
offset,
line, column, codeOffset, codeLength, className, mixinName, parameters);
152 if (jsonArray ==
null) {
155 ArrayList<ElementDeclaration> list =
new ArrayList<ElementDeclaration>(jsonArray.size());
156 Iterator<JsonElement> iterator = jsonArray.iterator();
157 while (iterator.hasNext()) {
158 list.add(fromJson(iterator.next().getAsJsonObject()));
248 HashCodeBuilder
builder =
new HashCodeBuilder();
264 JsonObject jsonObject =
new JsonObject();
265 jsonObject.addProperty(
"name",
name);
266 jsonObject.addProperty(
"kind", kind);
267 jsonObject.addProperty(
"fileIndex", fileIndex);
268 jsonObject.addProperty(
"offset",
offset);
269 jsonObject.addProperty(
"line",
line);
270 jsonObject.addProperty(
"column", column);
271 jsonObject.addProperty(
"codeOffset", codeOffset);
272 jsonObject.addProperty(
"codeLength", codeLength);
273 if (className !=
null) {
274 jsonObject.addProperty(
"className", className);
276 if (mixinName !=
null) {
277 jsonObject.addProperty(
"mixinName", mixinName);
279 if (parameters !=
null) {
280 jsonObject.addProperty(
"parameters", parameters);
287 StringBuilder
builder =
new StringBuilder();
294 builder.append(fileIndex +
", ");
302 builder.append(codeOffset +
", ");
304 builder.append(codeLength +
", ");
306 builder.append(className +
", ");
308 builder.append(mixinName +
", ");
static ElementDeclaration fromJson(JsonObject jsonObject)
ElementDeclaration(String name, String kind, int fileIndex, int offset, int line, int column, int codeOffset, int codeLength, String className, String mixinName, String parameters)
boolean equals(Object obj)
static List< ElementDeclaration > fromJsonArray(JsonArray jsonArray)
DEF_SWITCHES_START aot vmservice shared library name