|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.openexchange.admin.console.CLIParser
public class CLIParser
CLIParser
- The command-line parser.
Constructor Summary | |
---|---|
CLIParser()
Initializes a new non-strict CLIParser . |
|
CLIParser(boolean posix)
Initializes a new CLIParser . |
Method Summary | |
---|---|
CLIOption |
addBooleanOption(char shortForm,
String longForm)
Convenience method for adding a boolean option. |
CLIOption |
addBooleanOption(String longForm)
Convenience method for adding a boolean option. |
CLIOption |
addDoubleOption(char shortForm,
String longForm)
Convenience method for adding a double option. |
CLIOption |
addDoubleOption(String longForm)
Convenience method for adding a double option. |
CLIOption |
addIntegerOption(char shortForm,
String longForm)
Convenience method for adding an integer option. |
CLIOption |
addIntegerOption(String longForm)
Convenience method for adding an integer option. |
CLIOption |
addLongOption(char shortForm,
String longForm)
Convenience method for adding a long integer option. |
CLIOption |
addLongOption(String longForm)
Convenience method for adding a long integer option. |
CLIOption |
addOption(CLIOption opt)
Adds the specified option to the list of options. |
CLIOption |
addSettableBooleanOption(String longForm)
Convenience method for adding a settable boolean option. |
CLIOption |
addStringOption(char shortForm,
String longForm)
Convenience method for adding a string option. |
CLIOption |
addStringOption(String longForm)
Convenience method for adding a string option. |
Object |
getOptionValue(CLIOption o)
Gets given option's value. |
Object |
getOptionValue(CLIOption o,
Object def,
boolean remove)
Gets given option's value. |
Collection<Object> |
getOptionValues(CLIOption option)
Gets the parsed values of all occurrences of given option, or an empty collection if the option was not set. |
String[] |
getRemainingArgs()
|
void |
parse(String[] argv)
Parses specified command line. |
void |
parse(String[] argv,
Locale locale)
Parses specified command line. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CLIParser()
CLIParser
.
public CLIParser(boolean posix)
CLIParser
.
posix
- true
to strictly parse command line in POSIX notation; otherwise false
Method Detail |
---|
public CLIOption addOption(CLIOption opt)
opt
- The option to add
public CLIOption addStringOption(char shortForm, String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addStringOption(String longForm)
longForm
- The option's long form
public CLIOption addSettableBooleanOption(String longForm)
longForm
- The option's long form
public CLIOption addIntegerOption(char shortForm, String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addIntegerOption(String longForm)
longForm
- The option's long form
public CLIOption addLongOption(char shortForm, String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addLongOption(String longForm)
longForm
- The option's long form
public CLIOption addDoubleOption(char shortForm, String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addDoubleOption(String longForm)
longForm
- The option's long form
public CLIOption addBooleanOption(char shortForm, String longForm)
shortForm
- The option's short formlongForm
- The option's long form
public CLIOption addBooleanOption(String longForm)
longForm
- The option's long form
public Object getOptionValue(CLIOption o)
o
- The option whose value shall be returned
null
if not presentpublic Object getOptionValue(CLIOption o, Object def, boolean remove)
o
- The option whose value shall be returneddef
- The default value to return if option is not presentremove
- true
to remove option's value from parser's known values; otherwise false
public final Collection<Object> getOptionValues(CLIOption option)
option
- The option
public String[] getRemainingArgs()
public void parse(String[] argv) throws CLIParseException, CLIIllegalOptionValueException, CLIUnknownOptionException
argv
- The command line arguments
CLIParseException
- If parsing fails
CLIIllegalOptionValueException
- If an illegal option occurs
CLIUnknownOptionException
- If an unknown option occurspublic void parse(String[] argv, Locale locale) throws CLIParseException, CLIIllegalOptionValueException, CLIUnknownOptionException
argv
- The command line argumentslocale
- The locale
CLIParseException
- If parsing fails
CLIIllegalOptionValueException
- If an illegal option occurs
CLIUnknownOptionException
- If an unknown option occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |