|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.cli2.option.OptionImpl
public abstract class OptionImpl
A base implementation of Option providing limited ground work for further Option implementations.
Constructor Summary | |
---|---|
OptionImpl(int id,
boolean required)
Creates an OptionImpl with the specified id |
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.commons.cli2.Option |
---|
appendUsage, canProcess, getDescription, getPreferredName, getPrefixes, getTriggers, helpLines, process, validate |
Constructor Detail |
---|
public OptionImpl(int id, boolean required)
id
- the unique id of this Optionrequired
- true iff this Option must be presentMethod Detail |
---|
public boolean canProcess(WriteableCommandLine commandLine, ListIterator arguments)
Option
canProcess
in interface Option
commandLine
- the CommandLine to checkarguments
- the ListIterator over String arguments
Option.canProcess(WriteableCommandLine,String)
public String toString()
toString
in class Object
public int getId()
Option
for(Option o : cmd.getOptions()){
switch(o.getId()){
case POTENTIAL_OPTION:
...
}
}
The returned value is not guarenteed to be unique.
getId
in interface Option
public boolean equals(Object thatObj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public Option findOption(String trigger)
Option
findOption
in interface Option
trigger
- the trigger to search for.
public boolean isRequired()
Option
isRequired
in interface Option
public void defaults(WriteableCommandLine commandLine)
Option
defaults
in interface Option
commandLine
- The CommandLine object to store defaults inpublic Option getParent()
Option
getParent
in interface Option
public void setParent(Option parent)
Option
setParent
in interface Option
parent
- the parent optionprotected void checkPrefixes(Set prefixes)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |