[
https://issues.apache.org/jira/browse/WICKET-2244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13123601#comment-13123601
]
Martin Pieters commented on WICKET-2244:
----------------------------------------
Out of curiosity why do MaximimumValidator, MinimumValidator, and
RangeValidator not extend from AbstractValidator, which already offers this
functionality?
> Allow overriding of the Validator default MessageKey
> -----------------------------------------------------
>
> Key: WICKET-2244
> URL: https://issues.apache.org/jira/browse/WICKET-2244
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Affects Versions: 1.4-RC2
> Reporter: Alexandru Objelean
>
> Currently there is no other way to change the default message key of any
> validator. Provide a protected non final method: getMessageKey() to allow
> overriding of the message key. For example for MinimumValidator:
> [CODE]
> public void validate(IValidatable<Z> validatable)
> {
> Z value = validatable.getValue();
> if (value.compareTo(minimum) < 0)
> {
> ValidationError error = new ValidationError();
> error.addMessageKey(getMessageKey());
> error.setVariable("minimum", minimum);
> validatable.error(error);
> }
> }
> protected String getMessageKey() {
> return "MinimumValidator";
> }
> [CODE]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira