public class WriteableCommandLineImpl extends CommandLineImpl implements WriteableCommandLine
Constructor and Description |
---|
WriteableCommandLineImpl(Option rootOption,
List arguments)
Creates a new WriteableCommandLineImpl rooted on the specified Option, to
hold the parsed arguments.
|
Modifier and Type | Method and Description |
---|---|
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 |
getNormalised() |
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 the default property option
|
Set |
getProperties(Option option)
Retrieves the set of all property names associated with this option
|
String |
getProperty(Option option,
String property,
String defaultValue)
Retrieves the value associated with the specified property
|
String |
getProperty(String property)
Retrieves the value associated with the specified property for the default property set
|
Boolean |
getSwitch(Option option,
Boolean defaultValue)
Retrieves the Boolean value associated with the specified Switch
|
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.
|
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.
|
boolean |
looksLikeOption(String trigger)
Tests whether the passed in trigger looks like an option.
|
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 defaults)
Sets the default values for an Option in the CommandLine
|
String |
toString() |
getOptionCount, getOptionCount, getProperty, getSwitch, getSwitch, getSwitch, getValue, getValue, getValue, getValue, getValues, getValues, getValues, hasOption
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getOptionCount, getOptionCount, getProperty, getSwitch, getSwitch, getSwitch, getValue, getValue, getValue, getValue, getValues, getValues, getValues, hasOption
public WriteableCommandLineImpl(Option rootOption, List arguments)
rootOption
- the CommandLine's root Optionarguments
- the arguments this CommandLine representspublic Option getCurrentOption()
WriteableCommandLine
getCurrentOption
in interface WriteableCommandLine
public void setCurrentOption(Option currentOption)
WriteableCommandLine
setCurrentOption
in interface WriteableCommandLine
currentOption
- the new current optionpublic void addOption(Option option)
WriteableCommandLine
addOption
in interface WriteableCommandLine
option
- the Option to addpublic void addValue(Option option, 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 forpublic Option getOption(String trigger)
CommandLine
getOption
in interface CommandLine
trigger
- the name of the option to retrievepublic List getValues(Option option, List defaultValues)
CommandLine
getValues
in interface CommandLine
option
- the Option associated with the valuesdefaultValues
- the result to return if no values are foundpublic List getUndefaultedValues(Option option)
WriteableCommandLine
getUndefaultedValues
in interface WriteableCommandLine
option
- the Option associated with the valuespublic Boolean getSwitch(Option option, Boolean defaultValue)
CommandLine
getSwitch
in interface CommandLine
option
- the Option associated with the valuedefaultValue
- the Boolean to use if none matchpublic String getProperty(String property)
CommandLine
getProperty
in interface CommandLine
property
- the property name to lookuppublic void addProperty(Option option, String property, String value)
WriteableCommandLine
addProperty
in interface WriteableCommandLine
option
- the Option to add toproperty
- the name of the propertyvalue
- the value of the propertypublic void addProperty(String property, String value)
WriteableCommandLine
addProperty
in interface WriteableCommandLine
property
- the name of the propertyvalue
- the value of the propertypublic String getProperty(Option option, String property, String defaultValue)
CommandLine
getProperty
in interface CommandLine
option
- the option i.e., -Dproperty
- the property name to lookupdefaultValue
- the value to use if no other is foundpublic Set getProperties(Option option)
CommandLine
getProperties
in interface CommandLine
option
- the option i.e., -Dpublic Set getProperties()
CommandLine
getProperties
in interface CommandLine
public boolean looksLikeOption(String trigger)
looksLikeOption
in interface WriteableCommandLine
trigger
- the command line element to testpublic List getOptions()
CommandLine
getOptions
in interface CommandLine
public Set getOptionTriggers()
CommandLine
getOptionTriggers
in interface CommandLine
public void setDefaultValues(Option option, List defaults)
WriteableCommandLine
setDefaultValues
in interface WriteableCommandLine
option
- the Option to add todefaults
- the defaults for the optionpublic void setDefaultSwitch(Option option, Boolean defaultSwitch)
WriteableCommandLine
setDefaultSwitch
in interface WriteableCommandLine
option
- the Option to add todefaultSwitch
- the defaults state for ths switchpublic List getNormalised()
Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.