org.apache.commons.cli2
Interface WriteableCommandLine

All Superinterfaces:
CommandLine
All Known Implementing Classes:
WriteableCommandLineImpl

public interface WriteableCommandLine
extends CommandLine

A CommandLine that detected values and options can be written to.


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 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.
 boolean looksLikeOption(String argument)
          Detects whether the argument looks like an Option trigger
 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 defaultValues)
          Sets the default values for an Option in the CommandLine
 
Methods inherited from interface org.apache.commons.cli2.CommandLine
getOption, getOptionCount, getOptionCount, getOptions, getOptionTriggers, getProperties, getProperties, getProperty, getProperty, getProperty, getSwitch, getSwitch, getSwitch, getSwitch, getValue, getValue, getValue, getValue, getValues, getValues, getValues, getValues, hasOption, hasOption
 

Method Detail

addOption

void addOption(Option option)
Adds an Option to the CommandLine

Parameters:
option - the Option to add

addValue

void addValue(Option option,
              Object value)
Adds a value to an Option in the CommandLine.

Parameters:
option - the Option to add to
value - the value to add

getUndefaultedValues

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.

Parameters:
option - the Option associated with the values
Returns:
a list of values or an empty List if none are found

setDefaultValues

void setDefaultValues(Option option,
                      List defaultValues)
Sets the default values for an Option in the CommandLine

Parameters:
option - the Option to add to
defaultValues - the defaults for the option

addSwitch

void addSwitch(Option option,
               boolean value)
               throws IllegalStateException
Adds a switch value to an Option in the CommandLine.

Parameters:
option - the Option to add to
value - the switch value to add
Throws:
IllegalStateException - if the switch has already been added

setDefaultSwitch

void setDefaultSwitch(Option option,
                      Boolean defaultSwitch)
Sets the default state for a Switch in the CommandLine.

Parameters:
option - the Option to add to
defaultSwitch - the defaults state for ths switch

addProperty

void addProperty(Option option,
                 String property,
                 String value)
Adds a property value to a name in the CommandLine. Replaces any existing value for the property.

Parameters:
option - the Option to add to
property - the name of the property
value - the value of the property

addProperty

void addProperty(String property,
                 String value)
Adds a property value to the default property set. Replaces any existing value for the property.

Parameters:
property - the name of the property
value - the value of the property

looksLikeOption

boolean looksLikeOption(String argument)
Detects whether the argument looks like an Option trigger

Parameters:
argument - the argument to test
Returns:
true if the argument looks like an Option trigger

getCurrentOption

Option getCurrentOption()
Returns the option that is currently processed.

Returns:
the current option

setCurrentOption

void setCurrentOption(Option currentOption)
Sets the current option. This method is called by concrete option implementations during command line processing. It enables the command line to keep track about the option that is currently processed.

Parameters:
currentOption - the new current option


Copyright © 2002-2011 Apache Software Foundation. All Rights Reserved.