Class BaseCommand

java.lang.Object
com.codingchili.core.context.BaseCommand
All Implemented Interfaces:
Command

public class BaseCommand extends Object implements Command
A basic
  • Constructor Details

    • BaseCommand

      public BaseCommand(BiFunction<io.vertx.core.Promise<CommandResult>,​CommandExecutor,​Void> consumer, String name, String description)
      Creates a new asynchronous command.
      Parameters:
      consumer - the function to be called when the command is executed.
      name - the handler of the command
      description - the command description
    • BaseCommand

      public BaseCommand(Function<CommandExecutor,​CommandResult> runnable, String name, String description)
      Creates a new synchronous command
      Parameters:
      runnable - executed when the command is invoked
      name - the handler of the command
      description - the command description
  • Method Details

    • setVisible

      public Command setVisible(Boolean visible)
    • isVisible

      public boolean isVisible()
      Description copied from interface: Command
      Indicates if this command should be printed in the help dialog.
      Specified by:
      isVisible in interface Command
      Returns:
      true if the command should be listed in the help menu.
    • execute

      public void execute(io.vertx.core.Promise<CommandResult> future, CommandExecutor executor)
      Description copied from interface: Command
      Executes a command.
      Specified by:
      execute in interface Command
      Parameters:
      future - callback: complete with true to abort startup.
      executor - the executor executing the command, can be used to get properties.
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface Command
      Returns:
      the command description.
    • getName

      public String getName()
      Specified by:
      getName in interface Command
      Returns:
      the name of the command.