public class DateValidator extends Object
Perform date validations.
This class is a Singleton; you can retrieve the instance via the getInstance() method.
Modifier | Constructor and Description |
---|---|
protected |
DateValidator()
Deprecated.
Protected constructor for subclasses to use.
|
Modifier and Type | Method and Description |
---|---|
static DateValidator |
getInstance()
Deprecated.
Returns the Singleton instance of this validator.
|
boolean |
isValid(String value,
Locale locale)
Deprecated.
Checks if the field is a valid date.
|
boolean |
isValid(String value,
String datePattern,
boolean strict)
Deprecated.
Checks if the field is a valid date.
|
protected DateValidator()
public static DateValidator getInstance()
public boolean isValid(String value, String datePattern, boolean strict)
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 to false
for all.
value
- The value validation is being performed on.datePattern
- The pattern passed to SimpleDateFormat
.strict
- Whether or not to have an exact match of the datePattern.public boolean isValid(String value, Locale locale)
Checks if the field is a valid date. The Locale
is
used with java.text.DateFormat
. The setLenient method
is set to false
for all.
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.Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.