Class ParsedCommand


  • public class ParsedCommand
    extends Object
    This class divides the command line into the command with arguments. If pipeline is found in the command line, it will re-organize it so that the command before the pipe line will be placed after the command behind the pipe line.

    • Constructor Detail

      • ParsedCommand

        public ParsedCommand​(String command,
                             String[] arguments)
        To construct an object.

        Parameters:
        command - The command without arguments.
        arguments - The arguments to the command.
    • Method Detail

      • parse

        public static ParsedCommand parse​(String commandLine)
        This is a convenient method to parse a command line.

        Parameters:
        commandLine - The command line. Can contain pipe lines.

        Returns:
        An initialized ParsedCommand object.
      • getCommand

        public String getCommand()
        To get the command without arguments.

        Returns:
        the command without arguments.
      • setCommand

        public void setCommand​(String command)
        To set the command.

        Parameters:
        command - The command to be set.
      • getArguments

        public String[] getArguments()
        To get the arguments.

        Returns:
        the arguments.
      • setArguments

        public void setArguments​(String[] arguments)
        To set the arguments.

        Parameters:
        arguments - The arguments to be set.
      • getCombinedCommandLine

        public String getCombinedCommandLine()
        To get the command line combined from its command and arguments, using spaces to separate tokens.

        Returns:
        the combined command line.