Package dk.eSoftware.commandLineParser
Class SingletonCommandLineParser<T extends Configuration>
- java.lang.Object
-
- dk.eSoftware.commandLineParser.CommandLineParser<T>
-
- dk.eSoftware.commandLineParser.SingletonCommandLineParser<T>
-
public class SingletonCommandLineParser<T extends Configuration> extends CommandLineParser<T>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class dk.eSoftware.commandLineParser.CommandLineParser
CommandLineParser.Command, CommandLineParser.ConfigBuilder<T extends Configuration>
-
-
Constructor Summary
Constructors Constructor Description SingletonCommandLineParser(CommandLineParser.ConfigBuilder<T> builder)Constructor for aCommandLineParserwith only one mode of operations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CommandLineParser.ConfigBuilder<T>getConfigBuilder(java.lang.String firstParam)Method that must be implemented retrieving the correct configBuilder given first argumentjava.lang.Stringhelp()Tparse(java.lang.String[] input)Utility for parsing commandline parameters into configuration objects
-
-
-
Constructor Detail
-
SingletonCommandLineParser
public SingletonCommandLineParser(CommandLineParser.ConfigBuilder<T> builder)
Constructor for aCommandLineParserwith only one mode of operations.- Parameters:
builder- the singleton builder
-
-
Method Detail
-
parse
public T parse(java.lang.String[] input) throws NoSuchBuilderException, WrongFormatException, UnknownCommandException
Description copied from class:CommandLineParserUtility for parsing commandline parameters into configuration objectsAll commands parsable by the commandLineParser is of the form:
--mode --param1 -arg1 -arg2 --param2 --param3 -arg1mode is what determines theCommandLineParser.ConfigBuilderused
Note that the first argument that theCommandLineParser.ConfigBuilderreceives is always the mode argument. The mode is also able to receive get arguments, however they wont affect choice ofCommandLineParser.ConfigBuilder
Both commands and arguments are stripped of their "-" or "--" prefix- Overrides:
parsein classCommandLineParser<T extends Configuration>- Parameters:
input- the string array to be parsed- Returns:
- null if input is null or empty - otherwise a
Configurationcreated by the assignedCommandLineParser.ConfigBuilder - Throws:
NoSuchBuilderExceptionWrongFormatExceptionUnknownCommandException
-
getConfigBuilder
protected CommandLineParser.ConfigBuilder<T> getConfigBuilder(java.lang.String firstParam)
Description copied from class:CommandLineParserMethod that must be implemented retrieving the correct configBuilder given first argument- Specified by:
getConfigBuilderin classCommandLineParser<T extends Configuration>- Parameters:
firstParam- first argument from commandline- Returns:
CommandLineParser.ConfigBuilderto be used in parsing
-
help
public java.lang.String help()
- Specified by:
helpin classCommandLineParser<T extends Configuration>- Returns:
- terminal-formatted string describing configuration options
-
-