Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
RefactoringMethodParameter.java
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
3 * for details. All rights reserved. Use of this source code is governed by a
4 * BSD-style license that can be found in the LICENSE file.
5 *
6 * This file has been automatically generated. Please do not edit it manually.
7 * To regenerate the file, use the script "pkg/analysis_server/tool/spec/generate_files".
8 */
9package org.dartlang.analysis.server.protocol;
10
11import java.util.Arrays;
12import java.util.List;
13import java.util.Map;
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;
25
26/**
27 * A description of a parameter in a method refactoring.
28 *
29 * @coverage dart.server.generated.types
30 */
31@SuppressWarnings("unused")
33
34 public static final RefactoringMethodParameter[] EMPTY_ARRAY = new RefactoringMethodParameter[0];
35
36 public static final List<RefactoringMethodParameter> EMPTY_LIST = Lists.newArrayList();
37
38 /**
39 * The unique identifier of the parameter. Clients may omit this field for the parameters they want
40 * to add.
41 */
42 private String id;
43
44 /**
45 * The kind of the parameter.
46 */
47 private String kind;
48
49 /**
50 * The type that should be given to the parameter, or the return type of the parameter's function
51 * type.
52 */
53 private String type;
54
55 /**
56 * The name that should be given to the parameter.
57 */
58 private String name;
59
60 /**
61 * The parameter list of the parameter's function type. If the parameter is not of a function type,
62 * this field will not be defined. If the function type has zero parameters, this field will have a
63 * value of '()'.
64 */
65 private String parameters;
66
67 /**
68 * Constructor for {@link RefactoringMethodParameter}.
69 */
70 public RefactoringMethodParameter(String id, String kind, String type, String name, String parameters) {
71 this.id = id;
72 this.kind = kind;
73 this.type = type;
74 this.name = name;
75 this.parameters = parameters;
76 }
77
78 @Override
79 public boolean equals(Object obj) {
80 if (obj instanceof RefactoringMethodParameter) {
82 return
83 ObjectUtilities.equals(other.id, id) &&
84 ObjectUtilities.equals(other.kind, kind) &&
85 ObjectUtilities.equals(other.type, type) &&
86 ObjectUtilities.equals(other.name, name) &&
87 ObjectUtilities.equals(other.parameters, parameters);
88 }
89 return false;
90 }
91
92 public static RefactoringMethodParameter fromJson(JsonObject jsonObject) {
93 String id = jsonObject.get("id") == null ? null : jsonObject.get("id").getAsString();
94 String kind = jsonObject.get("kind").getAsString();
95 String type = jsonObject.get("type").getAsString();
96 String name = jsonObject.get("name").getAsString();
97 String parameters = jsonObject.get("parameters") == null ? null : jsonObject.get("parameters").getAsString();
98 return new RefactoringMethodParameter(id, kind, type, name, parameters);
99 }
100
101 public static List<RefactoringMethodParameter> fromJsonArray(JsonArray jsonArray) {
102 if (jsonArray == null) {
103 return EMPTY_LIST;
104 }
105 ArrayList<RefactoringMethodParameter> list = new ArrayList<RefactoringMethodParameter>(jsonArray.size());
106 Iterator<JsonElement> iterator = jsonArray.iterator();
107 while (iterator.hasNext()) {
108 list.add(fromJson(iterator.next().getAsJsonObject()));
109 }
110 return list;
111 }
112
113 /**
114 * The unique identifier of the parameter. Clients may omit this field for the parameters they want
115 * to add.
116 */
117 public String getId() {
118 return id;
119 }
120
121 /**
122 * The kind of the parameter.
123 */
124 public String getKind() {
125 return kind;
126 }
127
128 /**
129 * The name that should be given to the parameter.
130 */
131 public String getName() {
132 return name;
133 }
134
135 /**
136 * The parameter list of the parameter's function type. If the parameter is not of a function type,
137 * this field will not be defined. If the function type has zero parameters, this field will have a
138 * value of '()'.
139 */
140 public String getParameters() {
141 return parameters;
142 }
143
144 /**
145 * The type that should be given to the parameter, or the return type of the parameter's function
146 * type.
147 */
148 public String getType() {
149 return type;
150 }
151
152 @Override
153 public int hashCode() {
154 HashCodeBuilder builder = new HashCodeBuilder();
155 builder.append(id);
156 builder.append(kind);
157 builder.append(type);
158 builder.append(name);
159 builder.append(parameters);
160 return builder.toHashCode();
161 }
162
163 /**
164 * The unique identifier of the parameter. Clients may omit this field for the parameters they want
165 * to add.
166 */
167 public void setId(String id) {
168 this.id = id;
169 }
170
171 /**
172 * The kind of the parameter.
173 */
174 public void setKind(String kind) {
175 this.kind = kind;
176 }
177
178 /**
179 * The name that should be given to the parameter.
180 */
181 public void setName(String name) {
182 this.name = name;
183 }
184
185 /**
186 * The parameter list of the parameter's function type. If the parameter is not of a function type,
187 * this field will not be defined. If the function type has zero parameters, this field will have a
188 * value of '()'.
189 */
190 public void setParameters(String parameters) {
191 this.parameters = parameters;
192 }
193
194 /**
195 * The type that should be given to the parameter, or the return type of the parameter's function
196 * type.
197 */
198 public void setType(String type) {
199 this.type = type;
200 }
201
202 public JsonObject toJson() {
203 JsonObject jsonObject = new JsonObject();
204 if (id != null) {
205 jsonObject.addProperty("id", id);
206 }
207 jsonObject.addProperty("kind", kind);
208 jsonObject.addProperty("type", type);
209 jsonObject.addProperty("name", name);
210 if (parameters != null) {
211 jsonObject.addProperty("parameters", parameters);
212 }
213 return jsonObject;
214 }
215
216 @Override
217 public String toString() {
218 StringBuilder builder = new StringBuilder();
219 builder.append("[");
220 builder.append("id=");
221 builder.append(id + ", ");
222 builder.append("kind=");
223 builder.append(kind + ", ");
224 builder.append("type=");
225 builder.append(type + ", ");
226 builder.append("name=");
227 builder.append(name + ", ");
228 builder.append("parameters=");
229 builder.append(parameters);
230 builder.append("]");
231 return builder.toString();
232 }
233
234}
static RefactoringMethodParameter fromJson(JsonObject jsonObject)
static List< RefactoringMethodParameter > fromJsonArray(JsonArray jsonArray)
RefactoringMethodParameter(String id, String kind, String type, String name, String parameters)
const char * name
Definition fuchsia.cc:50
const uintptr_t id