class OptionAccessor
extends Object
Provides typed access to parsed command line options.
| Type | Name and description |
|---|---|
CommandLine.ParseResult |
parseResultThe underlying parse result. |
Map<String, TypedOption> |
savedTypeOptionsTyped option metadata keyed by option name. |
| Constructor and description |
|---|
OptionAccessor(CommandLine.ParseResult parseResult)Creates an accessor backed by the specified parse result. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
List<String> |
arguments()Returns the unmatched positional arguments. |
<T> |
T |
defaultValue(String name)Returns the typed default value for the named option. |
<T> |
T |
getAt(TypedOption<T> typedOption)Returns the value of the specified typed option using subscript notation semantics. |
<T> |
T |
getAt(TypedOption<T> typedOption, T defaultValue)Returns the value of the specified typed option using subscript notation semantics. |
|
Properties |
getOptionProperties(String name)Returns key/value pairs for the named option as Properties. |
<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, falling back to the supplied default. |
|
Object |
getProperty(String name)Resolves dynamic property access against matched or defaulted options. |
|
boolean |
hasOption(TypedOption typedOption)Checks whether the specified option was matched. |
|
Object |
invokeMethod(String name, Object args)Delegates selected dynamic method calls to the underlying parse result. |
The underlying parse result.
Typed option metadata keyed by option name.
Creates an accessor backed by the specified parse result.
parseResult - the parse result to wrapReturns the unmatched positional arguments.
Returns the typed default value for the named option.
name - the option namenull if none existsReturns the value of the specified typed option using subscript notation semantics.
typedOption - the option to retrievenull if not matchedReturns the value of the specified typed option using subscript notation semantics.
typedOption - the option to retrievedefaultValue - the fallback valueReturns key/value pairs for the named option as Properties.
name - the option namenull if the option was not matchedReturns the value of the specified typed option.
typedOption - the option to retrievenull if not matchedReturns the value of the specified typed option, falling back to the supplied default.
typedOption - the option to retrievedefaultValue - the fallback valueResolves dynamic property access against matched or defaulted options.
name - the property namefalse if unavailableChecks whether the specified option was matched.
typedOption - the option to checktrue if the option was matchedCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.