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
code;
51 private final String stackTrace;
59 this.stackTrace = stackTrace;
68 ObjectUtilities.equals(other.message,
message) &&
69 ObjectUtilities.equals(other.stackTrace, stackTrace);
75 String
code = jsonObject.get(
"code").getAsString();
76 String
message = jsonObject.get(
"message").getAsString();
77 String stackTrace = jsonObject.get(
"stackTrace") ==
null ? null : jsonObject.get(
"stackTrace").getAsString();
82 if (jsonArray ==
null) {
85 ArrayList<RequestError> list =
new ArrayList<RequestError>(jsonArray.size());
86 Iterator<JsonElement> iterator = jsonArray.iterator();
87 while (iterator.hasNext()) {
88 list.add(fromJson(iterator.next().getAsJsonObject()));
116 HashCodeBuilder
builder =
new HashCodeBuilder();
124 JsonObject jsonObject =
new JsonObject();
125 jsonObject.addProperty(
"code",
code);
126 jsonObject.addProperty(
"message",
message);
127 if (stackTrace !=
null) {
128 jsonObject.addProperty(
"stackTrace", stackTrace);
135 StringBuilder
builder =
new StringBuilder();
boolean equals(Object obj)
static List< RequestError > fromJsonArray(JsonArray jsonArray)
RequestError(String code, String message, String stackTrace)
static RequestError fromJson(JsonObject jsonObject)