Flutter Engine
The Flutter Engine
ImplementedClass.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 description of a class that is implemented or extended.
28 *
29 * @coverage dart.server.generated.types
30 */
31@SuppressWarnings("unused")
32public class ImplementedClass {
33
34 public static final ImplementedClass[] EMPTY_ARRAY = new ImplementedClass[0];
35
36 public static final List<ImplementedClass> EMPTY_LIST = Lists.newArrayList();
37
38 /**
39 * The offset of the name of the implemented class.
40 */
41 private final int offset;
42
43 /**
44 * The length of the name of the implemented class.
45 */
46 private final int length;
47
48 /**
49 * Constructor for {@link ImplementedClass}.
50 */
51 public ImplementedClass(int offset, int length) {
52 this.offset = offset;
53 this.length = length;
54 }
55
56 @Override
57 public boolean equals(Object obj) {
58 if (obj instanceof ImplementedClass) {
60 return
61 other.offset == offset &&
62 other.length == length;
63 }
64 return false;
65 }
66
67 public static ImplementedClass fromJson(JsonObject jsonObject) {
68 int offset = jsonObject.get("offset").getAsInt();
69 int length = jsonObject.get("length").getAsInt();
70 return new ImplementedClass(offset, length);
71 }
72
73 public static List<ImplementedClass> fromJsonArray(JsonArray jsonArray) {
74 if (jsonArray == null) {
75 return EMPTY_LIST;
76 }
77 ArrayList<ImplementedClass> list = new ArrayList<ImplementedClass>(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 * The length of the name of the implemented class.
87 */
88 public int getLength() {
89 return length;
90 }
91
92 /**
93 * The offset of the name of the implemented class.
94 */
95 public int getOffset() {
96 return offset;
97 }
98
99 @Override
100 public int hashCode() {
101 HashCodeBuilder builder = new HashCodeBuilder();
102 builder.append(offset);
103 builder.append(length);
104 return builder.toHashCode();
105 }
106
107 public JsonObject toJson() {
108 JsonObject jsonObject = new JsonObject();
109 jsonObject.addProperty("offset", offset);
110 jsonObject.addProperty("length", length);
111 return jsonObject;
112 }
113
114 @Override
115 public String toString() {
116 StringBuilder builder = new StringBuilder();
117 builder.append("[");
118 builder.append("offset=");
119 builder.append(offset + ", ");
120 builder.append("length=");
121 builder.append(length);
122 builder.append("]");
123 return builder.toString();
124 }
125
126}
static List< ImplementedClass > fromJsonArray(JsonArray jsonArray)
static ImplementedClass fromJson(JsonObject jsonObject)
size_t length
SeparatedVector2 offset