Module dev.metaschema.cli.processor
Class AbstractCommandExecutor
java.lang.Object
dev.metaschema.cli.processor.command.AbstractCommandExecutor
- All Implemented Interfaces:
ICommandExecutor
- Direct Known Subclasses:
AbstractConvertSubcommand.AbstractConversionCommandExecutor,AbstractValidateContentCommand.AbstractValidationCommandExecutor
A base class for implementation that perform the operation supported by a
command.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.metaschema.cli.processor.command.ICommandExecutor
ICommandExecutor.ExecutionFunction -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCommandExecutor(CallingContext callingContext, org.apache.commons.cli.CommandLine commandLine) Construct a new command executor. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidexecute()Execute the command operation.protected CallingContextGet the context of the command execution, which provides access to the execution environment needed for command processing.protected ICommandGet the command associated with this execution.protected org.apache.commons.cli.CommandLineGet the parsed command line details containing the command options and arguments provided by the user during execution.
-
Constructor Details
-
AbstractCommandExecutor
protected AbstractCommandExecutor(@NonNull CallingContext callingContext, @NonNull org.apache.commons.cli.CommandLine commandLine) Construct a new command executor.- Parameters:
callingContext- the context of the command executioncommandLine- the parsed command line details
-
-
Method Details
-
getCallingContext
Get the context of the command execution, which provides access to the execution environment needed for command processing.- Returns:
- the context
-
getCommandLine
@NonNull protected org.apache.commons.cli.CommandLine getCommandLine()Get the parsed command line details containing the command options and arguments provided by the user during execution.- Returns:
- the cli details
-
execute
Description copied from interface:ICommandExecutorExecute the command operation.- Specified by:
executein interfaceICommandExecutor- Throws:
CommandExecutionException- if an error occurred while executing the command operation
-
getCommand
Get the command associated with this execution.- Returns:
- the command
-