|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
D - type of the user data.public interface Command<D>
Represents a command.
A command associate in one place :
- a register method to register all options
managed by the current command in the
OptionRegistry.
- a usage of the command
- a method execute.
First, the method register()
is called by the command line parser
during its construction
(CommandLineParser(prefix,usageFormatter,commands)=
or during an addition of commands
(addCommand(commands).
This method may register some options to the
OptionRegistry.
When the method
parse
of CommandLineParser
found an option, it calls the method
execute(optionName,userData,arguments) of the
corresponding command.
| Method Summary | |
|---|---|
void |
execute(String optionName,
D userData,
List<? extends String> optionArguments)
Execute the command corresponding to the option. |
void |
register(OptionRegistry<? extends D> registry)
Register all options managed by the current command. |
String |
usage(String optionName,
int numberOfArgument)
Returns the usage of an option represented by the command. |
String |
usageArgumentName(String optionName,
int numberOfArgument,
int index)
Return the name of each argument of an option represented by the command. |
| Method Detail |
|---|
String usage(String optionName,
int numberOfArgument)
optionName - name of the option.numberOfArgument - number of argument of the option.
String usageArgumentName(String optionName,
int numberOfArgument,
int index)
optionName - name of the option.numberOfArgument - number of argument of the option.index - of the argument
index if always between [0,numberOfArgument[
void register(OptionRegistry<? extends D> registry)
registry - the option registry.OptionRegistry
void execute(String optionName,
D userData,
List<? extends String> optionArguments)
throws IllegalCommandLineArgumentException
optionName - name of the option.userData - user data.optionArguments - list of option arguments.
IllegalCommandLineArgumentException - if by example optionArguments are bad filled.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||