|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface OptionDeclarer
Trains the option parser. This interface aids integration with other code which may expose declaration of options but not actual command-line parsing.
OptionParser| Method Summary | |
|---|---|
OptionSpecBuilder |
accepts(String option)
Tells the parser to recognize the given option. |
OptionSpecBuilder |
accepts(String option,
String description)
Tells the parser to recognize the given option. |
OptionSpecBuilder |
acceptsAll(Collection<String> options)
Tells the parser to recognize the given options, and treat them as synonymous. |
OptionSpecBuilder |
acceptsAll(Collection<String> options,
String description)
Tells the parser to recognize the given options, and treat them as synonymous. |
void |
allowsUnrecognizedOptions()
Tells the parser to treat unrecognized options as non-option arguments. |
NonOptionArgumentSpec<String> |
nonOptions()
Gives an object that represents an access point for non-option arguments on a command line. |
NonOptionArgumentSpec<String> |
nonOptions(String description)
Gives an object that represents an access point for non-option arguments on a command line. |
void |
posixlyCorrect(boolean setting)
Tells the parser whether or not to behave "POSIX-ly correct"-ly. |
void |
recognizeAlternativeLongOptions(boolean recognize)
Tells the parser either to recognize or ignore "-W"-style long options. |
| Method Detail |
|---|
OptionSpecBuilder accepts(String option)
This method returns an instance of OptionSpecBuilder to allow the formation of parser directives
as sentences in a fluent interface language. For example:
OptionDeclarer parser = new OptionParser();
parser.accepts( "c" ).withRequiredArg().ofType( Integer.class );
If no methods are invoked on the returned OptionSpecBuilder, then the parser treats the option as
accepting no argument.
option - the option to recognize
OptionException - if the option contains illegal characters
NullPointerException - if the option is null
OptionSpecBuilder accepts(String option,
String description)
option - the option to recognizedescription - a string that describes the purpose of the option. This is used when generating help
information about the parser.
OptionException - if the option contains illegal characters
NullPointerException - if the option is nullaccepts(String)OptionSpecBuilder acceptsAll(Collection<String> options)
options - the options to recognize and treat as synonymous
OptionException - if any of the options contain illegal characters
NullPointerException - if the option list or any of its elements are nullaccepts(String)
OptionSpecBuilder acceptsAll(Collection<String> options,
String description)
options - the options to recognize and treat as synonymousdescription - a string that describes the purpose of the option. This is used when generating help
information about the parser.
OptionException - if any of the options contain illegal characters
NullPointerException - if the option list or any of its elements are null
IllegalArgumentException - if the option list is emptyacceptsAll(Collection)NonOptionArgumentSpec<String> nonOptions()
NonOptionArgumentSpec<String> nonOptions(String description)
description - a string that describes the purpose of the non-option arguments. This is used when generating
help information about the parser.
nonOptions()void posixlyCorrect(boolean setting)
setting - true if the parser should behave "POSIX-ly correct"-lyvoid allowsUnrecognizedOptions()
Tells the parser to treat unrecognized options as non-option arguments.
If not called, then the parser raises an OptionException when it encounters an unrecognized
option.
void recognizeAlternativeLongOptions(boolean recognize)
recognize - true if the parser is to recognize the special style of long options
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||