public class GenericValidatorImpl extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FIELD_TEST_EQUAL |
static String |
FIELD_TEST_NOTNULL |
static String |
FIELD_TEST_NULL |
| Constructor and Description |
|---|
GenericValidatorImpl() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
validateByte(Object bean,
org.apache.commons.validator.Field field)
Checks if the field can be successfully converted to a
byte. |
static boolean |
validateDouble(Object bean,
org.apache.commons.validator.Field field)
Checks if the field can be successfully converted to a
double. |
static boolean |
validateEmail(Object bean,
org.apache.commons.validator.Field field)
Checks if the field is an e-mail address.
|
static boolean |
validateFloat(Object bean,
org.apache.commons.validator.Field field)
Checks if the field can be successfully converted to a
float. |
static boolean |
validateInt(Object bean,
org.apache.commons.validator.Field field)
Checks if the field can be successfully converted to a
int. |
static boolean |
validateLong(Object bean,
org.apache.commons.validator.Field field)
Checks if the field can be successfully converted to a
long. |
static boolean |
validatePositive(Object bean,
org.apache.commons.validator.Field field)
Checks if field is positive assuming it is an integer
|
static boolean |
validateRaiseException(Object bean,
org.apache.commons.validator.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.
|
static boolean |
validateRequired(Object bean,
org.apache.commons.validator.Field field)
Checks if the field is required.
|
static boolean |
validateRequiredIf(Object bean,
org.apache.commons.validator.Field field,
org.apache.commons.validator.Validator validator) |
static boolean |
validateShort(Object bean,
org.apache.commons.validator.Field field)
Checks if the field can be successfully converted to a
short. |
public static final String FIELD_TEST_NULL
public static final String FIELD_TEST_NOTNULL
public static final String FIELD_TEST_EQUAL
public GenericValidatorImpl()
public static boolean validateRaiseException(Object bean, org.apache.commons.validator.Field field) throws Exception
RuntimeException - with "RUNTIME-EXCEPTION as message"
if value is "RUNTIME"Exception - with "CHECKED-EXCEPTION" as message
if value is "CHECKED"ValidatorException - with "VALIDATOR-EXCEPTION" as message
otherwisepublic static boolean validateRequired(Object bean, org.apache.commons.validator.Field field)
null and
has a length greater than zero, true is returned.
Otherwise false.public static boolean validateByte(Object bean, org.apache.commons.validator.Field field)
byte.bean - The value validation is being performed on.field - the field to usebyte true is returned.
Otherwise false.public static boolean validateShort(Object bean, org.apache.commons.validator.Field field)
short.bean - The value validation is being performed on.field - the field to useshort true is returned.
Otherwise false.public static boolean validateInt(Object bean, org.apache.commons.validator.Field field)
int.bean - The value validation is being performed on.field - the field to useint true is returned.
Otherwise false.public static boolean validatePositive(Object bean, org.apache.commons.validator.Field field)
bean - The value validation is being performed on.field - Description of the field to be evaluatedpublic static boolean validateLong(Object bean, org.apache.commons.validator.Field field)
long.bean - The value validation is being performed on.field - the field to uselong true is returned.
Otherwise false.public static boolean validateFloat(Object bean, org.apache.commons.validator.Field field)
float.bean - The value validation is being performed on.field - the field to usefloat true is returned.
Otherwise false.public static boolean validateDouble(Object bean, org.apache.commons.validator.Field field)
double.bean - The value validation is being performed on.field - the field to usedouble true is returned.
Otherwise false.public static boolean validateEmail(Object bean, org.apache.commons.validator.Field field)
bean - The value validation is being performed on.field - the field to usetrue is returned.
Otherwise false.public static boolean validateRequiredIf(Object bean, org.apache.commons.validator.Field field, org.apache.commons.validator.Validator validator)
Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.