Package commandManagers.commands
Class UpdateId
java.lang.Object
commandManagers.Command
commandManagers.commands.UpdateId
- All Implemented Interfaces:
CommandInterface
Command to update a city by its id number.
-
Constructor Summary
ConstructorsConstructorDescriptionUpdateId()
Default constructor from 1.0UpdateId
(ModeManager<City> modeManager) Provides choosing handler -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkArgument
(Object inputArgument) Checks if the input argument is valid for the UpdateId command.void
execute()
Executes the UpdateId command by updating a city with a specified id number in the collection.getDescr()
Base method for show command description.getName()
Base method for show command nameMethods inherited from class commandManagers.Command
getArgument, isHasArgument, setArgument
-
Constructor Details
-
UpdateId
public UpdateId()Default constructor from 1.0 -
UpdateId
Provides choosing handler- Parameters:
modeManager
- ModuleHandler for operating- Since:
- 1.1
-
-
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
Executes the UpdateId command by updating a city with a specified id number in the collection. The method calls the checkArgument method to validate the input argument before execution.- Specified by:
execute
in interfaceCommandInterface
- Specified by:
execute
in classCommand
- Throws:
BuildObjectException
-
checkArgument
Checks if the input argument is valid for the UpdateId command. The input argument should be a non-null string that can be parsed to an integer.- Specified by:
checkArgument
in interfaceCommandInterface
- Specified by:
checkArgument
in classCommand
- Parameters:
inputArgument
- the input argument to be checked- Returns:
- true if the input argument is valid, false otherwise
-