org.apache.commons.cli
Class OptionValidator

java.lang.Object
  extended by org.apache.commons.cli.OptionValidator

public class OptionValidator
extends java.lang.Object

Validates an Option string.

Author:
John Keyes ( john at integralsource.com )

Constructor Summary
OptionValidator()
           
 
Method Summary
private static boolean isValidChar(char c)
          Returns whether the specified character is a valid character.
private static boolean isValidOpt(char c)
          Returns whether the specified character is a valid Option.
(package private) static void validateOption(java.lang.String opt)
          Validates whether opt is a permissable Option shortOpt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptionValidator

public OptionValidator()
Method Detail

validateOption

static void validateOption(java.lang.String opt)
                    throws java.lang.IllegalArgumentException

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:
java.lang.IllegalArgumentException - if the Option is not valid.

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.

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.