Flutter Engine
The Flutter Engine
InlineMethodOptions.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 InlineMethodOptions[] EMPTY_ARRAY = new InlineMethodOptions[0];
33
34 public static final List<InlineMethodOptions> EMPTY_LIST = Lists.newArrayList();
35
36 /**
37 * True if the method being inlined should be removed. It is an error if this field is true and
38 * inlineAll is false.
39 */
40 private boolean deleteSource;
41
42 /**
43 * True if all invocations of the method should be inlined, or false if only the invocation site
44 * used to create this refactoring should be inlined.
45 */
46 private boolean inlineAll;
47
48 /**
49 * Constructor for {@link InlineMethodOptions}.
50 */
51 public InlineMethodOptions(boolean deleteSource, boolean inlineAll) {
52 this.deleteSource = deleteSource;
53 this.inlineAll = inlineAll;
54 }
55
56 @Override
57 public boolean equals(Object obj) {
58 if (obj instanceof InlineMethodOptions) {
60 return
61 other.deleteSource == deleteSource &&
62 other.inlineAll == inlineAll;
63 }
64 return false;
65 }
66
67 public static InlineMethodOptions fromJson(JsonObject jsonObject) {
68 boolean deleteSource = jsonObject.get("deleteSource").getAsBoolean();
69 boolean inlineAll = jsonObject.get("inlineAll").getAsBoolean();
70 return new InlineMethodOptions(deleteSource, inlineAll);
71 }
72
73 public static List<InlineMethodOptions> fromJsonArray(JsonArray jsonArray) {
74 if (jsonArray == null) {
75 return EMPTY_LIST;
76 }
77 ArrayList<InlineMethodOptions> list = new ArrayList<InlineMethodOptions>(jsonArray.size());
78 Iterator<JsonElement> iterator = jsonArray.iterator();
79 while (iterator.hasNext()) {
80 list.add(fromJson(iterator.next().getAsJsonObject()));
81 }
82 return list;
83 }
84
85 /**
86 * True if the method being inlined should be removed. It is an error if this field is true and
87 * inlineAll is false.
88 */
89 public boolean deleteSource() {
90 return deleteSource;
91 }
92
93 /**
94 * True if all invocations of the method should be inlined, or false if only the invocation site
95 * used to create this refactoring should be inlined.
96 */
97 public boolean inlineAll() {
98 return inlineAll;
99 }
100
101 @Override
102 public int hashCode() {
103 HashCodeBuilder builder = new HashCodeBuilder();
104 builder.append(deleteSource);
105 builder.append(inlineAll);
106 return builder.toHashCode();
107 }
108
109 /**
110 * True if the method being inlined should be removed. It is an error if this field is true and
111 * inlineAll is false.
112 */
113 public void setDeleteSource(boolean deleteSource) {
114 this.deleteSource = deleteSource;
115 }
116
117 /**
118 * True if all invocations of the method should be inlined, or false if only the invocation site
119 * used to create this refactoring should be inlined.
120 */
121 public void setInlineAll(boolean inlineAll) {
122 this.inlineAll = inlineAll;
123 }
124
125 public JsonObject toJson() {
126 JsonObject jsonObject = new JsonObject();
127 jsonObject.addProperty("deleteSource", deleteSource);
128 jsonObject.addProperty("inlineAll", inlineAll);
129 return jsonObject;
130 }
131
132 @Override
133 public String toString() {
134 StringBuilder builder = new StringBuilder();
135 builder.append("[");
136 builder.append("deleteSource=");
137 builder.append(deleteSource + ", ");
138 builder.append("inlineAll=");
139 builder.append(inlineAll);
140 builder.append("]");
141 return builder.toString();
142 }
143
144}
static List< InlineMethodOptions > fromJsonArray(JsonArray jsonArray)
InlineMethodOptions(boolean deleteSource, boolean inlineAll)
static InlineMethodOptions fromJson(JsonObject jsonObject)