Package de.hsh.graja.util.cli
Class CommandProvider
java.lang.Object
de.hsh.graja.util.cli.CommandProvider
- All Implemented Interfaces:
Comparable<CommandProvider>
- Direct Known Subclasses:
AsgmtBuilderCommandProvider,BackendCommandProvider,GuiCommandProvider,StarterCommandProvider,TransformCommandProvider,VariabilityCommandProvider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanabstract voidThis is themainmethod of a command.protected StringgetAdditionalAddModulesOption(String command) For usage printout this method should return a comma-separated list of modules that need to be added on the command line to get thecommandrunning.protected StringFor usage printout this method should return a path-delimiter-separated list of module paths that need to be added on the --module-path command line option to get thecommandrunning.protected StringFor usage printout this method should return a path-delimiter-separated list of module paths that need to be added on the --module-path command line option to get thecommandrunning.protected abstract String[]getCommands(Logging log) getName()inthashCode()provideCommands(Logging log, JsonMarshaller marshaller, CliConfig cfg) protected voidvalidateCommand(Logging log, String commandString)
-
Constructor Details
-
CommandProvider
public CommandProvider()
-
-
Method Details
-
getCommands
-
getAdditionalAddModulesOption
For usage printout this method should return a comma-separated list of modules that need to be added on the command line to get thecommandrunning.- Parameters:
command-- Returns:
- Default: ""
-
getAdditionalModulePathOptionTemplate
For usage printout this method should return a path-delimiter-separated list of module paths that need to be added on the --module-path command line option to get thecommandrunning.- Parameters:
command-- Returns:
- Default: ""
-
getAdditionalModulePathOptionExample
For usage printout this method should return a path-delimiter-separated list of module paths that need to be added on the --module-path command line option to get thecommandrunning.- Parameters:
command-- Returns:
- Default: ""
-
executeCommand
public abstract void executeCommand(Logging log, String command, TreeMap<String, Object> options) throws CommandExceptionThis is themainmethod of a command. It is called byCommand.execute(Logging, String[]).- Parameters:
log- All output should go to this Logging instancecommand-options-- Throws:
Exception- this signals an error, that usually a caller will react to by exiting the JVM return a value different from 0.CommandException
-
getName
-
provideCommands
public List<Command> provideCommands(Logging log, JsonMarshaller marshaller, CliConfig cfg) throws Exception - Throws:
Exception
-
validateCommand
- Throws:
IllegalArgumentException
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<CommandProvider>
-