|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.dpml.cli.commandline.CommandLineImpl
net.dpml.cli.commandline.WriteableCommandLineImpl
public class WriteableCommandLineImpl
A WriteableCommandLine implementation allowing Options to write their processed information to a CommandLine.
| Constructor Summary | |
|---|---|
WriteableCommandLineImpl(Option rootOption,
java.util.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(java.lang.String property,
java.lang.String value)
Add a property to the commandline. |
void |
addSwitch(Option option,
boolean value)
Add a switch. |
void |
addValue(Option option,
java.lang.Object value)
Add an option. |
java.util.List |
getNormalised()
Return the normalized collection. |
Option |
getOption(java.lang.String trigger)
Finds the Option with the specified trigger |
java.util.List |
getOptions()
Retrieves a list of all Options found in this CommandLine |
java.util.Set |
getOptionTriggers()
Retrieves a list of all Option triggers found in this CommandLine |
java.util.Set |
getProperties()
Retrieves the set of all property names associated with this CommandLine |
java.lang.String |
getProperty(java.lang.String property,
java.lang.String defaultValue)
Retrieves the value associated with the specified property |
java.lang.Boolean |
getSwitch(Option option,
java.lang.Boolean defaultValue)
Retrieves the Boolean value associated with the specified Switch |
java.util.List |
getValues(Option option,
java.util.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(java.lang.String trigger)
Return true if the trigger argument looks like an option. |
void |
setDefaultSwitch(Option option,
java.lang.Boolean defaultSwitch)
Set default switch. |
void |
setDefaultValues(Option option,
java.util.List defaults)
Set default values. |
java.lang.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,
java.util.List arguments)
rootOption - the CommandLine's root Optionarguments - the arguments this CommandLine represents| Method Detail |
|---|
public void addOption(Option option)
addOption in interface WriteableCommandLineoption - the option to add
public void addValue(Option option,
java.lang.Object value)
addValue in interface WriteableCommandLineoption - the option to addvalue - the option value
public void addSwitch(Option option,
boolean value)
addSwitch in interface WriteableCommandLineoption - the option to addvalue - the option valuepublic boolean hasOption(Option option)
hasOption in interface CommandLineoption - the Option to search for
public Option getOption(java.lang.String trigger)
getOption in interface CommandLinetrigger - the name of the option to retrieve
public java.util.List getValues(Option option,
java.util.List defaultValues)
getValues in interface CommandLineoption - the Option associated with the valuesdefaultValues - the result to return if no values are found
public java.lang.Boolean getSwitch(Option option,
java.lang.Boolean defaultValue)
getSwitch in interface CommandLineoption - the Option associated with the valuedefaultValue - the Boolean to use if none match
public void addProperty(java.lang.String property,
java.lang.String value)
addProperty in interface WriteableCommandLineproperty - the property namevalue - the property value
public java.lang.String getProperty(java.lang.String property,
java.lang.String defaultValue)
getProperty in interface CommandLineproperty - the property name to lookupdefaultValue - the value to use if no other is found
public java.util.Set getProperties()
getProperties in interface CommandLinepublic boolean looksLikeOption(java.lang.String trigger)
looksLikeOption in interface WriteableCommandLinetrigger - the trigger to evaluate
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List getOptions()
getOptions in interface CommandLinepublic java.util.Set getOptionTriggers()
getOptionTriggers in interface CommandLine
public void setDefaultValues(Option option,
java.util.List defaults)
setDefaultValues in interface WriteableCommandLineoption - the optiondefaults - a list of defaults
public void setDefaultSwitch(Option option,
java.lang.Boolean defaultSwitch)
setDefaultSwitch in interface WriteableCommandLineoption - the optiondefaultSwitch - the default switch statepublic java.util.List getNormalised()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||