public abstract class PublicMethodsCliObjectFactory<T> extends Object implements CliObjectFactory<T>
Options from the public methods in a class.
For each public method in the class to infer with exactly zero or one String parameter, the helper will create
an optional Option. Using the annotation CliObjectOption the helper can automatically
add a description to the Option. Annotating a method with NotOnCli will prevent the helper from
creating an Option from it.CliObjectFactory.HelpArgumentFound| Constructor and Description |
|---|
PublicMethodsCliObjectFactory(Class<? extends T> klazz) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyCommandLineOptions(org.apache.commons.cli.CommandLine cli,
T embeddedGobblin)
For each method for which the helper created an
Option and for which the input CommandLine contains
that option, this method will automatically call the method on the input object with the correct
arguments. |
T |
buildObject(org.apache.commons.cli.CommandLine cli)
Build an instance of T from the parsed
CommandLine. |
T |
buildObject(String[] args,
int offset,
boolean printUsage,
String usage)
Build an instance of T from the input arguments.
|
protected abstract T |
constructObject(org.apache.commons.cli.CommandLine cli) |
String |
getUsageString()
Get a usage string for display on the command line.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOptionspublic T buildObject(org.apache.commons.cli.CommandLine cli)
CliObjectFactoryCommandLine. The input CommandLine was parsed with
the output of Options, but may include additional Options added by the driver.buildObject in interface CliObjectFactory<T>public T buildObject(String[] args, int offset, boolean printUsage, String usage) throws IOException
CliObjectFactorybuildObject in interface CliObjectFactory<T>args - input arguments to the application.offset - will only start processing from this argument number.printUsage - if true, a failure or -h will cause help to be printed and an exception to be thrown.usage - usage String to be printed at the beginning of help message.IOExceptionprotected abstract T constructObject(org.apache.commons.cli.CommandLine cli) throws IOException
IOExceptionpublic String getUsageString()
CliObjectFactorygetUsageString in interface CliObjectFactory<T>public void applyCommandLineOptions(org.apache.commons.cli.CommandLine cli,
T embeddedGobblin)
Option and for which the input CommandLine contains
that option, this method will automatically call the method on the input object with the correct
arguments.