Class AbstractConsoleCommand
java.lang.Object
com.dianxin.tori.base.console.commands.AbstractConsoleCommand
- Direct Known Subclasses:
ExampleConsoleCommand
Abstract base class representing a terminal or console command.
Any custom system command must extend this class and implement the
execute(String[]) method.-
Constructor Summary
ConstructorsConstructorDescriptionAbstractConsoleCommand(String commandLine) Constructs a new console command with the specified trigger keyword. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidExecutes the core logic of this command.Gets the command line keyword trigger.protected org.slf4j.LoggerGets the logger associated with the runtime class of this command instance.
-
Constructor Details
-
AbstractConsoleCommand
Constructs a new console command with the specified trigger keyword.- Parameters:
commandLine- the unique string trigger for this command (e.g., "stop", "help")
-
-
Method Details
-
execute
Executes the core logic of this command.- Parameters:
args- the array of arguments passed to the command, excluding the command trigger itself
-
getLogger
protected org.slf4j.Logger getLogger()Gets the logger associated with the runtime class of this command instance.- Returns:
- the logger instance
-
getCommandLine
Gets the command line keyword trigger.- Returns:
- the lowercase trimmed trigger string
-