Phil Kulak wrote:

On 7/21/05, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
Sure, use a construction like:

           TextField c = new TextField("field");
           c.add(new TypeValidator(Date.class)
           {
               protected String resourceKey(FormComponent formComponent)
               {
                   return "my.special.key";
               }
           });

Regards,

Eelco

Ah yes, but I'm just creating a delegate method, I don't create the
validators. They are passed to me by the person building the panel.
Now, if Java let my subclass instances, that would be sweet. I'd
prefer to not go the bytecode manipulation route, however. :)

In that case it is either the responsibility of your user (you could help him/ her by provide factory methods for creating common validators) or you have to use the decorator pattern. If you use the latter, and let the user provide the key that should be used, you'll be flexible /and/ have your goal met.

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_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to