|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.dpml.cli.option.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)
Check prefixes. |
void |
defaults(WriteableCommandLine commandLine)
Adds defaults to a CommandLine. |
boolean |
equals(Object thatObj)
Evaluate this instance against the supplied instance for equality. |
Option |
findOption(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. |
String |
toString()
Returns a string representation of the option. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.dpml.cli.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)
canProcess
in interface Option
commandLine
- the CommandLine object to store defaults inarguments
- the ListIterator over String arguments
Option.canProcess(WriteableCommandLine,String)
public String toString()
public int getId()
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)
thatObj
- the other object
public int hashCode()
public Option findOption(String trigger)
findOption
in interface Option
trigger
- the trigger to search for.
public boolean isRequired()
isRequired
in interface Option
public void defaults(WriteableCommandLine commandLine)
defaults
in interface Option
commandLine
- the CommandLine object to store defaults inprotected void checkPrefixes(Set prefixes)
prefixes
- the prefixes set
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |