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