net.dpml.cli.commandline
Class WriteableCommandLineImpl
- CommandLine, WriteableCommandLine
A WriteableCommandLine implementation allowing Options to write their
processed information to a CommandLine.
WriteableCommandLineImpl(Option rootOption, List arguments) - Creates a new WriteableCommandLineImpl rooted on the specified Option, to
hold the parsed arguments.
|
void | addOption(Option option) - Add an option.
|
void | addProperty(String property, String value) - Add a property to the commandline.
|
void | addSwitch(Option option, boolean value) - Add a switch.
|
void | addValue(Option option, Object value) - Add an option.
|
List | getNormalised() - Return the normalized collection.
|
Option | getOption(String trigger) - Finds the Option with the specified trigger
|
Set | getOptionTriggers() - Retrieves a list of all Option triggers found in this CommandLine
|
List | getOptions() - Retrieves a list of all Options found in this CommandLine
|
Set | getProperties() - Retrieves the set of all property names associated with this CommandLine
|
String | getProperty(String property, String defaultValue) - Retrieves the value associated with the specified property
|
Boolean | getSwitch(Option option, Boolean defaultValue) - Retrieves the Boolean value associated with the specified Switch
|
List | getValues(Option option, List defaultValues) - Retrieves the Argument values associated with the specified Option
|
boolean | hasOption(Option option) - Detects the presence of an option in this CommandLine.
|
boolean | looksLikeOption(String trigger) - Return true if the trigger argument looks like an option.
|
void | setDefaultSwitch(Option option, Boolean defaultSwitch) - Set default switch.
|
void | setDefaultValues(Option option, List defaults) - Set default values.
|
String | toString() - Return this commandline as a string.
|
getOptionCount , getOptionCount , getProperty , getSwitch , getSwitch , getSwitch , getValue , getValue , getValue , getValue , getValues , getValues , getValues , hasOption |
WriteableCommandLineImpl
public WriteableCommandLineImpl(Option rootOption,
List arguments)
Creates a new WriteableCommandLineImpl rooted on the specified Option, to
hold the parsed arguments.
rootOption
- the CommandLine's root Optionarguments
- the arguments this CommandLine represents
getNormalised
public List getNormalised()
Return the normalized collection.
- the moprmalized collection
getOption
public Option getOption(String trigger)
Finds the Option with the specified trigger
- getOption in interface CommandLine
trigger
- the name of the option to retrieve
- the Option matching the trigger or null if none exists
getOptions
public List getOptions()
Retrieves a list of all Options found in this CommandLine
- getOptions in interface CommandLine
- a none null list of Options
getProperty
public String getProperty(String property,
String defaultValue)
Retrieves the value associated with the specified property
- getProperty in interface CommandLine
property
- the property name to lookupdefaultValue
- the value to use if no other is found
- the value of the property or defaultValue
getSwitch
public Boolean getSwitch(Option option,
Boolean defaultValue)
Retrieves the Boolean value associated with the specified Switch
- getSwitch in interface CommandLine
option
- the Option associated with the valuedefaultValue
- the Boolean to use if none match
- the Boolean associated with option or defaultValue if none exists
getValues
public List getValues(Option option,
List defaultValues)
Retrieves the Argument values associated with the specified Option
- getValues in interface CommandLine
option
- the Option associated with the valuesdefaultValues
- the result to return if no values are found
- a list of values or defaultValues if none are found
hasOption
public boolean hasOption(Option option)
Detects the presence of an option in this CommandLine.
- hasOption in interface CommandLine
option
- the Option to search for
- true iff the option is present
toString
public String toString()
Return this commandline as a string.
- the string representation