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.ExtractMethodFeedback Class Reference
Inheritance diagram for org.dartlang.analysis.server.protocol.ExtractMethodFeedback:
org.dartlang.analysis.server.protocol.RefactoringFeedback

Public Member Functions

 ExtractMethodFeedback (int offset, int length, String returnType, List< String > names, boolean canCreateGetter, List< RefactoringMethodParameter > parameters, int[] offsets, int[] lengths)
 
boolean equals (Object obj)
 
boolean canCreateGetter ()
 
int getLength ()
 
int[] getLengths ()
 
List< String > getNames ()
 
int getOffset ()
 
int[] getOffsets ()
 
List< RefactoringMethodParametergetParameters ()
 
String getReturnType ()
 
int hashCode ()
 
JsonObject toJson ()
 
String toString ()
 
- Public Member Functions inherited from org.dartlang.analysis.server.protocol.RefactoringFeedback
 RefactoringFeedback ()
 

Static Public Member Functions

static ExtractMethodFeedback fromJson (JsonObject jsonObject)
 
static List< ExtractMethodFeedbackfromJsonArray (JsonArray jsonArray)
 

Static Public Attributes

static final ExtractMethodFeedback[] EMPTY_ARRAY = new ExtractMethodFeedback[0]
 
static final List< ExtractMethodFeedbackEMPTY_LIST = Lists.newArrayList()
 
- Static Public Attributes inherited from org.dartlang.analysis.server.protocol.RefactoringFeedback
static final RefactoringFeedback[] EMPTY_ARRAY = new RefactoringFeedback[0]
 
static final List< RefactoringFeedbackEMPTY_LIST = Lists.newArrayList()
 

Detailed Description

@coverage dart.server.generated.types

Definition at line 30 of file ExtractMethodFeedback.java.

Constructor & Destructor Documentation

◆ ExtractMethodFeedback()

org.dartlang.analysis.server.protocol.ExtractMethodFeedback.ExtractMethodFeedback ( int  offset,
int  length,
String  returnType,
List< String >  names,
boolean  canCreateGetter,
List< RefactoringMethodParameter parameters,
int[]  offsets,
int[]  lengths 
)
inline

Constructor for ExtractMethodFeedback.

Definition at line 84 of file ExtractMethodFeedback.java.

84 {
85 this.offset = offset;
86 this.length = length;
87 this.returnType = returnType;
88 this.names = names;
89 this.canCreateGetter = canCreateGetter;
90 this.parameters = parameters;
91 this.offsets = offsets;
92 this.lengths = lengths;
93 }

Member Function Documentation

◆ canCreateGetter()

boolean org.dartlang.analysis.server.protocol.ExtractMethodFeedback.canCreateGetter ( )
inline

True if a getter could be created rather than a method.

Definition at line 139 of file ExtractMethodFeedback.java.

139 {
140 return canCreateGetter;
141 }

◆ equals()

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

Reimplemented from org.dartlang.analysis.server.protocol.RefactoringFeedback.

Definition at line 96 of file ExtractMethodFeedback.java.

96 {
97 if (obj instanceof ExtractMethodFeedback) {
98 ExtractMethodFeedback other = (ExtractMethodFeedback) obj;
99 return
100 other.offset == offset &&
101 other.length == length &&
102 ObjectUtilities.equals(other.returnType, returnType) &&
103 ObjectUtilities.equals(other.names, names) &&
104 other.canCreateGetter == canCreateGetter &&
105 ObjectUtilities.equals(other.parameters, parameters) &&
106 Arrays.equals(other.offsets, offsets) &&
107 Arrays.equals(other.lengths, lengths);
108 }
109 return false;
110 }

◆ fromJson()

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

Reimplemented from org.dartlang.analysis.server.protocol.RefactoringFeedback.

Definition at line 112 of file ExtractMethodFeedback.java.

112 {
113 int offset = jsonObject.get("offset").getAsInt();
114 int length = jsonObject.get("length").getAsInt();
115 String returnType = jsonObject.get("returnType").getAsString();
116 List<String> names = JsonUtilities.decodeStringList(jsonObject.get("names").getAsJsonArray());
117 boolean canCreateGetter = jsonObject.get("canCreateGetter").getAsBoolean();
118 List<RefactoringMethodParameter> parameters = RefactoringMethodParameter.fromJsonArray(jsonObject.get("parameters").getAsJsonArray());
119 int[] offsets = JsonUtilities.decodeIntArray(jsonObject.get("offsets").getAsJsonArray());
120 int[] lengths = JsonUtilities.decodeIntArray(jsonObject.get("lengths").getAsJsonArray());
121 return new ExtractMethodFeedback(offset, length, returnType, names, canCreateGetter, parameters, offsets, lengths);
122 }
ExtractMethodFeedback(int offset, int length, String returnType, List< String > names, boolean canCreateGetter, List< RefactoringMethodParameter > parameters, int[] offsets, int[] lengths)

◆ fromJsonArray()

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

Definition at line 124 of file ExtractMethodFeedback.java.

124 {
125 if (jsonArray == null) {
126 return EMPTY_LIST;
127 }
128 ArrayList<ExtractMethodFeedback> list = new ArrayList<ExtractMethodFeedback>(jsonArray.size());
129 Iterator<JsonElement> iterator = jsonArray.iterator();
130 while (iterator.hasNext()) {
131 list.add(fromJson(iterator.next().getAsJsonObject()));
132 }
133 return list;
134 }
static ExtractMethodFeedback fromJson(JsonObject jsonObject)

◆ getLength()

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

The length of the expression or statements that will be extracted.

Definition at line 146 of file ExtractMethodFeedback.java.

146 {
147 return length;
148 }

◆ getLengths()

int[] org.dartlang.analysis.server.protocol.ExtractMethodFeedback.getLengths ( )
inline

The lengths of the expressions or statements that would be replaced by an invocation of the method. The lengths correspond to the offsets. In other words, for a given expression (or block of statements), if the offset of that expression is offsets[i], then the length of that expression is lengths[i].

Definition at line 156 of file ExtractMethodFeedback.java.

156 {
157 return lengths;
158 }

◆ getNames()

List< String > org.dartlang.analysis.server.protocol.ExtractMethodFeedback.getNames ( )
inline

The proposed names for the method.

Definition at line 163 of file ExtractMethodFeedback.java.

163 {
164 return names;
165 }

◆ getOffset()

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

The offset to the beginning of the expression or statements that will be extracted.

Definition at line 170 of file ExtractMethodFeedback.java.

170 {
171 return offset;
172 }

◆ getOffsets()

int[] org.dartlang.analysis.server.protocol.ExtractMethodFeedback.getOffsets ( )
inline

The offsets of the expressions or statements that would be replaced by an invocation of the method.

Definition at line 178 of file ExtractMethodFeedback.java.

178 {
179 return offsets;
180 }

◆ getParameters()

List< RefactoringMethodParameter > org.dartlang.analysis.server.protocol.ExtractMethodFeedback.getParameters ( )
inline

The proposed parameters for the method.

Definition at line 185 of file ExtractMethodFeedback.java.

185 {
186 return parameters;
187 }

◆ getReturnType()

String org.dartlang.analysis.server.protocol.ExtractMethodFeedback.getReturnType ( )
inline

The proposed return type for the method. If the returned element does not have a declared return type, this field will contain an empty string.

Definition at line 193 of file ExtractMethodFeedback.java.

193 {
194 return returnType;
195 }

◆ hashCode()

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

Reimplemented from org.dartlang.analysis.server.protocol.RefactoringFeedback.

Definition at line 198 of file ExtractMethodFeedback.java.

198 {
199 HashCodeBuilder builder = new HashCodeBuilder();
200 builder.append(offset);
201 builder.append(length);
202 builder.append(returnType);
203 builder.append(names);
204 builder.append(canCreateGetter);
205 builder.append(parameters);
206 builder.append(offsets);
207 builder.append(lengths);
208 return builder.toHashCode();
209 }

◆ toJson()

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

Reimplemented from org.dartlang.analysis.server.protocol.RefactoringFeedback.

Definition at line 211 of file ExtractMethodFeedback.java.

211 {
212 JsonObject jsonObject = new JsonObject();
213 jsonObject.addProperty("offset", offset);
214 jsonObject.addProperty("length", length);
215 jsonObject.addProperty("returnType", returnType);
216 JsonArray jsonArrayNames = new JsonArray();
217 for (String elt : names) {
218 jsonArrayNames.add(new JsonPrimitive(elt));
219 }
220 jsonObject.add("names", jsonArrayNames);
221 jsonObject.addProperty("canCreateGetter", canCreateGetter);
222 JsonArray jsonArrayParameters = new JsonArray();
223 for (RefactoringMethodParameter elt : parameters) {
224 jsonArrayParameters.add(elt.toJson());
225 }
226 jsonObject.add("parameters", jsonArrayParameters);
227 JsonArray jsonArrayOffsets = new JsonArray();
228 for (int elt : offsets) {
229 jsonArrayOffsets.add(new JsonPrimitive(elt));
230 }
231 jsonObject.add("offsets", jsonArrayOffsets);
232 JsonArray jsonArrayLengths = new JsonArray();
233 for (int elt : lengths) {
234 jsonArrayLengths.add(new JsonPrimitive(elt));
235 }
236 jsonObject.add("lengths", jsonArrayLengths);
237 return jsonObject;
238 }

◆ toString()

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

Reimplemented from org.dartlang.analysis.server.protocol.RefactoringFeedback.

Definition at line 241 of file ExtractMethodFeedback.java.

241 {
242 StringBuilder builder = new StringBuilder();
243 builder.append("[");
244 builder.append("offset=");
245 builder.append(offset + ", ");
246 builder.append("length=");
247 builder.append(length + ", ");
248 builder.append("returnType=");
249 builder.append(returnType + ", ");
250 builder.append("names=");
251 builder.append(StringUtils.join(names, ", ") + ", ");
252 builder.append("canCreateGetter=");
253 builder.append(canCreateGetter + ", ");
254 builder.append("parameters=");
255 builder.append(StringUtils.join(parameters, ", ") + ", ");
256 builder.append("offsets=");
257 builder.append(StringUtils.join(offsets, ", ") + ", ");
258 builder.append("lengths=");
259 builder.append(StringUtils.join(lengths, ", "));
260 builder.append("]");
261 return builder.toString();
262 }

Member Data Documentation

◆ EMPTY_ARRAY

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

Definition at line 32 of file ExtractMethodFeedback.java.

◆ EMPTY_LIST

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

Definition at line 34 of file ExtractMethodFeedback.java.


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