T
- the Configuration
subclass which is loaded from the configuration fileCheckCommand
, EnvironmentCommand
public 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 | Description |
---|---|---|
protected |
ConfiguredCommand(java.lang.String name,
java.lang.String description) |
Modifier and Type | Method | 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 java.lang.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, onError
protected ConfiguredCommand(java.lang.String name, java.lang.String description)
protected java.lang.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 java.lang.Exception
Command
protected void cleanupAsynchronously()
protected void cleanup()
protected abstract void run(Bootstrap<T> bootstrap, net.sourceforge.argparse4j.inf.Namespace namespace, T configuration) throws java.lang.Exception
Bootstrap
and Configuration
.bootstrap
- the bootstrap bootstrapnamespace
- the parsed command line namespaceconfiguration
- the configuration objectjava.lang.Exception
- if something goes wrongCopyright © 2018. All rights reserved.