|
||||||||||
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.
Field Summary | |
---|---|
private int |
id
|
private boolean |
required
|
Constructor Summary | |
---|---|
OptionImpl(int id,
boolean required)
Creates an OptionImpl with the specified id |
Method Summary | |
---|---|
boolean |
canProcess(WriteableCommandLine commandLine,
java.util.ListIterator arguments)
Indicates whether this Option will be able to process the particular argument. |
private void |
checkPrefix(java.util.Set prefixes,
java.lang.String trigger)
|
protected void |
checkPrefixes(java.util.Set prefixes)
|
void |
defaults(WriteableCommandLine commandLine)
Adds defaults to a CommandLine. |
boolean |
equals(java.lang.Object thatObj)
|
private boolean |
equals(java.lang.Object left,
java.lang.Object right)
|
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()
|
boolean |
isRequired()
Indicates whether this option is required to be present. |
java.lang.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 |
Field Detail |
---|
private final int id
private final boolean required
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, java.util.ListIterator arguments)
Option
canProcess
in interface Option
arguments
- the ListIterator over String arguments
Option.canProcess(WriteableCommandLine,String)
public java.lang.String toString()
toString
in class java.lang.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(java.lang.Object thatObj)
equals
in class java.lang.Object
private boolean equals(java.lang.Object left, java.lang.Object right)
public int hashCode()
hashCode
in class java.lang.Object
public Option findOption(java.lang.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 inprotected void checkPrefixes(java.util.Set prefixes)
private void checkPrefix(java.util.Set prefixes, java.lang.String trigger)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |