|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Option
Interface for command line options. This interface is solely for interaction with the command line parser. The application will also need to create Option objects, and query them to find out whether they occurred and (if so) with what values. However, each Option implementation defines its own methods for those purposes.
All Option implementations should called
Parser.add(this)
in their constructors, once they have
fully set up their lists of long and short forms.
Method Summary | |
---|---|
boolean |
expectsValue()
Returns true if this option expects a value on the command line. |
java.util.List |
getLongForms()
Returns the long forms of this option. |
java.util.List |
getShortForms()
Returns the short (single-character) forms of this option. |
java.lang.String |
getUsageString()
Returns a string that documents the option. |
void |
recordOccurrence(java.lang.String form,
java.lang.String valueStr)
Records an occurrence of this option with the given value. |
Method Detail |
---|
java.util.List getShortForms()
java.util.List getLongForms()
boolean expectsValue()
void recordOccurrence(java.lang.String form, java.lang.String valueStr)
form
argument specifies the particular long or
short form of the option that was used. If the value is invalid,
or if the option has already occurred and a second occurrence is
not allowed, this method may print an error message and exit the
program.
form
- specifies the particular long or short form of the
option that was usedvalueStr
- the given value, or null if no value was given.
The parser will only pass null for this parameter
if expectsValue
returns false;
otherwise, if the value is missing, the parser
will not call this method.java.lang.String getUsageString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |