Class Command

java.lang.Object
org.moeaframework.util.cli.Command

public class Command extends Object
Defines a command for use by a command line utility. CLIs designed around commands require one position argument, the command name to invoke.
  • Method Details

    • getName

      public String getName()
      Returns the display name for this command.
      Returns:
      the display name
    • getImplementation

      public Class<? extends CommandLineUtility> getImplementation()
      Returns the class implementing this command.
      Returns:
      the class
    • isVisible

      public boolean isVisible()
      Returns true if this command is visible to users; false otherwise.
      Returns:
      true if this command is visible to users; false otherwise
    • of

      public static Command of(Class<? extends CommandLineUtility> implementation)
      Creates a command with the given implementation. The command name is derived from the class name.
      Parameters:
      implementation - the command implementation
      Returns:
      the command
    • of

      public static Command of(String name, Class<? extends CommandLineUtility> implementation)
      Creates a command with the given name and implementation.
      Parameters:
      name - the name of the command
      implementation - the command implementation
      Returns:
      the command
    • hidden

      public static Command hidden(Class<? extends CommandLineUtility> implementation)
      Creates a hidden command with the given implementation. The command name is derived from the class name. Hidden commands are not displayed in help messages but can still be invoked.
      Parameters:
      implementation - the command implementation
      Returns:
      the command
    • hidden

      public static Command hidden(String name, Class<? extends CommandLineUtility> implementation)
      Creates a hidden command with the given name and implementation. Hidden commands are not displayed in help messages but can still be invoked.
      Parameters:
      name - the name of the command
      implementation - the command implementation
      Returns:
      the command