i dont quite follow all this, but if you just want to change

IValidationErrror#getErrorMessage() to return a Serializable instead
of a String im fine with that.

-igor

On Wed, Mar 14, 2012 at 6:17 AM, Martin Grigorov <[email protected]> wrote:
> Hi,
>
> A colleague of mine asked me why ValidationError doesn't work with
> Serializable as Component's #info, #error, #debug, ... methods.
> I looked deeper and I saw a solution: write a custom IValidationError
> which keeps the Serializable and use it later.
>
> Problem 1) IValidationError requires from me to deal with IErrorMessageSource
> In my case with our custom FeedbackPanel that knows how to render our
> custom Serializables this is not needed
> Workaround: just return empty string to keep FormComponent#error()
> quiet (otherwise it logs a warning if the returned message is null)
>
> Problem 2) With my custom IValidationError impl I have to override
> FormComponent#error() to be able to use it
>
> And here I start thinking that IErrorMessageSource is something that
> is related to org.apache.wicket.validation.ValidationError because it
> works with resource keys (message bundles).
> I think it would be better if IValidationError actually had a method
> that returns a Serializable. In this case the current code of
> FormComponent#error() will be in o.a.w.validation.ValidationError and
> it will return org.apache.wicket.markup.html.form.ValidationErrorFeedback.
> And my custom IValidationError will return my custom Serializable impl
>
> So the new body of FormComponent#error(IValidatable) will be:
>
> public void error(IValidationError error)
> {
>  error(error.getMessage());  // getMessage() returns the Serializable
> }
>
> I doubt there are many custom impls of IErrorMessageSource in the wild.
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com

Reply via email to