|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dbforms.validation.DbFormsValidator
public class DbFormsValidator
This class performs validations. The parameters of methods must match the "methodParams" in "validator-rules.xml" file.
Constructor Summary | |
---|---|
DbFormsValidator()
|
Method Summary | |
---|---|
static boolean |
validateByte(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a byte primitive. |
static boolean |
validateCreditCard(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field is a valid credit card number. |
static boolean |
validateDate(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field is a valid date. |
static boolean |
validateDouble(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a double primitive. |
static boolean |
validateEmail(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if a field has a valid e-mail address. |
static boolean |
validateFloat(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a float primitive. |
static boolean |
validateInteger(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to an int primitive. |
static boolean |
validateLong(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a long primitive. |
static boolean |
validateMask(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field matches the regular expression in the field's mask attribute. |
static boolean |
validateMaxLength(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field's length is less than or equal to the maximum value. |
static boolean |
validateMinLength(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field's length is greater than or equal to the minimum value. |
static boolean |
validateRange(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if a fields value is within a range (min & max specified in the vars attribute). |
static boolean |
validateRequired(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field isn't null and length of the field is greater than zero not including whitespace. |
static boolean |
validateShort(Object bean,
ValidatorAction va,
Field field,
Vector errors,
Locale locale,
DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a short primitive. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DbFormsValidator()
Method Detail |
---|
public static boolean validateByte(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a byte primitive.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateCreditCard(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field is a valid credit card number.
Translated to Java by Ted Husted (husted@apache.org).
Reference Sean M. Burke's script at http://www.ling.nwu.edu/~sburke/pub/luhn_lib.pl
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateDate(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field is a valid date. If the field has a datePattern variable,
that will be used to format java.text.SimpleDateFormat
. If the field
has a datePatternStrict variable, that will be used to format
java.text.SimpleDateFormat
and the length will be checked so '2/12/1999'
will not pass validation with the format 'MM/dd/yyyy' because the month isn't two digits.
If no datePattern variable is specified, then the field gets the DateFormat.SHORT
format for the locale. The setLenient method is set to false
for all
variations.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateDouble(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a double primitive.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateEmail(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if a field has a valid e-mail address.
Based on a script by Sandeep V. Tamhankar (stamhankar@hotmail.com), http://javascript.internet.com
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateFloat(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a float primitive.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateInteger(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to an int primitive.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateLong(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a long primitive.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateMask(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field matches the regular expression in the field's mask attribute.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateMaxLength(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field's length is less than or equal to the maximum value. A Null
will be considered an error.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateMinLength(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field's length is greater than or equal to the minimum value.
A Null
will be considered an error.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateRange(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if a fields value is within a range (min & max specified in the vars attribute).
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateRequired(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field isn't null and length of the field is greater than zero not including whitespace.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to, if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.public static boolean validateShort(Object bean, ValidatorAction va, Field field, Vector errors, Locale locale, DbFormsErrors dbFormsErrors)
Checks if the field can safely be converted to a short primitive.
bean
- The bean validation is being performed on.va
- The ValidatorAction
used to retrieve validator information.field
- The Field
object associated with the current field being validated.errors
- The Vector
object used by DBForms to add errors to if any validation errors occur.locale
- The Locale
object of the Request.dbFormsErrors
- DbForms Error class to retrieve error message in DbForm-Errors.xml format.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |