Package com.jbstrap.core.validators
Class DateValidator
java.lang.Object
com.jbstrap.core.validators.DateValidator
- All Implemented Interfaces:
DataValidator
Date validator class
- Since:
- 4.0
- Author:
- JBStrap
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a date validator object, with the default yyyy-MM-dd date formatDateValidator(String format) Creates a date validator, with the specified date format -
Method Summary
Modifier and TypeMethodDescriptionvalidateData(Object data, String language) Validates the specified value.
-
Constructor Details
-
DateValidator
public DateValidator()Creates a date validator object, with the default yyyy-MM-dd date format -
DateValidator
Creates a date validator, with the specified date format- Parameters:
format- The date format, that will be used for the validation process
-
-
Method Details
-
validateData
Validates the specified value.
The specified value will be validated, if it can be converted into a date, according to the specified date format.
The error message returned by the method can be customized, or can be translated, by using the
validator.dateValidatorErrorproperties file key. For more information about translating/multi-language support, see theMessageSourceAPIclass description- Specified by:
validateDatain interfaceDataValidator- Parameters:
data- The data to be validatedlanguage- The language code of the error message. If not specified, the default language will be used. The default language can be set with theDEFAULT_LANGUAGEJBStrap parameter.- Returns:
- The specified error message or
null, if the validation found no errors.
-