Flutter Engine
The Flutter Engine
ServerLogEntry.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 log entry from the server.
28 *
29 * @coverage dart.server.generated.types
30 */
31@SuppressWarnings("unused")
32public class ServerLogEntry {
33
34 public static final ServerLogEntry[] EMPTY_ARRAY = new ServerLogEntry[0];
35
36 public static final List<ServerLogEntry> EMPTY_LIST = Lists.newArrayList();
37
38 /**
39 * The time (milliseconds since epoch) at which the server created this log entry.
40 */
41 private final int time;
42
43 /**
44 * The kind of the entry, used to determine how to interpret the "data" field.
45 */
46 private final String kind;
47
48 /**
49 * The payload of the entry, the actual format is determined by the "kind" field.
50 */
51 private final String data;
52
53 /**
54 * Constructor for {@link ServerLogEntry}.
55 */
56 public ServerLogEntry(int time, String kind, String data) {
57 this.time = time;
58 this.kind = kind;
59 this.data = data;
60 }
61
62 @Override
63 public boolean equals(Object obj) {
64 if (obj instanceof ServerLogEntry) {
65 ServerLogEntry other = (ServerLogEntry) obj;
66 return
67 other.time == time &&
68 ObjectUtilities.equals(other.kind, kind) &&
69 ObjectUtilities.equals(other.data, data);
70 }
71 return false;
72 }
73
74 public static ServerLogEntry fromJson(JsonObject jsonObject) {
75 int time = jsonObject.get("time").getAsInt();
76 String kind = jsonObject.get("kind").getAsString();
77 String data = jsonObject.get("data").getAsString();
78 return new ServerLogEntry(time, kind, data);
79 }
80
81 public static List<ServerLogEntry> fromJsonArray(JsonArray jsonArray) {
82 if (jsonArray == null) {
83 return EMPTY_LIST;
84 }
85 ArrayList<ServerLogEntry> list = new ArrayList<ServerLogEntry>(jsonArray.size());
86 Iterator<JsonElement> iterator = jsonArray.iterator();
87 while (iterator.hasNext()) {
88 list.add(fromJson(iterator.next().getAsJsonObject()));
89 }
90 return list;
91 }
92
93 /**
94 * The payload of the entry, the actual format is determined by the "kind" field.
95 */
96 public String getData() {
97 return data;
98 }
99
100 /**
101 * The kind of the entry, used to determine how to interpret the "data" field.
102 */
103 public String getKind() {
104 return kind;
105 }
106
107 /**
108 * The time (milliseconds since epoch) at which the server created this log entry.
109 */
110 public int getTime() {
111 return time;
112 }
113
114 @Override
115 public int hashCode() {
116 HashCodeBuilder builder = new HashCodeBuilder();
117 builder.append(time);
118 builder.append(kind);
119 builder.append(data);
120 return builder.toHashCode();
121 }
122
123 public JsonObject toJson() {
124 JsonObject jsonObject = new JsonObject();
125 jsonObject.addProperty("time", time);
126 jsonObject.addProperty("kind", kind);
127 jsonObject.addProperty("data", data);
128 return jsonObject;
129 }
130
131 @Override
132 public String toString() {
133 StringBuilder builder = new StringBuilder();
134 builder.append("[");
135 builder.append("time=");
136 builder.append(time + ", ");
137 builder.append("kind=");
138 builder.append(kind + ", ");
139 builder.append("data=");
140 builder.append(data);
141 builder.append("]");
142 return builder.toString();
143 }
144
145}
ServerLogEntry(int time, String kind, String data)
static List< ServerLogEntry > fromJsonArray(JsonArray jsonArray)
static ServerLogEntry fromJson(JsonObject jsonObject)
static double time(int loops, Benchmark *bench, Target *target)
Definition: nanobench.cpp:394
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63