Flutter Engine
The Flutter Engine
RuntimeCompletionVariable.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 variable in a runtime context.
28 *
29 * @coverage dart.server.generated.types
30 */
31@SuppressWarnings("unused")
33
34 public static final RuntimeCompletionVariable[] EMPTY_ARRAY = new RuntimeCompletionVariable[0];
35
36 public static final List<RuntimeCompletionVariable> EMPTY_LIST = Lists.newArrayList();
37
38 /**
39 * The name of the variable. The name "this" has a special meaning and is used as an implicit
40 * target for runtime completion, and in explicit "this" references.
41 */
42 private final String name;
43
44 /**
45 * The type of the variable.
46 */
48
49 /**
50 * Constructor for {@link RuntimeCompletionVariable}.
51 */
53 this.name = name;
54 this.type = type;
55 }
56
57 @Override
58 public boolean equals(Object obj) {
59 if (obj instanceof RuntimeCompletionVariable) {
61 return
62 ObjectUtilities.equals(other.name, name) &&
63 ObjectUtilities.equals(other.type, type);
64 }
65 return false;
66 }
67
68 public static RuntimeCompletionVariable fromJson(JsonObject jsonObject) {
69 String name = jsonObject.get("name").getAsString();
70 RuntimeCompletionExpressionType type = RuntimeCompletionExpressionType.fromJson(jsonObject.get("type").getAsJsonObject());
72 }
73
74 public static List<RuntimeCompletionVariable> fromJsonArray(JsonArray jsonArray) {
75 if (jsonArray == null) {
76 return EMPTY_LIST;
77 }
78 ArrayList<RuntimeCompletionVariable> list = new ArrayList<RuntimeCompletionVariable>(jsonArray.size());
79 Iterator<JsonElement> iterator = jsonArray.iterator();
80 while (iterator.hasNext()) {
81 list.add(fromJson(iterator.next().getAsJsonObject()));
82 }
83 return list;
84 }
85
86 /**
87 * The name of the variable. The name "this" has a special meaning and is used as an implicit
88 * target for runtime completion, and in explicit "this" references.
89 */
90 public String getName() {
91 return name;
92 }
93
94 /**
95 * The type of the variable.
96 */
98 return type;
99 }
100
101 @Override
102 public int hashCode() {
103 HashCodeBuilder builder = new HashCodeBuilder();
104 builder.append(name);
105 builder.append(type);
106 return builder.toHashCode();
107 }
108
109 public JsonObject toJson() {
110 JsonObject jsonObject = new JsonObject();
111 jsonObject.addProperty("name", name);
112 jsonObject.add("type", type.toJson());
113 return jsonObject;
114 }
115
116 @Override
117 public String toString() {
118 StringBuilder builder = new StringBuilder();
119 builder.append("[");
120 builder.append("name=");
121 builder.append(name + ", ");
122 builder.append("type=");
123 builder.append(type);
124 builder.append("]");
125 return builder.toString();
126 }
127
128}
GLenum type
static RuntimeCompletionExpressionType fromJson(JsonObject jsonObject)
static List< RuntimeCompletionVariable > fromJsonArray(JsonArray jsonArray)
static RuntimeCompletionVariable fromJson(JsonObject jsonObject)
RuntimeCompletionVariable(String name, RuntimeCompletionExpressionType type)
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32