class OptionAccessor
extends Object
Provides typed and dynamic access to parsed command-line options.
| Type | Name and description |
|---|---|
CommandLine |
commandLineThe parsed command line. |
Map<String, TypedOption> |
savedTypeOptionsTyped option metadata keyed by long name or short name. |
| Constructor and description |
|---|
OptionAccessor(CommandLine commandLine)Creates an accessor for the supplied parsed command line. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
List<String> |
arguments()Returns the remaining non-option arguments. |
<T> |
T |
defaultValue(String name)Returns the converted default value for the named option. |
<T> |
T |
getAt(TypedOption<T> typedOption)Returns the typed value for the supplied option using subscript syntax. |
<T> |
T |
getAt(TypedOption<T> typedOption, T defaultValue)Returns the typed value for the supplied option using subscript syntax, falling back to the given default. |
<T> |
T |
getOptionValue(TypedOption<T> typedOption)Returns the typed value for the supplied option. |
<T> |
T |
getOptionValue(TypedOption<T> typedOption, T defaultValue)Returns the typed value for the supplied option, falling back to the given default. |
|
Object |
getProperty(String name)Supports property-style access to option values and flags. |
|
boolean |
hasOption(TypedOption typedOption)Checks whether the supplied typed option was specified. |
|
Object |
invokeMethod(String name, Object args)Delegates unknown method calls to the underlying CommandLine. |
The parsed command line.
Typed option metadata keyed by long name or short name.
Creates an accessor for the supplied parsed command line.
commandLine - the parsed command lineReturns the remaining non-option arguments.
Returns the converted default value for the named option.
name - the option namenull if none is definedReturns the typed value for the supplied option using subscript syntax.
typedOption - the option metadatanull if the option is absentReturns the typed value for the supplied option using subscript syntax, falling back to the given default.
typedOption - the option metadatadefaultValue - the value to return when the option is absentdefaultValueReturns the typed value for the supplied option.
typedOption - the option metadatanull if the option is absentReturns the typed value for the supplied option, falling back to the given default.
typedOption - the option metadatadefaultValue - the value to return when the option is absentdefaultValueSupports property-style access to option values and flags.
name - the property nameChecks whether the supplied typed option was specified.
typedOption - the option metadatatrue if the option is presentCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.