Class CommandLine.NullParameterConsumer
- All Implemented Interfaces:
CommandLine.IParameterConsumer
- Enclosing class:
CommandLine
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
consumeParameters
(Stack<String> args, CommandLine.Model.ArgSpec argSpec, CommandLine.Model.CommandSpec commandSpec) Consumes as many of the specified command line arguments as needed by popping them off the specified Stack.
-
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 theCommandLine.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 interfaceCommandLine.IParameterConsumer
- Parameters:
args
- the command line argumentsargSpec
- the option or positional parameter for which to consume command line argumentscommandSpec
- the command that the option or positional parameter belongs to
-