2
|
1 |
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
|
2 |
// Use of this source code is governed by a BSD-style license that can be
|
|
3 |
// found in the LICENSE file.
|
|
4 |
|
|
5 |
package org.chromium.sdk.internal.protocol;
|
|
6 |
|
|
7 |
import java.util.EnumSet;
|
|
8 |
|
|
9 |
import org.chromium.sdk.internal.protocolparser.EnumValueCondition;
|
|
10 |
import org.chromium.sdk.internal.protocolparser.JsonField;
|
|
11 |
import org.chromium.sdk.internal.protocolparser.JsonOverrideField;
|
|
12 |
import org.chromium.sdk.internal.protocolparser.JsonSubtype;
|
|
13 |
import org.chromium.sdk.internal.protocolparser.JsonSubtypeCasting;
|
|
14 |
import org.chromium.sdk.internal.protocolparser.JsonSubtypeConditionCustom;
|
|
15 |
import org.chromium.sdk.internal.protocolparser.JsonType;
|
|
16 |
|
|
17 |
/**
|
|
18 |
* A generic type for all command responses. There are 2 subtypes; one for
|
|
19 |
* success responses and one for failure responses.
|
|
20 |
*/
|
|
21 |
@JsonType
|
|
22 |
public interface CommandResponse extends JsonSubtype<IncomingMessage> {
|
|
23 |
|
|
24 |
@JsonOverrideField
|
|
25 |
@JsonSubtypeConditionCustom(condition=TypeValueCondition.class)
|
|
26 |
MessageType getType();
|
|
27 |
|
|
28 |
class TypeValueCondition extends EnumValueCondition<MessageType> {
|
|
29 |
public TypeValueCondition() {
|
|
30 |
super(EnumSet.of(MessageType.response));
|
|
31 |
}
|
|
32 |
}
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Id of the corresponding request sent to debugger.
|
|
36 |
*/
|
|
37 |
@JsonField(jsonLiteralName="request_seq")
|
|
38 |
long getRequestSeq();
|
|
39 |
|
|
40 |
String getCommand();
|
|
41 |
|
|
42 |
boolean success();
|
|
43 |
|
|
44 |
@JsonSubtypeCasting
|
|
45 |
SuccessCommandResponse asSuccess();
|
|
46 |
|
|
47 |
@JsonSubtypeCasting
|
|
48 |
FailedCommandResponse asFailure();
|
|
49 |
}
|