Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
MoveFileOptions.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 MoveFileOptions extends RefactoringOptions {
31
32 public static final MoveFileOptions[] EMPTY_ARRAY = new MoveFileOptions[0];
33
34 public static final List<MoveFileOptions> EMPTY_LIST = Lists.newArrayList();
35
36 /**
37 * The new file path to which the given file is being moved.
38 */
39 private String newFile;
40
41 /**
42 * Constructor for {@link MoveFileOptions}.
43 */
44 public MoveFileOptions(String newFile) {
45 this.newFile = newFile;
46 }
47
48 @Override
49 public boolean equals(Object obj) {
50 if (obj instanceof MoveFileOptions) {
51 MoveFileOptions other = (MoveFileOptions) obj;
52 return
53 ObjectUtilities.equals(other.newFile, newFile);
54 }
55 return false;
56 }
57
58 public static MoveFileOptions fromJson(JsonObject jsonObject) {
59 String newFile = jsonObject.get("newFile").getAsString();
60 return new MoveFileOptions(newFile);
61 }
62
63 public static List<MoveFileOptions> fromJsonArray(JsonArray jsonArray) {
64 if (jsonArray == null) {
65 return EMPTY_LIST;
66 }
67 ArrayList<MoveFileOptions> list = new ArrayList<MoveFileOptions>(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 new file path to which the given file is being moved.
77 */
78 public String getNewFile() {
79 return newFile;
80 }
81
82 @Override
83 public int hashCode() {
84 HashCodeBuilder builder = new HashCodeBuilder();
85 builder.append(newFile);
86 return builder.toHashCode();
87 }
88
89 /**
90 * The new file path to which the given file is being moved.
91 */
92 public void setNewFile(String newFile) {
93 this.newFile = newFile;
94 }
95
96 public JsonObject toJson() {
97 JsonObject jsonObject = new JsonObject();
98 jsonObject.addProperty("newFile", newFile);
99 return jsonObject;
100 }
101
102 @Override
103 public String toString() {
104 StringBuilder builder = new StringBuilder();
105 builder.append("[");
106 builder.append("newFile=");
107 builder.append(newFile);
108 builder.append("]");
109 return builder.toString();
110 }
111
112}
static MoveFileOptions fromJson(JsonObject jsonObject)
static List< MoveFileOptions > fromJsonArray(JsonArray jsonArray)