9package org.dartlang.analysis.server.protocol;
11import java.util.Arrays;
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;
34@SuppressWarnings(
"unused")
46 private final Boolean enableAsync;
53 private final Boolean enableDeferredLoading;
60 private final Boolean enableEnums;
67 private final Boolean enableNullAwareOperators;
73 private final Boolean generateDart2jsHints;
78 private final Boolean generateHints;
83 private final Boolean generateLints;
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;
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);
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);
126 if (jsonArray ==
null) {
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()));
152 return enableDeferredLoading;
170 return enableNullAwareOperators;
178 return generateDart2jsHints;
185 return generateHints;
192 return generateLints;
197 HashCodeBuilder
builder =
new HashCodeBuilder();
199 builder.append(enableDeferredLoading);
201 builder.append(enableNullAwareOperators);
202 builder.append(generateDart2jsHints);
209 JsonObject jsonObject =
new JsonObject();
210 if (enableAsync !=
null) {
211 jsonObject.addProperty(
"enableAsync", enableAsync);
213 if (enableDeferredLoading !=
null) {
214 jsonObject.addProperty(
"enableDeferredLoading", enableDeferredLoading);
216 if (enableEnums !=
null) {
217 jsonObject.addProperty(
"enableEnums", enableEnums);
219 if (enableNullAwareOperators !=
null) {
220 jsonObject.addProperty(
"enableNullAwareOperators", enableNullAwareOperators);
222 if (generateDart2jsHints !=
null) {
223 jsonObject.addProperty(
"generateDart2jsHints", generateDart2jsHints);
225 if (generateHints !=
null) {
226 jsonObject.addProperty(
"generateHints", generateHints);
228 if (generateLints !=
null) {
229 jsonObject.addProperty(
"generateLints", generateLints);
236 StringBuilder
builder =
new StringBuilder();
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=");
boolean equals(Object obj)
static AnalysisOptions fromJson(JsonObject jsonObject)
Boolean getGenerateDart2jsHints()
Boolean getEnableDeferredLoading()
Boolean getEnableNullAwareOperators()
Boolean getGenerateHints()
AnalysisOptions(Boolean enableAsync, Boolean enableDeferredLoading, Boolean enableEnums, Boolean enableNullAwareOperators, Boolean generateDart2jsHints, Boolean generateHints, Boolean generateLints)
static List< AnalysisOptions > fromJsonArray(JsonArray jsonArray)
Boolean getGenerateLints()