|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The super type of all options representing a particular element of the command line interface.
Method Summary | |
void |
appendUsage(StringBuffer buffer,
Set helpSettings,
Comparator comp)
Appends usage information to the specified StringBuffer |
boolean |
canProcess(WriteableCommandLine commandLine,
ListIterator arguments)
Indicates whether this Option will be able to process the particular argument. |
boolean |
canProcess(WriteableCommandLine commandLine,
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(String trigger)
Recursively searches for an option with the supplied trigger. |
String |
getDescription()
Returns a description of the option. |
int |
getId()
Returns the id of the option. |
String |
getPreferredName()
The preferred name of an option is used for generating help and usage information. |
Set |
getPrefixes()
Identifies the argument prefixes that should be considered options. |
Set |
getTriggers()
Identifies the argument prefixes that should trigger this option. |
List |
helpLines(int depth,
Set helpSettings,
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,
ListIterator args)
Processes String arguments into a CommandLine. |
void |
validate(WriteableCommandLine commandLine)
Checks that the supplied CommandLine is valid with respect to this option. |
Method Detail |
public void process(WriteableCommandLine commandLine, ListIterator args) throws OptionException
commandLine
- the CommandLine object to store results inargs
- the arguments to process
OptionException
- if any problems occurpublic void defaults(WriteableCommandLine commandLine)
commandLine
- the CommandLine object to store defaults inpublic boolean canProcess(WriteableCommandLine commandLine, String argument)
commandLine
- the CommandLine object to store defaults inargument
- the argument to be tested
public boolean canProcess(WriteableCommandLine commandLine, ListIterator arguments)
commandLine
- the CommandLine object to store defaults inarguments
- the ListIterator over String arguments
canProcess(WriteableCommandLine,String)
public Set getTriggers()
public Set getPrefixes()
public void validate(WriteableCommandLine commandLine) throws OptionException
commandLine
- the CommandLine to check.
OptionException
- if the CommandLine is not valid.public List helpLines(int depth, Set helpSettings, Comparator comp)
depth
- the initial indent depthhelpSettings
- the HelpSettings that should be appliedcomp
- a comparator used to sort options when applicable.
HelpLine
,
HelpFormatter
public void appendUsage(StringBuffer buffer, Set helpSettings, Comparator comp)
buffer
- the buffer to append tohelpSettings
- a set of display settings @see DisplaySettingcomp
- a comparator used to sort the Optionspublic String getPreferredName()
public String getDescription()
HelpFormatter
public int getId()
for(Option o : cmd.getOptions()){
switch(o.getId()){
case POTENTIAL_OPTION:
...
}
}
The returned value is not guarenteed to be unique.
public Option findOption(String trigger)
trigger
- the trigger to search for.
public boolean isRequired()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |