T - the Configuration subclass which is loaded from the configuration filepublic abstract class ConfiguredCommand<T extends Configuration> extends Command
Configuration subclass, which is then validated. If the
configuration is valid, the command is run.Configuration| Modifier | Constructor and Description |
|---|---|
protected |
ConfiguredCommand(String name,
String description) |
| Modifier and Type | Method and Description |
|---|---|
protected net.sourceforge.argparse4j.inf.Argument |
addFileArgument(net.sourceforge.argparse4j.inf.Subparser subparser)
Adds the configuration file argument for the configured command.
|
protected void |
cleanup() |
protected void |
cleanupAsynchronously() |
void |
configure(net.sourceforge.argparse4j.inf.Subparser subparser)
Configure the command's
Subparser. |
protected Class<T> |
getConfigurationClass()
Returns the
Class of the configuration type. |
void |
run(Bootstrap<?> wildcardBootstrap,
net.sourceforge.argparse4j.inf.Namespace namespace)
Executes when the user runs this specific command.
|
protected abstract void |
run(Bootstrap<T> bootstrap,
net.sourceforge.argparse4j.inf.Namespace namespace,
T configuration)
Runs the command with the given
Bootstrap and Configuration. |
getDescription, getName, onErrorprotected Class<T> getConfigurationClass()
Class of the configuration type.Class of the configuration typepublic void configure(net.sourceforge.argparse4j.inf.Subparser subparser)
Subparser. N.B.: if you override this method, you
must call super.override(subparser) in order to preserve the configuration
file parameter in the subparser.
protected net.sourceforge.argparse4j.inf.Argument addFileArgument(net.sourceforge.argparse4j.inf.Subparser subparser)
subparser - The subparser to register the argument onpublic void run(Bootstrap<?> wildcardBootstrap, net.sourceforge.argparse4j.inf.Namespace namespace) throws Exception
Commandprotected void cleanupAsynchronously()
protected void cleanup()
protected abstract void run(Bootstrap<T> bootstrap, net.sourceforge.argparse4j.inf.Namespace namespace, T configuration) throws Exception
Bootstrap and Configuration.bootstrap - the bootstrap bootstrapnamespace - the parsed command line namespaceconfiguration - the configuration objectException - if something goes wrongCopyright © 2020. All rights reserved.