Package picocli

Class CommandLine.NullParameterConsumer

java.lang.Object
picocli.CommandLine.NullParameterConsumer
All Implemented Interfaces:
CommandLine.IParameterConsumer
Enclosing class:
CommandLine

private static class CommandLine.NullParameterConsumer extends Object implements CommandLine.IParameterConsumer
  • Constructor Details

    • NullParameterConsumer

      private NullParameterConsumer()
  • Method Details

    • consumeParameters

      public void consumeParameters(Stack<String> args, CommandLine.Model.ArgSpec argSpec, CommandLine.Model.CommandSpec commandSpec)
      Description copied from interface: CommandLine.IParameterConsumer
      Consumes as many of the specified command line arguments as needed by popping them off the specified Stack. Implementors are free to ignore the arity of the option or positional parameter, they are free to consume arguments that would normally be matched as other options of the command, and they are free to consume arguments that would normally be matched as an end-of-options delimiter.

      Implementors are responsible for saving the consumed values; if the user object of the option or positional parameter is a Collection or a Map, a common approach would be to obtain the current instance via the CommandLine.Model.ArgSpec.getValue(), and add to this instance. If the user object is an array, the implementation would need to create a new array that contains the old values as well as the newly consumed values, and store this array in the user object via the CommandLine.Model.ArgSpec.setValue(Object).

      If the user input is invalid, implementations should throw a CommandLine.ParameterException with a message to display to the user.

      When this method returns, the picocli parser will process the remaining arguments on the Stack.

      Specified by:
      consumeParameters in interface CommandLine.IParameterConsumer
      Parameters:
      args - the command line arguments
      argSpec - the option or positional parameter for which to consume command line arguments
      commandSpec - the command that the option or positional parameter belongs to