org.apache.commons.cli

Class OptionValidator

public class OptionValidator extends Object

Validates an Option string.

Author: John Keyes ( john at integralsource.com )

Method Summary
static booleanisValidChar(char c)

Returns whether the specified character is a valid character.

static booleanisValidOpt(char c)

Returns whether the specified character is a valid Option.

static voidvalidateOption(String opt)

Validates whether opt is a permissable Option shortOpt.

Method Detail

isValidChar

private static boolean isValidChar(char c)

Returns whether the specified character is a valid character.

Parameters: c the character to validate

Returns: true if c is a letter.

isValidOpt

private static boolean isValidOpt(char c)

Returns whether the specified character is a valid Option.

Parameters: c the option to validate

Returns: true if c is a letter, ' ', '?' or '@', otherwise false.

validateOption

static void validateOption(String opt)

Validates whether opt is a permissable Option shortOpt. The rules that specify if the opt is valid are:

Parameters: opt The option string to validate

Throws: IllegalArgumentException if the Option is not valid.