public abstract class CommandLineParser<T extends Configuration> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CommandLineParser.Command |
static interface |
CommandLineParser.ConfigBuilder<T extends Configuration> |
| Constructor and Description |
|---|
CommandLineParser() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract CommandLineParser.ConfigBuilder<? extends T> |
getConfigBuilder(String firstParam)
Method that must be implemented retrieving the correct configBuilder given first argument
|
abstract String |
help() |
T |
parse(String[] input)
Utility for parsing commandline parameters into configuration objects
|
public T parse(String[] input) throws NoSuchBuilderException, WrongFormatException, UnknownCommandException
All commands parsable by the commandLineParser is of the form:
--mode --param1 -arg1 -arg2 --param2 --param3 -arg1
mode is what determines the CommandLineParser.ConfigBuilder used
Note that the first argument that the CommandLineParser.ConfigBuilder receives is always the mode argument.
The mode is also able to receive get arguments, however they wont affect choice of CommandLineParser.ConfigBuilder
Both commands and arguments are stripped of their "-" or "--" prefix
input - the string array to be parsedConfiguration created by the assigned CommandLineParser.ConfigBuilderNoSuchBuilderExceptionWrongFormatExceptionUnknownCommandExceptionprotected abstract CommandLineParser.ConfigBuilder<? extends T> getConfigBuilder(String firstParam) throws NoSuchBuilderException
firstParam - first argument from commandlineCommandLineParser.ConfigBuilder to be used in parsingNoSuchBuilderException - when no CommandLineParser.ConfigBuilder is foundpublic abstract String help()
Copyright © 2022. All rights reserved.