Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
org.dartlang.analysis.server.protocol.SourceEdit Class Reference

Public Member Functions

 SourceEdit (int offset, int length, String replacement, String id, String description)
 
boolean equals (Object obj)
 
String getDescription ()
 
String getId ()
 
int getLength ()
 
int getOffset ()
 
String getReplacement ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static SourceEdit fromJson (JsonObject jsonObject)
 
static List< SourceEditfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final SourceEdit[] EMPTY_ARRAY = new SourceEdit[0]
 
static final List< SourceEditEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

A description of a single change to a single file.

@coverage dart.server.generated.types

Definition at line 32 of file SourceEdit.java.

Constructor & Destructor Documentation

◆ SourceEdit()

org.dartlang.analysis.server.protocol.SourceEdit.SourceEdit ( int  offset,
int  length,
String  replacement,
String  id,
String  description 
)
inline

Constructor for SourceEdit.

Definition at line 79 of file SourceEdit.java.

79 {
80 this.offset = offset;
81 this.length = length;
82 this.replacement = replacement;
83 this.id = id;
84 this.description = description;
85 }

Member Function Documentation

◆ equals()

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

Definition at line 88 of file SourceEdit.java.

88 {
89 if (obj instanceof SourceEdit) {
90 SourceEdit other = (SourceEdit) obj;
91 return
92 other.offset == offset &&
93 other.length == length &&
94 ObjectUtilities.equals(other.replacement, replacement) &&
95 ObjectUtilities.equals(other.id, id) &&
96 ObjectUtilities.equals(other.description, description);
97 }
98 return false;
99 }
SourceEdit(int offset, int length, String replacement, String id, String description)
Definition: SourceEdit.java:79

◆ fromJson()

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

Definition at line 101 of file SourceEdit.java.

101 {
102 int offset = jsonObject.get("offset").getAsInt();
103 int length = jsonObject.get("length").getAsInt();
104 String replacement = jsonObject.get("replacement").getAsString();
105 String id = jsonObject.get("id") == null ? null : jsonObject.get("id").getAsString();
106 String description = jsonObject.get("description") == null ? null : jsonObject.get("description").getAsString();
107 return new SourceEdit(offset, length, replacement, id, description);
108 }

◆ fromJsonArray()

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

Definition at line 110 of file SourceEdit.java.

110 {
111 if (jsonArray == null) {
112 return EMPTY_LIST;
113 }
114 ArrayList<SourceEdit> list = new ArrayList<SourceEdit>(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 final List< SourceEdit > EMPTY_LIST
Definition: SourceEdit.java:36
static SourceEdit fromJson(JsonObject jsonObject)

◆ getDescription()

String org.dartlang.analysis.server.protocol.SourceEdit.getDescription ( )
inline

A human readable description of the change made by this edit.

This description should be short and suitable to use as a heading with changes grouped by it. For example, a change made as part of a quick-fix may use the message "Replace final with var", allowing multiple changes and multiple applications of the fix to be grouped together.

This value may be more specific than any value in an enclosing SourceChange.message which could contain edits made for different reasons (such as during a bulk fix operation).

Definition at line 132 of file SourceEdit.java.

132 {
133 return description;
134 }

◆ getId()

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

An identifier that uniquely identifies this source edit from other edits in the same response. This field is omitted unless a containing structure needs to be able to identify the edit for some reason.

For example, some refactoring operations can produce edits that might not be appropriate (referred to as potential edits). Such edits will have an id so that they can be referenced. Edits in the same response that do not need to be referenced will not have an id.

Definition at line 145 of file SourceEdit.java.

145 {
146 return id;
147 }

◆ getLength()

int org.dartlang.analysis.server.protocol.SourceEdit.getLength ( )
inline

The length of the region to be modified.

Definition at line 152 of file SourceEdit.java.

152 {
153 return length;
154 }

◆ getOffset()

int org.dartlang.analysis.server.protocol.SourceEdit.getOffset ( )
inline

The offset of the region to be modified.

Definition at line 159 of file SourceEdit.java.

159 {
160 return offset;
161 }

◆ getReplacement()

String org.dartlang.analysis.server.protocol.SourceEdit.getReplacement ( )
inline

The code that is to replace the specified region in the original code.

Definition at line 166 of file SourceEdit.java.

166 {
167 return replacement;
168 }

◆ hashCode()

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

Definition at line 171 of file SourceEdit.java.

171 {
172 HashCodeBuilder builder = new HashCodeBuilder();
173 builder.append(offset);
174 builder.append(length);
175 builder.append(replacement);
176 builder.append(id);
177 builder.append(description);
178 return builder.toHashCode();
179 }

◆ toJson()

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

Definition at line 181 of file SourceEdit.java.

181 {
182 JsonObject jsonObject = new JsonObject();
183 jsonObject.addProperty("offset", offset);
184 jsonObject.addProperty("length", length);
185 jsonObject.addProperty("replacement", replacement);
186 if (id != null) {
187 jsonObject.addProperty("id", id);
188 }
189 if (description != null) {
190 jsonObject.addProperty("description", description);
191 }
192 return jsonObject;
193 }

◆ toString()

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

Definition at line 196 of file SourceEdit.java.

196 {
197 StringBuilder builder = new StringBuilder();
198 builder.append("[");
199 builder.append("offset=");
200 builder.append(offset + ", ");
201 builder.append("length=");
202 builder.append(length + ", ");
203 builder.append("replacement=");
204 builder.append(replacement + ", ");
205 builder.append("id=");
206 builder.append(id + ", ");
207 builder.append("description=");
208 builder.append(description);
209 builder.append("]");
210 return builder.toString();
211 }

Member Data Documentation

◆ EMPTY_ARRAY

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

Definition at line 34 of file SourceEdit.java.

◆ EMPTY_LIST

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

Definition at line 36 of file SourceEdit.java.


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