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;
31@SuppressWarnings(
"unused")
41 private final String
name;
47 private final String label;
53 private final Boolean literalValueBoolean;
59 private final Integer literalValueInteger;
65 private final String literalValueString;
78 private final Location valueLocation;
86 this.literalValueBoolean = literalValueBoolean;
87 this.literalValueInteger = literalValueInteger;
88 this.literalValueString = literalValueString;
89 this.nameLocation = nameLocation;
90 this.valueLocation = valueLocation;
99 ObjectUtilities.equals(other.label, label) &&
100 ObjectUtilities.equals(other.literalValueBoolean, literalValueBoolean) &&
101 ObjectUtilities.equals(other.literalValueInteger, literalValueInteger) &&
102 ObjectUtilities.equals(other.literalValueString, literalValueString) &&
103 ObjectUtilities.equals(other.nameLocation, nameLocation) &&
104 ObjectUtilities.equals(other.valueLocation, valueLocation);
110 String
name = jsonObject.get(
"name").getAsString();
111 String label = jsonObject.get(
"label").getAsString();
112 Boolean literalValueBoolean = jsonObject.get(
"literalValueBoolean") ==
null ? null : jsonObject.get(
"literalValueBoolean").getAsBoolean();
113 Integer literalValueInteger = jsonObject.get(
"literalValueInteger") ==
null ? null : jsonObject.get(
"literalValueInteger").getAsInt();
114 String literalValueString = jsonObject.get(
"literalValueString") ==
null ? null : jsonObject.get(
"literalValueString").getAsString();
115 Location nameLocation = jsonObject.get(
"nameLocation") ==
null ? null :
Location.
fromJson(jsonObject.get(
"nameLocation").getAsJsonObject());
116 Location valueLocation = jsonObject.get(
"valueLocation") ==
null ? null :
Location.
fromJson(jsonObject.get(
"valueLocation").getAsJsonObject());
117 return new FlutterOutlineAttribute(
name, label, literalValueBoolean, literalValueInteger, literalValueString, nameLocation, valueLocation);
121 if (jsonArray ==
null) {
124 ArrayList<FlutterOutlineAttribute> list =
new ArrayList<FlutterOutlineAttribute>(jsonArray.size());
125 Iterator<JsonElement> iterator = jsonArray.iterator();
126 while (iterator.hasNext()) {
127 list.add(fromJson(iterator.next().getAsJsonObject()));
145 return literalValueBoolean;
153 return literalValueInteger;
161 return literalValueString;
185 return valueLocation;
190 HashCodeBuilder
builder =
new HashCodeBuilder();
193 builder.append(literalValueBoolean);
194 builder.append(literalValueInteger);
195 builder.append(literalValueString);
202 JsonObject jsonObject =
new JsonObject();
203 jsonObject.addProperty(
"name",
name);
204 jsonObject.addProperty(
"label", label);
205 if (literalValueBoolean !=
null) {
206 jsonObject.addProperty(
"literalValueBoolean", literalValueBoolean);
208 if (literalValueInteger !=
null) {
209 jsonObject.addProperty(
"literalValueInteger", literalValueInteger);
211 if (literalValueString !=
null) {
212 jsonObject.addProperty(
"literalValueString", literalValueString);
214 if (nameLocation !=
null) {
215 jsonObject.add(
"nameLocation", nameLocation.
toJson());
217 if (valueLocation !=
null) {
218 jsonObject.add(
"valueLocation", valueLocation.
toJson());
225 StringBuilder
builder =
new StringBuilder();
231 builder.append(
"literalValueBoolean=");
232 builder.append(literalValueBoolean +
", ");
233 builder.append(
"literalValueInteger=");
234 builder.append(literalValueInteger +
", ");
235 builder.append(
"literalValueString=");
236 builder.append(literalValueString +
", ");
237 builder.append(
"nameLocation=");
238 builder.append(nameLocation +
", ");
239 builder.append(
"valueLocation=");
boolean equals(Object obj)
Integer getLiteralValueInteger()
Location getValueLocation()
Boolean getLiteralValueBoolean()
Location getNameLocation()
static List< FlutterOutlineAttribute > fromJsonArray(JsonArray jsonArray)
String getLiteralValueString()
FlutterOutlineAttribute(String name, String label, Boolean literalValueBoolean, Integer literalValueInteger, String literalValueString, Location nameLocation, Location valueLocation)
static FlutterOutlineAttribute fromJson(JsonObject jsonObject)
static Location fromJson(JsonObject jsonObject)
DEF_SWITCHES_START aot vmservice shared library name