author | Eugene Ostroukhov <eugeneo@symbian.org> |
Mon, 07 Jun 2010 16:51:19 -0700 | |
changeset 355 | 8726e95bcbba |
parent 2 | e4420d2515f1 |
permissions | -rw-r--r-- |
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; |
|
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
11 |
import org.chromium.sdk.internal.protocolparser.JsonOptionalField; |
2 | 12 |
import org.chromium.sdk.internal.protocolparser.JsonOverrideField; |
13 |
import org.chromium.sdk.internal.protocolparser.JsonSubtype; |
|
14 |
import org.chromium.sdk.internal.protocolparser.JsonSubtypeCasting; |
|
15 |
import org.chromium.sdk.internal.protocolparser.JsonSubtypeConditionCustom; |
|
16 |
import org.chromium.sdk.internal.protocolparser.JsonType; |
|
17 |
||
18 |
/** |
|
19 |
* A generic type for all command responses. There are 2 subtypes; one for |
|
20 |
* success responses and one for failure responses. |
|
21 |
*/ |
|
22 |
@JsonType |
|
23 |
public interface CommandResponse extends JsonSubtype<IncomingMessage> { |
|
24 |
||
25 |
@JsonOverrideField |
|
26 |
@JsonSubtypeConditionCustom(condition=TypeValueCondition.class) |
|
27 |
MessageType getType(); |
|
28 |
||
29 |
class TypeValueCondition extends EnumValueCondition<MessageType> { |
|
30 |
public TypeValueCondition() { |
|
31 |
super(EnumSet.of(MessageType.response)); |
|
32 |
} |
|
33 |
} |
|
34 |
||
35 |
/** |
|
36 |
* Id of the corresponding request sent to debugger. |
|
37 |
*/ |
|
38 |
@JsonField(jsonLiteralName="request_seq") |
|
39 |
long getRequestSeq(); |
|
40 |
||
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
41 |
@JsonOptionalField |
2 | 42 |
String getCommand(); |
43 |
||
44 |
boolean success(); |
|
45 |
||
46 |
@JsonSubtypeCasting |
|
47 |
SuccessCommandResponse asSuccess(); |
|
48 |
||
49 |
@JsonSubtypeCasting |
|
50 |
FailedCommandResponse asFailure(); |
|
51 |
} |