like this? 
http://apache-wicket.1842946.n4.nabble.com/Can-t-properly-override-getConverter-on-FormComponent-subclasses-td3744435.html

On Sun, Nov 27, 2011 at 7:36 PM, kamiseq <[email protected]> wrote:
> hi all,
> In 1.5 getConverter has new signature using generics : public <C>
> IConverter<C> getConverter(Class<C> type)
>
> and this is nice when you have global converter registered in
> application but in 1.4 it was handy to return different converter in
> specific component by overriding its getConverter(type).
>
> now it is also possible but it requires casting from C type to target
> type of the component and then back to C. for me this is a bit
> inconsistent as component always knows which type it using.
> maybe there should be additional method that can be overridden and it
> will return converter of type declared on component, what do you
> think??
>
> public abstract class Link<L>
> {
>    public Link(String id, IModel<L> model)
>    {
>        super(id, model);
>    }
>
>    @Override
>    public IConverter<L> getConverter()
>    {
>        return new MyCustomConverterThatIsUsingTypeL;
>    }
> }
>
> and another things is how ConverterLocator sets converters.
> it is possible to register converter that doesnt match key type
>
> ConverterLocator locator = (ConverterLocator) super.newConverterLocator();
> locator.set(MyType.class, new IConverter<String>()
> {
>    @Override
>    public String convertToObject(String value, Locale locale)
>    {
>        return null;
>    }
>
>    @Override
>    public String convertToString(String value, Locale locale)
>    {
>        return null;
>    }
> });
>
> where set should be declared as public final <C> IConverter<C>
> set(final Class<C> c, final IConverter<C> converter).
>
> how you deal with this things? maybe there is a better way
> thanks
>
> pozdrawiam
> Paweł Kamiński
>
> [email protected]
> [email protected]
> ______________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>



-- 
thank you,

regards,
Vineet Semwal

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to