Package io.bdeploy.common.cli
Class ToolBase.ConfiguredCliTool<T extends Annotation>
java.lang.Object
io.bdeploy.common.cli.ToolBase.CliTool
io.bdeploy.common.cli.ToolBase.ConfiguredCliTool<T>
- Direct Known Subclasses:
DiscUsageTool,ExportTool,FsckTool,ImportTool,InitTool,LocalLoginTool,PruneTool,RemoteServiceTool,ServeTool,TokenTool,TreeTool
- Enclosing class:
- ToolBase
public abstract static class ToolBase.ConfiguredCliTool<T extends Annotation>
extends ToolBase.CliTool
Base class for tools that accept additional configuration.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.bdeploy.common.cli.ToolBase.CliTool
ToolBase.CliTool.CliName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <X extends Annotation>
XCreate a specific configuration from the underlying raw configuration using the given annotation.protected List<Class<? extends Annotation>>protected Class<? extends Annotation>protected Configurationprotected voidhelpAndFail(String message) Display the help text and fail the tool (System.exit(1)).protected voidhelpAndFailIfMissing(Object argument, String message) final RenderableResultrun()Execute the tool.protected abstract RenderableResultRun the configured tool using configuration from the command line.Methods inherited from class io.bdeploy.common.cli.ToolBase.CliTool
createDataTable, createEmptyResult, createNoOp, createResultWithErrorMessage, createResultWithSuccessMessage, createSuccess, getActivityReporter, getAuditorFactory, getDataFormat, isVerbose, out, setActivityReporter, setAuditorFactory, setDataFormat, setOutput, setVerbose
-
Constructor Details
-
ConfiguredCliTool
- Parameters:
configClass- the configuration annotation class to use.
-
-
Method Details
-
getPrimaryConfigClass
- Returns:
- the type of the primary configuration annotation (the one passed in the constructor).
-
getConfigsForHelp
- Returns:
- all
Annotations for which to render help output.
-
getConfig
Create a specific configuration from the underlying raw configuration using the given annotation. -
getRawConfiguration
- Returns:
- the underlying raw configuration.
-
run
Description copied from class:ToolBase.CliToolExecute the tool.- Specified by:
runin classToolBase.CliTool
-
helpAndFailIfMissing
- Parameters:
argument- display help text and fail the tool if the argument isnull.
-
helpAndFail
Display the help text and fail the tool (System.exit(1)). -
run
Run the configured tool using configuration from the command line.- Parameters:
config- the configuration instance for the tool.
-