Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
org.dartlang.analysis.server.protocol.SourceChange Class Reference

Public Member Functions

 SourceChange (String message, List< SourceFileEdit > edits, List< LinkedEditGroup > linkedEditGroups, Position selection, Integer selectionLength, String id)
 
boolean equals (Object obj)
 
List< SourceFileEditgetEdits ()
 
String getId ()
 
List< LinkedEditGroupgetLinkedEditGroups ()
 
String getMessage ()
 
Position getSelection ()
 
Integer getSelectionLength ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static SourceChange fromJson (JsonObject jsonObject)
 
static List< SourceChangefromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final SourceChange[] EMPTY_ARRAY = new SourceChange[0]
 
static final List< SourceChangeEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

A description of a set of edits that implement a single conceptual change.

@coverage dart.server.generated.types

Definition at line 32 of file SourceChange.java.

Constructor & Destructor Documentation

◆ SourceChange()

org.dartlang.analysis.server.protocol.SourceChange.SourceChange ( String  message,
List< SourceFileEdit edits,
List< LinkedEditGroup linkedEditGroups,
Position  selection,
Integer  selectionLength,
String  id 
)
inline

Constructor for SourceChange.

Definition at line 76 of file SourceChange.java.

76 {
77 this.message = message;
78 this.edits = edits;
79 this.linkedEditGroups = linkedEditGroups;
80 this.selection = selection;
81 this.selectionLength = selectionLength;
82 this.id = id;
83 }

Member Function Documentation

◆ equals()

boolean org.dartlang.analysis.server.protocol.SourceChange.equals ( Object  obj)
inline

Definition at line 86 of file SourceChange.java.

86 {
87 if (obj instanceof SourceChange) {
88 SourceChange other = (SourceChange) obj;
89 return
90 ObjectUtilities.equals(other.message, message) &&
91 ObjectUtilities.equals(other.edits, edits) &&
92 ObjectUtilities.equals(other.linkedEditGroups, linkedEditGroups) &&
93 ObjectUtilities.equals(other.selection, selection) &&
94 ObjectUtilities.equals(other.selectionLength, selectionLength) &&
95 ObjectUtilities.equals(other.id, id);
96 }
97 return false;
98 }

◆ fromJson()

static SourceChange org.dartlang.analysis.server.protocol.SourceChange.fromJson ( JsonObject  jsonObject)
inlinestatic

Definition at line 100 of file SourceChange.java.

100 {
101 String message = jsonObject.get("message").getAsString();
102 List<SourceFileEdit> edits = SourceFileEdit.fromJsonArray(jsonObject.get("edits").getAsJsonArray());
103 List<LinkedEditGroup> linkedEditGroups = LinkedEditGroup.fromJsonArray(jsonObject.get("linkedEditGroups").getAsJsonArray());
104 Position selection = jsonObject.get("selection") == null ? null : Position.fromJson(jsonObject.get("selection").getAsJsonObject());
105 Integer selectionLength = jsonObject.get("selectionLength") == null ? null : jsonObject.get("selectionLength").getAsInt();
106 String id = jsonObject.get("id") == null ? null : jsonObject.get("id").getAsString();
107 return new SourceChange(message, edits, linkedEditGroups, selection, selectionLength, id);
108 }
static Position fromJson(JsonObject jsonObject)
Definition Position.java:67
SourceChange(String message, List< SourceFileEdit > edits, List< LinkedEditGroup > linkedEditGroups, Position selection, Integer selectionLength, String id)

◆ fromJsonArray()

static List< SourceChange > org.dartlang.analysis.server.protocol.SourceChange.fromJsonArray ( JsonArray  jsonArray)
inlinestatic

Definition at line 110 of file SourceChange.java.

110 {
111 if (jsonArray == null) {
112 return EMPTY_LIST;
113 }
114 ArrayList<SourceChange> list = new ArrayList<SourceChange>(jsonArray.size());
115 Iterator<JsonElement> iterator = jsonArray.iterator();
116 while (iterator.hasNext()) {
117 list.add(fromJson(iterator.next().getAsJsonObject()));
118 }
119 return list;
120 }
static SourceChange fromJson(JsonObject jsonObject)
static final List< SourceChange > EMPTY_LIST

◆ getEdits()

List< SourceFileEdit > org.dartlang.analysis.server.protocol.SourceChange.getEdits ( )
inline

A list of the edits used to effect the change, grouped by file.

Definition at line 125 of file SourceChange.java.

