Package org.eclipse.epsilon.common.cli
Class ConfigParser<C extends ProfilableRunConfiguration,B extends ProfilableRunConfiguration.Builder<C,B>>
- java.lang.Object
-
- org.eclipse.epsilon.common.cli.ConfigParser<C,B>
-
- Direct Known Subclasses:
EolConfigParser
public class ConfigParser<C extends ProfilableRunConfiguration,B extends ProfilableRunConfiguration.Builder<C,B>> extends Object implements Consumer<String[]>, Function<String[],C>
Convenience class providing an extensible command-line builder forProfilableRunConfiguration
.- Since:
- 1.6
- Author:
- Sina Madani
-
-
Field Summary
Fields Modifier and Type Field Description protected B
builder
protected org.apache.commons.cli.CommandLine
cmdLine
protected org.apache.commons.cli.HelpFormatter
help
protected String
helpOpt
protected String
nL
protected String
optionalUsage
protected org.apache.commons.cli.Options
options
protected String
outFileOpt
protected String
profileExecutionOpt
protected String
repeatsOpt
protected String
requiredUsage
protected C
runConfig
protected String
scriptOpt
protected String
showResultsOpt
-
Constructor Summary
Constructors Modifier Constructor Description protected
ConfigParser(B builder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(String[] args)
C
apply(String[] args)
protected String
formatUsage()
protected void
handleException(Exception ex)
void
parseAndRun(String[] args)
protected void
parseArgs(String[] args)
protected double
tryParse(String opt, double absentDefault)
protected double
tryParse(String opt, float absentDefault)
protected int
tryParse(String opt, int absentDefault)
protected long
tryParse(String opt, long absentDefault)
-
-
-
Field Detail
-
builder
protected B extends ProfilableRunConfiguration.Builder<C,B> builder
-
runConfig
protected C extends ProfilableRunConfiguration runConfig
-
nL
protected String nL
-
profileExecutionOpt
protected String profileExecutionOpt
-
repeatsOpt
protected String repeatsOpt
-
showResultsOpt
protected String showResultsOpt
-
helpOpt
protected String helpOpt
-
scriptOpt
protected String scriptOpt
-
outFileOpt
protected String outFileOpt
-
requiredUsage
protected String requiredUsage
-
optionalUsage
protected String optionalUsage
-
options
protected org.apache.commons.cli.Options options
-
help
protected org.apache.commons.cli.HelpFormatter help
-
cmdLine
protected org.apache.commons.cli.CommandLine cmdLine
-
-
Constructor Detail
-
ConfigParser
protected ConfigParser(B builder)
-
-
Method Detail
-
formatUsage
protected String formatUsage()
-
handleException
protected void handleException(Exception ex)
-
tryParse
protected double tryParse(String opt, float absentDefault) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
tryParse
protected double tryParse(String opt, double absentDefault) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
tryParse
protected int tryParse(String opt, int absentDefault) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
tryParse
protected long tryParse(String opt, long absentDefault) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
accept
public final void accept(String[] args)
- Specified by:
accept
in interfaceConsumer<C extends ProfilableRunConfiguration>
-
apply
public final C apply(String[] args)
- Specified by:
apply
in interfaceFunction<C extends ProfilableRunConfiguration,B extends ProfilableRunConfiguration.Builder<C,B>>
-
parseAndRun
public final void parseAndRun(String[] args)
-
-