Package commandManagers.commands
Class Add
java.lang.Object
commandManagers.Command
commandManagers.commands.Add
- All Implemented Interfaces:
CommandInterface
Command to add a new city to the collection.
- Author:
- boris
-
Constructor Summary
ConstructorsConstructorDescriptionAdd()
Default constructor from 1.0Add
(ModeManager<City> handler) Provides choosing handler -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkArgument
(Object inputArgument) Checks whether an argument is provided or not.void
execute()
Adds a new city to the collection if an argument is not provided.getDescr()
Base method for show command description.getName()
Base method for show command nameMethods inherited from class commandManagers.Command
getArgument, isHasArgument, setArgument
-
Constructor Details
-
Add
public Add()Default constructor from 1.0 -
Add
Provides choosing handler- Parameters:
handler
- ModuleHandler for operating- Since:
- 2.0
-
-
Method Details
-
getName
Description copied from class:Command
Base method for show command name- Specified by:
getName
in interfaceCommandInterface
- Specified by:
getName
in classCommand
- Returns:
- command name
-
getDescr
Description copied from class:Command
Base method for show command description.- Specified by:
getDescr
in interfaceCommandInterface
- Specified by:
getDescr
in classCommand
- Returns:
- command description
-
execute
Adds a new city to the collection if an argument is not provided. Prints a message indicating that the command does not take arguments otherwise.- Specified by:
execute
in interfaceCommandInterface
- Specified by:
execute
in classCommand
- Throws:
BuildObjectException
-
checkArgument
Checks whether an argument is provided or not.- Specified by:
checkArgument
in interfaceCommandInterface
- Specified by:
checkArgument
in classCommand
- Parameters:
inputArgument
- the argument to be checked.- Returns:
- true if no argument is provided and false otherwise.
-