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

Public Member Functions

 SourceFileEdit (String file, long fileStamp, List< SourceEdit > edits)
 
boolean equals (Object obj)
 
List< SourceEditgetEdits ()
 
String getFile ()
 
long getFileStamp ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 

Static Public Member Functions

static SourceFileEdit fromJson (JsonObject jsonObject)
 
static List< SourceFileEditfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final SourceFileEdit[] EMPTY_ARRAY = new SourceFileEdit[0]
 
static final List< SourceFileEditEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

A description of a set of changes to a single file.

@coverage dart.server.generated.types

Definition at line 32 of file SourceFileEdit.java.

Constructor & Destructor Documentation

◆ SourceFileEdit()

org.dartlang.analysis.server.protocol.SourceFileEdit.SourceFileEdit ( String  file,
long  fileStamp,
List< SourceEdit edits 
)
inline

Constructor for SourceFileEdit.

Definition at line 59 of file SourceFileEdit.java.

59 {
60 this.file = file;
61 this.fileStamp = fileStamp;
62 this.edits = edits;
63 }

Member Function Documentation

◆ equals()

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

Definition at line 66 of file SourceFileEdit.java.

66 {
67 if (obj instanceof SourceFileEdit) {
68 SourceFileEdit other = (SourceFileEdit) obj;
69 return
70 ObjectUtilities.equals(other.file, file) &&
71 other.fileStamp == fileStamp &&
72 ObjectUtilities.equals(other.edits, edits);
73 }
74 return false;
75 }
SourceFileEdit(String file, long fileStamp, List< SourceEdit > edits)

◆ fromJson()

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

Definition at line 77 of file SourceFileEdit.java.

77 {
78 String file = jsonObject.get("file").getAsString();
79 long fileStamp = jsonObject.get("fileStamp").getAsLong();
80 List<SourceEdit> edits = SourceEdit.fromJsonArray(jsonObject.get("edits").getAsJsonArray());
81 return new SourceFileEdit(file, fileStamp, edits);
82 }

◆ fromJsonArray()

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

Definition at line 84 of file SourceFileEdit.java.

84 {
85 if (jsonArray == null) {
86 return EMPTY_LIST;
87 }
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()));
92 }
93 return list;
94 }
static final List< SourceFileEdit > EMPTY_LIST
static SourceFileEdit fromJson(JsonObject jsonObject)

◆ getEdits()

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

A list of the edits used to effect the change.

Definition at line 99 of file SourceFileEdit.java.

99 {
100 return edits;
101 }

◆ getFile()

String org.dartlang.analysis.server.protocol.SourceFileEdit.getFile ( )
inline

The file containing the code to be modified.

Definition at line 106 of file SourceFileEdit.java.

106 {
107 return file;
108 }

◆ getFileStamp()

long org.dartlang.analysis.server.protocol.SourceFileEdit.getFileStamp ( )
inline

The modification stamp of the file at the moment when the change was created, in milliseconds since the "Unix epoch". Will be -1 if the file did not exist and should be created. The client may use this field to make sure that the file was not changed since then, so it is safe to apply the change.

Definition at line 116 of file SourceFileEdit.java.

116 {
117 return fileStamp;
118 }

◆ hashCode()

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

Definition at line 121 of file SourceFileEdit.java.

121 {
122 HashCodeBuilder builder = new HashCodeBuilder();
123 builder.append(file);
124 builder.append(fileStamp);
125 builder.append(edits);
126 return builder.toHashCode();
127 }

◆ toJson()

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

Definition at line 129 of file SourceFileEdit.java.

129 {
130 JsonObject jsonObject = new JsonObject();
131 jsonObject.addProperty("file", file);
132 jsonObject.addProperty("fileStamp", fileStamp);
133 JsonArray jsonArrayEdits = new JsonArray();
134 for (SourceEdit elt : edits) {
135 jsonArrayEdits.add(elt.toJson());
136 }
137 jsonObject.add("edits", jsonArrayEdits);
138 return jsonObject;
139 }

◆ toString()

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

Definition at line 142 of file SourceFileEdit.java.

142 {
143 StringBuilder builder = new StringBuilder();
144 builder.append("[");
145 builder.append("file=");
146 builder.append(file + ", ");
147 builder.append("fileStamp=");
148 builder.append(fileStamp + ", ");
149 builder.append("edits=");
150 builder.append(StringUtils.join(edits, ", "));
151 builder.append("]");
152 return builder.toString();
153 }

Member Data Documentation

◆ EMPTY_ARRAY

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

Definition at line 34 of file SourceFileEdit.java.

◆ EMPTY_LIST

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

Definition at line 36 of file SourceFileEdit.java.


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