Package org.javalite.validation
Class ValidatorAdapter
java.lang.Object
org.javalite.validation.ValidatorAdapter
- All Implemented Interfaces:
Validator
- Direct Known Subclasses:
AttributeLengthValidator
,AttributePresenceValidator
,DateValidator
,ImplicitConversionValidator
,JSONValidator
,NumericValidator
,RangeValidator
,RegexpValidator
,TimestampValidator
Subclass this class to create custom validators.
- Author:
- Igor Polevoy
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionformatMessage(Locale locale, Object... params)
Provides default implementation, will look for a property in resource bundle, using set message as key.void
Will pin the current message.void
setMessage(String message)
Sets an message on this validator.
-
Constructor Details
-
ValidatorAdapter
public ValidatorAdapter()
-
-
Method Details
-
setMessage
Description copied from interface:Validator
Sets an message on this validator.- Specified by:
setMessage
in interfaceValidator
- Parameters:
message
- error message.
-
formatMessage
Provides default implementation, will look for a property in resource bundle, using set message as key. If property in resource bundle not found, treats message verbatim.- Specified by:
formatMessage
in interfaceValidator
- Parameters:
locale
- locale to use, or null for default locale.params
- parameters in case a message is parametrized.- Returns:
- formatted message.
-
getMessage
-
pinMessage
public void pinMessage()Description copied from interface:Validator
Will pin the current message. It will ignore any messages generated duringt validation and will use a current message.- Specified by:
pinMessage
in interfaceValidator
-