public abstract class CommandLogic
extends java.lang.Object
| Constructor and Description |
|---|
CommandLogic() |
CommandLogic(java.lang.String[] params) |
| Modifier and Type | Method and Description |
|---|---|
CommandLogic |
addOption(Option t)
Adds a possible option to the command.
|
abstract void |
execute(java.lang.String[] args)
Override this method to define the logic for a command.
|
java.util.ArrayList<Option> |
getOptions() |
java.lang.String[] |
getParams() |
boolean |
onOption(char flag)
Use this method in an if-statement as such:
|
public CommandLogic()
public CommandLogic(java.lang.String[] params)
public java.util.ArrayList<Option> getOptions()
public java.lang.String[] getParams()
public abstract void execute(java.lang.String[] args)
args - Command-line argumentspublic boolean onOption(char flag)
to signify the execution of the command when different options are called in addition to the command's parameters.@Override public void execute() { ... if (onOption('a')) { // behavior with option 'a' } if (onOption('b')) { // behavior with option 'b' } }
flag - The option's one-character reference (Example: "-a" or "-b")true if the option exists and is called either by its
flag or one of its references, false otherwise.public CommandLogic addOption(Option t)
t - Default flag to call the option