public abstract class OptionImpl extends java.lang.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,
java.util.ListIterator arguments)
Indicates whether this Option will be able to process the particular
argument.
|
protected void |
checkPrefixes(java.util.Set prefixes)
Check prefixes.
|
void |
defaults(WriteableCommandLine commandLine)
Adds defaults to a CommandLine.
|
boolean |
equals(java.lang.Object thatObj)
Evaluate this instance against the supplied instance for equality.
|
Option |
findOption(java.lang.String trigger)
Recursively searches for an option with the supplied trigger.
|
int |
getId()
Returns the id of the option.
|
int |
hashCode()
Return the hashcode value for this instance.
|
boolean |
isRequired()
Indicates whether this option is required to be present.
|
java.lang.String |
toString()
Returns a string representation of the option.
|
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, java.util.ListIterator arguments)
canProcess in interface OptioncommandLine - the CommandLine object to store defaults inarguments - the ListIterator over String argumentsOption.canProcess(WriteableCommandLine,String)public java.lang.String toString()
toString in class java.lang.Objectpublic int getId()
for(Option o : cmd.getOptions()){
switch(o.getId()){
case POTENTIAL_OPTION:
...
}
}
The returned value is not guarenteed to be unique.public boolean equals(java.lang.Object thatObj)
equals in class java.lang.ObjectthatObj - the other objectpublic int hashCode()
hashCode in class java.lang.Objectpublic Option findOption(java.lang.String trigger)
findOption in interface Optiontrigger - the trigger to search for.public boolean isRequired()
isRequired in interface Optionpublic void defaults(WriteableCommandLine commandLine)
protected void checkPrefixes(java.util.Set prefixes)
prefixes - the prefixes set