org.apache.turbine.services.intake.validator
Interface Validator

All Known Implementing Classes:
DefaultValidator

public interface Validator

Validator api.

Version:
$Id: Validator.java 534527 2007-05-02 16:10:59Z tv $
Author:
John McNally, Thomas Vandahl

Field Summary
static java.lang.String FLEXIBLE_RULE_NAME
          "flexible" Rule, used in DateFormat Validator
static java.lang.String FORMAT_RULE_NAME
          "format" Rule, used in DateFormat Validator
static java.lang.String INVALID_NUMBER_RULE_NAME
          "invalidNumber" Rule, used in the various Number Validators
static java.lang.String MASK_RULE_NAME
          "mask" Rule, used in StringValidator
static java.lang.String MAX_LENGTH_RULE_NAME
          "maxLength" Rule, used in all validators
static java.lang.String MAX_VALUE_RULE_NAME
          "maxValue" Rule, used in the various Number Validators
static java.lang.String MIN_LENGTH_RULE_NAME
          "minLength" Rule, used in all validators
static java.lang.String MIN_VALUE_RULE_NAME
          "minValue" Rule, used in the various Number Validators
static java.lang.String REQUIRED_RULE_NAME
          "required" Rule, used in all validators
 
Method Summary
 void assertValidity(Field field)
          Determine whether a field meets the criteria specified in the constraints defined for this validator
 void assertValidity(java.lang.String testValue)
          Determine whether a testValue meets the criteria specified in the constraints defined for this validator
 java.lang.String getMessage()
          Get the last error message resulting from invalid input.
 boolean isValid(Field field)
          Determine whether a field meets the criteria specified in the constraints defined for this validator
 boolean isValid(java.lang.String testValue)
          Deprecated. use isValid(Field) instead
 

Field Detail

FLEXIBLE_RULE_NAME

public static final java.lang.String FLEXIBLE_RULE_NAME
"flexible" Rule, used in DateFormat Validator

See Also:
Constant Field Values

FORMAT_RULE_NAME

public static final java.lang.String FORMAT_RULE_NAME
"format" Rule, used in DateFormat Validator

See Also:
Constant Field Values

INVALID_NUMBER_RULE_NAME

public static final java.lang.String INVALID_NUMBER_RULE_NAME
"invalidNumber" Rule, used in the various Number Validators

See Also:
Constant Field Values

MASK_RULE_NAME

public static final java.lang.String MASK_RULE_NAME
"mask" Rule, used in StringValidator

See Also:
Constant Field Values

MAX_LENGTH_RULE_NAME

public static final java.lang.String MAX_LENGTH_RULE_NAME
"maxLength" Rule, used in all validators

See Also:
Constant Field Values

MAX_VALUE_RULE_NAME

public static final java.lang.String MAX_VALUE_RULE_NAME
"maxValue" Rule, used in the various Number Validators

See Also:
Constant Field Values

MIN_LENGTH_RULE_NAME

public static final java.lang.String MIN_LENGTH_RULE_NAME
"minLength" Rule, used in all validators

See Also:
Constant Field Values

MIN_VALUE_RULE_NAME

public static final java.lang.String MIN_VALUE_RULE_NAME
"minValue" Rule, used in the various Number Validators

See Also:
Constant Field Values

REQUIRED_RULE_NAME

public static final java.lang.String REQUIRED_RULE_NAME
"required" Rule, used in all validators

See Also:
Constant Field Values
Method Detail

isValid

public boolean isValid(Field field)
Determine whether a field meets the criteria specified in the constraints defined for this validator

Parameters:
field - a Field to be tested
Returns:
true if valid, false otherwise

assertValidity

public void assertValidity(Field field)
                    throws ValidationException
Determine whether a field meets the criteria specified in the constraints defined for this validator

Parameters:
field - a Field to be tested
Throws:
ValidationException - containing an error message if the testValue did not pass the validation tests.

isValid

public boolean isValid(java.lang.String testValue)
Deprecated. use isValid(Field) instead

Determine whether a testValue meets the criteria specified in the constraints defined for this validator

Parameters:
testValue - a String to be tested
Returns:
true if valid, false otherwise

assertValidity

public void assertValidity(java.lang.String testValue)
                    throws ValidationException
Determine whether a testValue meets the criteria specified in the constraints defined for this validator

Parameters:
testValue - a String to be tested
Throws:
ValidationException - containing an error message if the testValue did not pass the validation tests.

getMessage

public java.lang.String getMessage()
Get the last error message resulting from invalid input.

Returns:
a String message, or the empty String "".


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