|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.dpml.cli.commandline.CommandLineImpl net.dpml.cli.commandline.WriteableCommandLineImpl
A WriteableCommandLine implementation allowing Options to write their processed information to a CommandLine.
Constructor Summary | |
WriteableCommandLineImpl(Option rootOption,
List arguments)
Creates a new WriteableCommandLineImpl rooted on the specified Option, to hold the parsed arguments. |
Method Summary | |
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 |
List |
getOptions()
Retrieves a list of all Options found in this CommandLine |
Set |
getOptionTriggers()
Retrieves a list of all Option triggers 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. |
Methods inherited from class net.dpml.cli.commandline.CommandLineImpl |
getOptionCount, getOptionCount, getProperty, getSwitch, getSwitch, getSwitch, getValue, getValue, getValue, getValue, getValues, getValues, getValues, hasOption |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.dpml.cli.CommandLine |
getOptionCount, getOptionCount, getProperty, getSwitch, getSwitch, getSwitch, getValue, getValue, getValue, getValue, getValues, getValues, getValues, hasOption |
Constructor Detail |
public WriteableCommandLineImpl(Option rootOption, List arguments)
rootOption
- the CommandLine's root Optionarguments
- the arguments this CommandLine representsMethod Detail |
public void addOption(Option option)
addOption
in interface WriteableCommandLine
option
- the option to addpublic void addValue(Option option, Object value)
addValue
in interface WriteableCommandLine
option
- the option to addvalue
- the option valuepublic void addSwitch(Option option, boolean value)
addSwitch
in interface WriteableCommandLine
option
- the option to addvalue
- the option valuepublic boolean hasOption(Option option)
hasOption
in interface CommandLine
option
- the Option to search for
public Option getOption(String trigger)
getOption
in interface CommandLine
trigger
- the name of the option to retrieve
public List getValues(Option option, List defaultValues)
getValues
in interface CommandLine
option
- the Option associated with the valuesdefaultValues
- the result to return if no values are found
public Boolean getSwitch(Option option, Boolean defaultValue)
getSwitch
in interface CommandLine
option
- the Option associated with the valuedefaultValue
- the Boolean to use if none match
public void addProperty(String property, String value)
addProperty
in interface WriteableCommandLine
property
- the property namevalue
- the property valuepublic String getProperty(String property, String defaultValue)
getProperty
in interface CommandLine
property
- the property name to lookupdefaultValue
- the value to use if no other is found
public Set getProperties()
getProperties
in interface CommandLine
public boolean looksLikeOption(String trigger)
looksLikeOption
in interface WriteableCommandLine
trigger
- the trigger to evaluate
public String toString()
public List getOptions()
getOptions
in interface CommandLine
public Set getOptionTriggers()
getOptionTriggers
in interface CommandLine
public void setDefaultValues(Option option, List defaults)
setDefaultValues
in interface WriteableCommandLine
option
- the optiondefaults
- a list of defaultspublic void setDefaultSwitch(Option option, Boolean defaultSwitch)
setDefaultSwitch
in interface WriteableCommandLine
option
- the optiondefaultSwitch
- the default switch statepublic List getNormalised()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |