Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
RenameOptions.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")
30public class RenameOptions extends RefactoringOptions {
31
32 public static final RenameOptions[] EMPTY_ARRAY = new RenameOptions[0];
33
34 public static final List<RenameOptions> EMPTY_LIST = Lists.newArrayList();
35
36 /**
37 * The name that the element should have after the refactoring.
38 */
39 private String newName;
40
41 /**
42 * Constructor for {@link RenameOptions}.
43 */
44 public RenameOptions(String newName) {
45 this.newName = newName;
46 }
47
48 @Override
49 public boolean equals(Object obj) {
50 if (obj instanceof RenameOptions) {
51 RenameOptions other = (RenameOptions) obj;
52 return
53 ObjectUtilities.equals(other.newName, newName);
54 }
55 return false;
56 }
57
58 public static RenameOptions fromJson(JsonObject jsonObject) {
59 String newName = jsonObject.get("newName").getAsString();
60 return new RenameOptions(newName);
61 }
62
63 public static List<RenameOptions> fromJsonArray(JsonArray jsonArray) {
64 if (jsonArray == null) {
65 return EMPTY_LIST;
66 }
67 ArrayList<RenameOptions> list = new ArrayList<RenameOptions>(jsonArray.size());
68 Iterator<JsonElement> iterator = jsonArray.iterator();
69 while (iterator.hasNext()) {
70 list.add(fromJson(iterator.next().getAsJsonObject()));
71 }
72 return list;
73 }
74
75 /**
76 * The name that the element should have after the refactoring.
77 */
78 public String getNewName() {
79 return newName;
80 }
81
82 @Override
83 public int hashCode() {
84 HashCodeBuilder builder = new HashCodeBuilder();
85 builder.append(newName);
86 return builder.toHashCode();
87 }
88
89 /**
90 * The name that the element should have after the refactoring.
91 */
92 public void setNewName(String newName) {
93 this.newName = newName;
94 }
95
96 public JsonObject toJson() {
97 JsonObject jsonObject = new JsonObject();
98 jsonObject.addProperty("newName", newName);
99 return jsonObject;
100 }
101
102 @Override
103 public String toString() {
104 StringBuilder builder = new StringBuilder();
105 builder.append("[");
106 builder.append("newName=");
107 builder.append(newName);
108 builder.append("]");
109 return builder.toString();
110 }
111
112}
static List< RenameOptions > fromJsonArray(JsonArray jsonArray)
static RenameOptions fromJson(JsonObject jsonObject)