Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2244

Allow overriding of the Validator default MessageKey

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4-RC2
    • Fix Version/s: 1.5.2, 1.5.5
    • Component/s: wicket
    • Labels:
      None

      Description

      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]

        Attachments

        There are no Sub-Tasks for this issue.

          Activity

            People

            • Assignee:
              mgrigorov Martin Grigorov
              Reporter:
              alexandru.objelean Alexandru Objelean
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: