Interface Command

All Known Implementing Classes:
DefaultCommand

public interface Command
A plug-in to the Vert.x command or Launcher class. Each command instance is created by a CommandFactory.

Command implementation can retrieve argument and option using the Argument and Option annotations. Documentation / help is provided using the Summary (single sentence) and Description annotations.

Commands follow a strict lifecycle. The setUp(ExecutionContext) method is called with an execution context. It lets you validate the inputs and prepare the environment is needed. The run() method is called immediately after setUp(ExecutionContext), and executes the command. Finally, once the command has completed, the tearDown() method is called. In this method you have the opportunity to cleanup.

Author:
Clement Escoffier invalid input: '<'[email protected]>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run()
    Executes the command.
    void
    Set up the command execution environment.
    void
    The command has been executed.
  • Method Details

    • setUp

      void setUp(ExecutionContext context) throws CLIException
      Set up the command execution environment. The command line model has been retrieved and is frozen. Values has been set / injected. You can use this callback to validate the inputs.
      Parameters:
      context - the context
      Throws:
      CLIException - if the validation failed
    • run

      void run() throws CLIException
      Executes the command.
      Throws:
      CLIException - If anything went wrong.
    • tearDown

      void tearDown() throws CLIException
      The command has been executed. Use this method to cleanup the environment.
      Throws:
      CLIException - if anything went wrong