|
||||||||||
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.
Field Summary | |
---|---|
private java.util.Map |
defaultSwitches
|
private java.util.Map |
defaultValues
|
private java.util.Map |
nameToOption
|
private java.util.List |
normalised
|
private java.util.List |
options
|
private java.util.Set |
prefixes
|
private java.util.Properties |
properties
|
private java.util.Map |
switches
|
private java.util.Map |
values
|
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)
Adds an Option to the CommandLine |
void |
addProperty(java.lang.String property,
java.lang.String value)
Adds a property value to a name in the CommandLine. |
void |
addSwitch(Option option,
boolean value)
Adds a switch value to an Option in the CommandLine. |
void |
addValue(Option option,
java.lang.Object value)
Adds a value to an Option in the CommandLine. |
java.util.List |
getNormalised()
|
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)
Detects whether the argument looks like an Option trigger |
void |
setDefaultSwitch(Option option,
java.lang.Boolean defaultSwitch)
Sets the default state for a Switch in the CommandLine. |
void |
setDefaultValues(Option option,
java.util.List defaults)
Sets the default values for an Option in the CommandLine |
java.lang.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 |
Field Detail |
---|
private final java.util.Properties properties
private final java.util.List options
private final java.util.Map nameToOption
private final java.util.Map values
private final java.util.Map switches
private final java.util.Map defaultValues
private final java.util.Map defaultSwitches
private final java.util.List normalised
private final java.util.Set prefixes
Constructor Detail |
---|
public WriteableCommandLineImpl(Option rootOption, java.util.List arguments)
rootOption
- the CommandLine's root Optionarguments
- the arguments this CommandLine representsMethod Detail |
---|
public void addOption(Option option)
WriteableCommandLine
addOption
in interface WriteableCommandLine
option
- the Option to addpublic void addValue(Option option, java.lang.Object value)
WriteableCommandLine
addValue
in interface WriteableCommandLine
option
- the Option to add tovalue
- the value to addpublic void addSwitch(Option option, boolean value)
WriteableCommandLine
addSwitch
in interface WriteableCommandLine
option
- the Option to add tovalue
- the switch value to addpublic boolean hasOption(Option option)
CommandLine
hasOption
in interface CommandLine
option
- the Option to search for
public Option getOption(java.lang.String trigger)
CommandLine
getOption
in interface CommandLine
trigger
- the name of the option to retrieve
public java.util.List getValues(Option option, java.util.List defaultValues)
CommandLine
getValues
in interface CommandLine
option
- 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)
CommandLine
getSwitch
in interface CommandLine
option
- the Option associated with the valuedefaultValue
- the Boolean to use if none match
public void addProperty(java.lang.String property, java.lang.String value)
WriteableCommandLine
addProperty
in interface WriteableCommandLine
property
- the name of the propertyvalue
- the value of the propertypublic java.lang.String getProperty(java.lang.String property, java.lang.String defaultValue)
CommandLine
getProperty
in interface CommandLine
property
- the property name to lookupdefaultValue
- the value to use if no other is found
public java.util.Set getProperties()
CommandLine
getProperties
in interface CommandLine
public boolean looksLikeOption(java.lang.String trigger)
WriteableCommandLine
looksLikeOption
in interface WriteableCommandLine
trigger
- the argument to test
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.List getOptions()
CommandLine
getOptions
in interface CommandLine
public java.util.Set getOptionTriggers()
CommandLine
getOptionTriggers
in interface CommandLine
public void setDefaultValues(Option option, java.util.List defaults)
WriteableCommandLine
setDefaultValues
in interface WriteableCommandLine
option
- the Option to add todefaults
- the defaults for the optionpublic void setDefaultSwitch(Option option, java.lang.Boolean defaultSwitch)
WriteableCommandLine
setDefaultSwitch
in interface WriteableCommandLine
option
- the Option to add todefaultSwitch
- the defaults state for ths switchpublic java.util.List getNormalised()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |