Class CommandLine


  • public class CommandLine
    extends java.lang.Object
    The command line argument parser.
    • Constructor Summary

      Constructors 
      Constructor Description
      CommandLine​(Argument[] arguments)
      Constructs the command line parser for the given list of possible arguments, their types, etc.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Iterable<Argument> getMandatoryArguments()
      Returns a list of all expected mandatory arguments.
      java.lang.Iterable<Argument> getOptionalArguments()
      Returns a list of all possible optional arguments.
      java.util.Map<Setting,​java.lang.String> parse​(java.lang.String[] arguments)
      Parses the given argument list.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommandLine

        public CommandLine​(Argument[] arguments)
        Constructs the command line parser for the given list of possible arguments, their types, etc.
        Parameters:
        arguments - the argument specification
    • Method Detail

      • parse

        public java.util.Map<Setting,​java.lang.String> parse​(java.lang.String[] arguments)
                                                            throws CommandLineException
        Parses the given argument list.
        Parameters:
        arguments - the argument list, as obtained from the main() method
        Returns:
        the configuration object (a set of key-value pairs)
        Throws:
        CommandLineException - when the arguments are invalid
      • getMandatoryArguments

        public java.lang.Iterable<Argument> getMandatoryArguments()
        Returns a list of all expected mandatory arguments.
        Returns:
        the iterable list
      • getOptionalArguments

        public java.lang.Iterable<Argument> getOptionalArguments()
        Returns a list of all possible optional arguments.
        Returns:
        the iterable list