Class AbstractConsoleCommand

java.lang.Object
com.dianxin.tori.base.console.commands.AbstractConsoleCommand
Direct Known Subclasses:
ExampleConsoleCommand

public abstract class AbstractConsoleCommand extends Object
Abstract base class representing a terminal or console command. Any custom system command must extend this class and implement the execute(String[]) method.
  • Constructor Details

    • AbstractConsoleCommand

      public AbstractConsoleCommand(String commandLine)
      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

      public abstract void execute(String[] args)
      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

      public String getCommandLine()
      Gets the command line keyword trigger.
      Returns:
      the lowercase trimmed trigger string