Flutter Engine
The Flutter Engine
FlutterWidgetPropertyValueEnumItem.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 * An item of an enumeration in a general sense - actual enum value, or a static field in a class.
28 *
29 * @coverage dart.server.generated.types
30 */
31@SuppressWarnings("unused")
33
35
36 public static final List<FlutterWidgetPropertyValueEnumItem> EMPTY_LIST = Lists.newArrayList();
37
38 /**
39 * The URI of the library containing the className. When the enum item is passed back, this will
40 * allow the server to import the corresponding library if necessary.
41 */
42 private final String libraryUri;
43
44 /**
45 * The name of the class or enum.
46 */
47 private final String className;
48
49 /**
50 * The name of the field in the enumeration, or the static field in the class.
51 */
52 private final String name;
53
54 /**
55 * The documentation to show to the user. Omitted if the server does not know the documentation,
56 * e.g. because the corresponding field is not documented.
57 */
58 private final String documentation;
59
60 /**
61 * Constructor for {@link FlutterWidgetPropertyValueEnumItem}.
62 */
63 public FlutterWidgetPropertyValueEnumItem(String libraryUri, String className, String name, String documentation) {
64 this.libraryUri = libraryUri;
65 this.className = className;
66 this.name = name;
67 this.documentation = documentation;
68 }
69
70 @Override
71 public boolean equals(Object obj) {
72 if (obj instanceof FlutterWidgetPropertyValueEnumItem) {
74 return
75 ObjectUtilities.equals(other.libraryUri, libraryUri) &&
76 ObjectUtilities.equals(other.className, className) &&
77 ObjectUtilities.equals(other.name, name) &&
78 ObjectUtilities.equals(other.documentation, documentation);
79 }
80 return false;
81 }
82
83 public static FlutterWidgetPropertyValueEnumItem fromJson(JsonObject jsonObject) {
84 String libraryUri = jsonObject.get("libraryUri").getAsString();
85 String className = jsonObject.get("className").getAsString();
86 String name = jsonObject.get("name").getAsString();
87 String documentation = jsonObject.get("documentation") == null ? null : jsonObject.get("documentation").getAsString();
88 return new FlutterWidgetPropertyValueEnumItem(libraryUri, className, name, documentation);
89 }
90
91 public static List<FlutterWidgetPropertyValueEnumItem> fromJsonArray(JsonArray jsonArray) {
92 if (jsonArray == null) {
93 return EMPTY_LIST;
94 }
95 ArrayList<FlutterWidgetPropertyValueEnumItem> list = new ArrayList<FlutterWidgetPropertyValueEnumItem>(jsonArray.size());
96 Iterator<JsonElement> iterator = jsonArray.iterator();
97 while (iterator.hasNext()) {
98 list.add(fromJson(iterator.next().getAsJsonObject()));
99 }
100 return list;
101 }
102
103 /**
104 * The name of the class or enum.
105 */
106 public String getClassName() {
107 return className;
108 }
109
110 /**
111 * The documentation to show to the user. Omitted if the server does not know the documentation,
112 * e.g. because the corresponding field is not documented.
113 */
114 public String getDocumentation() {
115 return documentation;
116 }
117
118 /**
119 * The URI of the library containing the className. When the enum item is passed back, this will
120 * allow the server to import the corresponding library if necessary.
121 */
122 public String getLibraryUri() {
123 return libraryUri;
124 }
125
126 /**
127 * The name of the field in the enumeration, or the static field in the class.
128 */
129 public String getName() {
130 return name;
131 }
132
133 @Override
134 public int hashCode() {
135 HashCodeBuilder builder = new HashCodeBuilder();
136 builder.append(libraryUri);
137 builder.append(className);
138 builder.append(name);
139 builder.append(documentation);
140 return builder.toHashCode();
141 }
142
143 public JsonObject toJson() {
144 JsonObject jsonObject = new JsonObject();
145 jsonObject.addProperty("libraryUri", libraryUri);
146 jsonObject.addProperty("className", className);
147 jsonObject.addProperty("name", name);
148 if (documentation != null) {
149 jsonObject.addProperty("documentation", documentation);
150 }
151 return jsonObject;
152 }
153
154 @Override
155 public String toString() {
156 StringBuilder builder = new StringBuilder();
157 builder.append("[");
158 builder.append("libraryUri=");
159 builder.append(libraryUri + ", ");
160 builder.append("className=");
161 builder.append(className + ", ");
162 builder.append("name=");
163 builder.append(name + ", ");
164 builder.append("documentation=");
165 builder.append(documentation);
166 builder.append("]");
167 return builder.toString();
168 }
169
170}
static FlutterWidgetPropertyValueEnumItem fromJson(JsonObject jsonObject)
FlutterWidgetPropertyValueEnumItem(String libraryUri, String className, String name, String documentation)
static List< FlutterWidgetPropertyValueEnumItem > fromJsonArray(JsonArray jsonArray)
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32