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, wait
appendUsage, canProcess, getDescription, getPreferredName, getPrefixes, getTriggers, helpLines, process, validate
public 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)
Option
canProcess
in interface Option
commandLine
- 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)
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
public Option getParent()
Option
public void setParent(Option parent)
Option
protected void checkPrefixes(Set prefixes)
Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.