org.apache.turbine.util.validation
Class InputValidator

java.lang.Object
  |
  +--org.apache.turbine.util.validation.InputValidator
Direct Known Subclasses:
AlwaysTrueValidator, EmailValidator, NotEmpty

public abstract class InputValidator
extends java.lang.Object

Author:
Mike Haberman

Field Summary
private  boolean allowNullInput
           
static boolean AllowNullInput
           
private  java.lang.String argv
           
static java.lang.String EmptyArgv
           
private  int maxSize
           
private static java.lang.String MaxSizeExceededError
           
static int NoMaxSize
           
private static java.lang.String NullInputError
           
 
Constructor Summary
InputValidator()
          default Constructor,
InputValidator(boolean allowNullInput, int maxSize, java.lang.String argv)
          Constructor,
 
Method Summary
protected abstract  void check(java.lang.String input)
           
 void checkInput(java.lang.String value)
           
 java.lang.String getErrorMessage(java.lang.String input)
           
abstract  java.lang.String getExpectedFormat()
           
 boolean isValid(java.lang.String input)
           
 void setAllowNullInput(boolean allowNullInput)
           
 void setArgv(java.lang.String argv)
           
 void setMaxSize(int maxSize)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

AllowNullInput

public static final boolean AllowNullInput

NoMaxSize

public static final int NoMaxSize

EmptyArgv

public static final java.lang.String EmptyArgv

NullInputError

private static java.lang.String NullInputError

MaxSizeExceededError

private static java.lang.String MaxSizeExceededError

allowNullInput

private boolean allowNullInput

maxSize

private int maxSize

argv

private java.lang.String argv
Constructor Detail

InputValidator

public InputValidator()
default Constructor,

InputValidator

public InputValidator(boolean allowNullInput,
                      int maxSize,
                      java.lang.String argv)
Constructor,
Parameters:
boolean - allowNullInput
int - maxSize
String - argv
Method Detail

setAllowNullInput

public void setAllowNullInput(boolean allowNullInput)
Parameters:
boolean - allowNullInput, set allowNullInput

setMaxSize

public void setMaxSize(int maxSize)
Parameters:
int - maxSize, set maxSize

setArgv

public void setArgv(java.lang.String argv)
Parameters:
String - argv, set argv

isValid

public boolean isValid(java.lang.String input)
Parameters:
String - input, input to be checked
Returns:
boolean, whether or not the input is valid

getErrorMessage

public java.lang.String getErrorMessage(java.lang.String input)
Parameters:
String - input, input to be checked
Returns:
String, error message or null

checkInput

public void checkInput(java.lang.String value)
                throws java.lang.Exception
Parameters:
String - value
Throws:
Exception, - a generic exception.

getExpectedFormat

public abstract java.lang.String getExpectedFormat()
Returns:
String, the expected format of the input

check

protected abstract void check(java.lang.String input)
                       throws java.lang.Exception
Parameters:
String - input, input to be checked all subclasses must define this method


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.