Package org.apache.commons.validator
Class DateValidator
java.lang.Object
org.apache.commons.validator.DateValidator
Deprecated.
Use the new DateValidator, CalendarValidator or TimeValidator in the
routines package. This class will be removed in a future release.
Perform date validations.
This class is a Singleton; you can retrieve the instance via the getInstance() method.
- Since:
- 1.1
-
Constructor Summary
ModifierConstructorDescriptionprotected
Deprecated.Protected constructor for subclasses to use. -
Method Summary
Modifier and TypeMethodDescriptionstatic DateValidator
Deprecated.Returns the Singleton instance of this validator.boolean
Deprecated.Checks if the field is a valid date.boolean
Deprecated.Checks if the field is a valid date.
-
Constructor Details
-
DateValidator
protected DateValidator()Deprecated.Protected constructor for subclasses to use.
-
-
Method Details
-
getInstance
Deprecated.Returns the Singleton instance of this validator.- Returns:
- A singleton instance of the DateValidator.
-
isValid
Deprecated.Checks if the field is a valid date. The
Locale
is used withjava.text.DateFormat
. The setLenient method is set tofalse
for all.- Parameters:
value
- The value validation is being performed on.locale
- The locale to use for the date format, defaults to the default system default if null.- Returns:
- true if the date is valid.
-
isValid
Deprecated.Checks if the field is a valid date. The pattern is used with
java.text.SimpleDateFormat
. If strict is true, then 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. The setLenient method is set tofalse
for all.- Parameters:
value
- The value validation is being performed on.datePattern
- The pattern passed toSimpleDateFormat
.strict
- Whether or not to have an exact match of the datePattern.- Returns:
- true if the date is valid.
-