public interface Option
| Modifier and Type | Method and Description |
|---|---|
void |
appendUsage(java.lang.StringBuffer buffer,
java.util.Set helpSettings,
java.util.Comparator comp)
Appends usage information to the specified StringBuffer
|
boolean |
canProcess(WriteableCommandLine commandLine,
java.util.ListIterator arguments)
Indicates whether this Option will be able to process the particular
argument.
|
boolean |
canProcess(WriteableCommandLine commandLine,
java.lang.String argument)
Indicates whether this Option will be able to process the particular
argument.
|
void |
defaults(WriteableCommandLine commandLine)
Adds defaults to a CommandLine.
|
Option |
findOption(java.lang.String trigger)
Recursively searches for an option with the supplied trigger.
|
java.lang.String |
getDescription()
Returns a description of the option.
|
int |
getId()
Returns the id of the option.
|
java.lang.String |
getPreferredName()
The preferred name of an option is used for generating help and usage
information.
|
java.util.Set |
getPrefixes()
Identifies the argument prefixes that should be considered options.
|
java.util.Set |
getTriggers()
Identifies the argument prefixes that should trigger this option.
|
java.util.List |
helpLines(int depth,
java.util.Set helpSettings,
java.util.Comparator comp)
Builds up a list of HelpLineImpl instances to be presented by HelpFormatter.
|
boolean |
isRequired()
Indicates whether this option is required to be present.
|
void |
process(WriteableCommandLine commandLine,
java.util.ListIterator args)
Processes String arguments into a CommandLine.
|
void |
validate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this
option.
|
void process(WriteableCommandLine commandLine, java.util.ListIterator args) throws OptionException
commandLine - the CommandLine object to store results inargs - the arguments to processOptionException - if any problems occurvoid defaults(WriteableCommandLine commandLine)
commandLine - the CommandLine object to store defaults inboolean canProcess(WriteableCommandLine commandLine, java.lang.String argument)
commandLine - the CommandLine object to store defaults inargument - the argument to be testedboolean canProcess(WriteableCommandLine commandLine, java.util.ListIterator arguments)
commandLine - the CommandLine object to store defaults inarguments - the ListIterator over String argumentscanProcess(WriteableCommandLine,String)java.util.Set getTriggers()
java.util.Set getPrefixes()
void validate(WriteableCommandLine commandLine) throws OptionException
commandLine - the CommandLine to check.OptionException - if the CommandLine is not valid.java.util.List helpLines(int depth, java.util.Set helpSettings, java.util.Comparator comp)
depth - the initial indent depthhelpSettings - the HelpSettings that should be appliedcomp - a comparator used to sort options when applicable.HelpLine,
HelpFormattervoid appendUsage(java.lang.StringBuffer buffer, java.util.Set helpSettings, java.util.Comparator comp)
buffer - the buffer to append tohelpSettings - a set of display settings @see DisplaySettingcomp - a comparator used to sort the Optionsjava.lang.String getPreferredName()
java.lang.String getDescription()
HelpFormatterint getId()
for(Option o : cmd.getOptions()){
switch(o.getId()){
case POTENTIAL_OPTION:
...
}
}
The returned value is not guarenteed to be unique.Option findOption(java.lang.String trigger)
trigger - the trigger to search for.boolean isRequired()