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;
32@SuppressWarnings(
"unused")
44 private final String scope;
56 this.libraryPaths = libraryPaths;
64 ObjectUtilities.
equals(other.scope, scope) &&
65 ObjectUtilities.equals(other.libraryPaths, libraryPaths);
71 String scope = jsonObject.get(
"scope").getAsString();
72 List<String> libraryPaths = JsonUtilities.decodeStringList(jsonObject.get(
"libraryPaths").getAsJsonArray());
77 if (jsonArray ==
null) {
80 ArrayList<LibraryPathSet> list =
new ArrayList<LibraryPathSet>(jsonArray.size());
81 Iterator<JsonElement> iterator = jsonArray.iterator();
82 while (iterator.hasNext()) {
83 list.add(fromJson(iterator.next().getAsJsonObject()));
106 HashCodeBuilder
builder =
new HashCodeBuilder();
113 JsonObject jsonObject =
new JsonObject();
114 jsonObject.addProperty(
"scope", scope);
115 JsonArray jsonArrayLibraryPaths =
new JsonArray();
116 for (String elt : libraryPaths) {
117 jsonArrayLibraryPaths.add(
new JsonPrimitive(elt));
119 jsonObject.add(
"libraryPaths", jsonArrayLibraryPaths);
125 StringBuilder
builder =
new StringBuilder();
129 builder.append(
"libraryPaths=");
130 builder.append(StringUtils.join(libraryPaths,
", "));
static List< LibraryPathSet > fromJsonArray(JsonArray jsonArray)
static LibraryPathSet fromJson(JsonObject jsonObject)
boolean equals(Object obj)
List< String > getLibraryPaths()
LibraryPathSet(String scope, List< String > libraryPaths)