Flutter Engine
The Flutter Engine
InlineMethodFeedback.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 * @coverage dart.server.generated.types
28 */
29@SuppressWarnings("unused")
31
32 public static final InlineMethodFeedback[] EMPTY_ARRAY = new InlineMethodFeedback[0];
33
34 public static final List<InlineMethodFeedback> EMPTY_LIST = Lists.newArrayList();
35
36 /**
37 * The name of the class enclosing the method being inlined. If not a class member is being
38 * inlined, this field will be absent.
39 */
40 private final String className;
41
42 /**
43 * The name of the method (or function) being inlined.
44 */
45 private final String methodName;
46
47 /**
48 * True if the declaration of the method is selected. So all references should be inlined.
49 */
50 private final boolean isDeclaration;
51
52 /**
53 * Constructor for {@link InlineMethodFeedback}.
54 */
55 public InlineMethodFeedback(String className, String methodName, boolean isDeclaration) {
56 this.className = className;
57 this.methodName = methodName;
58 this.isDeclaration = isDeclaration;
59 }
60
61 @Override
62 public boolean equals(Object obj) {
63 if (obj instanceof InlineMethodFeedback) {
65 return
66 ObjectUtilities.equals(other.className, className) &&
67 ObjectUtilities.equals(other.methodName, methodName) &&
68 other.isDeclaration == isDeclaration;
69 }
70 return false;
71 }
72
73 public static InlineMethodFeedback fromJson(JsonObject jsonObject) {
74 String className = jsonObject.get("className") == null ? null : jsonObject.get("className").getAsString();
75 String methodName = jsonObject.get("methodName").getAsString();
76 boolean isDeclaration = jsonObject.get("isDeclaration").getAsBoolean();
77 return new InlineMethodFeedback(className, methodName, isDeclaration);
78 }
79
80 public static List<InlineMethodFeedback> fromJsonArray(JsonArray jsonArray) {
81 if (jsonArray == null) {
82 return EMPTY_LIST;
83 }
84 ArrayList<InlineMethodFeedback> list = new ArrayList<InlineMethodFeedback>(jsonArray.size());
85 Iterator<JsonElement> iterator = jsonArray.iterator();
86 while (iterator.hasNext()) {
87 list.add(fromJson(iterator.next().getAsJsonObject()));
88 }
89 return list;
90 }
91
92 /**
93 * The name of the class enclosing the method being inlined. If not a class member is being
94 * inlined, this field will be absent.
95 */
96 public String getClassName() {
97 return className;
98 }
99
100 /**
101 * True if the declaration of the method is selected. So all references should be inlined.
102 */
103 public boolean isDeclaration() {
104 return isDeclaration;
105 }
106
107 /**
108 * The name of the method (or function) being inlined.
109 */
110 public String getMethodName() {
111 return methodName;
112 }
113
114 @Override
115 public int hashCode() {
116 HashCodeBuilder builder = new HashCodeBuilder();
117 builder.append(className);
118 builder.append(methodName);
119 builder.append(isDeclaration);
120 return builder.toHashCode();
121 }
122
123 public JsonObject toJson() {
124 JsonObject jsonObject = new JsonObject();
125 if (className != null) {
126 jsonObject.addProperty("className", className);
127 }
128 jsonObject.addProperty("methodName", methodName);
129 jsonObject.addProperty("isDeclaration", isDeclaration);
130 return jsonObject;
131 }
132
133 @Override
134 public String toString() {
135 StringBuilder builder = new StringBuilder();
136 builder.append("[");
137 builder.append("className=");
138 builder.append(className + ", ");
139 builder.append("methodName=");
140 builder.append(methodName + ", ");
141 builder.append("isDeclaration=");
142 builder.append(isDeclaration);
143 builder.append("]");
144 return builder.toString();
145 }
146
147}
InlineMethodFeedback(String className, String methodName, boolean isDeclaration)
static List< InlineMethodFeedback > fromJsonArray(JsonArray jsonArray)
static InlineMethodFeedback fromJson(JsonObject jsonObject)