| Index: editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java
|
| diff --git a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java
|
| index eed27d96df591bf929ac6ed5f7b563690d2391d8..10712f2a1ca5d5e99abe0c8ffc6400b2e7521494 100644
|
| --- a/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java
|
| +++ b/editor/tools/plugins/com.google.dart.server/src/com/google/dart/server/generated/types/SearchResult.java
|
| @@ -19,10 +19,15 @@ package com.google.dart.server.generated.types;
|
| import java.util.Arrays;
|
| import java.util.List;
|
| import java.util.Map;
|
| +import com.google.common.collect.Lists;
|
| +import com.google.dart.server.utilities.general.JsonUtilities;
|
| import com.google.dart.server.utilities.general.ObjectUtilities;
|
| import com.google.gson.JsonArray;
|
| +import com.google.gson.JsonElement;
|
| import com.google.gson.JsonObject;
|
| import com.google.gson.JsonPrimitive;
|
| +import java.util.ArrayList;
|
| +import java.util.Iterator;
|
| import org.apache.commons.lang3.StringUtils;
|
|
|
| /**
|
| @@ -33,11 +38,10 @@ import org.apache.commons.lang3.StringUtils;
|
| @SuppressWarnings("unused")
|
| public class SearchResult {
|
|
|
| - /**
|
| - * An empty array of {@link SearchResult}s.
|
| - */
|
| public static final SearchResult[] EMPTY_ARRAY = new SearchResult[0];
|
|
|
| + public static final List<SearchResult> EMPTY_LIST = Lists.newArrayList();
|
| +
|
| /**
|
| * The location of the code that matched the search criteria.
|
| */
|
| @@ -84,6 +88,26 @@ public class SearchResult {
|
| return false;
|
| }
|
|
|
| + public static SearchResult fromJson(JsonObject jsonObject) {
|
| + Location location = Location.fromJson(jsonObject.get("location").getAsJsonObject());
|
| + String kind = jsonObject.get("kind").getAsString();
|
| + Boolean isPotential = jsonObject.get("isPotential").getAsBoolean();
|
| + List<Element> path = Element.fromJsonArray(jsonObject.get("path").getAsJsonArray());
|
| + return new SearchResult(location, kind, isPotential, path);
|
| + }
|
| +
|
| + public static List<SearchResult> fromJsonArray(JsonArray jsonArray) {
|
| + if (jsonArray == null) {
|
| + return EMPTY_LIST;
|
| + }
|
| + ArrayList<SearchResult> list = new ArrayList<SearchResult>(jsonArray.size());
|
| + Iterator<JsonElement> iterator = jsonArray.iterator();
|
| + while (iterator.hasNext()) {
|
| + list.add(fromJson(iterator.next().getAsJsonObject()));
|
| + }
|
| + return list;
|
| + }
|
| +
|
| /**
|
| * True if the result is a potential match but cannot be confirmed to be a match. For example, if
|
| * all references to a method m defined in some class were requested, and a reference to a method m
|
|
|