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
file;
49 private final long fileStamp;
61 this.fileStamp = fileStamp;
71 other.fileStamp == fileStamp &&
72 ObjectUtilities.equals(other.edits, edits);
78 String
file = jsonObject.get(
"file").getAsString();
79 long fileStamp = jsonObject.get(
"fileStamp").getAsLong();
85 if (jsonArray ==
null) {
88 ArrayList<SourceFileEdit> list =
new ArrayList<SourceFileEdit>(jsonArray.size());
89 Iterator<JsonElement> iterator = jsonArray.iterator();
90 while (iterator.hasNext()) {
91 list.add(fromJson(iterator.next().getAsJsonObject()));
122 HashCodeBuilder
builder =
new HashCodeBuilder();
130 JsonObject jsonObject =
new JsonObject();
131 jsonObject.addProperty(
"file",
file);
132 jsonObject.addProperty(
"fileStamp", fileStamp);
133 JsonArray jsonArrayEdits =
new JsonArray();
135 jsonArrayEdits.add(elt.toJson());
137 jsonObject.add(
"edits", jsonArrayEdits);
143 StringBuilder
builder =
new StringBuilder();
148 builder.append(fileStamp +
", ");
150 builder.append(StringUtils.join(edits,
", "));
static List< SourceEdit > fromJsonArray(JsonArray jsonArray)
static List< SourceFileEdit > fromJsonArray(JsonArray jsonArray)
boolean equals(Object obj)
SourceFileEdit(String file, long fileStamp, List< SourceEdit > edits)
List< SourceEdit > getEdits()
static SourceFileEdit fromJson(JsonObject jsonObject)