|
||||||||||
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.PropertiesCommandLine
public class PropertiesCommandLine
A CommandLine implementation using a java Properties instance, useful for
constructing a complex DefaultingCommandLine
Options are keyed from their property name and presence in the Properties
instance is taken as presence in the CommandLine. Argument values are taken
from the property value and are optionally separated using the separator
char, defined at construction time. Switch values can be specified using a
simple value of true
or false
; obviously this means
that Switches with Arguments are not supported by this implementation.
Properties
,
DefaultingCommandLine
,
Option.getPreferredName()
Constructor Summary | |
---|---|
PropertiesCommandLine(Option root,
Properties properties)
Creates a new PropertiesCommandLine using the specified root Option, Properties instance. |
|
PropertiesCommandLine(Option root,
Properties properties,
char separator)
Creates a new PropertiesCommandLine using the specified root Option, Properties instance and value separator. |
Method Summary | |
---|---|
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. |
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, toString, wait, wait, wait |
Constructor Detail |
---|
public PropertiesCommandLine(Option root, Properties properties)
root
- the CommandLine's root Optionproperties
- the Properties instance to get values frompublic PropertiesCommandLine(Option root, Properties properties, char separator)
root
- the CommandLine's root Optionproperties
- the Properties instance to get values fromseparator
- the character to split argument valuesMethod Detail |
---|
public boolean hasOption(Option option)
option
- the Option to search for
public Option getOption(String trigger)
trigger
- the name of the option to retrieve
public List getValues(Option option, List defaultValues)
option
- the Option associated with the valuesdefaultValues
- the result to return if no values are found
public Boolean getSwitch(Option option, Boolean defaultValue)
option
- the Option associated with the valuedefaultValue
- the Boolean to use if none match
public String getProperty(String property, String defaultValue)
property
- the property name to lookupdefaultValue
- the value to use if no other is found
public Set getProperties()
public List getOptions()
public Set getOptionTriggers()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |