Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / components / devtools_bridge / android / java / src / org / chromium / components / devtools_bridge / commands / CommandDefinition.java
1 // Copyright 2014 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.components.devtools_bridge.commands;
6
7 import java.util.List;
8 import java.util.Map;
9
10 /**
11  * Definition for a Command and a command factory. Definition needed when
12  * registering in GCD. GCD only interested in in-parameters so to CommandDefinition.
13  */
14 public abstract class CommandDefinition {
15     private final String mName;
16     private final List<ParamDefinition<?>> mInParams;
17
18     public CommandDefinition(String name, List<ParamDefinition<?>> inParams) {
19         mName = name;
20         mInParams = inParams;
21     }
22
23     public Iterable<ParamDefinition<?>> inParams() {
24         return mInParams;
25     }
26
27     public String shortName() {
28         return "_" + mName;
29     }
30
31     public String fullName() {
32         return "base._" + mName;
33     }
34
35     /**
36      * Factory method for creaiting a command from serialized state.
37      */
38     public abstract Command newCommand(String id, Map<String, String> actualParameters)
39             throws CommandFormatException;
40 }