net.dpml.cli.commandline
Class CommandLineImpl
java.lang.Object
net.dpml.cli.commandline.CommandLineImpl
- CommandLine
Instances of CommandLine represent a command line that has been processed
according to the definition supplied to the parser.
int | getOptionCount(String trigger) - Retrieves the number of times the specified Option appeared in this
CommandLine
|
int | getOptionCount(Option option) - Retrieves the number of times the specified Option appeared in this
CommandLine
|
String | getProperty(String property) - Retrieves the value associated with the specified property
|
Boolean | getSwitch(String trigger) - Retrieves the Boolean value associated with the specified Switch
|
Boolean | getSwitch(String trigger, Boolean defaultValue) - Retrieves the Boolean value associated with the specified Switch
|
Boolean | getSwitch(Option option) - Retrieves the Boolean value associated with the specified Switch
|
Object | getValue(String trigger) - Retrieves the single Argument value associated with the specified Option
|
Object | getValue(String trigger, Object defaultValue) - Retrieves the single Argument value associated with the specified Option
|
Object | getValue(Option option) - Retrieves the single Argument value associated with the specified Option
|
Object | getValue(Option option, Object defaultValue) - Retrieves the single Argument value associated with the specified Option
|
List | getValues(String trigger) - Retrieves the Argument values associated with the specified Option
|
List | getValues(String trigger, List defaultValues) - Retrieves the Argument values associated with the specified Option
|
List | getValues(Option option) - Retrieves the Argument values associated with the specified Option
|
boolean | hasOption(String trigger) - Detects the presence of an option with the specified trigger in this
CommandLine.
|
getOptionCount
public final int getOptionCount(String trigger)
Retrieves the number of times the specified Option appeared in this
CommandLine
- getOptionCount in interface CommandLine
trigger
- a trigger used to lookup the Option
- the number of occurrences of the option
getOptionCount
public final int getOptionCount(Option option)
Retrieves the number of times the specified Option appeared in this
CommandLine
- getOptionCount in interface CommandLine
option
- the Option associated to check
- the number of occurrences of the option
getProperty
public final String getProperty(String property)
Retrieves the value associated with the specified property
- getProperty in interface CommandLine
property
- the property name to lookup
- the value of the property or null
getSwitch
public final Boolean getSwitch(String trigger)
Retrieves the Boolean value associated with the specified Switch
- getSwitch in interface CommandLine
trigger
- a trigger used to lookup the Option
- the Boolean associated with trigger or null if none exists
getSwitch
public final Boolean getSwitch(String trigger,
Boolean defaultValue)
Retrieves the Boolean value associated with the specified Switch
- getSwitch in interface CommandLine
trigger
- a trigger used to lookup the OptiondefaultValue
- the Boolean to use if none match
- the Boolean associated with trigger or defaultValue if none exists
getSwitch
public final Boolean getSwitch(Option option)
Retrieves the Boolean value associated with the specified Switch
- getSwitch in interface CommandLine
option
- the Option associated with the value
- the Boolean associated with option or null if none exists
getValue
public final Object getValue(String trigger)
throws IllegalStateException
Retrieves the single Argument value associated with the specified Option
- getValue in interface CommandLine
trigger
- a trigger used to lookup the Option
- the matching value or null if none exists
getValue
public final Object getValue(String trigger,
Object defaultValue)
throws IllegalStateException
Retrieves the single Argument value associated with the specified Option
- getValue in interface CommandLine
trigger
- a trigger used to lookup the OptiondefaultValue
- the result to use if no values are found
- the matching value or defaultValue if none exists
getValue
public final Object getValue(Option option)
throws IllegalStateException
Retrieves the single Argument value associated with the specified Option
- getValue in interface CommandLine
option
- the Option associated with the value
- the matching value or null if none exists
getValue
public final Object getValue(Option option,
Object defaultValue)
throws IllegalStateException
Retrieves the single Argument value associated with the specified Option
- getValue in interface CommandLine
option
- the Option associated with the valuedefaultValue
- the result to use if no values are found
- the matching value or defaultValue if none exists
getValues
public final List getValues(String trigger)
Retrieves the Argument values associated with the specified Option
- getValues in interface CommandLine
trigger
- a trigger used to lookup the Option
- a list of values or an empty List if none are found
getValues
public final List getValues(String trigger,
List defaultValues)
Retrieves the Argument values associated with the specified Option
- getValues in interface CommandLine
trigger
- a trigger used to lookup the OptiondefaultValues
- the result to return if no values are found
- a list of values or defaultValues if none are found
getValues
public final List getValues(Option option)
Retrieves the Argument values associated with the specified Option
- getValues in interface CommandLine
option
- the Option associated with the values
- a list of values or an empty List if none are found
hasOption
public final boolean hasOption(String trigger)
Detects the presence of an option with the specified trigger in this
CommandLine.
- hasOption in interface CommandLine
trigger
- the trigger to search for
- true iff an option with this trigger is present