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

kami...@gmail.com
pkaminski....@gmail.com
______________________

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to