Class PromptCommand

java.lang.Object
it.polimi.ingsw.am13.PromptCommand

public class PromptCommand extends Object
Representation of a command accepted from the command line
  • Field Details

    • command

      private final String command
      Command key from the command line (comprehensive of the '--')
    • description

      private final String description
      Short description of the command
    • parameterList

      private final List<String> parameterList
      List of parameters needed, in form of text. The list can be used to check how many parameters must be present for this command (optional parameters are not supported)
    • action

      private final Consumer<List<String>> action
      Action corresponding to the command. The argument is the possible list of arguments for that command
  • Constructor Details

  • Method Details

    • getCommand

      public String getCommand()
      Returns:
      Command key from the command line (comprehensive of the '--')
    • getParameterList

      public List<String> getParameterList()
      Returns:
      List of parameters needed, in form of text. The list can be used to check how many parameters must be present for this command
    • executeAction

      public void executeAction(List<String> args) throws IllegalArgumentException
      Throws:
      IllegalArgumentException
    • generateHelpString

      public String generateHelpString()
      Returns:
      A formatted string representing the command