|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.cli2.commandline.CommandLineImpl
org.apache.commons.cli2.commandline.WriteableCommandLineImpl
public class 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)
Adds an Option to the CommandLine |
void |
addProperty(Option option,
String property,
String value)
Adds a property value to a name in the CommandLine. |
void |
addProperty(String property,
String value)
Adds a property value to the default property set. |
void |
addSwitch(Option option,
boolean value)
Adds a switch value to an Option in the CommandLine. |
void |
addValue(Option option,
Object value)
Adds a value to an Option in the CommandLine. |
Option |
getCurrentOption()
Returns the option that is currently processed. |
List |
getNormalised()
|
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 the default property option |
Set |
getProperties(Option option)
Retrieves the set of all property names associated with this option |
String |
getProperty(Option option,
String property,
String defaultValue)
Retrieves the value associated with the specified property |
String |
getProperty(String property)
Retrieves the value associated with the specified property for the default property set |
Boolean |
getSwitch(Option option,
Boolean defaultValue)
Retrieves the Boolean value associated with the specified Switch |
List |
getUndefaultedValues(Option option)
Retrieves the Argument values specified on the command line for the specified Option, this doesn't return any values supplied programmatically as defaults. |
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)
Tests whether the passed in trigger looks like an option. |
void |
setCurrentOption(Option currentOption)
Sets the current option. |
void |
setDefaultSwitch(Option option,
Boolean defaultSwitch)
Sets the default state for a Switch in the CommandLine. |
void |
setDefaultValues(Option option,
List defaults)
Sets the default values for an Option in the CommandLine |
String |
toString()
|
| Methods inherited from class org.apache.commons.cli2.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 org.apache.commons.cli2.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 represents| Method Detail |
|---|
public Option getCurrentOption()
WriteableCommandLine
getCurrentOption in interface WriteableCommandLinepublic void setCurrentOption(Option currentOption)
WriteableCommandLine
setCurrentOption in interface WriteableCommandLinecurrentOption - the new current optionpublic void addOption(Option option)
WriteableCommandLine
addOption in interface WriteableCommandLineoption - the Option to add
public void addValue(Option option,
Object value)
WriteableCommandLine
addValue in interface WriteableCommandLineoption - the Option to add tovalue - the value to add
public void addSwitch(Option option,
boolean value)
WriteableCommandLine
addSwitch in interface WriteableCommandLineoption - the Option to add tovalue - the switch value to addpublic boolean hasOption(Option option)
CommandLine
hasOption in interface CommandLineoption - the Option to search for
public Option getOption(String trigger)
CommandLine
getOption in interface CommandLinetrigger - the name of the option to retrieve
public List getValues(Option option,
List defaultValues)
CommandLine
getValues in interface CommandLineoption - the Option associated with the valuesdefaultValues - the result to return if no values are found
public List getUndefaultedValues(Option option)
WriteableCommandLine
getUndefaultedValues in interface WriteableCommandLineoption - the Option associated with the values
public Boolean getSwitch(Option option,
Boolean defaultValue)
CommandLine
getSwitch in interface CommandLineoption - the Option associated with the valuedefaultValue - the Boolean to use if none match
public String getProperty(String property)
CommandLine
getProperty in interface CommandLineproperty - the property name to lookup
public void addProperty(Option option,
String property,
String value)
WriteableCommandLine
addProperty in interface WriteableCommandLineoption - the Option to add toproperty - the name of the propertyvalue - the value of the property
public void addProperty(String property,
String value)
WriteableCommandLine
addProperty in interface WriteableCommandLineproperty - the name of the propertyvalue - the value of the property
public String getProperty(Option option,
String property,
String defaultValue)
CommandLine
getProperty in interface CommandLineoption - the option i.e., -Dproperty - the property name to lookupdefaultValue - the value to use if no other is found
public Set getProperties(Option option)
CommandLine
getProperties in interface CommandLineoption - the option i.e., -D
public Set getProperties()
CommandLine
getProperties in interface CommandLinepublic boolean looksLikeOption(String trigger)
looksLikeOption in interface WriteableCommandLinetrigger - the command line element to test
public String toString()
toString in class Objectpublic List getOptions()
CommandLine
getOptions in interface CommandLinepublic Set getOptionTriggers()
CommandLine
getOptionTriggers in interface CommandLine
public void setDefaultValues(Option option,
List defaults)
WriteableCommandLine
setDefaultValues in interface WriteableCommandLineoption - the Option to add todefaults - the defaults for the option
public void setDefaultSwitch(Option option,
Boolean defaultSwitch)
WriteableCommandLine
setDefaultSwitch in interface WriteableCommandLineoption - the Option to add todefaultSwitch - the defaults state for ths switchpublic List getNormalised()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||