Method Summary |
|
public static Option | create(char opt) Create an Option using the current settings and with
the specified Option char .
Parameters: opt - the character representation of the Option the Option instance throws: IllegalArgumentException - if opt is nota valid character. |
public static Option | create() Create an Option using the current settings
the Option instance throws: IllegalArgumentException - if longOpt hasnot been set. |
public static Option | create(String opt) Create an Option using the current settings and with
the specified Option char .
Parameters: opt - the java.lang.String representation of the Option the Option instance throws: IllegalArgumentException - if opt is nota valid character. |
public static OptionBuilder | hasArg() The next Option created will require an argument value. |
public static OptionBuilder | hasArg(boolean hasArg) The next Option created will require an argument value if
hasArg is true. |
public static OptionBuilder | hasArgs() The next Option created can have unlimited argument values. |
public static OptionBuilder | hasArgs(int num) The next Option created can have num
argument values. |
public static OptionBuilder | hasOptionalArg() The next Option can have an optional argument. |
public static OptionBuilder | hasOptionalArgs() The next Option can have an unlimited number of
optional arguments. |
public static OptionBuilder | hasOptionalArgs(int numArgs) The next Option can have the specified number of
optional arguments.
Parameters: numArgs - - the maximum number of optional argumentsthe next Option created can have. |
public static OptionBuilder | isRequired() The next Option created will be required. |
public static OptionBuilder | isRequired(boolean newRequired) The next Option created will be required if required
is true. |
public static OptionBuilder | withArgName(String name) The next Option created will have the specified argument value
name. |
public static OptionBuilder | withDescription(String newDescription) |
public static OptionBuilder | withLongOpt(String newLongopt) The next Option created will have the following long option value. |
public static OptionBuilder | withType(Object newType) The next Option created will have a value that will be an instance
of type . |
public static OptionBuilder | withValueSeparator(char sep) The next Option created uses sep as a means to
separate argument values.
Example:
Option opt = OptionBuilder.withValueSeparator(':')
.create('D');
CommandLine line = parser.parse(args);
String propertyName = opt.getValue(0);
String propertyValue = opt.getValue(1);
Parameters: sep - The value separator to be used for the argument values. |
public static OptionBuilder | withValueSeparator() The next Option created uses '= ' as a means to
separate argument values. |