| java.lang.Object org.apache.commons.validator.TestValidator
TestValidator | public class TestValidator (Code) | | Contains validation methods for different unit tests.
version: $Revision: 478334 $ $Date: 2006-11-22 21:31:54 +0000 (Wed, 22 Nov 2006) $ |
Method Summary | |
public static boolean | validateByte(Object bean, Field field) Checks if the field can be successfully converted to a byte .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a byte true is returned. | public static boolean | validateDouble(Object bean, Field field) Checks if the field can be successfully converted to a double .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a double true is returned. | public static boolean | validateEmail(Object bean, Field field) Checks if the field is an e-mail address.
Parameters: value - The value validation is being performed on. boolean If the field is an e-mail addresstrue is returned. | public static boolean | validateFloat(Object bean, Field field) Checks if the field can be successfully converted to a float .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a float true is returned. | public static boolean | validateInt(Object bean, Field field) Checks if the field can be successfully converted to a int .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a int true is returned. | public static boolean | validateLong(Object bean, Field field) Checks if the field can be successfully converted to a long .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a long true is returned. | public static boolean | validatePositive(Object bean, Field field) | public static boolean | validateRaiseException(Object bean, Field field) Throws a runtime exception if the value of the argument is "RUNTIME",
an exception if the value of the argument is "CHECKED", and a
ValidatorException otherwise. | public static boolean | validateRequired(Object bean, Field field) Checks if the field is required.
boolean If the field isn't null andhas a length greater than zero, true is returned. | public static boolean | validateRequiredIf(Object bean, Field field, Validator validator) | public static boolean | validateShort(Object bean, Field field) Checks if the field can be successfully converted to a short .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a short true is returned. |
FIELD_TEST_EQUAL | final public static String FIELD_TEST_EQUAL(Code) | | |
FIELD_TEST_NOTNULL | final public static String FIELD_TEST_NOTNULL(Code) | | |
FIELD_TEST_NULL | final public static String FIELD_TEST_NULL(Code) | | |
validateByte | public static boolean validateByte(Object bean, Field field)(Code) | | Checks if the field can be successfully converted to a byte .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a byte true is returned. Otherwise false . |
validateDouble | public static boolean validateDouble(Object bean, Field field)(Code) | | Checks if the field can be successfully converted to a double .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a double true is returned. Otherwise false . |
validateEmail | public static boolean validateEmail(Object bean, Field field)(Code) | | Checks if the field is an e-mail address.
Parameters: value - The value validation is being performed on. boolean If the field is an e-mail addresstrue is returned. Otherwise false . |
validateFloat | public static boolean validateFloat(Object bean, Field field)(Code) | | Checks if the field can be successfully converted to a float .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a float true is returned. Otherwise false . |
validateInt | public static boolean validateInt(Object bean, Field field)(Code) | | Checks if the field can be successfully converted to a int .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a int true is returned. Otherwise false . |
validateLong | public static boolean validateLong(Object bean, Field field)(Code) | | Checks if the field can be successfully converted to a long .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a long true is returned. Otherwise false . |
validatePositive | public static boolean validatePositive(Object bean, Field field)(Code) | | Checks if field is positive assuming it is an integer
Parameters: value - The value validation is being performed on. Parameters: field - Description of the field to be evaluated boolean If the integer field is greater than zero, returnstrue, otherwise returns false. |
validateRaiseException | public static boolean validateRaiseException(Object bean, Field field) throws Exception(Code) | | Throws a runtime exception if the value of the argument is "RUNTIME",
an exception if the value of the argument is "CHECKED", and a
ValidatorException otherwise.
throws: RuntimeException - with "RUNTIME-EXCEPTION as message"if value is "RUNTIME" throws: Exception - with "CHECKED-EXCEPTION" as message if value is "CHECKED" throws: ValidatorException - with "VALIDATOR-EXCEPTION" as message otherwise |
validateRequired | public static boolean validateRequired(Object bean, Field field)(Code) | | Checks if the field is required.
boolean If the field isn't null andhas a length greater than zero, true is returned. Otherwise false . |
validateShort | public static boolean validateShort(Object bean, Field field)(Code) | | Checks if the field can be successfully converted to a short .
Parameters: value - The value validation is being performed on. boolean If the field can be successfully converted to a short true is returned. Otherwise false . |
|
|