public abstract class OptionImpl extends Object implements Option
| Constructor and Description |
|---|
OptionImpl(int id,
boolean required)
Creates an OptionImpl with the specified id
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canProcess(WriteableCommandLine commandLine,
ListIterator arguments)
Indicates whether this Option will be able to process the particular
argument.
|
protected void |
checkPrefixes(Set prefixes) |
void |
defaults(WriteableCommandLine commandLine)
Adds defaults to a CommandLine.
|
boolean |
equals(Object thatObj) |
Option |
findOption(String trigger)
Recursively searches for an option with the supplied trigger.
|
int |
getId()
Returns the id of the option.
|
Option |
getParent()
Returns the parent of this option.
|
int |
hashCode() |
boolean |
isRequired()
Indicates whether this option is required to be present.
|
void |
setParent(Option parent)
Sets the parent of this option.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitappendUsage, canProcess, getDescription, getPreferredName, getPrefixes, getTriggers, helpLines, process, validatepublic OptionImpl(int id, boolean required)
id - the unique id of this Optionrequired - true iff this Option must be presentpublic boolean canProcess(WriteableCommandLine commandLine, ListIterator arguments)
OptioncanProcess in interface OptioncommandLine - the CommandLine to checkarguments - the ListIterator over String argumentsOption.canProcess(WriteableCommandLine,String)public int getId()
Option
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)
OptionfindOption in interface Optiontrigger - the trigger to search for.public boolean isRequired()
OptionisRequired in interface Optionpublic void defaults(WriteableCommandLine commandLine)
Optionpublic Option getParent()
Optionpublic void setParent(Option parent)
Optionprotected void checkPrefixes(Set prefixes)
Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.