Agreed there is a delicate balance. However, RequiredValidator allready
was a singleton, but as it was not thread safe, it shouldn't have been.
Furthermore, the comment in AbstractValidator also falsely noted that it
was threadsafe.
I am obviously not against statefull objects, but I think in this case
it is good not to impose this on users (which we did). If you want to
use state in your custom validators, you can do that without problems.
If you want to your custom message key in validators, you can just
subclass it. If you do this with an anonymous class, it is imo just
slightly less elegant than setting the key on the object. If you create
your custom validator for reuse in your own projects, you never have to
think about it again.
Though I am defending this now, please note that other people /did/ have
problems with validators not being threadsafe. It's hard to have
everybody happy.
Eelco
Phil Kulak wrote:
Yea, but if you don't create the validator yourself, you're totally
out of luck. What's wrong with validators holding state? They're just
going to attached to stateful components anyway. I mean, why stop
there? Let's make TextField thread safe too. :)
On 7/21/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
I guess resourceKey isn't such a good idea after all, as it breaks the
thread safety we just introduced. It should be enough to remove this but
make getResourceKey(FormComponent) overridable, so people can do this
with annonymous classes. Slightly inconvient, but safe. And safe should
win over inconvient.
Eelco
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user