public abstract class ApiCommand extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CMD_PREFIX |
static String |
DEFAULT_LONG_CMD_PREFIX |
| Constructor and Description |
|---|
ApiCommand(String apiCommand,
String console,
String consoleShort,
String header,
String description)
Constructor for new API command.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCommandArgument(CommandArgument param)
Adds an argument to the command.
|
org.json.JSONObject |
callApiCommand() |
org.json.JSONObject |
callApiCommand(Map<String,String> parameters) |
String |
getApiCommand()
Retrieve the API command.
|
List<CommandArgument> |
getCommandArguments()
Retrieves the possible command parameters.
|
String |
getConsoleCommand()
The long command version used as program parameter.
|
String |
getConsoleShortCommand()
The short version used as program parameter
|
String |
getDescription()
Retrieve the description of the command.
|
String |
getHeader() |
String |
getHelp() |
boolean |
hasArgs()
Does this command has arguments?
|
abstract org.json.JSONObject |
run(List<String> arguments) |
boolean |
shouldStart(List<String> arguments) |
public static final String DEFAULT_CMD_PREFIX
public static final String DEFAULT_LONG_CMD_PREFIX
public ApiCommand(String apiCommand, String console, String consoleShort, String header, String description)
apiCommand - - the original API command as listed in the API documentation
of Mozilla's HTTP Observatoryconsole - - the command for the consoleconsoleShort - - the short version of the console commandpublic abstract org.json.JSONObject run(List<String> arguments) throws IllegalArgumentException
arguments - IllegalArgumentExceptionpublic String getApiCommand()
public String getConsoleCommand()
public String getConsoleShortCommand()
public org.json.JSONObject callApiCommand()
public String getDescription()
public String getHeader()
public String getHelp()
public List<CommandArgument> getCommandArguments()
public void addCommandArgument(CommandArgument param)
param - - the command argument to addpublic boolean hasArgs()
Copyright © 2016. All rights reserved.