public final class CommandLine extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
CommandLine.CommandLineCallback |
Constructor and Description |
---|
CommandLine() |
CommandLine(ConfigurationBuilder conf) |
Modifier and Type | Method and Description |
---|---|
CommandLine |
addCommandLineOption(org.apache.commons.cli.Option option,
CommandLine.CommandLineCallback cb) |
ConfigurationBuilder |
getBuilder() |
static Configuration |
parseToConfiguration(String[] args,
Class<? extends Name<?>>... argClasses)
Utility method to quickly parse a command line to a Configuration.
|
static ConfigurationBuilder |
parseToConfigurationBuilder(String[] args,
Class<? extends Name<?>>... argClasses)
Utility method to quickly parse a command line to a ConfigurationBuilder.
|
<T> CommandLine |
processCommandLine(String[] args,
Class<? extends Name<?>>... argClasses) |
CommandLine |
registerShortNameOfClass(Class<? extends Name<?>> c) |
CommandLine |
registerShortNameOfClass(String s) |
public CommandLine()
public CommandLine(ConfigurationBuilder conf)
public ConfigurationBuilder getBuilder()
public CommandLine registerShortNameOfClass(String s) throws BindException
BindException
public CommandLine registerShortNameOfClass(Class<? extends Name<?>> c) throws BindException
BindException
public CommandLine addCommandLineOption(org.apache.commons.cli.Option option, CommandLine.CommandLineCallback cb)
@SafeVarargs public final <T> CommandLine processCommandLine(String[] args, Class<? extends Name<?>>... argClasses) throws IOException, BindException
args
- IOException
NumberFormatException
org.apache.commons.cli.ParseException
BindException
public static Configuration parseToConfiguration(String[] args, Class<? extends Name<?>>... argClasses) throws org.apache.commons.cli.ParseException
parseToConfigurationBuilder(args, argClasses).build()
args
- the command line parameters to parse.argClasses
- the named parameters to look for.org.apache.commons.cli.ParseException
- if the parsing of the commandline fails.public static ConfigurationBuilder parseToConfigurationBuilder(String[] args, Class<? extends Name<?>>... argClasses) throws org.apache.commons.cli.ParseException
new CommandLine().processCommandLine(args, argClasses).getBuilder()
, but with additional checks.args
- the command line parameters to parse.argClasses
- the named parameters to look for.org.apache.commons.cli.ParseException
- if the parsing of the commandline fails.Copyright © 2015 The Apache Software Foundation. All rights reserved.