Instances of CommandLine represent a command line that has been processed
according to the definition supplied to the parser.
getOption
public Option getOption(String trigger)
Finds the Option with the specified trigger
trigger
- the name of the option to retrieve
- the Option matching the trigger or null if none exists
getOptionCount
public int getOptionCount(String trigger)
Retrieves the number of times the specified Option appeared in this
CommandLine
trigger
- a trigger used to lookup the Option
- the number of occurrences of the option
getOptionCount
public int getOptionCount(Option option)
Retrieves the number of times the specified Option appeared in this
CommandLine
option
- the Option associated to check
- the number of occurrences of the option
getOptionTriggers
public Set getOptionTriggers()
Retrieves a list of all Option triggers found in this CommandLine
- a none null list of Option triggers
getOptions
public List getOptions()
Retrieves a list of all Options found in this CommandLine
- a none null list of Options
getProperties
public Set getProperties()
Retrieves the set of all property names associated with this CommandLine
- a none null set of property names
getProperty
public String getProperty(String property)
Retrieves the value associated with the specified property
property
- the property name to lookup
- the value of the property or null
getProperty
public String getProperty(String property,
String defaultValue)
Retrieves the value associated with the specified property
property
- the property name to lookupdefaultValue
- the value to use if no other is found
- the value of the property or defaultValue
getSwitch
public Boolean getSwitch(String trigger)
Retrieves the Boolean value associated with the specified Switch
trigger
- a trigger used to lookup the Option
- the Boolean associated with trigger or null if none exists
getSwitch
public Boolean getSwitch(String trigger,
Boolean defaultValue)
Retrieves the Boolean value associated with the specified Switch
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 Boolean getSwitch(Option option)
Retrieves the Boolean value associated with the specified Switch
option
- the Option associated with the value
- the Boolean associated with option or null if none exists
getSwitch
public Boolean getSwitch(Option option,
Boolean defaultValue)
Retrieves the Boolean value associated with the specified Switch
option
- the Option associated with the valuedefaultValue
- the Boolean to use if none match
- the Boolean associated with option or defaultValue if none exists
getValue
public Object getValue(String trigger)
throws IllegalStateException
Retrieves the single Argument value associated with the specified Option
trigger
- a trigger used to lookup the Option
- the matching value or null if none exists
getValue
public Object getValue(String trigger,
Object defaultValue)
throws IllegalStateException
Retrieves the single Argument value associated with the specified Option
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 Object getValue(Option option)
throws IllegalStateException
Retrieves the single Argument value associated with the specified Option
option
- the Option associated with the value
- the matching value or null if none exists
getValue
public Object getValue(Option option,
Object defaultValue)
throws IllegalStateException
Retrieves the single Argument value associated with the specified Option
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 List getValues(String trigger)
Retrieves the Argument values associated with the specified Option
trigger
- a trigger used to lookup the Option
- a list of values or an empty List if none are found
getValues
public List getValues(String trigger,
List defaultValues)
Retrieves the Argument values associated with the specified Option
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 List getValues(Option option)
Retrieves the Argument values associated with the specified Option
option
- the Option associated with the values
- a list of values or an empty List if none are found
getValues
public List getValues(Option option,
List defaultValues)
Retrieves the Argument values associated with the specified Option
option
- the Option associated with the valuesdefaultValues
- the result to return if no values are found
- a list of values or defaultValues if none are found
hasOption
public boolean hasOption(String trigger)
Detects the presence of an option with the specified trigger in this
CommandLine.
trigger
- the trigger to search for
- true iff an option with this trigger is present
hasOption
public boolean hasOption(Option option)
Detects the presence of an option in this CommandLine.
option
- the Option to search for
- true iff the option is present