The real problem is that Component has no generics.
The tradeoff is that the library (FormComponents) do cast but all
users of them benefit without seeing this casting

On Mon, Aug 15, 2011 at 6:21 PM, vineet semwal
<[email protected]> wrote:
> the signature of method is  public final <C> IConverter<C>
> getConverter(Class<C> clazz) ;
>
>    public IConverter<String> getConverter(Class<String> type)
>  ^^  means not overriding correctly as method signature is not the  same
>
>        public <String> IConverter<String>getConverter(Class<String> type)
>   now you have declared <String> as your type parameter but you will
> not be able to use String as class in method now as the
> declared <String> will now hide the String java data type..
>
> martin has already told you the way,currently casting appears to be
> the only way..
>
> On Mon, Aug 15, 2011 at 5:35 PM, Fabio Cechinel Veronez
> <[email protected]> wrote:
>> Sorry for previews post, wrong combinations of pressed keys =/
>>
>> I, will continue:
>>
>> Hello everybody,
>>
>> I'm using wicket 1.5-RC5.1 and I'm having problem to override
>> getConverter method of in a FormCompont subclass.
>>
>> Well, lets say I have a TextField<Date> (I'm using j.u.Date here just
>> as example, could be any type) when I try to to provide a specific
>> converter for my instance I'm implementing like that:
>>
>>        TextField<String> tf = new TextField<String>("id") {
>>
>>            @Override
>>            public IConverter<String> getConverter(Class<String> type) {
>>                // ...
>>                return converter;
>>            }
>>        };
>>
>> But if I do like I get a compiler error saying:
>>
>>     "Name clash: The method getConverter(Class<String>) of type new
>> TextField<String>(){} has the same erasure as getConverter(Class<C>)
>> of type Component but does not override it"
>>     "The method getConverter(Class<String>) of type new
>> TextField<String>(){} must override or implement a supertype method"
>>
>> And when I try
>>
>>        TextField<String> tf = new TextField<String>("id") {
>>
>>            @Override
>>            public <String> IConverter<String>
>> getConverter(Class<String> type) {
>>                // ...
>>                return converter;
>>            }
>>        };
>>
>> I get a compilation warn saying:
>>
>>   "The type parameter String is hiding the type String"
>>
>>
>> I guess it happens 'cause getConverter uses a generic type C defined
>> at method level that is not the same generic type T defined at
>> TextField class level.
>>
>> What is the proper way to overwrite getConverter method?
>>
>>
>> On Mon, Aug 15, 2011 at 8:57 AM, Fabio Cechinel Veronez
>> <[email protected]> wrote:
>>> Hello everybody,
>>>
>>> I'm using wicket 1.5-RC5.1 and I'm having problem to override
>>> getConverter method of in a FormCompont subclass.
>>>
>>> Well, lets say I have a TextField<Date> (I'm using j.u.Date here just
>>> as example, could be any type) when I try to to provide a specific
>>> converter for my instance I
>>>
>>> --
>>> Fabio Cechinel Veronez
>>>
>>
>>
>>
>> --
>> Fabio Cechinel Veronez
>>
>> ---------------------------------------------------------------------
>> 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]
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to