Flutter Engine
The Flutter Engine
AnalysisOptions.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 * Deprecated: the only reference to this type has been deprecated.
28 *
29 * A set of options controlling what kind of analysis is to be performed. If the value of a field
30 * is omitted the value of the option will not be changed.
31 *
32 * @coverage dart.server.generated.types
33 */
34@SuppressWarnings("unused")
35public class AnalysisOptions {
36
37 public static final AnalysisOptions[] EMPTY_ARRAY = new AnalysisOptions[0];
38
39 public static final List<AnalysisOptions> EMPTY_LIST = Lists.newArrayList();
40
41 /**
42 * Deprecated: this feature is always enabled.
43 *
44 * True if the client wants to enable support for the proposed async feature.
45 */
46 private final Boolean enableAsync;
47
48 /**
49 * Deprecated: this feature is always enabled.
50 *
51 * True if the client wants to enable support for the proposed deferred loading feature.
52 */
53 private final Boolean enableDeferredLoading;
54
55 /**
56 * Deprecated: this feature is always enabled.
57 *
58 * True if the client wants to enable support for the proposed enum feature.
59 */
60 private final Boolean enableEnums;
61
62 /**
63 * Deprecated: this feature is always enabled.
64 *
65 * True if the client wants to enable support for the proposed "null aware operators" feature.
66 */
67 private final Boolean enableNullAwareOperators;
68
69 /**
70 * True if hints that are specific to dart2js should be generated. This option is ignored if
71 * generateHints is false.
72 */
73 private final Boolean generateDart2jsHints;
74
75 /**
76 * True if hints should be generated as part of generating errors and warnings.
77 */
78 private final Boolean generateHints;
79
80 /**
81 * True if lints should be generated as part of generating errors and warnings.
82 */
83 private final Boolean generateLints;
84
85 /**
86 * Constructor for {@link AnalysisOptions}.
87 */
88 public AnalysisOptions(Boolean enableAsync, Boolean enableDeferredLoading, Boolean enableEnums, Boolean enableNullAwareOperators, Boolean generateDart2jsHints, Boolean generateHints, Boolean generateLints) {
89 this.enableAsync = enableAsync;
90 this.enableDeferredLoading = enableDeferredLoading;
91 this.enableEnums = enableEnums;
92 this.enableNullAwareOperators = enableNullAwareOperators;
93 this.generateDart2jsHints = generateDart2jsHints;
94 this.generateHints = generateHints;
95 this.generateLints = generateLints;
96 }
97
98 @Override
99 public boolean equals(Object obj) {
100 if (obj instanceof AnalysisOptions) {
101 AnalysisOptions other = (AnalysisOptions) obj;
102 return
103 ObjectUtilities.equals(other.enableAsync, enableAsync) &&
104 ObjectUtilities.equals(other.enableDeferredLoading, enableDeferredLoading) &&
105 ObjectUtilities.equals(other.enableEnums, enableEnums) &&
106 ObjectUtilities.equals(other.enableNullAwareOperators, enableNullAwareOperators) &&
107 ObjectUtilities.equals(other.generateDart2jsHints, generateDart2jsHints) &&
108 ObjectUtilities.equals(other.generateHints, generateHints) &&
109 ObjectUtilities.equals(other.generateLints, generateLints);
110 }
111 return false;
112 }
113
114 public static AnalysisOptions fromJson(JsonObject jsonObject) {
115 Boolean enableAsync = jsonObject.get("enableAsync") == null ? null : jsonObject.get("enableAsync").getAsBoolean();
116 Boolean enableDeferredLoading = jsonObject.get("enableDeferredLoading") == null ? null : jsonObject.get("enableDeferredLoading").getAsBoolean();
117 Boolean enableEnums = jsonObject.get("enableEnums") == null ? null : jsonObject.get("enableEnums").getAsBoolean();
118 Boolean enableNullAwareOperators = jsonObject.get("enableNullAwareOperators") == null ? null : jsonObject.get("enableNullAwareOperators").getAsBoolean();
119 Boolean generateDart2jsHints = jsonObject.get("generateDart2jsHints") == null ? null : jsonObject.get("generateDart2jsHints").getAsBoolean();
120 Boolean generateHints = jsonObject.get("generateHints") == null ? null : jsonObject.get("generateHints").getAsBoolean();
121 Boolean generateLints = jsonObject.get("generateLints") == null ? null : jsonObject.get("generateLints").getAsBoolean();
122 return new AnalysisOptions(enableAsync, enableDeferredLoading, enableEnums, enableNullAwareOperators, generateDart2jsHints, generateHints, generateLints);
123 }
124
125 public static List<AnalysisOptions> fromJsonArray(JsonArray jsonArray) {
126 if (jsonArray == null) {
127 return EMPTY_LIST;
128 }
129 ArrayList<AnalysisOptions> list = new ArrayList<AnalysisOptions>(jsonArray.size());
130 Iterator<JsonElement> iterator = jsonArray.iterator();
131 while (iterator.hasNext()) {
132 list.add(fromJson(iterator.next().getAsJsonObject()));
133 }
134 return list;
135 }
136
137 /**
138 * Deprecated: this feature is always enabled.
139 *
140 * True if the client wants to enable support for the proposed async feature.
141 */
142 public Boolean getEnableAsync() {
143 return enableAsync;
144 }
145
146 /**
147 * Deprecated: this feature is always enabled.
148 *
149 * True if the client wants to enable support for the proposed deferred loading feature.
150 */
151 public Boolean getEnableDeferredLoading() {
152 return enableDeferredLoading;
153 }
154
155 /**
156 * Deprecated: this feature is always enabled.
157 *
158 * True if the client wants to enable support for the proposed enum feature.
159 */
160 public Boolean getEnableEnums() {
161 return enableEnums;
162 }
163
164 /**
165 * Deprecated: this feature is always enabled.
166 *
167 * True if the client wants to enable support for the proposed "null aware operators" feature.
168 */
170 return enableNullAwareOperators;
171 }
172
173 /**
174 * True if hints that are specific to dart2js should be generated. This option is ignored if
175 * generateHints is false.
176 */
177 public Boolean getGenerateDart2jsHints() {
178 return generateDart2jsHints;
179 }
180
181 /**
182 * True if hints should be generated as part of generating errors and warnings.
183 */
184 public Boolean getGenerateHints() {
185 return generateHints;
186 }
187
188 /**
189 * True if lints should be generated as part of generating errors and warnings.
190 */
191 public Boolean getGenerateLints() {
192 return generateLints;
193 }
194
195 @Override
196 public int hashCode() {
197 HashCodeBuilder builder = new HashCodeBuilder();
198 builder.append(enableAsync);
199 builder.append(enableDeferredLoading);
200 builder.append(enableEnums);
201 builder.append(enableNullAwareOperators);
202 builder.append(generateDart2jsHints);
203 builder.append(generateHints);
204 builder.append(generateLints);
205 return builder.toHashCode();
206 }
207
208 public JsonObject toJson() {
209 JsonObject jsonObject = new JsonObject();
210 if (enableAsync != null) {
211 jsonObject.addProperty("enableAsync", enableAsync);
212 }
213 if (enableDeferredLoading != null) {
214 jsonObject.addProperty("enableDeferredLoading", enableDeferredLoading);
215 }
216 if (enableEnums != null) {
217 jsonObject.addProperty("enableEnums", enableEnums);
218 }
219 if (enableNullAwareOperators != null) {
220 jsonObject.addProperty("enableNullAwareOperators", enableNullAwareOperators);
221 }
222 if (generateDart2jsHints != null) {
223 jsonObject.addProperty("generateDart2jsHints", generateDart2jsHints);
224 }
225 if (generateHints != null) {
226 jsonObject.addProperty("generateHints", generateHints);
227 }
228 if (generateLints != null) {
229 jsonObject.addProperty("generateLints", generateLints);
230 }
231 return jsonObject;
232 }
233
234 @Override
235 public String toString() {
236 StringBuilder builder = new StringBuilder();
237 builder.append("[");
238 builder.append("enableAsync=");
239 builder.append(enableAsync + ", ");
240 builder.append("enableDeferredLoading=");
241 builder.append(enableDeferredLoading + ", ");
242 builder.append("enableEnums=");
243 builder.append(enableEnums + ", ");
244 builder.append("enableNullAwareOperators=");
245 builder.append(enableNullAwareOperators + ", ");
246 builder.append("generateDart2jsHints=");
247 builder.append(generateDart2jsHints + ", ");
248 builder.append("generateHints=");
249 builder.append(generateHints + ", ");
250 builder.append("generateLints=");
251 builder.append(generateLints);
252 builder.append("]");
253 return builder.toString();
254 }
255
256}
static AnalysisOptions fromJson(JsonObject jsonObject)
AnalysisOptions(Boolean enableAsync, Boolean enableDeferredLoading, Boolean enableEnums, Boolean enableNullAwareOperators, Boolean generateDart2jsHints, Boolean generateHints, Boolean generateLints)
static List< AnalysisOptions > fromJsonArray(JsonArray jsonArray)