Class ExternalCommand
java.lang.Object
za.co.wethinkcode.robots.server.commands.Command
za.co.wethinkcode.robots.server.commands.external.ExternalCommand
- Direct Known Subclasses:
BackCommand,ClientQuitCommand,FireCommand,ForwardCommand,LaunchCommand,LookCommand,ReloadCommand,RepairCommand,StateCommand,TurnCommand,WorldCommand
Abstract class of commands external to server, typically from clients
-
Constructor Summary
ConstructorsConstructorDescriptionExternalCommand(com.google.gson.JsonObject json) Overload command constructorExternalCommand(String robotName) Required command constructor -
Method Summary
Modifier and TypeMethodDescriptiongetArgs()Getter for the args of an external commandabstract ImplementedClientCommandsReturn which client command this command implementsabstract StringgetUsage()Get the way this command is supposed to be used.Methods inherited from class za.co.wethinkcode.robots.server.commands.Command
execute, executeToString, findRobot, getRobotName
-
Constructor Details
-
ExternalCommand
Required command constructor- Parameters:
robotName- the name of the robot the command is being executed on
-
ExternalCommand
public ExternalCommand(com.google.gson.JsonObject json) throws ClassCastException, UnsupportedOperationException, IllegalStateException Overload command constructor- Parameters:
json- the Json version of the input- Throws:
ClassCastExceptionUnsupportedOperationExceptionIllegalStateException
-
-
Method Details
-
getCommandName
Return which client command this command implements- Returns:
- the command this child is
-
getArgs
Getter for the args of an external command- Returns:
- a list of arguments.
-
getUsage
Get the way this command is supposed to be used.Example for a command foo#robot-world-client > invalid input: '<'foo-usage> invalid input: '<'foo-args>- Returns:
- the string representation of the usage of this command.
-