class OptionAccessor
extends Object
Provides typed and dynamic access to values produced by CliBuilder.parse.
| Type | Name and description |
|---|---|
CommandLine.ParseResult |
parseResultThe underlying picocli parse result. |
Map<String, TypedOption> |
savedTypeOptionsType metadata for options declared by the originating CliBuilder. |
| Constructor and description |
|---|
OptionAccessor(CommandLine.ParseResult parseResult)Creates an accessor for the specified parse result. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
List<String> |
arguments()Returns the remaining positional arguments. |
<T> |
T |
defaultValue(String name)Returns the converted default value for a named option. |
<T> |
T |
getAt(TypedOption<T> typedOption)Returns the value of the specified typed option using subscript syntax. |
<T> |
T |
getAt(TypedOption<T> typedOption, T defaultValue)Returns the value of the specified typed option using subscript syntax. |
|
Properties |
getOptionProperties(String name)Returns properties collected for a map-style option. |
<T> |
T |
getOptionValue(TypedOption<T> typedOption)Returns the value of the specified typed option. |
<T> |
T |
getOptionValue(TypedOption<T> typedOption, T defaultValue)Returns the value of the specified typed option. |
|
Object |
getProperty(String name)Resolves dynamic property lookups to parsed option values, defaults, or multi-value views. |
|
boolean |
hasOption(TypedOption typedOption)Checks whether the specified typed option was matched. |
|
Object |
invokeMethod(String name, Object args)Provides limited Apache Commons CLI compatibility by delegating selected method calls to the underlying parse result. |
The underlying picocli parse result.
Type metadata for options declared by the originating CliBuilder.
Creates an accessor for the specified parse result.
parseResult - the parsed command line stateReturns the remaining positional arguments.
Returns the converted default value for a named option.
name - the option name used to register the option metadatanull if none was declaredReturns the value of the specified typed option using subscript syntax.
typedOption - the option to inspectnull if none is availableReturns the value of the specified typed option using subscript syntax.
typedOption - the option to inspectdefaultValue - the fallback value to use when the option has no valueReturns properties collected for a map-style option.
name - the option namenull if the option was not matchedReturns the value of the specified typed option.
typedOption - the option to inspectnull if none is availableReturns the value of the specified typed option.
typedOption - the option to inspectdefaultValue - the fallback value to use when the option has no valueResolves dynamic property lookups to parsed option values, defaults, or multi-value views.
name - the property name to resolvefalse when no matching option existsChecks whether the specified typed option was matched.
typedOption - the option to inspecttrue if the option was supplied on the command lineCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.