125 {
126 return edits;
127 }

◆ getId()

String org.dartlang.analysis.server.protocol.SourceChange.getId ( )
inline

The optional identifier of the change kind. The identifier remains stable even if the message changes, or is parameterized.

Definition at line 133 of file SourceChange.java.

133 {
134 return id;
135 }

◆ getLinkedEditGroups()

List< LinkedEditGroup > org.dartlang.analysis.server.protocol.SourceChange.getLinkedEditGroups ( )
inline

A list of the linked editing groups used to customize the changes that were made.

Definition at line 140 of file SourceChange.java.

140 {
141 return linkedEditGroups;
142 }

◆ getMessage()

String org.dartlang.analysis.server.protocol.SourceChange.getMessage ( )
inline

A human-readable description of the change to be applied.

If this change includes multiple edits made for different reasons (such as during a bulk fix operation), the individual items in edits may contain more specific descriptions.

Definition at line 150 of file SourceChange.java.

150 {
151 return message;
152 }

◆ getSelection()

Position org.dartlang.analysis.server.protocol.SourceChange.getSelection ( )
inline

The position that should be selected after the edits have been applied.

Definition at line 157 of file SourceChange.java.

157 {
158 return selection;
159 }

◆ getSelectionLength()

Integer org.dartlang.analysis.server.protocol.SourceChange.getSelectionLength ( )
inline

The length of the selection (starting at Position) that should be selected after the edits have been applied.

Definition at line 165 of file SourceChange.java.

165 {
166 return selectionLength;
167 }

◆ hashCode()

int org.dartlang.analysis.server.protocol.SourceChange.hashCode ( )
inline

Definition at line 170 of file SourceChange.java.

170 {
171 HashCodeBuilder builder = new HashCodeBuilder();
172 builder.append(message);
173 builder.append(edits);
174 builder.append(linkedEditGroups);
175 builder.append(selection);
176 builder.append(selectionLength);
177 builder.append(id);
178 return builder.toHashCode();
179 }

◆ toJson()

JsonObject org.dartlang.analysis.server.protocol.SourceChange.toJson ( )
inline

Definition at line 181 of file SourceChange.java.

181 {
182 JsonObject jsonObject = new JsonObject();
183 jsonObject.addProperty("message", message);
184 JsonArray jsonArrayEdits = new JsonArray();
185 for (SourceFileEdit elt : edits) {
186 jsonArrayEdits.add(elt.toJson());
187 }
188 jsonObject.add("edits", jsonArrayEdits);
189 JsonArray jsonArrayLinkedEditGroups = new JsonArray();
190 for (LinkedEditGroup elt : linkedEditGroups) {
191 jsonArrayLinkedEditGroups.add(elt.toJson());
192 }
193 jsonObject.add("linkedEditGroups", jsonArrayLinkedEditGroups);
194 if (selection != null) {
195 jsonObject.add("selection", selection.toJson());
196 }
197 if (selectionLength != null) {
198 jsonObject.addProperty("selectionLength", selectionLength);
199 }
200 if (id != null) {
201 jsonObject.addProperty("id", id);
202 }
203 return jsonObject;
204 }

◆ toString()

String org.dartlang.analysis.server.protocol.SourceChange.toString ( )
inline

Definition at line 207 of file SourceChange.java.

207 {
208 StringBuilder builder = new StringBuilder();
209 builder.append("[");
210 builder.append("message=");
211 builder.append(message + ", ");
212 builder.append("edits=");
213 builder.append(StringUtils.join(edits, ", ") + ", ");
214 builder.append("linkedEditGroups=");
215 builder.append(StringUtils.join(linkedEditGroups, ", ") + ", ");
216 builder.append("selection=");
217 builder.append(selection + ", ");
218 builder.append("selectionLength=");
219 builder.append(selectionLength + ", ");
220 builder.append("id=");
221 builder.append(id);
222 builder.append("]");
223 return builder.toString();
224 }

Member Data Documentation

◆ EMPTY_ARRAY

final SourceChange [] org.dartlang.analysis.server.protocol.SourceChange.EMPTY_ARRAY = new SourceChange[0]
static

Definition at line 34 of file SourceChange.java.

◆ EMPTY_LIST

final List<SourceChange> org.dartlang.analysis.server.protocol.SourceChange.EMPTY_LIST = Lists.newArrayList()
static

Definition at line 36 of file SourceChange.java.


The documentation for this class was generated from the following file: